[03/19] videoparsers: fix mpeg2 parsing confusion w/ dvd

Message ID 1325628171-4803-3-git-send-email-rob@ti.com
State New
Headers show

Commit Message

Rob Clark Jan. 3, 2012, 10:02 p.m.
Perhaps not unique to mpeg2 from DVD, but this is the case where I'm
seeing the parsing logic tripped up by an extension_start_code which
is not sequence_extension_id.
---
See: https://bugzilla.gnome.org/show_bug.cgi?id=667219

 gst/videoparsers/mpegvideoparse.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

Patch

diff --git a/gst/videoparsers/mpegvideoparse.c b/gst/videoparsers/mpegvideoparse.c
index e85d77b..5a90c2b 100644
--- a/gst/videoparsers/mpegvideoparse.c
+++ b/gst/videoparsers/mpegvideoparse.c
@@ -80,6 +80,17 @@  gst_mpeg_video_params_parse_extension (MPEGVParams * params, GstBitReader * br)
 
   /* extension_start_code identifier */
   GET_BITS (br, 4, &bits);
+  if (bits != 0x1) {
+    /* not sequence_extension_id.. our caller got fooled by it's
+     * limited understanding of mpeg1/2 syntax.. let's just pretend
+     * and caller will skip fwd to next start code.
+     *
+     * Note: see http://www.omegacs.net/misc/glamdring/misc/mpeg2.parse
+     * with mpeg2 from DVD, I see us hit this a second time with
+     * sequence_display_extension_id (0x2)
+     */
+    return TRUE;
+  }
 
   /* profile_and_level_indication */
   GET_BITS (br, 4, &bits);