Commit Graph

528 Commits

Author SHA1 Message Date
Michael Niedermayer dac7b27802 Merge commit 'b14086ca38efa1a86cb0f0c6aa147b05f698877b'
* commit 'b14086ca38efa1a86cb0f0c6aa147b05f698877b':
  mkv: Correctly report the latest packet had been flushed

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-09 18:30:24 +02:00
Luca Barbato b14086ca38 mkv: Correctly report the latest packet had been flushed
Bug-Id: 865
CC: libav-stable@libav.org
2015-06-09 14:27:54 +02:00
Vignesh Venkatasubramanian 7be0f48a32 lavf/matroskaenc: Write Block Keyframe correctly
Per matroska Block Structure [1], for keyframes 0th bit of the flag
should not be set (unlike SimpleBlocks). For Blocks, keyframes is
inferred by the absence of ReferenceBlock element (as done by
matroskadec). This CL writes the flag correctly and inserts the
ReferenceBlock element for non-keyframes. The timestamp inserted is
that of the immediately preceding frame (which is true for VP8 and VP9
- the only 2 codecs using the matroska block element as of now). It
also considers all non-video frames (audio, subtitles, metadata) to
be keyframes.

[1] http://www.matroska.org/technical/specs/index.html#block_structure

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-05 02:48:04 +02:00
Michael Niedermayer cf86fd0069 avformat/matroskaenc: Avoid floats in default duration calculation
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-26 20:42:05 +02:00
Carl Eugen Hoyos 8f6b919d99 lavf/mkv: Only skip prores header if the packet is large enough.
Fixes a possible endless loop.
2015-05-21 00:43:38 +02:00
Michael Niedermayer 66f26b3e8e avformat/matroskaenc: Check ff_vorbiscomment_length in put_flac_codecpriv()
Its currently guaranteed to be smaller but its safer to check anyway

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-11 15:56:16 +02:00
Michael Niedermayer 9d4fdfe24c avformat/matroskaenc: Use avoid_negative_ts_use_pts if no stream writes dts
This reduces the number of cases where timestamps need to be shifted

Fixes Ticket4487

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-05 13:17:25 +02:00
wm4 c4d37cd9ef matroskadec: export cover art correctly
Generally, libavformat exports cover art pictures as video streams with
1 packet and AV_DISPOSITION_ATTACHED_PIC set. Only matroskadec exported
it as attachment with codec_id set to AV_CODEC_ID_MJPEG.

Obviously, this should be consistent, so change the Matroska demuxer to
export a AV_DISPOSITION_ATTACHED_PIC pseudo video stream.

Matroska muxing is probably incorrect too. I know that it can create
broken files with an audio track and just 1 video frame when e.g.
remuxing mp3 with APIC to mkv. But for now this commit does not change
anything about muxing, and also continues to write attachments with
AV_CODEC_ID_MJPEG should the muxer application have special knowledge
that the Matroska is broken in this way.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-04-08 12:36:53 +02:00
Vignesh Venkatasubramanian 6fd300ac6c lavf: Add support for WebM Live Muxing
This patch adds support for WebM Live Muxing by adding a new WebM
Chunk muxer. It writes out live WebM Chunks which can be used for
playback using Live DASH Clients.

Please see muxers.texi for sample usage.

Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-07 15:08:59 +02:00
wm4 511585ce7f matroskadec: export cover art correctly
Generally, libavformat exports cover art pictures as video streams with
1 packet and AV_DISPOSITION_ATTACHED_PIC set. Only matroskadec exported
it as attachment with codec_id set to AV_CODEC_ID_MJPEG.

Obviously, this should be consistent, so change the Matroska demuxer to
export a AV_DISPOSITION_ATTACHED_PIC pseudo video stream.

Matroska muxing is probably incorrect too. I know that it can create
broken files with an audio track and just 1 video frame when e.g.
remuxing mp3 with APIC to mkv. But for now this commit does not change
anything about muxing, and also continues to write attachments with
AV_CODEC_ID_MJPEG should the muxer application have special knowledge
that the Matroska is broken in this way.

Fixes trac #4423.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-04 02:25:56 +02:00
Carl Eugen Hoyos b76df6efb6 lavf/matroskaenc: List subtitle codecs with fake codec_tags to allow remuxing.
Fixes remuxing of DVBSUB to mkv.
2015-03-24 10:07:18 +01:00
Carl Eugen Hoyos 7a5356c728 lavf/mkv: Ignore ff_isom_write_hvcc() return value as the mov muxer does.
This change allows remuxing hevc from mpeg-ts to Matroska.
2015-03-18 20:35:26 +01:00
Michael Niedermayer e48ff13ba7 Merge commit '9272c965d9559a90ee64d46aebd99c117e07f7a3'
* commit '9272c965d9559a90ee64d46aebd99c117e07f7a3':
  matroskaenc: Fix type used for chapter timestamps

Conflicts:
	libavformat/matroskaenc.c

See: a4cd057bc7
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 20:09:18 +01:00
Vittorio Giovara 9272c965d9 matroskaenc: Fix type used for chapter timestamps 2015-03-11 17:56:51 +00:00
Michael Niedermayer 2e8020c66c Merge commit '9f25a109922da43c1f81273a431d3b40cb5a785a'
* commit '9f25a109922da43c1f81273a431d3b40cb5a785a':
  matroskaenc: Also validate chapter end time

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-09 20:31:22 +01:00
Vittorio Giovara 9f25a10992 matroskaenc: Also validate chapter end time
This prevents it to be written as unsigned. Also add an error message.

CC: libav-stable@libav.org
Bug-Id: CID 1265717
2015-03-09 12:57:19 +00:00
John Stebbins da7e561964 matroskaenc: Allow writing track "forced" flag
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-02-24 22:28:51 +01:00
Michael Niedermayer a4cd057bc7 avformat/matroskaenc: Use the correct data type for the chapter times
Fixes potential integer overflow

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-17 20:40:00 +01:00
Michael Niedermayer d302853bca Merge commit '5dc47a2bd52e375ed742c45d08356b45098f458d'
* commit '5dc47a2bd52e375ed742c45d08356b45098f458d':
  matroskaenc: Validate chapter start and end times

Conflicts:
	libavformat/matroskaenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-17 20:25:47 +01:00
Vittorio Giovara 5dc47a2bd5 matroskaenc: Validate chapter start and end times
CC: libav-stable@libav.org
Bug-Id: CID 1265717
2015-02-17 11:27:41 -05:00
Michael Niedermayer 7d60baa8d9 avformat/matroskaenc: add allow_raw_vfw and disable it by default
Based on complaint by wm4

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-15 00:43:38 +01:00
Michael Niedermayer a0fe1a25fa Merge commit 'daf8cf358a098a903d59adb6c0d0cc3262a8c93e'
* commit 'daf8cf358a098a903d59adb6c0d0cc3262a8c93e':
  avformat: Don't anonymously typedef structs

Conflicts:
	libavformat/adtsenc.c
	libavformat/aiffenc.c
	libavformat/avidec.c
	libavformat/gif.c
	libavformat/iff.c
	libavformat/img2dec.c
	libavformat/jvdec.c
	libavformat/matroskadec.c
	libavformat/udp.c
	libavformat/wtvdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-14 21:07:40 +01:00
Diego Biurrun daf8cf358a avformat: Don't anonymously typedef structs 2015-02-14 10:13:47 -08:00
Michael Niedermayer 9ccc4eedd1 avformat/matroskaenc: Do not use native mode for raw RGB
This fixes generating totally unplayable files

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-14 13:02:30 +01:00
Michael Niedermayer e2fb12b629 avformat/matroskaenc: fix handling of VFW style raw rgb
raw rgb uses 0 as codec tag in "VFW", the code assumed 0 means error

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-14 13:02:30 +01:00
Michael Niedermayer f95cd5a235 Merge commit '51da7d02748cc54b7d009115e76efa940b99a8ef'
* commit '51da7d02748cc54b7d009115e76efa940b99a8ef':
  matroskaenc: refuse to write AAC without valid extradata

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 21:25:49 +01:00
Anton Khirnov 51da7d0274 matroskaenc: refuse to write AAC without valid extradata 2015-01-09 15:51:00 +01:00
Michael Niedermayer 988d27b802 Merge commit 'b1306823d0b3ae998c8e10ad832004eb13bdd93e'
* commit 'b1306823d0b3ae998c8e10ad832004eb13bdd93e':
  check memory errors from av_strdup()

Conflicts:
	avprobe.c
	libavformat/matroskaenc.c
	libavutil/opt.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-19 04:57:25 +01:00
Vittorio Giovara b1306823d0 check memory errors from av_strdup() 2014-12-18 23:27:14 +01:00
Michael Niedermayer ad2deb02e5 avcodec/xiph: mark returned header pointers const from avpriv_split_xiph_headers()
Reviewed-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-14 14:30:45 +01:00
Luca Barbato 69c1fe7c9c mkv: Validate ASS Start and End fields
CC: libav-stable@libav.org
2014-12-03 13:08:41 +00:00
Michael Niedermayer f769671f86 Merge commit '090c67d586e3916f9acc49e010b6389d07f97153'
* commit '090c67d586e3916f9acc49e010b6389d07f97153':
  matroskaenc: write correct Display{Width, Height} in stereo encoding

Conflicts:
	libavformat/matroskaenc.c

See: 6103faaa51
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-27 22:18:03 +01:00
Vittorio Giovara 090c67d586 matroskaenc: write correct Display{Width, Height} in stereo encoding
should be the raw amount of pixels (for example 3840x1080 for full HD side by
side) and the DisplayWidth/Height in pixels should be the amount of pixels for
one plane (1920x1080 for that full HD stream)."

So, move the aspect ratio check in the mkv_write_stereo_mode() function
and always write the embl when stereo format and/or aspect ration is set.
Also add a few comments to that function.

CC: libav-stable@libav.org
Found-by: Asan Usipov <asan.usipov@gmail.com>
2014-10-27 18:21:35 +00:00
Michael Niedermayer 8be93ba049 Merge commit '28c020d4df9b060a58a124a7a5406d4313fbe249'
* commit '28c020d4df9b060a58a124a7a5406d4313fbe249':
  matroskaenc: check avio_open_dyn_buf return value

Conflicts:
	libavformat/matroskaenc.c

See: b1f517f503
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-25 04:45:23 +02:00
Vittorio Giovara 28c020d4df matroskaenc: check avio_open_dyn_buf return value
CC: libav-stable@libav.org
Bug-Id: CID 703629
2014-10-24 23:48:57 +01:00
Michael Niedermayer 4694c0bb7c Merge commit 'eabdc2a830f1ab1a3f12243eb7e2fba801cb81f0'
* commit 'eabdc2a830f1ab1a3f12243eb7e2fba801cb81f0':
  lavf: use initial_padding instead of deprecated delay

Conflicts:
	libavformat/matroskaenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-14 03:00:17 +02:00
Anton Khirnov eabdc2a830 lavf: use initial_padding instead of deprecated delay 2014-10-13 19:10:30 +00:00
Frank Galligan 241b306b1e Fix writing first audio Cues in dash mode.
In dahsmode Matroska is not writing the first Cluster for every
audio stream in the Cues element.

Signed-off-by: Frank Galligan <frankgalligan@gmail.com>
Reviewed-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-09 21:50:48 +02:00
Clément Bœsch 55180b3299 Kill timed SRT 2014-09-30 20:21:14 +02:00
Clément Bœsch c7d8dbad14 avformat: remove FF_API_ASS_SSA dead code 2014-09-09 21:34:23 +02:00
Michael Niedermayer 37520a91ac avformat: drop redundant MATROSKA_VIDEO_STEREO_MODE_COUNT identifier
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-29 01:26:52 +02:00
Michael Niedermayer 39cd9fdbf8 Merge commit '4d686fb721b485ebbc4c7779d927d876c1e630f7'
* commit '4d686fb721b485ebbc4c7779d927d876c1e630f7':
  matroskaenc: convert avstream stereo3d side data during encoding

Conflicts:
	libavformat/matroskaenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-29 00:44:47 +02:00
Vittorio Giovara 4d686fb721 matroskaenc: convert avstream stereo3d side data during encoding
Write the StereoMode Embl to bitstream.
2014-08-28 12:35:27 -04:00
Michael Niedermayer c2c4cee866 avformat/matroskaenc: Check alpha_mode
Fixes CID1231992

Suggested-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-24 20:33:17 +02:00
Michael Niedermayer fb33bff990 Merge commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39'
* commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39':
  cosmetics: Write NULL pointer equality checks more compactly

Conflicts:
	cmdutils.c
	ffmpeg_opt.c
	ffplay.c
	libavcodec/dvbsub.c
	libavcodec/dvdsubdec.c
	libavcodec/dvdsubenc.c
	libavcodec/dxa.c
	libavcodec/libxvid_rc.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/rv10.c
	libavcodec/tiffenc.c
	libavcodec/utils.c
	libavcodec/vc1dec.c
	libavcodec/zmbv.c
	libavdevice/v4l2.c
	libavformat/matroskadec.c
	libavformat/movenc.c
	libavformat/sdp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-15 21:00:50 +02:00
Gabriel Dume f929ab0569 cosmetics: Write NULL pointer equality checks more compactly
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-15 03:18:18 -07:00
Michael Niedermayer 64d029de41 avformat/matroskaenc: fix MAX_CUEPOINT_SIZE calculation
Fixes assertion failure
Fixes Ticket3822

as a side-effect this makes some mkv files a few bytes smaller

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 05:05:09 +02:00
Michael Niedermayer d44b8f0a47 avformat/matroskaenc: print a warning when the relative timestamp wouldnt fit in 16bit
This is somewhat unusual so its better to use warning level than debug

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-24 20:25:29 +02:00
Michael Niedermayer 7923aa0fba avformat/matroskaenc: Start new cluster if relative timestamp could not otherwise be stored
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-24 18:19:50 +02:00
Michael Niedermayer 3c6e220a8c avformat/matroskaenc: Factor mkv_start_new_cluster() out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-24 18:19:11 +02:00
Jan Gerber 73b7a360d8 matroskaenc: Don't set language to empty string, use "und"
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-20 14:03:00 +02:00
Michael Niedermayer 141ee10913 Merge commit '48e6432407a73d5006d84609456e6e0bc3dd8fc4'
* commit '48e6432407a73d5006d84609456e6e0bc3dd8fc4':
  matroska: Factor out mkv_write_stereo_mode

Conflicts:
	libavformat/matroskaenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-01 20:55:42 +02:00
Michael Niedermayer ee78b0c252 Merge commit 'b75a1f9892b5b715397edbf837e4d4cda337907b'
* commit 'b75a1f9892b5b715397edbf837e4d4cda337907b':
  matroska: Factor out write_track from mkv_write_tracks

Conflicts:
	libavformat/matroskaenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-01 20:25:35 +02:00
Michael Niedermayer 8365287e61 Merge commit 'f1f6156b3fc9eb77b439d031ba18974d80b8341e'
* commit 'f1f6156b3fc9eb77b439d031ba18974d80b8341e':
  matroska: K&R formatting cosmetics

Conflicts:
	libavformat/matroskaenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-01 19:58:57 +02:00
Luca Barbato 48e6432407 matroska: Factor out mkv_write_stereo_mode 2014-07-01 16:43:20 +02:00
Luca Barbato b75a1f9892 matroska: Factor out write_track from mkv_write_tracks 2014-07-01 16:43:01 +02:00
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