Here is a new and improved patch, better reflecting the ffmpeg versions in question. Tested with both ffmpeg 7 and 9.
-- Happy hacking Petter Reinholdtsen
Description: Fix build with FFmpeg 9+ (libavutil 61+) av_opt_set_int_list() was removed in FFmpeg 9.0 (libavutil 61). AVCodec members sample_fmts, supported_samplerates, ch_layouts were removed in FFmpeg 9.0 (libavcodec 63). The abuffersink filter options sample_fmts, sample_rates, ch_layouts were also removed in FFmpeg 9.0 (libavfilter 12). The aformat filter in the chain already ensures the correct output format, so these constraints are redundant for FFmpeg 9+. Author: Petter Reinholdtsen <[email protected]> Bug-Debian: https://bugs.debian.org/1144027 Forwarded: Last-Updated: 2026-10-06 diff --git a/libff/ff_audio.c b/libff/ff_audio.c index b123d23..dfabd23 100755 --- a/libff/ff_audio.c +++ b/libff/ff_audio.c @@ -48,7 +48,9 @@ int ff_audio_create(ff_audio_t *audio, ff_inout_t *inout, AVCodecParameters *codecpar=stream->codecpar; AVDictionary *opt=NULL; FF_CONST AVCodec *codec; +#if LIBAVCODEC_VERSION_MAJOR < 63 // [ int i; +#endif // ] char value[64]; int err; @@ -93,6 +95,7 @@ int ff_audio_create(ff_audio_t *audio, ff_inout_t *inout, //////////////////////////////////////////////////////////////////////////// if (ocodecpar) { // we're going to encode. +#if LIBAVCODEC_VERSION_MAJOR < 63 // [ if (codec->sample_fmts) { audio->ctx->sample_fmt=AV_SAMPLE_FMT_NONE; @@ -233,6 +236,13 @@ int ff_audio_create(ff_audio_t *audio, ff_inout_t *inout, //audio->ctx->channels #endif // ] +#else // ] [ + // AVCodec members sample_fmts, supported_samplerates, ch_layouts + // were removed in FFmpeg 9.0 (libavcodec 63). + audio->ctx->sample_fmt=ocodecpar->format; + audio->ctx->sample_rate=ocodecpar->sample_rate; + audio->ctx->ch_layout=ocodecpar->ch_layout; +#endif // ] audio->ctx->time_base.num=1; audio->ctx->time_base.den=audio->ctx->sample_rate; diff --git a/libff/ff_filter.c b/libff/ff_filter.c index 02267ba..4b2c1fb 100755 --- a/libff/ff_filter.c +++ b/libff/ff_filter.c @@ -395,6 +395,7 @@ e_filter_graph: ///////////////////////////////////////////////////////////////////////////// #if defined (FF_SAMPLE_FMTS_DEPRECATED_FIX) // [ +#if LIBAVUTIL_VERSION_MAJOR < 61 // [ /* err= avcodec_get_supported_config(dec_ctx,NULL,AV_CODEC_CONFIG_PIX_FORMAT, 0,(const void**)&sink_sample_fmts,NULL); @@ -402,8 +403,21 @@ e_filter_graph: err=av_opt_set_bin(f->ctx.sink,"sample_fmts", sink_sample_fmts,-1,AV_OPT_SEARCH_CHILDREN|AV_OPT_TYPE_FLAG_ARRAY); #else // ] [ + { + char sample_fmts_str[256]; + snprintf(sample_fmts_str, sizeof(sample_fmts_str), "%s", + av_get_sample_fmt_name(ocodecpar->format)); + err=av_opt_set(f->ctx.sink,"sample_fmts",sample_fmts_str,AV_OPT_SEARCH_CHILDREN); + } +#endif // ] +#else // ] [ +#if LIBAVUTIL_VERSION_MAJOR < 61 // [ err=av_opt_set_int_list(f->ctx.sink,"sample_fmts", sink_sample_fmts,-1,AV_OPT_SEARCH_CHILDREN); +#else // ] [ + /* FFmpeg 9+: abuffersink dropped sample_fmts option; aformat handles format. */ + err=0; +#endif // ] #endif // ] if (err<0) { @@ -413,12 +427,16 @@ e_filter_graph: ///////////////////////////////////////////////////////////////////////////// #if defined (FF_BITMASK_BASED_CHANNEL_LAYOUT) // [ +#if LIBAVUTIL_VERSION_MAJOR < 61 // [ err=av_opt_set_int_list(f->ctx.sink,"channel_layouts", sink_channel_layouts,-1,AV_OPT_SEARCH_CHILDREN); -#elif 1 // ] [ - av_channel_layout_describe(&ocodecpar->ch_layout, - args,sizeof(args)); - err=av_opt_set(f->ctx.sink,"ch_layouts",args,AV_OPT_SEARCH_CHILDREN); +#else // ] [ + /* FFmpeg 9+: abuffersink dropped ch_layouts option; aformat handles layout. */ + err=0; +#endif // ] +#else // ] [ + /* FFmpeg 9+: abuffersink dropped ch_layouts option; aformat handles layout. */ + err=0; #endif // ] if (err<0) { @@ -429,8 +447,13 @@ e_filter_graph: ///////////////////////////////////////////////////////////////////////////// #if defined (FF_SAMPLE_FMTS_DEPRECATED_FIX) // [ #else // ] [ +#if LIBAVUTIL_VERSION_MAJOR < 61 // [ err=av_opt_set_int_list(f->ctx.sink,"sample_rates", sink_sample_rates,-1,AV_OPT_SEARCH_CHILDREN); +#else // ] [ + /* FFmpeg 9+: abuffersink dropped sample_rates option; aformat handles rate. */ + err=0; +#endif // ] #endif // ] if (err<0) {

