diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-12-03 13:32:45 -0500 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2011-12-09 16:12:58 -0500 |
commit | 1fdf18f4b7e9f9983b6f07ef1033a51b289692f2 (patch) | |
tree | b309313a40bc0bfd82889fa6833fb9d51f5bc872 /libavformat/movenc.c | |
parent | b2890f5ed684701ec15820b117738f6af0b7f334 (diff) | |
download | ffmpeg-1fdf18f4b7e9f9983b6f07ef1033a51b289692f2.tar.gz |
mov: add support for reading and writing the 'chan' tag
This implements reading the tag in the demuxer and adds support for writing it
in the muxer. Some example channel layout tables for muxing are included for
ac3, aac, and alac, but they are not utilized yet.
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r-- | libavformat/movenc.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 5d770aa90e..897a204e1d 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -37,6 +37,7 @@ #include "libavutil/opt.h" #include "libavutil/dict.h" #include "rtpenc.h" +#include "mov_chan.h" #undef NDEBUG #include <assert.h> @@ -338,6 +339,31 @@ static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track) return updateSize(pb, pos); } +static int mov_write_chan_tag(AVIOContext *pb, MOVTrack *track) +{ + uint32_t layout_tag, bitmap; + int64_t pos = avio_tell(pb); + + layout_tag = ff_mov_get_channel_layout_tag(track->enc->codec_id, + track->enc->channel_layout, + &bitmap); + if (!layout_tag) { + av_log(track->enc, AV_LOG_WARNING, "not writing 'chan' tag due to " + "lack of channel information\n"); + return 0; + } + + avio_wb32(pb, 0); // Size + ffio_wfourcc(pb, "chan"); // Type + avio_w8(pb, 0); // Version + avio_wb24(pb, 0); // Flags + avio_wb32(pb, layout_tag); // mChannelLayoutTag + avio_wb32(pb, bitmap); // mChannelBitmap + avio_wb32(pb, 0); // mNumberChannelDescriptions + + return updateSize(pb, pos); +} + static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track) { int64_t pos = avio_tell(pb); |