summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorJosep Torra <josep@fluendo.com>2009-07-16 12:03:32 +0200
committerEdward Hervey <bilboed@bilboed.com>2009-07-16 16:05:41 +0200
commit6303b0e80d0904f271a881e02aeffd2e91689121 (patch)
treee1a6e9c521ef8288b90d27f4a0314bfd5a75d8bd /gst
parent9deb7346316559ce25e2fb5458905a8c0cedd8c1 (diff)
downloadgst-plugins-bad-6303b0e80d0904f271a881e02aeffd2e91689121.tar.gz
gst-plugins-bad-6303b0e80d0904f271a881e02aeffd2e91689121.tar.bz2
gst-plugins-bad-6303b0e80d0904f271a881e02aeffd2e91689121.zip
pesfilter: Permit unbounded packets for 0xfd (extended stream id).
Added parsing of PES extension related data. Fixes some VC1 related issues.
Diffstat (limited to 'gst')
-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;