[gst-cvs] CVS: gstreamer/plugins/mpeg2/parse mpeg2parse.c,1.32.4.6,1.32.4.7

Wim Taymans wtay at users.sourceforge.net
Tue Sep 25 14:44:03 PDT 2001


Update of /cvsroot/gstreamer/gstreamer/plugins/mpeg2/parse
In directory usw-pr-cvs1:/tmp/cvs-serv25121

Modified Files:
      Tag: BRANCH-EVENTS1
	mpeg2parse.c 
Log Message:
Handle empty pes packets by flushing the packet length rather than our
miscalculated length.


Index: mpeg2parse.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/plugins/mpeg2/parse/mpeg2parse.c,v
retrieving revision 1.32.4.6
retrieving revision 1.32.4.7
diff -u -d -r1.32.4.6 -r1.32.4.7
--- mpeg2parse.c	2001/09/24 19:44:24	1.32.4.6
+++ mpeg2parse.c	2001/09/25 21:43:41	1.32.4.7
@@ -32,7 +32,6 @@
   "(C) 1999",
 };
 
-
 /* Mpeg2Parse signals and args */
 enum {
   /* FILL ME */
@@ -607,10 +606,12 @@
   {
     guchar flags1 = *buf++;
     guchar flags2 = *buf++;
-    header_data_length = *buf++;
 
-    if ((flags1 & 0xC0) != 0x80)
+    if ((flags1 & 0xC0) != 0x80) {
       return FALSE;
+    }
+
+    header_data_length = *buf++;
 
     GST_DEBUG (0,"mpeg2parse: header_data_length is %d\n",header_data_length);
 
@@ -703,7 +704,7 @@
 
   // if we don't know what it is, bail
   if (outpad == NULL) {
-    gst_bytestream_flush (bs, headerlen + datalen);
+    gst_bytestream_flush (bs, 2 + packet_length);
     return TRUE;
   }
 
@@ -777,7 +778,7 @@
     gst_pad_push((*outpad),outbuf);
   }
   else {
-    gst_bytestream_flush (bs, headerlen + datalen);
+    gst_bytestream_flush (bs, 2 + packet_length);
   }
 
   // return total number of bytes
@@ -805,6 +806,7 @@
     code = (code << 8) | buf[offset++];
     
     GST_DEBUG (0, "  code = %08x\n", code);
+    g_print ("  code = %08x\n", code);
 
     if (offset == chunksize) {
       gst_bytestream_flush (bs, offset);





More information about the Gstreamer-commits mailing list