summaryrefslogtreecommitdiff
path: root/libavformat/movenc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r--libavformat/movenc.c26
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);