Commit graph

299 commits

Author SHA1 Message Date
Martin Kelly
be05515da7 matroskamux: don't store used UIDs
Currently, whenever we generate a 128-bit UID, we store it in a list and
return 0 if we ever encounter a collision. This is so mathematically
improbable that it's not worth checking for, so we can save memory and
time by not tracking the UID. Even if a collision happened, a list of
only 10 UIDs would be unlikely to detect it.

This article has a good description of how improbable a collision is:
https://en.wikipedia.org/wiki/Universally_unique_identifier#Collisions

https://bugzilla.gnome.org/show_bug.cgi?id=797086
2018-09-06 14:14:56 -04: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
Olivier Crête
d641b37fcb matroskamux: Put codec_data as CodecPrivate for AV1 2018-07-26 14:14:53 -04:00
Olivier Crête
e3b14e345d matroskamux: Accept muxing AV1 2018-07-26 14:14:53 -04:00
Mathieu Duponchelle
d9235404aa matroska-mux: write colorimetry
This is a straightforward translation of 5dd39d8, can be trivially
checked by running:

gst-launch-1.0 -v videotestsrc ! video/x-raw, colorimetry=2:4:7:1 ! \
matroskamux ! matroskademux ! fakesink

and verifying that the colorimetry is correctly preserved.

https://bugzilla.gnome.org/show_bug.cgi?id=796344
2018-05-23 15:14:23 +02:00
Sebastian Dröge
80d5c43a81 matroskamux: Only mark new clusters as keyframe if they start on a keyframe or we're muxing only audio
Based on a patch by Nicola Murino <nicola.murino@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=792775
2018-02-28 19:21:53 +02:00
Sebastian Dröge
15ae79838c matroskamux: Clip maximum cluster duration to the maximum possible value
Only up to timescale * G_MAXINT16 is possible as cluster duration, which
is already higher than our default value. Using higher values would
cause overflows and broken files.

Based on the investigation by Nicola Murino <nicola.murino@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=792775
2018-02-28 19:20:23 +02:00
Sebastian Dröge
fc37bf70c5 matroska-mux: Refuse caps changes after starting to write headers
Matroska does not support changing the stream type and stream properties
after the headers were started to be written, and for example H264
codec_data changes can't be supported.

https://bugzilla.gnome.org/show_bug.cgi?id=782949
2018-02-28 10:38:29 +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
3464aac3c9 matroska: fix memory leaks due to toc related updates
https://bugzilla.gnome.org/show_bug.cgi?id=790686
2017-12-15 16:14:43 +02: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
Reynaldo H. Verdejo Pinochet
0ddb65dec7 Use proper GtkDoc notation for NULL/FALSE/TRUE 2017-10-03 16:30:10 -07:00
Sebastian Dröge
317d3380bb matroskamux: For audio tracks, take the default duration from the first buffer
... if we don't have any better idea from the caps. This allows writing
SimpleBlocks for a majority of audio streams where the duration of
frames is usually fixed. And as a side effect, allows VLC to play
streams with Opus as it only works with SimpleBlocks currently:
  https://trac.videolan.org/vlc/ticket/18545

https://bugzilla.gnome.org/show_bug.cgi?id=784969
2017-07-25 11:28:46 +03:00
Nicola Murino
1bbdfa8738 matroskamux: add properties to control cluster duration
https://bugzilla.gnome.org/show_bug.cgi?id=784971
2017-07-18 10:08:33 +03:00
Nicola Murino
c950672809 matroskamux: only drop actual streamheader buffers with xiph codecs
With Xiph codecs the stream header buffers are both in the caps and are
usually also at the beginning of each input stream, but it's perfectly
possible that the input stream does not have the stream header buffers
inline in the data. Matroskamux would drop the first N buffers assuming
they're stream headers, but this meant it would drop actual payload data
when the stream didn't contain the stream headers inline. Fix this by
only dropping leading buffers if they're flagged as stream headers. This
fixes issues with streams that are being tapped into after streaming
has started.

https://bugzilla.gnome.org/show_bug.cgi?id=749098
2016-12-21 17:02:57 +00:00
Nicola Murino
38265ee1a5 matroskamux: mark all packets of audio-only streams as keyframes
This helps with streaming audio-only streams via multifdsink,
tcpserversink and such.

https://bugzilla.gnome.org/show_bug.cgi?id=754696
2016-12-20 23:35:00 +00:00
Nicola Murino
92626d4085 matroskamux: add G722 audio support
https://bugzilla.gnome.org/show_bug.cgi?id=746574
2016-12-20 12:49:04 +02:00
Scott D Phillips
55297bdbad Use intermediate guint when handling GstVideoMultiviewFlags
The underlying integer type of the enum GstVideoMultiviewFlags is
implementation defined and may not have the same size as guint.

https://bugzilla.gnome.org/show_bug.cgi?id=774293
2016-11-12 10:52:24 +02:00
Branko Subasic
ddba77ea6e matroskamux: allow resolutions above 4096
Modify the caps string to allow width and height greater than 4096.
There is no need to restrict it since the matroska format allows the
width and height values to be up to eight bytes long.

https://bugzilla.gnome.org/show_bug.cgi?id=773582
2016-10-27 14:01:55 +01:00
Sebastian Dröge
7ab3df4542 matroskamux: Always write the default frame duration for VP8/9 too
The WebM spec allows this now, and it allows us to guess a framerate.

See https://bugzilla.gnome.org/show_bug.cgi?id=772141 and
also https://bugzilla.gnome.org/show_bug.cgi?id=654379
2016-09-29 10:19:56 +03:00
Sebastian Dröge
f0ba7a5ca4 matroskamux: Remove suspicious checks for pads being active and linked
We should add all pads, no matter if they are linked or active or not at this
point. Skipping some that are not will cause different behaviour than with
other muxers.
2016-07-07 18:26:48 +03:00
Sebastian Dröge
dbb8ec4639 matroskamux: Error out if we start writing data with some pads not having a codec id yet
This can only happen if a) upstream somehow gets around the CAPS event failing
or b) there never being any CAPS event.

The following code assumes that all pads have a codec-id.

https://bugzilla.gnome.org/show_bug.cgi?id=768509
2016-07-07 18:26:48 +03:00
Sebastian Dröge
cc636760b6 matroskamux: Consistently use gst_matroska_mux_set_codec_id() for setting the codec id 2016-07-07 18:26:48 +03:00
Edward Hervey
ac3b1cf2ed matroska-mux: Fix strcmp usage
Just use g_strcmp0 which can handle NULL entries
2016-05-15 12:25:03 +02:00
Nicola Murino
cbdbfc8902 matroskamux: make timecodescale configurable
In some use cases the default timecodescale will produce blocks with the same timestamp

https://bugzilla.gnome.org/show_bug.cgi?id=764769
2016-04-11 10:17:25 +03:00
Vineeth TM
1071309870 good: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763076
2016-03-24 14:32:20 +02:00
Matej Knopp
8657987f8f matroskamux: don't output empty tags/tag elements
Such files will not play on Android, because of bug in libwebm matroska parsing, which is still present in 6.0.1

https://bugzilla.gnome.org/show_bug.cgi?id=762349
2016-02-23 11:00:05 +02:00
Vincent Penquerc'h
565607107f matroska-mux: make up an OpusHead block if possible when missing
This block is needed in the Matroska file, but data coming from
RTP may not have one.

https://bugzilla.gnome.org/show_bug.cgi?id=761489
2016-02-23 10:47:43 +02:00
Mark Nauwelaerts
7456ee1e1b matroska: remove confusing duplicate track uid field 2016-02-22 16:05:41 +01:00
Matej Knopp
e7460d9c06 matroskamux: use A_AAC instead of A_AAC/MPEGx/y
Some GoogleCast compatible devices ignore A_AAC/MPEGx/y tracks; Also according to http://wiki.multimedia.cx/index.php?title=Matroska A_AAC/MPEGx/y is obsolete

https://bugzilla.gnome.org/show_bug.cgi?id=761144
2016-01-27 13:50:21 +01:00
Thibault Saunier
10d1ba1477 matroska-mux: Implement prores support
https://bugzilla.gnome.org/show_bug.cgi?id=758258
2015-12-19 03:49:28 +11:00
Luis de Bethencourt
40aa27b788 matroskamux: remove duplicate check
We want 1 or 2 streamheaders, the check  if (bufarr->len != 1 &&
bufarr->len != 2) is enough. Not need to check if bufarr->len is <= 0 or
> 255.
2015-11-18 16:06:27 +00:00
Reynaldo H. Verdejo Pinochet
fd4d33b0fa matroskamux: remove unnecessary NULL checks before g_free() 2015-11-15 01:43:08 -08:00
Sebastian Dröge
c6f6092f2f matroska/webmmux: Support Opus in webmmux and VP9 in matroskamux
https://bugzilla.gnome.org/show_bug.cgi?id=729950
2015-11-03 20:35:27 +02: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
Sebastian Dröge
b34574d829 matroskamux: Opus headers are not in-band
https://bugzilla.gnome.org/show_bug.cgi?id=727305
2015-11-03 20:35:27 +02:00
Sebastian Dröge
ca9b6b55e6 matroskamux: Create a TIME segment when creating streamable output
Related to https://bugzilla.gnome.org/show_bug.cgi?id=754435 which
does the same for flvmux.
2015-10-11 11:37:51 +01:00
Jan Schmidt
e5d53ec7e4 matroska-mux: Don't output a warning on MONO multiview mode. 2015-09-22 00:46:01 +10:00
Tim-Philipp Müller
a95c761fde matroskamux: fix outdated comment
The default behaviour was changed in the 0.10 -> 1.x
transition, but the comment was not updated.
2015-08-08 16:44:49 +01:00
Tim-Philipp Müller
2e3a5ba227 Update mailing list address from sourceforge to freedesktop 2015-07-16 17:19:03 +01:00
Stefan Sauer
12930c2f8c docs: fix "Symbol name not found at the start of the comment block"
Add symbols or change comment into a regular comment.
2015-07-07 17:12:02 +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
Luis de Bethencourt
9391622579 Rename property enums from ARG_ to PROP_
Property enum items should be named PROP_ for consistency and readability.
2015-04-27 11:22:11 +01:00
Nicola Murino
c4e542de69 matroskamux: Remove duration accumulation logic
Duration accumulation can cause rounding errors and generate wrong
duration with different buffers that share the same timestamp.

https://bugzilla.gnome.org/show_bug.cgi?id=745192
2015-03-04 11:37:48 +01: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
Nicola Murino
e676b8ba9c matroskamux/demux: initialize dts_only
https://bugzilla.gnome.org/show_bug.cgi?id=745192
2015-02-27 09:56:06 +02:00
Nicola Murino
09b8f0efc3 matroskamux: store DTS for V_MS/VFW/FOURCC streams
https://bugzilla.gnome.org/show_bug.cgi?id=745192
2015-02-27 09:56:06 +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
Edward Hervey
932b32bb6e matroskamux: Avoid using freed variable
the name variable might have been attributed to pad_name, make sure we
free it only *after* pad_name has been used.

Coverity CID : 1265774
2015-01-23 15:16:25 +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