diff options
author | Edward Hervey <edward@centricular.com> | 2017-08-29 11:14:59 +0200 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2017-09-01 10:49:36 +0200 |
commit | c393f0d768a5c86dade48d991fb7d890f6dc5221 (patch) | |
tree | 4cc732db4346972bc4a93dab3738b95add38f57f /gst | |
parent | 4e239a6632ca648e3bf39b120e2d15822e5540e4 (diff) |
tsdemux: Handle quirk in jp2k es header handling
The jp2k specification (ITU-T T.800) specifies that the 'brat' box
has two fields and the second one (AUF2) can be set to 0 for progressive
streams.
The problem is that the mpeg-ts specification (ITU-T H.222.0 06/2012)
says that the AUF2 field is only present if the stream is interlaced
In order to cope with both situation, accept those next 32bit if the
stream is marked as progressive and those bits contain 0
https://bugzilla.gnome.org/show_bug.cgi?id=786111
Diffstat (limited to 'gst')
-rw-r--r-- | gst/mpegtsdemux/tsdemux.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c index f802ae0ff..68080109d 100644 --- a/gst/mpegtsdemux/tsdemux.c +++ b/gst/mpegtsdemux/tsdemux.c @@ -2730,8 +2730,20 @@ parse_jp2k_access_unit (TSDemuxStream * stream) goto error; #endif } + /* Time Code Box 'tcod' == 0x74636f64 */ + /* Some progressive streams might have a AUF[1] of value 0 present */ header_tag = gst_byte_reader_get_uint32_be_unchecked (&reader); + if (header_tag == 0 && !stream->jp2kInfos.interlace) { + AUF[1] = header_tag; + header_tag = gst_byte_reader_get_uint32_be_unchecked (&reader); + /* Bump up header size and recheck */ + header_size += 4; + if (stream->current_size < header_size) { + GST_ERROR_OBJECT (stream->pad, "Not enough data for header"); + goto error; + } + } if (header_tag != 0x74636f64) { GST_ERROR_OBJECT (stream->pad, "Expected Time code box but found %d box instead", header_tag); |