[MPlayer-cvslog] r32433 - trunk/libmpdemux/mpeg_hdr.c

diego subversion at mplayerhq.hu
Sun Oct 3 17:37:17 CEST 2010


Author: diego
Date: Sun Oct  3 17:37:17 2010
New Revision: 32433

Log:
Move mp_unescape03 function around to avoid forward declaration.

Modified:
   trunk/libmpdemux/mpeg_hdr.c

Modified: trunk/libmpdemux/mpeg_hdr.c
==============================================================================
--- trunk/libmpdemux/mpeg_hdr.c	Sun Oct  3 17:35:41 2010	(r32432)
+++ trunk/libmpdemux/mpeg_hdr.c	Sun Oct  3 17:37:17 2010	(r32433)
@@ -373,7 +373,40 @@ static int h264_parse_vui(mp_mpeg_header
   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 * pi
   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;


More information about the MPlayer-cvslog mailing list