changeset 15073:28ba6bfcf2dc

assign picture->(width,height) when parsing h264
author nicodvb
date Sat, 09 Apr 2005 11:00:00 +0000
parents 9ec12f960724
children aab0ddfabf3f
files libmpdemux/mpeg_hdr.c
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/mpeg_hdr.c	Fri Apr 08 21:35:31 2005 +0000
+++ b/libmpdemux/mpeg_hdr.c	Sat Apr 09 11:00:00 2005 +0000
@@ -297,8 +297,9 @@
 
 int h264_parse_sps(mp_mpeg_header_t * picture, unsigned char * buf, int len)
 {
-  unsigned int n = 0, m = 0, v, i, j;
+  unsigned int n = 0, v, i, j, mbh;
   unsigned char *dest;
+  int frame_mbs_only;
 
   dest = (unsigned char*) malloc(len);
   if(! dest)
@@ -343,9 +344,11 @@
   }
   read_golomb(buf, &n);
   getbits(buf, n++, 1);
-  read_golomb(buf, &n);
-  read_golomb(buf, &n);
-  if(!getbits(buf, n++, 1))
+  picture->display_picture_width = 16 *(read_golomb(buf, &n)+1);
+  mbh = read_golomb(buf, &n)+1;
+  frame_mbs_only = getbits(buf, n++, 1);
+  picture->display_picture_height = 16 * (2 - frame_mbs_only) * mbh;
+  if(!frame_mbs_only)
     getbits(buf, n++, 1);
   getbits(buf, n++, 1);
   if(getbits(buf, n++, 1))