Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decoding example fails to build with ffmpeg 7.0.2 #3011

Open
blaueente opened this issue Apr 6, 2025 · 0 comments
Open

Decoding example fails to build with ffmpeg 7.0.2 #3011

blaueente opened this issue Apr 6, 2025 · 0 comments

Comments

@blaueente
Copy link

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);

@blaueente blaueente changed the title Decoding examble fails to build with ffmpeg 7.0.2 Decoding example fails to build with ffmpeg 7.0.2 Apr 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant