[FFmpeg-devel] [PATCH]Support channel layout when muxing aif
Carl Eugen Hoyos
cehoyos at ag.or.at
Sat Apr 23 01:39:01 CEST 2011
Hi!
On Saturday 23 April 2011 12:58:02 am you wrote:
> > + } else if (enc->channels > 2) {
> > + av_log(s, AV_LOG_WARNING, "Unsupported channel layout\n");
> > + }
>
> Error message is not adequate IMHO. The Channel layout is missing here.
Thank you. New patch attached.
Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index cc3cbc4..2d8f59e 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -22,6 +22,7 @@
#include "avformat.h"
#include "aiff.h"
#include "avio_internal.h"
+#include "caf.h"
typedef struct {
int64_t form;
@@ -36,6 +37,7 @@ static int aiff_write_header(AVFormatContext *s)
AVCodecContext *enc = s->streams[0]->codec;
AVExtFloat sample_rate;
int aifc = 0;
+ uint32_t layout_tag = ff_get_chan_layout_tag(enc->channel_layout);
/* First verify if format is ok */
if (!enc->codec_tag)
@@ -61,6 +63,19 @@ static int aiff_write_header(AVFormatContext *s)
avio_wb32(pb, 0xA2805140);
}
+ if (enc->channels > 2 && layout_tag) {
+ ffio_wfourcc(pb, "CHAN");
+ avio_wb32(pb, 12); //< mChunkSize
+ avio_wb32(pb, layout_tag); //< mChannelLayoutTag
+ avio_wb32(pb, 0); //< mChannelBitmap
+ avio_wb32(pb, 0); //< mNumberChannelDescriptions
+ } else if (enc->channels > 2) {
+ char name[32];
+ av_get_channel_layout_string(name, sizeof(name), enc->channels,
+ enc->channel_layout);
+ av_log(s, AV_LOG_WARNING, "Unsupported channel layout %s\n", name);
+ }
+
/* Common chunk */
ffio_wfourcc(pb, "COMM");
avio_wb32(pb, aifc ? 24 : 18); /* size */
More information about the ffmpeg-devel
mailing list