Commit Graph

330 Commits

Author SHA1 Message Date
James Almer 56f17407bc matroska: Add the CueDuration element
Use it only on subtitle CuePoints.
With proper demuxer/splitter support this should improve the display
of subtitles right after seeking to a given point in the stream.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-21 14:33:01 +02:00
James Almer 39442b1a1b matroskaenc: Add CuePoints for subtitle tracks
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-20 22:40:16 +02:00
James Almer ea70e2f2d7 matroskaenc: Write muxingapp and writingapp elements when using bitexact flag
Files won't validate with mkvalidtor if these two elements are missing.
Use a const "Lavf" string that wont change with library version bumps.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-18 23:06:59 +02:00
James Almer d59213b5d3 matroskaenc: Bump DocTypeVersion to 4
The muxer has been creating files with v4 elements for some time now,
and especially now that we can mux non-experimental Opus files, reporting
the DocTypeVersion as 2 is not correct.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-15 02:08:15 +02:00
Michael Niedermayer ba5e77814e Merge remote-tracking branch 'qatar/master'
* qatar/master:
  matroskaenc: Fix stray pointers left over from av_reallocp_array refactoring

Conflicts:
	libavformat/matroskaenc.c

Mostly not merged as the buggy code was no longer part of FFmpeg

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-12 15:26:06 +02:00
Alexandra Khirnova 00a63bfb87 matroskaenc: Fix stray pointers left over from av_reallocp_array refactoring
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-09-12 13:16:15 +02:00
Michael Niedermayer 9bca8e5341 avformat/matroskaenc: use av_realloc_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-11 13:36:11 +02:00
Michael Niedermayer b5b34c1983 avformat/matroskaenc: use av_freep() to avoid leaving stale pointers
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-11 13:28:41 +02:00
Michael Niedermayer c9367c0709 avformat/matroskaenc: functions that add entries should not destroy the whole list on failure
This reverts a hunk from "avformat: Use av_reallocp_array() where suitable"

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-11 12:16:21 +02:00
Michael Niedermayer cbe47b1e84 Merge commit 'f369b9356c4606cd4d713d60f7db5de119d901fa'
* commit 'f369b9356c4606cd4d713d60f7db5de119d901fa':
  avformat: Use av_reallocp_array() where suitable

Conflicts:
	libavformat/asfenc.c
	libavformat/gxfenc.c
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-11 11:23:40 +02:00
Alexandra Khirnova f369b9356c avformat: Use av_reallocp_array() where suitable
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-09-10 12:38:32 +02:00
Vignesh Venkatasubramanian d92b1b1bab lavf/matroska: Adding support for Opus CodecDelay
In order to represent the codec delay accurately in Matroska, a
new element CodecDelay has been introduced. It contains the
overall delay added by the codec in nanoseconds. This patch adds
support for muxing CodecDelay value in the container.
Matroska spec for CodecDelay element can be found here:
http://matroska.org/technical/specs/index.html#CodecDelay

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-10 01:45:38 +02:00
Vignesh Venkatasubramanian bb47aa5850 opus/matroska: Adding support for DiscardPadding in muxer
Support for end trimming Opus in Matroska is implemented by using
the DiscardPadding container element in the Block data. The last
chunk is stored as a Block instead of SimpleBlock and the
trimming information is stored and used to discard samples that
were padded by the Opus codec. This patch adds support for muxing
DiscardPadding element into the container with appropriate value.
Matroska spec for the DiscardPadding element can be found here:
http://matroska.org/technical/specs/index.html#DiscardPadding

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-10 01:04:06 +02:00
Clément Bœsch 90fc00a623 avformat/subtitles: add a next line jumper and use it.
This fixes a bunch of possible overread in avformat with the idiom p +=
strcspn(p, "\n") + 1 (strcspn() can focus on the trailing '\0' if no
'\n' is found, so the +1 leads to an overread).

Note on lavf/matroskaenc: no extra subtitles.o Makefile dependency is
added because only the header is required for ff_subtitles_next_line().

Note on lavf/mpsubdec: code gets slightly complex to avoid an infinite
loop in the probing since there is no more forced increment.
2013-09-08 18:48:09 +02:00
Paul B Mahol 14851ca5f5 avformat/matroskaenc: remove bogus prores tag
Fixes: ffmpeg -i input -c:v prores output.mkv

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-09-08 13:03:08 +00:00
Michael Niedermayer 2230d85ceb Merge remote-tracking branch 'qatar/master'
* qatar/master:
  matroskaenc: Allow chapters to be written in trailer

Conflicts:
	libavformat/matroskaenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-05 13:34:37 +02:00
John Stebbins 26b241c079 matroskaenc: Allow chapters to be written in trailer
This allows creation of frame accurate chapter marks from sources like
DVD and BD where the precise chapter location is not known until the
chapter mark has been reached during reading.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-09-04 20:30:43 +02:00
Michael Niedermayer 87d38ad803 Merge commit 'f812eeda17e38797df5cb733ce99cdfd829d84ca'
* commit 'f812eeda17e38797df5cb733ce99cdfd829d84ca':
  matroskaenc: Fix writing TRACKDEFAULTFLAG

Conflicts:
	libavformat/matroskaenc.c
	tests/fate/wavpack.mak
	tests/ref/lavf/mkv
	tests/ref/seek/lavf-mkv

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-28 11:33:59 +02:00
John Stebbins f812eeda17 matroskaenc: Fix writing TRACKDEFAULTFLAG
The element was only being written when the value == 1.  But the default
value of this element is 1, so this has no useful effect.  This element
needs to be written when the value == 0.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-08-27 14:00:31 +02:00
Michael Niedermayer e1acfd3cb0 Merge commit 'b886f5c2f1e71b3e60e4265c500158d392b4b9a4'
* commit 'b886f5c2f1e71b3e60e4265c500158d392b4b9a4':
  mkv: Allow flushing the current cluster in progress

Conflicts:
	libavformat/matroskaenc.c
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-20 11:44:25 +02:00
Michael Niedermayer d169b56b7b Merge commit '59f595921eb2b848a80a74aa81b6bb43038c9ebe'
* commit '59f595921eb2b848a80a74aa81b6bb43038c9ebe':
  mkv: Flush the old cluster before writing a new one

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-20 11:30:55 +02:00
Michael Niedermayer ac957bc60c Merge commit '98308bd44face14ea3142b501d16226eec23b75a'
* commit '98308bd44face14ea3142b501d16226eec23b75a':
  mkv: Add options for specifying cluster limits

Conflicts:
	libavformat/matroskaenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-20 11:15:11 +02:00
Michael Niedermayer 976de369dd Merge commit '148fbdd1c2a2a88a78ba9fd152c81c840bdb205a'
* commit '148fbdd1c2a2a88a78ba9fd152c81c840bdb205a':
  mkv: Refactor mkv_write_packet

Conflicts:
	libavformat/matroskaenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-20 11:05:02 +02:00
Martin Storsjö b886f5c2f1 mkv: Allow flushing the current cluster in progress
Allow emitting the current cluster that is being written before
starting a new one, simplifying how to figure out where clusters
are positioned in the output stream (for live streaming).

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-08-19 22:47:07 +02:00
Luca Barbato 59f595921e mkv: Flush the old cluster before writing a new one
This simplifies keeping track of cluster boundaries for e.g.
livestreaming of WebM.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-08-19 22:47:06 +02:00
Luca Barbato 98308bd44f mkv: Add options for specifying cluster limits
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-08-19 22:46:31 +02:00
Luca Barbato 148fbdd1c2 mkv: Refactor mkv_write_packet
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-08-19 17:21:15 +02:00
Paul B Mahol daede1e3fa matroskaenc: remove unneeded wavpack tag
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-08-19 09:41:18 +00:00
Vignesh Venkatasubramanian 571efd9729 lavf/matroska: Adding the new SeekPreRoll element
In order to encapsuate Opus in Matroska, there is a new element
that has been added to the Matroska Spec, SeekPreRoll. It has the
duration in nanoseconds that has to be decoded before every seek.
Spec: http://matroska.org/technical/specs/index.html#SeekPreRoll
Proposal for encapsulateing Opus in Matroska:
http://wiki.xiph.org/MatroskaOpus

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-18 00:04:08 +02:00
Michael Niedermayer 0553f2c6e5 avformat/matroskaenc: make 2 tables static that are not used outside matroskaenc
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-02 21:14:59 +02:00
Bernie Habermeier c5f3cc40e3 matroskaenc: implement CueRelativePosition
This is a minimal change to matroskaenc that implements CueRelativePosition in the output.
Most players will probably ignore this additional information, but it is in the
matroska spec, and it'd be nice to be able to make use of it.

Signed-off-by: Bernt Habermeier <bernt@wulfram.com>
Tested-by:  wm4 <nfxjfg@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-24 14:08:52 +02:00
Michael Niedermayer 07704c61dd avformat/matroskaenc: Only change chapter ids if needed.
This also fixes the case where negative chapter ids where input
And fixes the case where remuxing from mkv changed chapter ids

Found-by: Luca Barbato
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-19 23:32:04 +02:00
Fabian Neundorf 353f302250 lavf/matroskaenc: using valid chapter ids
Fixes ticket 2790, by starting the ChapterUIDs in mkv files with 1 instead of a 0.
 

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-18 01:02:31 +02:00
Michael Niedermayer 066111bf19 matroskaenc: simplify mkv_check_tag()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-17 13:30:36 +02:00
James Almer 088ed53146 lavf/matroskaenc: Check for valid metadata before creating tags
Tags must have at least one SimpleTag element to be spec conformant.
Updated lavf-mkv and seek-lavf-mkv FATE references as the tests were affected by
this.

Fixes ticket #2785

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-17 12:18:27 +02:00
Paul B Mahol 5ceffb1bf6 matroskaenc: use ffio_fill()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-07-16 19:25:13 +00:00
Alexis Ballier 8d9c1b325e mastroka audio muxer: Set long_name to Matroska Audio so that it differs from the long_name of matroska video.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-16 02:53:38 +02:00
Matthew Heaney 509642b4bd WebM muxer writes WebVTT subtitle track
The Matroska muxer now allows WebVTT subtitle tracks to be written
while in WebM muxing mode.

WebVTT subtitle tracks have four kinds: "subtitles", "captions",
"descriptions", and "metadata". Each text track kind has a distinct
Mastroska CodecID and track type, as described in the temporal
metadata guidelines here:

http://wiki.webmproject.org/webm-metadata/temporal-metadata/webvtt-in-webm

When the stream has codec id AV_CODEC_ID_WEBVTT, the stream packet is
serialized per the temporal metadata guidelines cited above. The
WebVTT cue is written as a Matroska block group. The block frame
comprises the WebVTT cue id, followed by the cue settings, followed by
the cue text.  (The block timestamp is synthesized from the cue
timestamp.)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-09 03:09:12 +02:00
Tudor Suciu 820ffaed0f avformat/matroskaenc: Allow VP9 and Opus in webm
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-03 00:10:50 +02:00
Michael Niedermayer a620c8321e Merge commit 'c3e58f8fb75d8467161a65b85eb88281547ebab1'
* commit 'c3e58f8fb75d8467161a65b85eb88281547ebab1':
  matroskaenc: restore compatibility with non referenced AVPacket

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-24 11:11:31 +02:00
Rafaël Carré c3e58f8fb7 matroskaenc: restore compatibility with non referenced AVPacket
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-06-24 08:03:26 +02:00
Michael Niedermayer d9cde3976c Merge commit '2d2d6a4883479403798f4ed46941d5b365823570'
* commit '2d2d6a4883479403798f4ed46941d5b365823570':
  lavf: add a raw WavPack muxer.
  apetag: add support for writing APE tags
  matroskaenc: support muxing WavPack

Conflicts:
	libavformat/Makefile
	libavformat/allformats.c
	libavformat/apetag.h
	libavformat/version.h
	libavformat/wvenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-29 10:40:42 +02:00
Anton Khirnov 01656fd476 matroskaenc: support muxing WavPack 2013-05-28 18:18:57 +02:00
Michael Niedermayer 2fb193b1e7 vformat/matroskaenc: factorize alpha code in mkv_write_block()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-17 15:11:23 +02:00
Vignesh Venkatasubramanian 8ffcc826b3 Adding support for muxing VP8 Alpha files
This patch adds support for muxing VP8 Alpha Files. The Alpha channel data is
placed in BlockAdditional element of the matroska container. More information
& exact spec on how this is implemented can be found here: http://goo.gl/wCP1y

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-17 15:11:23 +02:00
Nicolas George fa245e432b lavf/matroskaenc: return an error for unsupported types. 2013-05-04 14:12:57 +02:00
Michael Niedermayer 6537827189 Merge commit 'e3b225a4fe0ff1e64a220b757c6f0a5cf9258521'
* commit 'e3b225a4fe0ff1e64a220b757c6f0a5cf9258521':
  matroskaenc: add an option to put the index at the start of the file

Conflicts:
	doc/muxers.texi
	libavformat/matroskaenc.c
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-03 13:16:34 +02:00
Michael Niedermayer 2e0cc34292 Merge commit '0574bc06d23a6690a16c5926dddc9be359a3d7bb'
* commit '0574bc06d23a6690a16c5926dddc9be359a3d7bb':
  matroskaenc: cosmetics, reorder the #includes

Conflicts:
	libavformat/matroskaenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-03 13:09:23 +02:00
Anton Khirnov e3b225a4fe matroskaenc: add an option to put the index at the start of the file 2013-05-03 08:32:35 +02:00
Anton Khirnov 0574bc06d2 matroskaenc: cosmetics, reorder the #includes 2013-05-03 08:26:55 +02:00