fix for build errors with FFMpeg version 6 (#489)

* fix for build errors with FFMpeg version 6

* set initialize for reconfigure

[ROCm/rocdecode commit: f02751900d]
This commit is contained in:
Rajy Rawther
2025-01-08 13:26:08 -08:00
committato da GitHub
parent 9d96ca1354
commit 75add792ab
2 ha cambiato i file con 8 aggiunte e 2 eliminazioni
@@ -246,7 +246,7 @@ int FFMpegVideoDecoder::HandleVideoSequence(RocdecVideoFormat *p_video_format) {
if (coded_width_ && coded_height_) {
end_of_stream_ = false;
// rocdecCreateDecoder() has been called before, and now there's possible config change
b_decoder_initialized = false; // reinitialize for reconfigure
return ReconfigureDecoder(p_video_format);
}
// e_codec has been set in the constructor (for parser). Here it's set again for potential correction
@@ -798,8 +798,9 @@ int FFMpegVideoDecoder::DecodeAvFrame(AVPacket *av_pkt, AVFrame *p_frame) {
return 0;
}
// for the first frame, initialize OutputsurfaceInfo
if (dec_context_->frame_number == 1) {
if (!b_decoder_initialized) {
InitOutputFrameInfo(p_frame);
b_decoder_initialized = true;
}
decoded_pic_cnt_++;
if (no_multithreading_)
@@ -214,6 +214,7 @@ class FFMpegVideoDecoder: public RocVideoDecoder {
typedef enum { STATUS_SUCCESS = 0, STATUS_FAILURE = -1 } StatusType;
bool no_multithreading_ = false;
bool b_decoder_initialized = false;
uint32_t av_frame_cnt_ = 0;
uint32_t av_pkt_cnt_ = 0;
RocdecSourceDataPacket last_packet_;
@@ -230,7 +231,11 @@ class FFMpegVideoDecoder: public RocVideoDecoder {
// Variables for FFMpeg decoding
AVCodecContext * dec_context_ = nullptr;
AVPixelFormat decoder_pixel_format_;
#if USE_AVCODEC_GREATER_THAN_58_134
const AVCodec *_decoder = nullptr;
#else
AVCodec *decoder_ = nullptr;
#endif
AVFormatContext * formatContext = nullptr;
AVInputFormat * inputFormat = nullptr;
AVStream *video = nullptr;