[Libav-user] AVCodec::sample_fmts is deprecated

nolan d dnolan314159 at gmail.com
Fri Apr 25 10:58:34 EEST 2025


> I was trying to find an example of how to replace the sample_fmts variable
> using the new method avcodec_get_supported_config(), but I couldn't find it.
>
> Any help or hint would be appreciated. Thanks.

Hi Gustav,

Yes. I faced this too. It was a pretty easy change.

    const AVSampleFormat* sample_fmts = nullptr;
    int out_num_configs = 0;
    int err = avcodec_get_supported_config(nullptr, codec,
       AVCodecConfig::AV_CODEC_CONFIG_SAMPLE_FORMAT, 0,
       reinterpret_cast<const void**>(&sample_fmts), &out_num_configs);

Hope this helps.

Nolan


More information about the Libav-user mailing list