[gst-cvs] gst-plugins-bad: mpegtsparse: Create a sub-buffer with the section length

Alessandro Decina alessandro at kemper.freedesktop.org
Tue Nov 23 02:29:15 PST 2010


Module: gst-plugins-bad
Branch: master
Commit: e307bfe6e6e8b28782281dd2af250eeb155c8881
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=e307bfe6e6e8b28782281dd2af250eeb155c8881

Author: Andoni Morales Alastruey <amorales at flumotion.com>
Date:   Mon Nov 22 12:23:30 2010 +0100

mpegtsparse: Create a sub-buffer with the section length

---

 gst/mpegdemux/mpegtspacketizer.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/gst/mpegdemux/mpegtspacketizer.c b/gst/mpegdemux/mpegtspacketizer.c
index 24ca153..70cf3d7 100644
--- a/gst/mpegdemux/mpegtspacketizer.c
+++ b/gst/mpegdemux/mpegtspacketizer.c
@@ -2192,18 +2192,14 @@ mpegts_packetizer_push_section (MpegTSPacketizer * packetizer,
 
     data += pointer;
   }
-  /* create a sub buffer from the start of the section (table_id and
-   * section_length included) to the end */
-  sub_buf = gst_buffer_create_sub (packet->buffer,
-      data - GST_BUFFER_DATA (packet->buffer), packet->data_end - data);
-
   /* TDT and TOT sections (see ETSI EN 300 468 5.2.5)
    *  these sections do not extend to several packets so we don't need to use the
    *  sections filter. */
   if (packet->pid == 0x14) {
-    table_id = *data++;
-    section->section_length = GST_READ_UINT16_BE (data) & 0x0FFF;
-    section->buffer = sub_buf;
+    table_id = data[0];
+    section->section_length = GST_READ_UINT24_BE (data) & 0x000FFF;
+    section->buffer = gst_buffer_create_sub (packet->buffer,
+        data - GST_BUFFER_DATA (packet->buffer), section->section_length + 3);
     section->table_id = table_id;
     section->complete = TRUE;
     res = TRUE;
@@ -2212,6 +2208,12 @@ mpegts_packetizer_push_section (MpegTSPacketizer * packetizer,
     goto out;
   }
 
+  /* create a sub buffer from the start of the section (table_id and
+   * section_length included) to the end */
+  sub_buf = gst_buffer_create_sub (packet->buffer,
+      data - GST_BUFFER_DATA (packet->buffer), packet->data_end - data);
+
+
   stream = packetizer->streams[packet->pid];
   if (stream == NULL) {
     stream = mpegts_packetizer_stream_new ();





More information about the Gstreamer-commits mailing list