mpegtsparse: Create a sub-buffer with the section length

This commit is contained in:
Andoni Morales Alastruey 2010-11-22 12:23:30 +01:00 committed by Alessandro Decina
parent 6e43f75df3
commit e307bfe6e6

View file

@ -2192,18 +2192,14 @@ mpegts_packetizer_push_section (MpegTSPacketizer * packetizer,
data += pointer; 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) /* 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 * these sections do not extend to several packets so we don't need to use the
* sections filter. */ * sections filter. */
if (packet->pid == 0x14) { if (packet->pid == 0x14) {
table_id = *data++; table_id = data[0];
section->section_length = GST_READ_UINT16_BE (data) & 0x0FFF; section->section_length = GST_READ_UINT24_BE (data) & 0x000FFF;
section->buffer = sub_buf; section->buffer = gst_buffer_create_sub (packet->buffer,
data - GST_BUFFER_DATA (packet->buffer), section->section_length + 3);
section->table_id = table_id; section->table_id = table_id;
section->complete = TRUE; section->complete = TRUE;
res = TRUE; res = TRUE;
@ -2212,6 +2208,12 @@ mpegts_packetizer_push_section (MpegTSPacketizer * packetizer,
goto out; 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]; stream = packetizer->streams[packet->pid];
if (stream == NULL) { if (stream == NULL) {
stream = mpegts_packetizer_stream_new (); stream = mpegts_packetizer_stream_new ();