diff options
author | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-01-20 13:46:17 +0000 |
---|---|---|
committer | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-01-20 13:46:17 +0000 |
commit | 2abbb9c863ee1127c37dd344e1219b2eff551c4c (patch) | |
tree | 28f9c63f54736f6cf1c397dd58e9795817e99a0d /libmpdemux | |
parent | 6d708c31b6f8f7884681c229d269b89f083a9af6 (diff) | |
download | mpv-2abbb9c863ee1127c37dd344e1219b2eff551c4c.tar.bz2 mpv-2abbb9c863ee1127c37dd344e1219b2eff551c4c.tar.xz |
in h264_parse_sps() reuse mp_unescape03()
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21971 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/mpeg_hdr.c | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/libmpdemux/mpeg_hdr.c b/libmpdemux/mpeg_hdr.c index 2107299ae2..8376fbaeda 100644 --- a/libmpdemux/mpeg_hdr.c +++ b/libmpdemux/mpeg_hdr.c @@ -340,36 +340,14 @@ static int h264_parse_vui(mp_mpeg_header_t * picture, unsigned char * buf, unsig 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 @@ int h264_parse_sps(mp_mpeg_header_t * picture, unsigned char * buf, int len) if(getbits(buf, n++, 1)) n = h264_parse_vui(picture, buf, n); - free(dest); return n; } |