changeset 32347:6c6a59af9513

Move mp_unescape03 function around to avoid forward declaration.
author diego
date Sun, 03 Oct 2010 15:37:17 +0000
parents 1fb9fff0eb39
children b4e4b6ecb471
files libmpdemux/mpeg_hdr.c
diffstat 1 files changed, 34 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/mpeg_hdr.c	Sun Oct 03 15:35:41 2010 +0000
+++ b/libmpdemux/mpeg_hdr.c	Sun Oct 03 15:37:17 2010 +0000
@@ -373,7 +373,40 @@
   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 @@
   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;