[MPlayer-dev-eng] [RFC][PATCH 4/8] Switch to FFmpeg AVChannelLayout

Alexander Strasser eclipse7 at gmx.net
Sun Apr 7 12:40:26 EEST 2024


Hi Ivan!

On 2024-04-07 02:27 +0300, Ivan Kalvachev wrote:
> I'm not familiar with the code, but the following looks fishy.

Agree, I fear something went wrong over time in that code.
As I'm not really familiar I just wanted to do the minimal fixes,
but now I think it's better to do a bit more.


> On Thu, Apr 4, 2024 at 1:40 AM Alexander Strasser <eclipse7 at gmx.net> wrote:
> > --- a/libmpcodecs/ad_ffmpeg.c
> > +++ b/libmpcodecs/ad_ffmpeg.c
> [...]
> > -    lavc_context->channel_layout = sh_audio->channel_layout;
> > -    lavc_context->request_channel_layout = av_get_default_channel_layout(audio_output_channels);
> > +    lavc_context->ch_layout.nb_channels = sh_audio->channel_layout;
>
> It puts "layout" into "number of channels", and that overwrites the
> value filled right before that.

Good catch, that is a copy and paste error on my part :(


> Later I see example of the code that reads the "layout" from "ch_layout mask".
>
> > --- a/libmpdemux/demux_lavf.c
> > +++ b/libmpdemux/demux_lavf.c
> > +            wf->nChannels= codec->ch_layout.nb_channels;
> > +            sh_audio->channel_layout = codec->ch_layout.u.mask;

While editing the code first time I thought the waveformat branch in
ad ffmpeg looked wrong. Now I see this it definitely looks wrong to
me. I will attempt a re-work and hopefully send v2 of this patch set
later today.

I have some hope it might also fix the problems reported by Ingo.


Best regards,
  Alexander


More information about the MPlayer-dev-eng mailing list