ffmpeg: update API for ffmpeg 8

This commit is contained in:
oltolm committed 2025-11-05 19:11:32 +01:00
1 parent 245927b360
commit 122eddfe0f
3 files changed
+11 -5

No files matched your search

+1 -3
View File
@@ -929,16 +929,14 @@ static bool decodePmpVideo(PSPPointer<SceMpegRingBuffer> ringbuffer, u32 pmpctxA
avcodec_send_packet(pCodecCtx, &packet);
int len = avcodec_receive_frame(pCodecCtx, pFrame);
if (len == 0) {
len = pFrame->pkt_size;
got_picture = 1;
} else if (len == AVERROR(EAGAIN)) {
len = 0;
got_picture = 0;
} else {
got_picture = 0;
}
#else
int len = avcodec_decode_video2(pCodecCtx, pFrame, &got_picture, &packet);
avcodec_decode_video2(pCodecCtx, pFrame, &got_picture, &packet);
#endif
DEBUG_LOG(Log::Mpeg, "got_picture %d", got_picture);
if (got_picture){
+5 -1
View File
@@ -369,7 +369,11 @@ void MediaEngine::closeContext() {
m_pCodecCtxs.clear();
// These are streams allocated from avformat_new_stream.
for (auto &it : m_codecsToClose) {
#if LIBAVCODEC_VERSION_MAJOR >= 62
avcodec_free_context(&it);
#else
avcodec_close(it);
#endif
}
m_codecsToClose.clear();
if (m_pFormatCtx)
@@ -690,7 +694,7 @@ bool MediaEngine::stepVideo(int videoPixelMode, bool skipFrame) {
avcodec_send_packet(m_pCodecCtx, &packet);
int result = avcodec_receive_frame(m_pCodecCtx, m_pFrame);
if (result == 0) {
result = m_pFrame->pkt_size;
result = 1;
frameFinished = 1;
} else if (result == AVERROR(EAGAIN)) {
result = 0;
+5 -1
View File
@@ -327,7 +327,7 @@ bool FFmpegAudioDecoder::Decode(const uint8_t *inbuf, int inbytes, int *inbytesC
int err = avcodec_receive_frame(codecCtx_, frame_);
int len = 0;
if (err >= 0) {
len = frame_->pkt_size;
len = packet.size;
got_frame = 1;
} else if (err != AVERROR(EAGAIN)) {
len = err;
@@ -392,7 +392,11 @@ bool FFmpegAudioDecoder::Decode(const uint8_t *inbuf, int inbytes, int *inbytesC
if (!swrCtx_ || swr_init(swrCtx_) < 0) {
ERROR_LOG(Log::ME, "swr_init: Failed to initialize the resampling context");
#if LIBAVCODEC_VERSION_MAJOR >= 62
avcodec_free_context(&codecCtx_);
#else
avcodec_close(codecCtx_);
#endif
codec_ = 0;
return false;
}