mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
ffmpeg: update API for ffmpeg 8
This commit is contained in:
1 parent
245927b360
commit
122eddfe0f
3 files changed
+11
-5
No files matched your search
@@ -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){
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user