summaryrefslogtreecommitdiff
path: root/libavformat/isom.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2011-05-15 03:25:27 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2011-05-15 03:25:57 +0200
commit2c4ad1a37b7980b40d6875daea4f87b154509c2e (patch)
treee9e103e6aa67211ba61658809836be185f59c92d /libavformat/isom.c
parent0c3803f6bb50038970ee40daa25cfb3ea484febd (diff)
Initial caf muxer.
Diffstat (limited to 'libavformat/isom.c')
-rw-r--r--libavformat/isom.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libavformat/isom.c b/libavformat/isom.c
index 1713aa89b7..3259128d3a 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -27,6 +27,7 @@
#include "internal.h"
#include "isom.h"
#include "riff.h"
+#include "avio_internal.h"
#include "libavcodec/mpeg4audio.h"
#include "libavcodec/mpegaudiodata.h"
@@ -483,3 +484,31 @@ void ff_mov_read_chan(AVFormatContext *s, int64_t size, AVCodecContext *codec)
avio_skip(pb, 8);
}
+void ff_mov_write_chan(AVFormatContext *s, int64_t channel_layout,
+ const char *chunk_type)
+{
+ AVIOContext *pb = s->pb;
+ const MovChannelLayout *layouts;
+ uint32_t layout_tag = 0;
+
+ if (!channel_layout)
+ return;
+
+ for (layouts = mov_channel_layout; layouts->channel_layout; layouts++)
+ if (channel_layout == layouts->channel_layout) {
+ layout_tag = layouts->layout_tag;
+ break;
+ }
+
+ ffio_wfourcc(pb, chunk_type);
+ avio_wb64(pb, 12); //< mChunkSize
+ if (layout_tag) {
+ avio_wb32(pb, layout_tag); //< mChannelLayoutTag
+ avio_wb32(pb, 0); //< mChannelBitmap
+ } else {
+ avio_wb32(pb, 0x10000); //< kCAFChannelLayoutTag_UseChannelBitmap
+ avio_wb32(pb, channel_layout);
+ }
+ avio_wb32(pb, 0); //< mNumberChannelDescriptions
+}
+