mpeg_hdr.c: move function to avoid forward declaration

Move mp_unescape03 function around to avoid forward declaration.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32433 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
diego 2010-10-03 15:37:17 +00:00 committed by Uoti Urpala
parent 03dae530f8
commit 342c68283e
1 changed files with 34 additions and 36 deletions

View File

@ -373,7 +373,40 @@ 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);
static int mp_unescape03(unsigned char *buf, int len)
{
unsigned char *dest;
int i, j, skip;
dest = malloc(len);
if(! dest)
return 0;
j = i = skip = 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;
skip++;
}
else
{
dest[j] = buf[i];
j++;
i++;
}
}
dest[j] = buf[len-2];
dest[j+1] = buf[len-1];
len -= skip;
memcpy(buf, dest, len);
free(dest);
return len;
}
int h264_parse_sps(mp_mpeg_header_t * picture, unsigned char * buf, int len)
{
@ -438,41 +471,6 @@ int h264_parse_sps(mp_mpeg_header_t * picture, unsigned char * buf, int len)
return n;
}
static int mp_unescape03(unsigned char *buf, int len)
{
unsigned char *dest;
int i, j, skip;
dest = malloc(len);
if(! dest)
return 0;
j = i = skip = 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;
skip++;
}
else
{
dest[j] = buf[i];
j++;
i++;
}
}
dest[j] = buf[len-2];
dest[j+1] = buf[len-1];
len -= skip;
memcpy(buf, dest, len);
free(dest);
return len;
}
int mp_vc1_decode_sequence_header(mp_mpeg_header_t * picture, unsigned char * buf, int len)
{
int n, x;