[FFmpeg-devel] Set channel_layout in mpegaudio
Justin Ruggles
justin.ruggles
Thu Feb 10 19:58:12 CET 2011
On 02/10/2011 01:10 PM, Ronald S. Bultje wrote:
> Hi,
>
> On Mon, Feb 7, 2011 at 6:10 PM, Justin Ruggles <justin.ruggles at gmail.com> wrote:
>> On 02/07/2011 06:01 PM, Baptiste Coudurier wrote:
>>> On 02/05/2011 10:01 AM, Kieran Kunhya wrote:
>>>> $subj
>>>>
>>>> 0001-Set-channel_layout-for-mpegaudio.patch
>>>>
>>>> From 112c79fe16957a6badc20eb69cdfdb0b5eed270b Mon Sep 17 00:00:00 2001
>>>> From: Kieran Kunhya<kieran at kunhya.com>
>>>> Date: Sat, 5 Feb 2011 17:59:48 +0000
>>>> Subject: [PATCH] Set channel_layout for mpegaudio
>>>>
>>>> ---
>>>> libavcodec/mpegaudiodec.c | 1 +
>>>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
>>>> index 0cd0b68..6fa3d85 100644
>>>> --- a/libavcodec/mpegaudiodec.c
>>>> +++ b/libavcodec/mpegaudiodec.c
>>>> @@ -2054,6 +2054,7 @@ static int decode_frame(AVCodecContext * avctx,
>>>> }
>>>> /* update codec info */
>>>> avctx->channels = s->nb_channels;
>>>> + avctx->channel_layout = s->nb_channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;
>>>
>>> Do we have dual mono layout as well ? mpegaudio can specify that as well
>>> IIRC, to carry CENTER+LFE as a pair for example.
>>
>>
>> We do not have "dual mono" per-se but we can do:
>> channel_layout = AV_CH_FRONT_CENTER | AV_CH_LOW_FREQUENCY
>
> How do I detect that in mp3? Grep shows no hit for any such a term, so
> I don't really know when to set it.
>
> I guess I could look it up in the spec.
I think it's the mode field in the header.
'00' stereo
'01' joint_stereo (intensity_stereo and/or ms_stereo)
'10' dual_channel
'11' single_channel
But there is nothing I can find that says what the dual channels are
other than 2 mono channels put together in 1 file. Like in AC-3 it
appears to just mean that the 2 channels are not meant to be mixed as
left and right.
Maybe some containers use this and have some format-specific way of
saying what the 2 channels are?
-Justin
More information about the ffmpeg-devel
mailing list