[FFmpeg-devel] [PATCH]Support channel layout when muxing aif

Baptiste Coudurier baptiste.coudurier at gmail.com
Sat Apr 23 00:58:02 CEST 2011


Hi Carl Eugen,

On 04/22/2011 11:05 AM, Carl Eugen Hoyos wrote:
> Hi!
> 
> Not documented (afaict), but tested successfully with current OS X.
> Depends on my caf patch, Makefile change missing.
> 
> Please comment, Carl Eugen
> 
> 
> patchaiffenc.diff
> 
> 
> diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
> index cc3cbc4..e92ca09 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,16 @@ 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) {
> +        av_log(s, AV_LOG_WARNING, "Unsupported channel layout\n");
> +    }

Error message is not adequate IMHO. The Channel layout is missing here.

-- 
Baptiste COUDURIER
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org


More information about the ffmpeg-devel mailing list