From 26389e857c01adf9714bdd7b8b42d0e1bdd9e68d Mon Sep 17 00:00:00 2001 From: Rajy Rawther Date: Thu, 28 Aug 2025 09:28:12 -0700 Subject: [PATCH] fixed build issues with FFMpeg AVCodec version >=59 changes (#636) * fixed build issues with FFMpeg AVCodec version >=59 changes * fixed mistake of pushing stashed change --------- Co-authored-by: Kiriti Gowda [ROCm/rocdecode commit: 253e604c7be98d78bf1e106638bf4a6aa6fc2e44] --- .../src/rocdecode-host/avcodec/avcodec_videodecoder.cpp | 6 +++++- projects/rocdecode/utils/video_demuxer.h | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/rocdecode/src/rocdecode-host/avcodec/avcodec_videodecoder.cpp b/projects/rocdecode/src/rocdecode-host/avcodec/avcodec_videodecoder.cpp index 2f08ce748e..af93323a16 100644 --- a/projects/rocdecode/src/rocdecode-host/avcodec/avcodec_videodecoder.cpp +++ b/projects/rocdecode/src/rocdecode-host/avcodec/avcodec_videodecoder.cpp @@ -387,7 +387,11 @@ rocDecStatus AvcodecVideoDecoder::NotifyNewSequence(AVFrame *p_frame) { p_video_format->frame_rate.denominator = dec_context_->framerate.den; p_video_format->bit_depth_luma_minus8 = BitDepthFromPixelFormat(dec_context_->pix_fmt) - 8; p_video_format->bit_depth_chroma_minus8 = p_video_format->bit_depth_luma_minus8; - p_video_format->progressive_sequence = !p_frame->interlaced_frame; +#if USE_AVCODEC_GREATER_THAN_58_134 + p_video_format->progressive_sequence = !(p_frame->flags & AV_FRAME_FLAG_INTERLACED); +#else + p_video_format->progressive_sequence = !!p_frame->interlaced_frame;; +#endif //number of decode surfaces are internal and not exposed in avcodec based decoding. Setting some value for sanity p_video_format->min_num_decode_surfaces = dec_frames_.size(); p_video_format->coded_width = p_frame->linesize[0]; diff --git a/projects/rocdecode/utils/video_demuxer.h b/projects/rocdecode/utils/video_demuxer.h index 549f021926..4244835a7b 100644 --- a/projects/rocdecode/utils/video_demuxer.h +++ b/projects/rocdecode/utils/video_demuxer.h @@ -462,7 +462,11 @@ class VideoDemuxer { || !strcmp(av_fmt_input_ctx_->iformat->long_name, "Matroska / WebM")); // Check if the input file allow seek functionality. +#if USE_AVCODEC_GREATER_THAN_58_134 + is_seekable_ = true; //for latest version of FFMPeg, read_seek and read_seek2 is not exposed in AVFormatContext +#else is_seekable_ = av_fmt_input_ctx_->iformat->read_seek || av_fmt_input_ctx_->iformat->read_seek2; +#endif if (is_h264_) { const AVBitStreamFilter *bsf = av_bsf_get_by_name("h264_mp4toannexb");