Commit Graph

422 Commits

Author SHA1 Message Date
Luca Barbato f1f6156b3f matroska: K&R formatting cosmetics 2014-07-01 16:42:32 +02:00
Vignesh Venkatasubramanian c80181352c lavf/matroskaenc: Fix Cues on Audio for WebM DASH
Fix a change that was broken by [1]. Cues must be added for audio frames
on cluster start for WebM when the DASH flag is passed. Restoring
correct functionality.

[1] http://goo.gl/xYLq7Z

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-06 21:36:11 +02:00
Michael Niedermayer 955b31a751 Merge commit 'e19d48dfce52f1417f7f06143b96fed00cbcdc52'
* commit 'e19d48dfce52f1417f7f06143b96fed00cbcdc52':
  flac muxer: support reading updated extradata from side data

Conflicts:
	libavformat/flacenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-01 14:16:29 +02:00
Michael Niedermayer 754bf1212c Merge commit 'd2ef708c95ace2518deffe830a9c439aeb9edd5d'
* commit 'd2ef708c95ace2518deffe830a9c439aeb9edd5d':
  matroskaenc: Allow VP9 and Opus in webm

Conflicts:
	libavformat/matroskaenc.c

See: 820ffaed0f
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-01 12:00:20 +02:00
Anton Khirnov e19d48dfce flac muxer: support reading updated extradata from side data 2014-06-01 08:32:33 +02:00
Tudor Suciu d2ef708c95 matroskaenc: Allow VP9 and Opus in webm
Bug-Id: 695

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-06-01 07:50:00 +02:00
John Peebles 925f7980eb libavformat: output cues for each subtitle block in MKV muxer
Signed-off-by: John Peebles <johnpeeb@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-31 13:26:48 +02:00
Michael Niedermayer 4991eacc06 Merge commit '962d63157322466a9a82f9f9d84c1b6f1b582f65'
* commit '962d63157322466a9a82f9f9d84c1b6f1b582f65':
  matroskaenc: set the stream timebase earlier

Conflicts:
	tests/ref/lavf/mkv
	tests/ref/seek/lavf-mkv

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-29 13:43:04 +02:00
Michael Niedermayer bc59d39b82 Merge commit '81eec081afea9fc017a175581ceea7c420a0dfc3'
* commit '81eec081afea9fc017a175581ceea7c420a0dfc3':
  matroskaenc: base DefaultDuration on the framerate, not the codec timebase

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

See: ea83b032af
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-29 12:58:55 +02:00
Anton Khirnov 962d631573 matroskaenc: set the stream timebase earlier
Fixes calculating the ts offset for audio codecs with delay.
2014-05-29 08:01:58 +02:00
Anton Khirnov 81eec081af matroskaenc: base DefaultDuration on the framerate, not the codec timebase
This results in DefaultDuration not being written when the framerate is
not known, but as this field is purely informative, this should not
break any sane demuxers.
2014-05-29 08:00:57 +02:00
Vignesh Venkatasubramanian c14045c818 lavf: Remove experimental flag for Opus in WebM
Opus in WebM is no more experimental as we have everything necessary in
the container writing code as per the spec. So removing the experimental flag.
Note that we removed the experimental suffix from the CodecId field long
ago ( http://goo.gl/O0TYRB ).

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-28 19:29:45 +02:00
Michael Niedermayer cf3a038f50 avformat/matroskaenc: fix ident string
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-28 15:15:14 +02:00
Michael Niedermayer 61917a104e Merge commit '106b62f4ba600f24415eaded5e020aeceb23fd59'
* commit '106b62f4ba600f24415eaded5e020aeceb23fd59':
  matroskaenc: write the channel mask for FLAC

Conflicts:
	libavformat/matroskaenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-28 13:19:26 +02:00
Anton Khirnov 106b62f4ba matroskaenc: write the channel mask for FLAC 2014-05-28 07:55:14 +02:00
Vignesh Venkatasubramanian 37cef8c774 libavformat/matroskaenc: Add WebM DASH support
WebM DASH specification [1] requires the Clusters and Cues to be output in a
specific way. Adding a flag to matroskaenc that will enable support for
creating WebM/Mkv files conforming to the WebM DASH specification.

[1] http://wiki.webmproject.org/adaptive-streaming/webm-dash-specification

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-22 18:53:13 +02:00
Michael Niedermayer 0421409c52 avformat/matroskaenc: switch to AVFMT_FLAG_BITEXACT
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-18 04:04:01 +02:00
Michael Niedermayer eacf7d650d Merge commit '0c1959b056f6ccaa2eee2c824352ba93c8e36d52'
* commit '0c1959b056f6ccaa2eee2c824352ba93c8e36d52':
  lavf: add AVFMT_FLAG_BITEXACT.

Conflicts:
	doc/APIchanges
	libavformat/avformat.h
	libavformat/flacenc.c
	libavformat/movenc.c
	libavformat/oggenc.c
	libavformat/options_table.h
	libavformat/version.h
	tests/fate/video.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-15 19:16:57 +02:00
Anton Khirnov 0c1959b056 lavf: add AVFMT_FLAG_BITEXACT.
Use it instead of checking CODEC_FLAG_BITEXACT in the first stream's
codec context.

Using codec options inside lavf is fragile and can easily break when the
muxing codec context is not the encoding context.
2014-05-15 07:42:07 +02:00
Michael Niedermayer f6d17d2aa9 avformat/matroskaenc: use av_mallocz_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-15 01:56:08 +02:00
Carl Eugen Hoyos ab21acecc7 Use Matroska document version 2 for WebM files if possible.
Google's plugin for the Internet Explorer refuses to play
files with another document version.

Fixes ticket #3583.
2014-05-12 18:16:48 +02:00
Michael Niedermayer 82e4f39883 Merge commit 'a1aa37dd0b96710d4a17718198a3f56aea2040c1'
* commit 'a1aa37dd0b96710d4a17718198a3f56aea2040c1':
  matroskaenc: write CodecDelay

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

This is largely not merged as it causes assertion failures and av sync errors
Further investigation of this is warranted if the changes are found to
fix/improve something in relation to d92b1b1bab

See: d92b1b1bab
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-01 15:56:38 +02:00
Anton Khirnov a1aa37dd0b matroskaenc: write CodecDelay 2014-05-01 08:03:51 +02:00
Daniel Verkamp 5e7d21c7ad ff_put_wav_header: add flag to force WAVEFORMATEX
Partially undoes commit 2c4e08d89327595f7f4be57dda4b3775e1198d5e:

    riff: always generate a proper WAVEFORMATEX structure in
    ff_put_wav_header

A new flag, FF_PUT_WAV_HEADER_FORCE_WAVEFORMATEX, is added to force the
use of WAVEFORMATEX rather than PCMWAVEFORMAT even for PCM codecs.

This flag is used in the Matroska muxer (the cause of the original
change) and in the ASF muxer, because the specifications for
these formats indicate explicitly that WAVEFORMATEX should be used.

Muxers for other formats will return to the original behavior of writing
PCMWAVEFORMAT when writing a header for raw PCM.

In particular, this causes raw PCM in WAV to generate the canonical
44-byte header expected by some tools.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-30 16:41:35 +02:00
Michael Niedermayer 24725f8e09 avformat/matroskaenc: fix indention level
Fixes CID1206644
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-26 22:01:48 +02:00
Carl Eugen Hoyos 3d5c859fa6 Set Matroska private data when muxing Prores.
The specification requires the mov code point to be written as "fourcc".
2014-04-06 23:35:17 +02:00
Michael Niedermayer fb0023639e Merge remote-tracking branch 'qatar/master'
* qatar/master:
  matroskaenc: enable Annex B to MP4 conversion for HEVC tracks.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-09 23:41:02 +01:00
Michael Niedermayer 38aee6408a Merge commit 'a823d0948683bd97dd58556b5740e434166209a8'
* commit 'a823d0948683bd97dd58556b5740e434166209a8':
  matroskaenc: write private data in hvcC format for HEVC.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-09 23:34:17 +01:00
Tim Walker 558b20d729 matroskaenc: enable Annex B to MP4 conversion for HEVC tracks. 2014-03-09 18:09:40 +01:00
Tim Walker a823d09486 matroskaenc: write private data in hvcC format for HEVC. 2014-03-09 18:09:40 +01:00
Michael Niedermayer 4cb6814160 Merge commit '0092c1dd8dac2d9e185b58503b447a0d3fb5230d'
* commit '0092c1dd8dac2d9e185b58503b447a0d3fb5230d':
  matroskaenc: allow override of "writing application" tag

Conflicts:
	libavformat/matroskaenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-09 01:41:55 +01:00
John Stebbins 0092c1dd8d matroskaenc: allow override of "writing application" tag
Signed-off-by: Tim Walker <tdskywalker@gmail.com>

CC: libav-stable@libav.org
2014-03-08 18:56:49 +01:00
Michael Niedermayer 8456bd2c0f avformat/matroskaenc: wrap V_QUICKTIME codec private in something that looks like its part of quicktime stsd
This is needed for matroska spec compliance
Fixes playback of SVQ3 in matroska with vlc
Fixes Ticket 3256

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-23 14:49:50 +01:00
Carl Eugen Hoyos 565102dcac Do not set mkv bit_depth to av_get_bytes_per_sample() for G.726.
The value is wrong and leads to broken files.
2014-01-15 23:35:22 +01:00
Peter Ross f5f6e59495 avformat/matroskaenc: warn when muxing video codec not supported by format
This occurs for video codecs that have codec_tag set, but are are not listed
in ff_codec_bmp_tags (e.g. AV_CODEC_ID_BINKAUDIO, AV_CODEC_ID_IFF_ILBM).

Fixes ticket #3269.

Signed-off-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-05 04:33:24 +01:00
Peter Ross fcbb94712d riffenc: add option to ff_put_bmp_header to ignore extradata
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-23 15:42:35 +01:00
Michael Niedermayer ccdfa3e271 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  Add missing #includes for *INT64_MAX and *INT64_C

Conflicts:
	ffmpeg.c
	ffmpeg_filter.c
	ffplay.c
	libavformat/assdec.c
	libavformat/avidec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-24 05:21:19 +01:00
Diego Biurrun 8f8bc92365 Add missing #includes for *INT64_MAX and *INT64_C 2013-11-23 21:55:52 +01:00
Jan Gerber f4b1ca99ff lavf/matroska*: DiscardPadding is a signed integer
according to the Matriska Specification
 http://matroska.org/technical/specs/index.html
DiscardPadding is a signed integer.

Tested-by: Jan Gerber <j@v2v.cc>
Tested-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-16 00:49:23 +01:00
Michael Niedermayer cddd15ba5c avformat/matroska: simplify signed int access code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-15 21:38:23 +01:00
Jan Gerber d03eea36b2 lavf/matroska*: add support for signed integers
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-15 21:38:12 +01:00
Michael Niedermayer 6103faaa51 matroskaenc: fixed display width / height calculation for stereo mode
Based-on: patch by Asan Usipov <asan.usipov@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-29 16:08:00 +01:00
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
Clément Bœsch 7c1a002c78 subtitles: introduce ASS codec id and use it.
Currently, we have a AV_CODEC_ID_SSA, which matches the way the ASS/SSA
markup is muxed in a standalone .ass/.ssa file. This means the AVPacket
data starts with a "Dialogue:" string, followed by a timing information
(start and end of the event as string) and a trailing CRLF after each
line. One packet can contain several lines. We'll refer to this layout
as "SSA" or "SSA lines".

In matroska, this markup is not stored as such: it has no "Dialogue:"
prefix, it contains a ReadOrder field, the timing information is not in
the payload, and it doesn't contain the trailing CRLF. See [1] for more
info. We'll refer to this layout as "ASS".

Since we have only one common codec for both formats, the matroska
demuxer is constructing an AVPacket following the "SSA lines" format.
This causes several problems, so it was decided to change this into
clean ASS packets.

Some insight about what is changed or unchanged in this commit:

  CODECS
  ------

  - the decoding process still writes "SSA lines" markup inside the ass
    fields of the subtitles rectangles (sub->rects[n]->ass), which is
    still the current common way of representing decoded subtitles
    markup. It is meant to change later.

  - new ASS codec id: AV_CODEC_ID_ASS (which is different from the
    legacy AV_CODEC_ID_SSA)

  - lavc/assdec: the "ass" decoder is renamed into "ssa" (instead of
    "ass") for consistency with the codec id and allows to add a real
    ass decoder. This ass decoder receives clean ASS lines (so it starts
    with a ReadOrder, is followed by the Layer, etc). We make sure this
    is decoded properly in a new ass-line rectangle of the decoded
    subtitles (the ssa decoder OTOH is doing a simple straightforward
    copy). Using the packet timing instead of data string makes sure the
    ass-line now contains the appropriate timing.

  - lavc/assenc: just like the ass decoder, the "ssa" encoder is renamed
    into "ssa" (instead of "ass") for consistency with the codec id, and
    allows to add a real "ass" encoder.

    One important thing about this encoder is that it only supports one
    ass rectangle: we could have put several dialogue events in the
    AVPacket (separated by a \0 for instance) but this would have cause
    trouble for the muxer which needs not only the start time, but also
    the duration: typically, you have merged events with the same start
    time (stored in the AVPacket->pts) but a different duration. At the
    moment, only the matroska do the merge with the SSA-line codec.

    We will need to make sure all the decoders in the future can't add
    more than one rectangle (and only one Dialogue line in it
    obviously).

  FORMATS
  -------

  - lavf/assenc: the .ass/.ssa muxer can take both SSA and ASS packets.
    In the case of ASS packets as input, it adds the timing based on the
    AVPacket pts and duration, and mux it with "Dialogue:", trailing
    CRLF, etc.

  - lavf/assdec: unchanged; it currently still only outputs SSA-lines
    packets.

  - lavf/mkv: the demuxer can now output ASS packets without the need of
    any "SSA-lines" reconstruction hack. It will become the default at
    next libavformat bump, and the SSA support will be dropped from the
    demuxer. The muxer can take ASS packets since it's muxed normally,
    and still supports the old SSA packets. All the SSA support and
    hacks in Matroska code will be dropped at next lavf bump.

[1]: http://www.matroska.org/technical/specs/subtitles/ssa.html
2013-04-18 23:23:59 +02:00
Michael Niedermayer 2653e12520 Merge commit '1afddbe59e96af75f1c07605afc95615569f388f'
* commit '1afddbe59e96af75f1c07605afc95615569f388f':
  avpacket: use AVBuffer to allow refcounting the packets.

Conflicts:
	libavcodec/avpacket.c
	libavcodec/utils.c
	libavdevice/v4l2.c
	libavformat/avidec.c
	libavformat/flacdec.c
	libavformat/id3v2.c
	libavformat/matroskaenc.c
	libavformat/mux.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-08 19:12:03 +01:00
Anton Khirnov 1afddbe59e avpacket: use AVBuffer to allow refcounting the packets.
This will allow us to avoid copying the packets in many cases.

This breaks ABI.
2013-03-08 07:33:45 +01:00
Michael Niedermayer 285485ac5f matroskaenc: fix cue tracknum off by 1 error
Fixes out of array accesses

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-23 23:06:27 +01:00
Stefano Sabatini 271f411267 lavf/matroskaenc: avoid assert failure in case of cuepoints with duplicated PTS
Avoid to write more than one cuepoint per track and PTS in
mkv_write_cues(). This avoids a later assertion failure on "(bytes >=
needed_bytes)" in put_ebml_num() called from end_ebml_master(), in case
there are several cuepoints per track with the same PTS.

This may happen with files containing packets with duplicated PTS in the
same track.
2013-02-20 12:01:21 +01:00
Stefano Sabatini 6b171f046c lavf/matroskaenc: provide more feedback in case of unsupported codec
Also return meaningful error code.
2013-02-10 21:00:56 +01:00
Carl Eugen Hoyos f02f231e05 Do not write invalid matroska files.
Some real codecs are supported by the matroska specification
(and FFmpeg's matroska demuxer) but not the FFmpeg muxer.
2013-02-10 10:51:12 +01:00
Carl Eugen Hoyos 91f359292a Correctly mark non-default streams when muxing matroska.
Fixes ticket #1815.

Reviewed-by: Hendrik Leppkes
2013-01-30 10:28:53 +01:00