From 85b5c03f36cbe1630e5f3327918e67255fa01dd3 Mon Sep 17 00:00:00 2001 From: anujshuk-amd Date: Wed, 26 Nov 2025 01:55:05 +0530 Subject: [PATCH] [rocprof-sys] Fix test build failure on RHEL 10 (#1955) ## Motivation To solve: SWDEV-566076 FFmpeg versions >= 58.134 no longer expose read_seek and read_seek2 function pointers in AVInputFormat, requiring alternative seek detection methods. This pull request updates the `VideoDemuxer` class to improve compatibility with newer versions of FFmpeg. The main change is how the code determines whether the input file is seekable, addressing differences in FFmpeg API versions. ## Technical Details In `video_demuxer.h`, added a conditional check for `USE_AVCODEC_GREATER_THAN_58_134` to set `is_seekable_` to `true` for newer FFmpeg versions, since `read_seek` and `read_seek2` are no longer exposed in `AVFormatContext`. For older versions, the previous method of checking these fields remains in place. The conditional compilation now assumes seek capability is available for newer FFmpeg versions. --- .../examples/videodecode/video_demuxer.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/projects/rocprofiler-systems/examples/videodecode/video_demuxer.h b/projects/rocprofiler-systems/examples/videodecode/video_demuxer.h index 5aba9c9c4e..f1477459cc 100644 --- a/projects/rocprofiler-systems/examples/videodecode/video_demuxer.h +++ b/projects/rocprofiler-systems/examples/videodecode/video_demuxer.h @@ -570,9 +570,17 @@ private: !strcmp(av_fmt_input_ctx_->iformat->long_name, "FLV (Flash Video)") || !strcmp(av_fmt_input_ctx_->iformat->long_name, "Matroska / WebM")); + // For latest version of FFMPeg, read_seek and read_seek2 are not exposed in + // AVInputFormat +#if USE_AVCODEC_GREATER_THAN_58_134 + // Check if the input stream is seekable for FFmpeg >= 58.134 + is_seekable_ = (av_fmt_input_ctx_->iformat->flags & AVFMT_NO_BYTE_SEEK) == 0 && + av_fmt_input_ctx_->pb && av_fmt_input_ctx_->pb->seekable; +#else // Check if the input file allow seek functionality. is_seekable_ = av_fmt_input_ctx_->iformat->read_seek || av_fmt_input_ctx_->iformat->read_seek2; +#endif if(is_h264_) {