Commit graph

90 commits

Author SHA1 Message Date
Tim-Philipp Müller
05854f74c5 matroskademux: use g_memdup2() as g_memdup() is deprecated
- ebml-read: add some sanity checks when going from 64-bit
  to 32-bit length
- matroska-ids: codec_data_size has been checked via
  gst_ebml_read_binary(), is existing allocation.
- matroska-demux: alloc size is from existing allocations

g_memdup() is deprecated since GLib 2.68 and we want to avoid
deprecation warnings with recent versions of GLib.

Also use gst_buffer_new_memdup() instead of _wrapped(g_memdup(),..).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/993>
2021-06-02 17:34:38 +01:00
Linus Svensson
08060dd97b matroskamux: Add property to set DateUTC
Add a property that makes it possible for an application to set the
DateUTC header field in matroska files. This is useful for live feeds,
where the DateUTC header can be set to a UTC timestamp, matching the
beginning of the file.

Needs gstreamer!323

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/481
2019-11-25 14:01:48 +01:00
Aaron Boxer
46989dca96 documentation: fix a number of typos 2019-10-05 22:38:11 +00:00
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
Thibault Saunier
defae35035 matroskdemux: do not use MapInfo.data after unmapping
And minor gst-indenting
2018-10-03 17:39:33 +02: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
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
Sebastian Dröge
7d6cf17498 matroskademux: Fix memory leak when parsing attachments
gst_tag_image_data_to_image_sample() does not take ownership of the
passed memory, so don't set it to NULL to allow us to free it later.

https://bugzilla.gnome.org/show_bug.cgi?id=775472
2016-12-01 17:38:33 +02:00
Sebastian Dröge
d3bc50bc8f matroskademux: Unify zlib/bzip2 decompress loops with the ones from qtdemux
Especially, simplify the code a bit.
2016-12-01 14:56:18 +02:00
Nicola Murino
20ed9e8237 matroskaparse: add support for skipping invalid data
https://bugzilla.gnome.org/show_bug.cgi?id=774566
2016-11-21 13:38:08 +02:00
Steven Hoving
910d75ddaf matroska: Store subtitle stream count in the correct variable
And don't override the video stream count instead.
2016-01-07 18:20:30 +02:00
Reynaldo H. Verdejo Pinochet
edec775e26 matroska/read-common: remove unnecessary NULL checks before g_free() 2015-11-15 01:43:08 -08:00
Vineeth TM
77c9e2cd4d matroska: read: fix tag list memory leak
gst_toc_entry_merge_tags makes a new ref of the taglist, so it should
be unref'ed as soon as the tags are merged to the tocentry

https://bugzilla.gnome.org/show_bug.cgi?id=753904
2015-08-21 10:22:54 +03:00
Glen Diener
cd57697a2c matroskademux: Preserve forward referenced track tags
https://bugzilla.gnome.org/show_bug.cgi?id=752850
2015-08-05 16:46:33 -04:00
Vineeth TM
72b86ae868 matroska: fix memory leak
After adding to tag list, key_val is not being free'd
resulting in memory leak

https://bugzilla.gnome.org/show_bug.cgi?id=752992
2015-07-29 09:14:31 +01:00
Luis de Bethencourt
6d06a74f7f matroska: overwritten value assignment
curpos is set and immediately after, set again. Remove the redundant
assignment.

https://bugzilla.gnome.org/show_bug.cgi?id=749909
2015-05-27 16:56:15 +01:00
Guillaume Desmottes
592cab1512 matroska: fix GValue leaks when parsing tags
gst_tag_list_add_value() doesn't consume the GValue we pass to it so there is
no point copying it.

https://bugzilla.gnome.org/show_bug.cgi?id=746810
2015-03-30 08:59:36 -03: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
Ramiro Polla
af45021036 matroskaparse: send global tags
Global tags are already being read in matroskaparse, but they are not
currently being sent.

This patch makes global tags get sent incrementally whenever new ones
are found.

https://bugzilla.gnome.org/show_bug.cgi?id=746242
2015-03-28 10:24:57 -03:00
Ramiro Polla
0fad053497 matroskademux: fix sending of tags
* Fix critical when new tags are found after segment event has already
  been sent.
* Send global tags before stream tags.
* Split sending of tags out of gst_matroska_demux_send_event() into its
  own function.

https://bugzilla.gnome.org/show_bug.cgi?id=745973
2015-03-14 18:17:48 +00:00
Jan Schmidt
4a77c8a84f matroska: Fix seeking past the end of the file in reverse mode.
Snap to the end of the file when seeking past the end in reverse mode,
and also fix GST_SEEK_TYPE_END and GST_SEEK_TYPE_NONE handling
for the stop position by always seeking on a segment in stream time
2015-01-31 06:15:44 +11:00
Luis de Bethencourt
1e15808563 matroskademux: remove unnecessary check
No matter if gst_matroska_read_common_parse_index_cuetrack () returns that the
flow is OK or not, the check there will be a break from the switch. Removing the
check since the outcome is the same.

CID #1265762
2015-01-23 17:35:51 +00:00
Sebastian Dröge
daf25482ed matroskademux: Don't call GST_DEBUG_OBJECT() and other macros with non-GObject objects
It will crash with latest GLib GIT and was never supposed to work before
either.
2014-06-22 19:26:03 +02:00
Tim-Philipp Müller
341b691b18 matroskademux: don't leak doctype string in error code path
CID 1212145.
2014-06-02 09:57:42 +02: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
9872c19491 matroskademux: don't leak doctype string in error code path
CID 1212145.
2014-05-09 14:22:42 +01:00
Vincent Penquerc'h
d9eb5f7fde matroska: fix content encoding scope validity check
It's 3 bits, and http://matroska.org/technical/specs/index.html
says it can't be 0.

Coverity 1139660
2014-04-21 17:21:20 +01: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
Reynaldo H. Verdejo Pinochet
cf0c780138 matroskaparse: better default caps when none set
Uses information gathered during EBML parsing to
forge a more suitable set of caps instead of blindly
assuming everything is video/x-matroska.

For consistency, stream type reset was added to
matroska-demux too.

https://bugzilla.gnome.org/show_bug.cgi?id=722311
2014-01-21 11:11:46 -03:00
Tim-Philipp Müller
88ac735af3 matroskademux: don't leak TOC chapter list 2014-01-10 16:50:11 +00:00
Matej Knopp
a5ceab82dd matroskademux: fix leaking buffer and caps
https://bugzilla.gnome.org/show_bug.cgi?id=707688
2013-09-07 15:50:36 +01:00
Tim-Philipp Müller
f4cb0c4315 matroskademux: skip empty tags
instead of trying to add tags with empty strings, which
causes criticals at runtime.

https://bugzilla.gnome.org/show_bug.cgi?id=690358
2012-12-17 22:55:12 +00: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
Руслан Ижбулатов
78193dfe71 matroskademux: Support recursive SimpleTags
Fixes #682644
Depends on #682615
2012-10-26 10:16:42 +02: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
Sebastian Dröge
6c635ce64f matroskademux: Fix uninitialized variable compiler warning 2012-10-26 10:09:39 +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
c074bfd0b9 gst_tag_list_free -> gst_tag_list_unref 2012-08-04 16:10:16 +01:00
Tim-Philipp Müller
5b4eb723b6 matroska: update for TOC API changes 2012-07-28 11:22:43 +01:00
Sebastian Dröge
0827f54b93 tag: Update for taglist/tag event API changes 2012-07-28 00:19:51 +02:00
Sebastian Dröge
04e0bbef17 matroska: Update for new GstToc API
TOC support in matroskamux is disabled for now as it was broken anyway.
2012-07-05 12:28:59 +02:00
Tim-Philipp Müller
83cb4c63c3 matroska: update for GstToc API additions 2012-06-26 18:48:11 +01:00
Tim-Philipp Müller
296783908c matroska: update for GstToc API changes 2012-06-24 22:51:16 +01:00
Wim Taymans
b5df4f0e62 update for tag event change 2012-06-06 13:02:12 +02:00
Tim-Philipp Müller
3986174aa9 flv, matroska: don't use GstStructure API on tag lists 2012-05-27 00:02:08 +01:00
Vincent Penquerc'h
93ce50f9b9 matroska: implement forward snapping keyframe seeking
Requires an index.
2012-04-30 10:37:57 +01:00
Stefan Sauer
bc761c94c7 mkv: port toc changes to 0.11 2012-04-02 23:35:43 +02:00
Stefan Sauer
50bc831c91 Merge branch '0.10'
Conflicts:
	gst/matroska/matroska-demux.c
	gst/matroska/matroska-mux.c
	gst/matroska/matroska-read-common.c
	gst/matroska/matroska-read-common.h
2012-04-02 23:22:01 +02:00