diff options
author | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | 2009-09-07 16:20:23 +0200 |
---|---|---|
committer | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | 2009-09-07 19:10:02 +0200 |
commit | 5b1ed7d42c9569f5a1f38b897debde3815c3dcef (patch) | |
tree | a83aa84c21145e9b92ab4c2f1920bb39e461633f /gst/mpeg4videoparse | |
parent | 503091ae0ef2c4edc68f438b2bd1f30afbe5cf43 (diff) | |
download | gstreamer-plugins-bad-5b1ed7d42c9569f5a1f38b897debde3815c3dcef.tar.gz |
mpeg4videoparse: also consider user_data pieces when parsing VO(S)
Diffstat (limited to 'gst/mpeg4videoparse')
-rw-r--r-- | gst/mpeg4videoparse/mpeg4videoparse.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gst/mpeg4videoparse/mpeg4videoparse.c b/gst/mpeg4videoparse/mpeg4videoparse.c index e0e28d0cd..a93008511 100644 --- a/gst/mpeg4videoparse/mpeg4videoparse.c +++ b/gst/mpeg4videoparse/mpeg4videoparse.c @@ -129,6 +129,7 @@ gst_mpeg4vparse_set_new_caps (GstMpeg4VParse * parse, #define START_MARKER 0x000001 #define VISUAL_OBJECT_STARTCODE_MARKER ((START_MARKER << 8) + VISUAL_OBJECT_STARTCODE) +#define USER_DATA_STARTCODE_MARKER ((START_MARKER << 8) + USER_DATA_STARTCODE) typedef struct { @@ -327,6 +328,24 @@ failed: } } +static inline gboolean +skip_user_data (bitstream_t * bs, guint32 * bits) +{ + while (*bits == USER_DATA_STARTCODE_MARKER) { + guint32 b; + + do { + GET_BITS (bs, 8, &b); + *bits = (*bits << 8) | b; + } while ((*bits >> 8) != START_MARKER); + } + + return TRUE; + +failed: + return FALSE; +} + /* Returns whether we successfully set the caps downstream if needed */ static gboolean gst_mpeg4vparse_handle_vos (GstMpeg4VParse * parse, const guint8 * data, @@ -373,6 +392,10 @@ gst_mpeg4vparse_handle_vos (GstMpeg4VParse * parse, const guint8 * data, /* Expect Visual Object startcode */ GET_BITS (&bs, 32, &bits); + /* but skip optional user data */ + if (!skip_user_data (&bs, &bits)) + goto failed; + if (bits != VISUAL_OBJECT_STARTCODE_MARKER) goto failed; @@ -404,6 +427,13 @@ gst_mpeg4vparse_handle_vos (GstMpeg4VParse * parse, const guint8 * data, if (!next_start_code (&bs)) goto failed; + /* skip optional user data */ + GET_BITS (&bs, 32, &bits); + if (!skip_user_data (&bs, &bits)) + goto failed; + /* rewind to start code */ + bs.offset -= 4; + data = &bs.data[bs.offset]; size -= bs.offset; |