Skip to content

Decoding example fails to build with ffmpeg 7.0.2 #3011

Closed
@blaueente

Description

@blaueente

I got some errors while building the example with ffmpeg v7 (default version on ubuntu 24.10)
Needed the following patch to have it compile:

diff --git a/examples/ffmpeg-transcode.cpp b/examples/ffmpeg-transcode.cpp
index 20f390de..7c4ff283 100644
--- a/examples/ffmpeg-transcode.cpp
+++ b/examples/ffmpeg-transcode.cpp
@@ -248,11 +248,13 @@ static int decode_audio(struct audio_buffer *audio_buf, s16 **data, int *size)
 
        /* prepare resampler */
        swr = swr_alloc();
-
-       av_opt_set_int(swr, "in_channel_count", codec->channels, 0);
+       AVChannelLayout out_chlayout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
+       av_opt_set_int(swr, "in_channel_count", codec->ch_layout.nb_channels, 0);
        av_opt_set_int(swr, "out_channel_count", 1, 0);
-       av_opt_set_int(swr, "in_channel_layout", codec->channel_layout, 0);
-       av_opt_set_int(swr, "out_channel_layout", AV_CH_LAYOUT_MONO, 0);
+       av_opt_set_chlayout(swr, "in_chlayout", &codec->ch_layout, 0);
+       av_opt_set_chlayout(swr, "out_chlayout", &out_chlayout, 0);
        av_opt_set_int(swr, "in_sample_rate", codec->sample_rate, 0);
        av_opt_set_int(swr, "out_sample_rate", WAVE_SAMPLE_RATE, 0);
        av_opt_set_sample_fmt(swr, "in_sample_fmt", codec->sample_fmt, 0);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions