diff --git a/include/libvideo2x/avutils.h b/include/libvideo2x/avutils.h index 59cb46c..9fd8696 100644 --- a/include/libvideo2x/avutils.h +++ b/include/libvideo2x/avutils.h @@ -5,6 +5,8 @@ extern "C" { #include } +#define CALC_FFMPEG_VERSION(a, b, c) (a << 16 | b << 8 | c) + int64_t get_video_frame_count(AVFormatContext *ifmt_ctx, int in_vstream_idx); enum AVPixelFormat diff --git a/src/avutils.cpp b/src/avutils.cpp index 798ae22..f73ab18 100644 --- a/src/avutils.cpp +++ b/src/avutils.cpp @@ -60,6 +60,7 @@ get_encoder_default_pix_fmt(const AVCodec *encoder, AVPixelFormat target_pix_fmt char errbuf[AV_ERROR_MAX_STRING_SIZE]; // Retrieve the list of supported pixel formats +#if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(61, 13, 100) const enum AVPixelFormat *supported_pix_fmts = nullptr; ret = avcodec_get_supported_config( nullptr, encoder, AV_CODEC_CONFIG_PIX_FORMAT, 0, (const void **)&supported_pix_fmts, nullptr @@ -79,6 +80,9 @@ get_encoder_default_pix_fmt(const AVCodec *encoder, AVPixelFormat target_pix_fmt return target_pix_fmt; } } +#else + const enum AVPixelFormat *supported_pix_fmts = encoder->pix_fmts; +#endif // Determine if the target pixel format has an alpha channel const AVPixFmtDescriptor *desc = nullptr;