Skip to content

Commit 53faa53

Browse files
kiritigowdarrawtherLakshmiKumar23samjwu
authored
Cherry-pick 7.0.2-RC2: FFMpeg Support - Support Version 4/5/6/7 (#636) + Remove .jenkins (#615) (#644)
* 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 <[email protected]> * FFmpeg version support for 5.1 and 6.1 (#646) * add support for ffmpeg versions 5.1 & 6.1 * avcodec variable version support * update for ffmpeg 6.1 * edit comments --------- Co-authored-by: Kiriti Gowda <[email protected]> * CI - Remove .jenkins (#615) migrating to rocJenkins --------- Co-authored-by: Rajy Rawther <[email protected]> Co-authored-by: Lakshmi Kumar <[email protected]> Co-authored-by: Sam Wu <[email protected]>
1 parent eb487c3 commit 53faa53

File tree

6 files changed

+19
-431
lines changed

6 files changed

+19
-431
lines changed

.jenkins/common.groovy

Lines changed: 0 additions & 348 deletions
This file was deleted.

.jenkins/precheckin.groovy

Lines changed: 0 additions & 78 deletions
This file was deleted.

src/rocdecode-host/CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff 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)
96101
else()
97102
message("-- ERROR!: ${PROJECT_NAME} excluded! please install all the dependencies and try again!")

src/rocdecode-host/avcodec/avcodec_videodecoder.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff 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);

src/rocdecode-host/avcodec/avcodec_videodecoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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;

utils/video_demuxer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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");

0 commit comments

Comments
 (0)