summaryrefslogtreecommitdiffstats
path: root/gst/mpegdemux/gstpesfilter.c
diff options
context:
space:
mode:
authorDave Robillard <dave@drobilla.net>2009-07-22 14:36:14 -0400
committerDave Robillard <dave@drobilla.net>2009-07-22 14:36:14 -0400
commitadadf06b0a9e26005ba9363aa0049dc0b740c94d (patch)
treeb61e688d7ed775acff14763d0453102f80cc6c09 /gst/mpegdemux/gstpesfilter.c
parent23ef5d4ac3487345c1c91db57c76554363e6c0f5 (diff)
parent5d9d4a7b518c42bda88c7f6c87ce7c3c01233562 (diff)
downloadgst-plugins-bad-adadf06b0a9e26005ba9363aa0049dc0b740c94d.tar.gz
gst-plugins-bad-adadf06b0a9e26005ba9363aa0049dc0b740c94d.tar.bz2
gst-plugins-bad-adadf06b0a9e26005ba9363aa0049dc0b740c94d.zip
Merge branch 'fdo' into lv2
Diffstat (limited to 'gst/mpegdemux/gstpesfilter.c')
-rw-r--r--gst/mpegdemux/gstpesfilter.c49
1 files changed, 47 insertions, 2 deletions
diff --git a/gst/mpegdemux/gstpesfilter.c b/gst/mpegdemux/gstpesfilter.c
index b520c766..736d4960 100644
--- a/gst/mpegdemux/gstpesfilter.c
+++ b/gst/mpegdemux/gstpesfilter.c
@@ -151,6 +151,7 @@ gst_pes_filter_parse (GstPESFilter * filter)
* to set the allow_unbounded flag if they want */
if (filter->length == 0 &&
((filter->start_code & 0xFFFFFFF0) == PACKET_VIDEO_START_CODE ||
+ filter->start_code == ID_EXTENDED_STREAM_ID ||
filter->allow_unbounded)) {
GST_DEBUG ("id 0x%02x, unbounded length", filter->id);
filter->unbounded_packet = TRUE;
@@ -389,9 +390,53 @@ gst_pes_filter_parse (GstPESFilter * filter)
}
/* PES_extension_flag */
if ((flags & 0x01)) {
- GST_DEBUG ("%x PES_extension", filter->id);
+ flags = *data++;
+ header_data_length -= 1;
+ datalen -= 1;
+ GST_DEBUG ("%x PES_extension, flags 0x%02x", filter->id, flags);
+ /* PES_private_data_flag */
+ if ((flags & 0x80)) {
+ GST_DEBUG ("%x PES_private_data_flag", filter->id);
+ data += 16;
+ header_data_length -= 16;
+ datalen -= 16;
+ }
+ /* pack_header_field_flag */
+ if ((flags & 0x40)) {
+ guint8 pack_field_length = *data;
+ GST_DEBUG ("%x pack_header_field_flag, pack_field_length %d",
+ filter->id, pack_field_length);
+ data += pack_field_length + 1;
+ header_data_length -= pack_field_length + 1;
+ datalen -= pack_field_length + 1;
+ }
+ /* program_packet_sequence_counter_flag */
+ if ((flags & 0x20)) {
+ GST_DEBUG ("%x program_packet_sequence_counter_flag", filter->id);
+ data += 2;
+ header_data_length -= 2;
+ datalen -= 2;
+ }
+ /* P-STD_buffer_flag */
+ if ((flags & 0x10)) {
+ GST_DEBUG ("%x P-STD_buffer_flag", filter->id);
+ data += 2;
+ header_data_length -= 2;
+ datalen -= 2;
+ }
+ /* PES_extension_flag_2 */
+ if ((flags & 0x01)) {
+ guint8 PES_extension_field_length = *data++;
+ GST_DEBUG ("%x PES_extension_flag_2, len %d",
+ filter->id, PES_extension_field_length & 0x7f);
+ if (PES_extension_field_length == 0x81) {
+ GST_DEBUG ("%x substream id 0x%02x", filter->id, *data);
+ }
+ data += PES_extension_field_length & 0x7f;
+ header_data_length -= (PES_extension_field_length & 0x7f) + 1;
+ datalen -= (PES_extension_field_length & 0x7f) + 1;
+ }
}
-
/* calculate the amount of real data in this PES packet */
data += header_data_length;
datalen -= header_data_length;