File tree Expand file tree Collapse file tree 6 files changed +19
-431
lines changed
Expand file tree Collapse file tree 6 files changed +19
-431
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -87,11 +87,16 @@ if(HIP_FOUND AND FFMPEG_FOUND AND Threads_FOUND AND rocprofiler-register_FOUND)
8787
8888 target_link_libraries (${PROJECT_NAME} ${LINK_LIBRARY_LIST} )
8989 # FFMPEG multi-version support
90- if (_FFMPEG_AVCODEC_VERSION VERSION_LESS_EQUAL 58.134.100)
90+ if (_FFMPEG_AVCODEC_VERSION VERSION_LESS_EQUAL 58.134.100) #FFmpeg version <= 4.4
9191 target_compile_definitions (${PROJECT_NAME} PUBLIC USE_AVCODEC_GREATER_THAN_58_134=0)
92- else ()
92+ target_compile_definitions (${PROJECT_NAME} PUBLIC USE_AVCODEC_GREATER_THAN_60_31=0)
93+ elseif (_FFMPEG_AVCODEC_VERSION VERSION_GREATER 58.134.100 AND _FFMPEG_AVCODEC_VERSION VERSION_LESS_EQUAL 60.31.100) #FFmpeg version >= 4.4 && version < 6.1
9394 target_compile_definitions (${PROJECT_NAME} PUBLIC USE_AVCODEC_GREATER_THAN_58_134=1)
94- endif ()
95+ target_compile_definitions (${PROJECT_NAME} PUBLIC USE_AVCODEC_GREATER_THAN_60_31=0)
96+ else ()
97+ target_compile_definitions (${PROJECT_NAME} PUBLIC USE_AVCODEC_GREATER_THAN_58_134=0) #FFmpeg version >= 6.1
98+ target_compile_definitions (${PROJECT_NAME} PUBLIC USE_AVCODEC_GREATER_THAN_60_31=1)
99+ endif () #FFMpeg version >= 7.1
95100 set_target_properties (${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON )
96101else ()
97102 message ("-- ERROR!: ${PROJECT_NAME} excluded! please install all the dependencies and try again!" )
Original file line number Diff line number Diff line change @@ -386,8 +386,13 @@ rocDecStatus AvcodecVideoDecoder::NotifyNewSequence(AVFrame *p_frame) {
386386 p_video_format->frame_rate .denominator = dec_context_->framerate .den ;
387387 p_video_format->bit_depth_luma_minus8 = BitDepthFromPixelFormat (dec_context_->pix_fmt ) - 8 ;
388388 p_video_format->bit_depth_chroma_minus8 = p_video_format->bit_depth_luma_minus8 ;
389+ #if USE_AVCODEC_GREATER_THAN_60_31
390+ p_video_format->progressive_sequence = !(p_frame->flags & AV_FRAME_FLAG_INTERLACED);
391+ #elif USE_AVCODEC_GREATER_THAN_58_134
389392 p_video_format->progressive_sequence = !p_frame->interlaced_frame ;
390- p_video_format->min_num_decode_surfaces = dec_context_->delay + dec_context_->max_b_frames ;
393+ #endif
394+ // number of decode surfaces are internal and not exposed in avcodec based decoding. Setting some value for sanity
395+ p_video_format->min_num_decode_surfaces = dec_frames_.size ();
391396 p_video_format->coded_width = p_frame->linesize [0 ];
392397 p_video_format->coded_height = p_frame->height ;
393398 p_video_format->chroma_format = AVPixelFormat2rocDecVideoChromaFormat (dec_context_->pix_fmt );
Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ class AvcodecVideoDecoder {
156156 // Variables for FFMpeg decoding
157157 AVCodecContext * dec_context_ = nullptr ;
158158 AVPixelFormat decoder_pixel_format_;
159- #if USE_AVCODEC_GREATER_THAN_58_134
159+ #if USE_AVCODEC_GREATER_THAN_58_134 || USE_AVCODEC_GREATER_THAN_60_31
160160 const AVCodec *decoder_ = nullptr ;
161161#else
162162 AVCodec *decoder_ = nullptr ;
Original file line number Diff line number Diff line change @@ -462,7 +462,11 @@ class VideoDemuxer {
462462 || !strcmp (av_fmt_input_ctx_->iformat ->long_name , " Matroska / WebM" ));
463463
464464 // Check if the input file allow seek functionality.
465+ #if USE_AVCODEC_GREATER_THAN_58_134
466+ is_seekable_ = true ; // for latest version of FFMPeg, read_seek and read_seek2 is not exposed in AVFormatContext
467+ #else
465468 is_seekable_ = av_fmt_input_ctx_->iformat ->read_seek || av_fmt_input_ctx_->iformat ->read_seek2 ;
469+ #endif
466470
467471 if (is_h264_) {
468472 const AVBitStreamFilter *bsf = av_bsf_get_by_name (" h264_mp4toannexb" );
You can’t perform that action at this time.
0 commit comments