[MPlayer-cvslog] r21971 - trunk/libmpdemux/mpeg_hdr.c
nicodvb
subversion at mplayerhq.hu
Sat Jan 20 14:46:17 CET 2007
Author: nicodvb
Date: Sat Jan 20 14:46:17 2007
New Revision: 21971
Modified:
trunk/libmpdemux/mpeg_hdr.c
Log:
in h264_parse_sps() reuse mp_unescape03()
Modified: trunk/libmpdemux/mpeg_hdr.c
==============================================================================
--- trunk/libmpdemux/mpeg_hdr.c (original)
+++ trunk/libmpdemux/mpeg_hdr.c Sat Jan 20 14:46:17 2007
@@ -340,36 +340,14 @@
return n;
}
+static int mp_unescape03(unsigned char *buf, int len);
+
int h264_parse_sps(mp_mpeg_header_t * picture, unsigned char * buf, int len)
{
- unsigned int n = 0, v, i, j, mbh;
- unsigned char *dest;
+ unsigned int n = 0, v, i, mbh;
int frame_mbs_only;
- dest = (unsigned char*) malloc(len);
- if(! dest)
- return 0;
- j = i = 0;
- while(i <= len-3)
- {
- if(buf[i] == 0 && buf[i+1] == 0 && buf[i+2] == 3)
- {
- dest[j] = dest[j+1] = 0;
- j += 2;
- i += 3;
- }
- else
- {
- dest[j] = buf[i];
- j++;
- i++;
- }
- }
- dest[j] = buf[len-2];
- dest[j+1] = buf[len-1];
- j += 2;
- len = j+1;
- buf = dest;
+ len = mp_unescape03(buf, len);
picture->fps = picture->timeinc_unit = picture->timeinc_resolution = 0;
n = 24;
@@ -416,7 +394,6 @@
if(getbits(buf, n++, 1))
n = h264_parse_vui(picture, buf, n);
- free(dest);
return n;
}
More information about the MPlayer-cvslog
mailing list