Commit graph

24 commits

Author SHA1 Message Date
Johan Bjäreholt
e736f29376 matroska-demux: Fix caps memleak
https://bugzilla.gnome.org/show_bug.cgi?id=797326
2018-10-27 10:48:38 +01:00
Johan Bjäreholt
abfc7da345 matroska-ids: Fix uninitialized memory in contexts
https://bugzilla.gnome.org/show_bug.cgi?id=797327
2018-10-24 09:54:20 +01:00
Yacine Bandou
0432826950 matroska: Add the WebM encrypted content support in matroskademux
This commit:

1. Reads the WebM and Matroska ContentEncryption subelements.

2. Creates a GST_PROTECTION event for each ContentEncryption, which
   will be sent before pushing the first source buffer.
   The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
   because it isn't specified neither by Matroska nor by the WebM spec.

3. Reads the protection information of encrypted Block/SimpleBlock and
   extracts the IV and the partitioning format (subsamples).

4. Creates the metadata protection for each encrypted Block/SimpleBlock,
   with those informations: KeyID (extracted from ContentEncryption element),
   IV and partitioning format.

5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
   with the following new fields:

   "encryption-algorithm": The encryption algorithm used.
                           values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".

   "encoding-scope": The field that describes which Elements have been modified.
                     Values: "frame", "codec-data", "next-content".

   "cipher-mode": The cipher mode used in the encryption.
                  Values: "None", "CTR".

https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-10-03 16:59:14 +02:00
Seungha Yang
5dd39d8946 matroskademux: Add parsing Colour element
... and forward colorimetry to downstream. The Colour element describes
various color information (similar to 'colr' box in isobmff).
Note that, due to the comparatively limited syntax for color information
in vpx codecs, the color information in mkv/wemb container level
should be used for sophisticated color handling (e.g., HDR video).

https://bugzilla.gnome.org/show_bug.cgi?id=790023
2017-11-08 11:01:55 +02:00
Sebastian Dröge
c0da05df38 matroska: Add size checks to the parsing of FLAC headers 2016-11-22 20:02:42 +02:00
Nicola Murino
65d08e2154 matroskamux: don't drop JPEG frames that only have PTS but no DTS set
For the MS/VfW codec ids, we want to write DTS timestamps instead
of PTS because that's what everyone else seems to do (and it's also
how it is in AVI). So for those input formats we use the buffer DTS
instead of the PTS. However, if there's no DTS set but only the PTS
then just take the PTS instead of dropping the input buffer. This
is useful especially for I-frame only codecs like JPEG and huffyuv,
but should also be fine as fallback in general.

Fixes regression with input JPEG frames that only have PTS set on them.

https://bugzilla.gnome.org/show_bug.cgi?id=756967
2015-10-28 19:02:44 +00:00
Jan Schmidt
ec5bc9dccb matroska: Implement basic stereoscopic video support
Implement support for the packed video formats WebM
uses, not all the values that Matroska might use.

In practice, it's really hard to find any samples in the
wild of any.

Supported in both the muxer and demuxer.
2015-06-11 12:11:42 +10:00
Thiago Santos
d56b11af56 matroska: store stream tags and push as updated
New tags can be found on different parts of the file, so this patch
keeps the stream taglists around for the life cycle of the pad
and adds those new tags as found. Then a new tag is found, the
pad's is marked with a tags changed flag, making the element push
a new tag event on the next check. Before this, we were sending
only the newly found tags, as the element was losing its taglist
when pushing the event.
2015-03-28 11:20:39 -03:00
Nicola Murino
f727762c1f matroska: Add an helper method to get buffer timestamps
... and replace GST_BUFFER_TIMESTAMP that always return PTS with this method
that return PTS or DTS based on stream type.

https://bugzilla.gnome.org/show_bug.cgi?id=745192
2015-03-04 11:36:24 +01:00
Vincent Penquerc'h
b7413279d9 matroska: mux/demux the OpusHead header
This is meant to be so (https://wiki.xiph.org/MatroskaOpus - while
it is marked as a draft, this part was confirmed to be correct on
IRC), and allows one to determine whether a demuxed stream is
multistream or not, and thus set the multistream caps field
accordingly. In turn, this means downstream does not have to guess.

https://bugzilla.gnome.org/show_bug.cgi?id=740744
2014-12-18 11:38:49 +00:00
Reynaldo H. Verdejo Pinochet
2f8a1aa870 matroska: factor out read context init/reset
While at this, move _track_reset() to track-ids
so it can be called from the common read context
reset routine.

https://bugzilla.gnome.org/show_bug.cgi?id=722705
2014-02-06 13:25:12 -03:00
Tim-Philipp Müller
230cf41cc9 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-04 00:07:18 +00:00
Tim-Philipp Müller
ef0805ea14 matroskademux: put streamheaders on vorbis/speex/flac/theora caps to make remuxing work
https://bugzilla.gnome.org/show_bug.cgi?id=640589
2012-10-30 23:29:46 +00:00
Tim-Philipp Müller
54a951ff15 matroskademux: initialise seen_markup_tag field on subtitle stream context 2011-11-26 16:06:59 +00:00
Philip Jägenstedt
80926a5596 matroskademux: skip buffers before a late keyframe (QoS)
Before, vp8dec had no option but to decode all frames even if some/all
of them would be late. With this change, performance when keyframes are
frequent is helped a great deal. On my Thinkpad X60s, decoding a 20 s
1080p sunflower encode with keyframes every 10 frames went from taking
42 s with 5 frames shown to 21 s with 15 frames shown (still slow
enough to count by hand). When keyframes are more sparse, you will
still be able to catch up eventually, but the results won't be as
noticable.
2010-06-01 11:21:29 +02:00
Sebastian Dröge
82e4807d10 matroska: Remove the doctype enum, it's not needed anymore 2010-05-20 21:49:43 +02:00
Philip Jägenstedt
27069088db matroskamux: Support "webm" DocType 2010-05-19 20:28:42 +02:00
Sebastian Dröge
25bc74b8a6 Build depend on core CVS for the attachment tag.
Original commit message from CVS:
* configure.ac:
* gst/matroska/matroska-ids.c: (gst_matroska_register_tags):
* gst/matroska/matroska-ids.h:
Build depend on core CVS for the attachment tag.
2008-08-02 18:20:44 +00:00
Sebastian Dröge
6cf110c1e3 gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
Sebastian Dröge
8c6d2c506a gst/matroska/: Parse Attachments and post them as GST_TAG_IMAGE if we detect it as image and otherwise as GST_TAG_ATT...
Original commit message from CVS:
* gst/matroska/Makefile.am:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c: (gst_matroska_register_tags):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska.c: (plugin_init):
Parse Attachments and post them as GST_TAG_IMAGE if we detect
it as image and otherwise as GST_TAG_ATTACHMENT. Include filename
and description of the attachments in the caps. Fixes bug #537622.
2008-06-16 10:59:39 +00:00
Sebastian Dröge
a778b414b8 gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
Tim-Philipp Müller
0d3b023699 gst/matroska/: Try harder to extract the framerate for video tracks correctly and save it directly instead of convert...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_video_caps):
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
Try harder to extract the framerate for video tracks correctly and
save it directly instead of converting it back and forth a few
times. Mostly makes a difference for very small framerates (<1).
Fixes #380199.
2006-12-11 13:59:33 +00:00
Tim-Philipp Müller
45c10ca9de gst/matroska/: Try to fix up broken matroska files containing subtitle streams with non-UTF8 character encodings (cou...
Original commit message from CVS:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
Try to fix up broken matroska files containing subtitle
streams with non-UTF8 character encodings (courtesy of
mkvmerge) using either the encoding specified in the
GST_SUBTITLE_ENCODING environment variable or the
current locale's character set if it is non-UTF8.
Fixes #337076.
2006-06-22 16:27:03 +00:00
Tim-Philipp Müller
da34723a6b gst/matroska/: Handle case where the TrackType ebml chunk does not come before the
Original commit message from CVS:
* gst/matroska/Makefile.am:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_event):
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context),
(gst_matroska_track_init_audio_context),
(gst_matroska_track_init_subtitle_context),
(gst_matroska_track_init_complex_context):
* gst/matroska/matroska-ids.h:
Handle case where the TrackType ebml chunk does not come before the
TrackInfoAudio or TrackInfoVideo ebml chunk (#339446). Ignore QoS
events.
2006-04-25 16:38:50 +00:00