Skip to content

Build fail: AVFrame has no member named ch_layout #1981

@d9k

Description

@d9k

Describe the bug

> git clone --recursive https://github.com/grumpycoders/pcsx-redux.git
> cd pcsx-redux
> make
. . . . .
src/support/ffmpeg-audio-file.cc:130:23: error: ‘AVFrame’ {aka ‘struct AVFrame’} has no member named ‘ch_layout’; did you mean ‘channel_layout’?
  130 |     m_resampledFrame->ch_layout.nb_channels = channels == Channels::Stereo ? 2 : 1;
      |                       ^~~~~~~~~
      |                       channel_layout
src/support/ffmpeg-audio-file.cc:131:23: error: ‘AVFrame’ {aka ‘struct AVFrame’} has no member named ‘ch_layout’; did you mean ‘channel_layout’?
  131 |     m_resampledFrame->ch_layout.order = AV_CHANNEL_ORDER_NATIVE;
      |                       ^~~~~~~~~
      |                       channel_layout
src/support/ffmpeg-audio-file.cc:131:41: error: ‘AV_CHANNEL_ORDER_NATIVE’ was not declared in this scope
  131 |     m_resampledFrame->ch_layout.order = AV_CHANNEL_ORDER_NATIVE;
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~
src/support/ffmpeg-audio-file.cc:132:23: error: ‘AVFrame’ {aka ‘struct AVFrame’} has no member named ‘ch_layout’; did you mean ‘channel_layout’?
  132 |     m_resampledFrame->ch_layout.u.mask = channels == Channels::Stereo ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
      |                       ^~~~~~~~~
      |                       channel_layout
src/support/ffmpeg-audio-file.cc:135:76: error: invalid conversion from ‘const AVCodec**’ to ‘AVCodec**’ [-fpermissive]
  135 |     ret = av_find_best_stream(m_formatContext, AVMEDIA_TYPE_AUDIO, -1, -1, &codec, 0);
      |                                                                            ^~~~~~
      |                                                                            |
      |                                                                            const AVCodec**
In file included from src/support/ffmpeg-audio-file.h:31,
                 from src/support/ffmpeg-audio-file.cc:26:
/usr/include/x86_64-linux-gnu/libavformat/avformat.h:2301:35: note:   initializing argument 5 of ‘int av_find_best_stream(AVFormatContext*, AVMediaType, int, int, AVCodec**, int)’
 2301 |                         AVCodec **decoder_ret,
      |                         ~~~~~~~~~~^~~~~~~~~~~
src/support/ffmpeg-audio-file.cc:156:5: error: ‘AVChannelLayout’ was not declared in this scope
  156 |     AVChannelLayout layout;
      |     ^~~~~~~~~~~~~~~
src/support/ffmpeg-audio-file.cc:158:9: error: ‘layout’ was not declared in this scope
  158 |         layout = AV_CHANNEL_LAYOUT_STEREO;
      |         ^~~~~~
src/support/ffmpeg-audio-file.cc:158:18: error: ‘AV_CHANNEL_LAYOUT_STEREO’ was not declared in this scope; did you mean ‘AV_CH_LAYOUT_STEREO’?
  158 |         layout = AV_CHANNEL_LAYOUT_STEREO;
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~
      |                  AV_CH_LAYOUT_STEREO
src/support/ffmpeg-audio-file.cc:160:9: error: ‘layout’ was not declared in this scope
  160 |         layout = AV_CHANNEL_LAYOUT_MONO;
      |         ^~~~~~
src/support/ffmpeg-audio-file.cc:160:18: error: ‘AV_CHANNEL_LAYOUT_MONO’ was not declared in this scope; did you mean ‘AV_CH_LAYOUT_MONO’?
  160 |         layout = AV_CHANNEL_LAYOUT_MONO;
      |                  ^~~~~~~~~~~~~~~~~~~~~~
      |                  AV_CH_LAYOUT_MONO
src/support/ffmpeg-audio-file.cc:162:51: error: ‘layout’ was not declared in this scope
  162 |     if (swr_alloc_set_opts2(&m_resamplerContext, &layout, getSampleFormat(), frequency, &m_codecContext->ch_layout,
      |                                                   ^~~~~~
src/support/ffmpeg-audio-file.cc:162:106: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘ch_layout’; did you mean ‘channel_layout’?
  162 |     if (swr_alloc_set_opts2(&m_resamplerContext, &layout, getSampleFormat(), frequency, &m_codecContext->ch_layout,
      |                                                                                                          ^~~~~~~~~
      |                                                                                                          channel_layout
src/support/ffmpeg-audio-file.cc:162:9: error: ‘swr_alloc_set_opts2’ was not declared in this scope; did you mean ‘swr_alloc_set_opts’?
  162 |     if (swr_alloc_set_opts2(&m_resamplerContext, &layout, getSampleFormat(), frequency, &m_codecContext->ch_layout,
      |         ^~~~~~~~~~~~~~~~~~~
      |         swr_alloc_set_opts

Expected behavior

Build properly

Steps to reproduce the bug

> git clone --recursive https://github.com/grumpycoders/pcsx-redux.git
> cd pcsx-redux
> make

Operating System

Ubuntu 22.04

PCSX-Redux version

Commit b745534eb231d3699ec57949f16a9a7bd5b79385 2025-11-17.

CPU model

AMD Ryzen 5 5600G with Radeon Graphics × 6

GPU model & Drivers

NVIDIA Corporation GA106 [GeForce RTX 3060 Lite Hash Rate]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions