From 10c881b107f0541d40aae1a8bf203144bfb93bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 19 Oct 2012 00:47:45 +0100 Subject: [PATCH] tsdemux: fix some inconsequential PES header parsing issues additional_copy_info: need to get rid of the highest bit, not the lowest one program_packet_sequence_counter: also need to get rid of the highest bit instead of multiplying with a random value original_stuff_length: want to AND 0x3f to extract the lowest 6 bits, not multiply by it. None of these fields are actually used though, so these should not have caused any issues. --- gst/mpegtsdemux/pesparse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gst/mpegtsdemux/pesparse.c b/gst/mpegtsdemux/pesparse.c index 75f593cda9..120e90bc9f 100644 --- a/gst/mpegtsdemux/pesparse.c +++ b/gst/mpegtsdemux/pesparse.c @@ -226,7 +226,7 @@ mpegts_parse_pes_header (const guint8 * data, gsize length, PESHeader * res, if (G_UNLIKELY (!(val8 & 0x80))) goto bad_original_copy_info_marker; - res->additional_copy_info = val8 >> 1; + res->additional_copy_info = val8 & 0x7f; GST_LOG ("additional_copy_info : 0x%x", res->additional_copy_info); } @@ -290,7 +290,7 @@ mpegts_parse_pes_header (const guint8 * data, gsize length, PESHeader * res, /* GRMBL, this is most often wrong */ if (G_UNLIKELY ((val8 & 0x80) != 0x80)) goto bad_sequence_marker1; - res->program_packet_sequence_counter = val8 * 0x70; + res->program_packet_sequence_counter = val8 & 0x7f; GST_LOG ("program_packet_sequence_counter %d", res->program_packet_sequence_counter); @@ -299,7 +299,7 @@ mpegts_parse_pes_header (const guint8 * data, gsize length, PESHeader * res, if (G_UNLIKELY ((val8 * 0x80) != 0x80)) goto bad_sequence_marker2; res->MPEG1_MPEG2_identifier = (val8 >> 6) & 0x1; - res->original_stuff_length = val8 * 0x3f; + res->original_stuff_length = val8 & 0x3f; GST_LOG ("MPEG1_MPEG2_identifier : %d , original_stuff_length : %d", res->MPEG1_MPEG2_identifier, res->original_stuff_length); length -= 2;