Commit graph

87 commits

Author SHA1 Message Date
Doug Nazar b0534c65d1 matroska: Handle interlaced field order 2019-08-07 14:12:32 +00:00
Seungha Yang 61f9a2a415 matroskademux: Add support parsing HDR metadata
Set SMPTE ST 2086 mastering-display-metadata and
content-light-level to caps, if any
2019-05-01 14:28:36 +00:00
Seungha Yang 53fedc43ae matroska: Remove white space 2019-05-01 14:28:36 +00: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
Tim-Philipp Müller fd0afe033b matroska: fix handling of FlagInterlaced
This is an enum not a boolean, and a value of 2 signals
that the video is progressive, but we would mistakenly set
interlace-mode=mixed on the output caps.

https://bugzilla.gnome.org/show_bug.cgi?id=787206
2018-08-23 23:32:06 +02:00
Sean DuBois de8f080a5c Add AV1 to matroska plugin
https://bugzilla.gnome.org/show_bug.cgi?id=784160
2017-12-15 18:00:31 +01:00
fengalin a6702a76d5 matroska: re-activate and update TOC support
TOC support in mastroskamux has been deactivated for a couple of years. This commit updates it to recent GstToc evolutions and introduces toc unit tests for both matroska-mux and matroska-demux.

There are two UIDs for Chapters in Matroska's specifications:
- The ChapterUID is a mandatory unsigned integer which internally refers to a given chapter. Except for title & language which use dedicated fields, this UID can also be used to add tags to the Chapter. The tags come in a separate section of the container.
- The ChapterStringUID is an optional UTF-8 string which also uniquely refers to a chapter but from an external perspective. It can act as a "WebVTT cue identifier" which "can be used to reference a specific cue, for example from script or CSS".

During muxing, the ChapterUID is generated and checked for unicity, while the ChapterStringUID receives the user defined UID. In order to be able to refer to chapters from the tags section, we maintain an internal Toc tree with the generated ChapterUID.

When demuxing, the ChapterStringUIDs (if available) are assigned to the GstTocEntries UIDs and an internal toc mimicking the toc is used to keep track of the ChapterUIDs and match the tags with the appropriate GstTocEntries.

https://bugzilla.gnome.org/show_bug.cgi?id=790686
2017-12-15 16:14:43 +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
Tim-Philipp Müller d826c5ad96 matroskademux: improve index memory usage
Re-arrange order of index entry struct members to avoid padding
bytes in the middle of the struct, thus potentially reducing the
overall size of the struct and reducing memory used by the index.
On Linux x86_64 the size goes down from 32 bytes to 24 bytes for
each index entry.
2017-05-06 22:39:31 +01:00
Mark Nauwelaerts 7456ee1e1b matroska: remove confusing duplicate track uid field 2016-02-22 16:05:41 +01:00
Jan Schmidt 71d43327a3 matroska-demux: Play ProRes video streams
Generate video/x-prores caps for ProRes video streams.
Every frame needs an 8 byte header prepended, as described in
http://wiki.multimedia.cx/index.php?title=Apple_ProRes#Frame_layout
so do that in a post-processing callback.

https://bugzilla.gnome.org/show_bug.cgi?id=758258
2015-12-19 03:47:49 +11:00
Sebastian Dröge 52122f9206 matroskamux: Write CodecDelay, DiscardPadding and SeekPreroll for Opus
And also adjust timestamps and durations according to the codec delay, both
should include it for whatever reason.

https://bugzilla.gnome.org/show_bug.cgi?id=727305
2015-11-03 20:35:27 +02: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 bb3d82ef04 matroskademux: for dts only stream set pts=dts for intra only formats
https://bugzilla.gnome.org/show_bug.cgi?id=745192
2015-03-15 14:28:36 +00: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
Matej Knopp fa283f407f matroskademux: V_MS/VFW/FOURCC streams have DTS instead of PTS
When such stream is present demuxer should set DTS on buffers instead
of PTS. This is consistent with how VLC and libav/ffmpeg handle VFW
streams.

Sample file
https://s3.amazonaws.com/MatejK/Samples/Matroska-VFW-DTS-Only.mkv

https://bugzilla.gnome.org/show_bug.cgi?id=745192
2015-02-26 11:12:34 +02:00
Thiago Santos 7772a25fdc matroskamux: store and write stream tags
Separate global from stream tags storage and write them to the
appropriate tags entry in the output
2015-02-02 20:07:13 -03: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
Thiago Santos c7c25071e3 matroskademux: use GstFlowCombiner
Use the flow combiner to have the standard combination results and avoid
repeating the same code

https://bugzilla.gnome.org/show_bug.cgi?id=709224
2014-05-26 19:51:02 -03:00
Tim-Philipp Müller b158a1c068 matroska-demux: add mapping for Opus audio codec
https://bugzilla.gnome.org/show_bug.cgi?id=727305
2014-03-30 00:31:11 +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
Sebastian Dröge 77745289c4 matroskademux: Add HEVC / h265 support 2014-01-06 14:55:36 +01:00
Sebastian Dröge 3c9aba91dc matroska: Add initial VP9 support 2013-06-21 18:22:13 +02:00
Arnaud Vrac 00b46b4744 matroskademux: handle TrueHD audio codec id
https://bugzilla.gnome.org/show_bug.cgi?id=697113
2013-04-02 22:47:54 +01: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
Руслан Ижбулатов cd719bb808 matroskademux: Expand the tag mapping.
* Also expose unknown tags as key=value pairs.
* Arrange tag map in the same order tags are listed in Matroska spec, leaving
unmapped tags as comments.
* More specific TODOs.
* Remove duplicate DATE define.

Fixes #682615
Depends on #682524
2012-10-26 10:12:52 +02:00
Руслан Ижбулатов 71fd688ef0 matroskademux: Matroska tag TargetType support
* Reads TargetType and TargetTypeValue from a Tag.
* After Tag is completely read, processes taglist, substituting some of the
tags depending on target type value and the presence of video/subtitle streams.
* Supports reading two new simpletags - PART_NUMBER and TOTAL_PARTS

Depends on #682448
Fixes #682524
2012-10-26 10:08:18 +02:00
Руслан Ижбулатов b75628f041 matroskademux: Per-track tags for Matroska
Requires Matroska file to have sane layout (track info before tag info).
Uses replace-merge.
Makes track UIDs 64-bit.

Fixes #682448
2012-10-26 10:03:55 +02:00
Tim-Philipp Müller d895ac645f Merge remote-tracking branch 'origin/master' into 0.11
Conflicts:
	docs/plugins/inspect/plugin-esdsink.xml
	docs/plugins/inspect/plugin-gconfelements.xml
	ext/pulse/pulseaudiosink.c
	gst/matroska/matroska-demux.c
	gst/matroska/matroska-mux.c
	gst/multifile/gstmultifilesink.c
2011-12-02 01:58:30 +00:00
Sebastian Dröge 588734b291 matroskademux: Only check for markup and escape if necessary for plaintext subtitles
Otherwise we break USF and ASS/SSA subtitles.
2011-12-01 13:35:54 +01:00
René Stadler 17240ac9ec matroska: port to 0.11
Support for TAG_IMAGE and TAG_ATTACHMENT is commented out; this requires caps
on buffers which is gone from 0.11.

Segment handling in the demuxer is a bit complex; I added some FIXME comments
in places where I'm not yet sure if I ported correctly.
2011-11-26 15:01:01 +01:00
Vincent Penquerc'h 671b56f9da matroskademux: ensure minimal alignment for audio/x-raw-* buffers
Since matroskademux will attempt to push unaligned buffers,
downstream might have trouble with those, especially if downstream
uses ORC, such as audioconvert.

Ensure we push buffers aligned to the basic type at least for
those raw buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=659798
2011-09-28 12:49:42 +02:00
Mark Nauwelaerts 74e0c05ff7 matroskademux: UTF-8 subtitles may have markup
Fixes #616936.
2011-05-26 12:12:57 +02:00
Sebastian Dröge 52aa27f997 matroskademux: Use ARTIST Matroska tag instead of AUTHOR for GST_TAG_ARTIST
AUTHOR only existed in an old version of the spec and ARTIST is
the new replacement for this. We are still reading both to still
be compatible with old files.

Fixes bug #644875.
2011-03-16 09:39:20 +01:00
Mark Nauwelaerts 44fa95d5cb matroskademux: improve reverse playback
Slightly modify approach to also handle cases where cue entries do not reliably
lead to initial keyframes.

Fixes #619817.
2010-06-01 15:56:34 +02: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 e5e90f6035 matroskamux: Add support for On2 VP8
...matroskademux automatically supports it through libgstriff.
2010-05-17 17:18:24 +02:00
Mark Nauwelaerts 9157c262ba matroskademux: support (pull mode) negative seek rate 2010-03-26 11:45:41 +01:00
Edward Hervey be186bd089 matroskademux: Mark streams as being EOS at the right time.
This allows us to stop streaming only when all streams have gone past the
segment.stop and not before.

Fixes #611501
2010-03-02 21:20:31 +01:00
Vincent Penquerc'h 19b7001bf9 matroska: add kate subtitle support to matroska muxer and demuxer
See #525743.
2009-08-08 12:54:48 +01:00
Wim Taymans dff3f37bdf matroska: and the new headers too 2009-06-23 14:39:56 +02:00
Sebastian Dröge afbe123e33 matroskademux: Populate a GstIndex that is set on matroskademux 2009-05-22 19:41:59 +02:00
Jan Schmidt 66149475bd matroskademux: Recognise PGS subpicture streams - the bluray format.
Recognise and apply appropriate caps to PGS (Presentation Graphic Stream)
subpicture streams.
2009-05-21 21:23:49 +01:00
Sebastian Dröge e4909b37eb matroskademux: Improve/optimize seeking
First of all a keyframe seek should be done to the
keyframe right before the requested position and not
to the keyframe that is nearest to the requested position.

Use per track index arrays and use our new binary search function
from core to speed up the search.
2009-05-11 15:36:46 +02:00
Sebastian Dröge 108774781d Add initial support for muxing/demuxing Speex audio
Note: This is not in the Matroska spec yet
Fixes bug #578310.
2009-04-13 14:03:03 +02:00
Edward Hervey 481d98b710 gst/matroska/: Make mkvdemux aware of E-AC3.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
Make mkvdemux aware of E-AC3.
2008-11-16 14:41:32 +00:00