diff options
author | Andoni Morales Alastruey <amorales@flumotion.com> | 2010-11-22 12:23:30 +0100 |
---|---|---|
committer | Alessandro Decina <alessandro.d@gmail.com> | 2010-11-23 11:26:56 +0100 |
commit | e307bfe6e6e8b28782281dd2af250eeb155c8881 (patch) | |
tree | 7189ea146ae4a2129112d9eda855db3250ea83c8 | |
parent | 6e43f75df3340fca4b9d084c51933a191f7737e2 (diff) |
mpegtsparse: Create a sub-buffer with the section length
-rw-r--r-- | 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 24ca153e7..70cf3d710 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 (); |