diff options
author | Moritz Bunkus <moritz@bunkus.org> | 2012-09-14 22:26:14 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2012-09-19 20:34:14 +0200 |
commit | 8071dca3d595a4fc5f9b3ee9f667e2c3e4a35517 (patch) | |
tree | 95c59a49002c12171dde2bf8132ff69cd015fe43 /libavformat/matroskaenc.c | |
parent | 870e75524aa0d00ebcd1d15589c8d29b84af1565 (diff) | |
download | ffmpeg-8071dca3d595a4fc5f9b3ee9f667e2c3e4a35517.tar.gz |
matroska: implement support for ALAC
Support Matroska native formatting.
On demuxing reconstruct the 36-bytes QuickTime atom that the ALAC
decoder expects by prepending the "atom size", "tag" and
"tag version" fields missing from the Matroska's CodecPrivate
element.
On muxing remove the initial 12 bytes
Sample files are available:
http://www.bunkus.org/videotools/mkvtoolnix/samples/alac/alac-in-matroska.mka
and the CoreAudio file it was created from with today's mkvmerge:
http://www.bunkus.org/videotools/mkvtoolnix/samples/alac/alac-in-matroska-source.caf
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r-- | libavformat/matroskaenc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 9d9c223dbb..521f6b5c1a 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -475,6 +475,16 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecCo ret = ff_flac_write_header(dyn_cp, codec, 1); else if (codec->codec_id == AV_CODEC_ID_H264) ret = ff_isom_write_avcc(dyn_cp, codec->extradata, codec->extradata_size); + else if (codec->codec_id == AV_CODEC_ID_ALAC) { + if (codec->extradata_size < 36) { + av_log(s, AV_LOG_ERROR, + "Invalid extradata found, ALAC expects a 36-byte " + "QuickTime atom."); + ret = AVERROR_INVALIDDATA; + } else + avio_write(dyn_cp, codec->extradata + 12, + codec->extradata_size - 12); + } else if (codec->extradata_size) avio_write(dyn_cp, codec->extradata, codec->extradata_size); } else if (codec->codec_type == AVMEDIA_TYPE_VIDEO) { |