Skip to content

Commit 21776a2

Browse files
committed
Attempt to fix ffmpeg 8.0 build errors
1 parent 79f0b05 commit 21776a2

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

cores/libretro-ffmpeg/ffmpeg_core.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ static tpool_t *tpool;
101101
#define FFMPEG3 ((LIBAVUTIL_VERSION_INT < (56, 6, 100)) || \
102102
(LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 10, 100)))
103103
#endif
104+
#ifndef FFMPEG8
105+
#define FFMPEG8 (LIBAVCODEC_VERSION_MAJOR >= 62)
106+
#endif
104107

105108
#if ENABLE_HW_ACCEL
106109
static enum AVHWDeviceType hw_decoder;
@@ -2093,17 +2096,28 @@ void CORE_PREFIX(retro_unload_game)(void)
20932096

20942097
for (i = 0; i < MAX_STREAMS; i++)
20952098
{
2099+
#if FFMPEG8
2100+
if (sctx[i])
2101+
avcodec_free_context(&sctx[i]);
2102+
if (actx[i])
2103+
avcodec_free_context(&actx[i]);
2104+
#else
20962105
if (sctx[i])
20972106
avcodec_close(sctx[i]);
20982107
if (actx[i])
20992108
avcodec_close(actx[i]);
2109+
#endif
21002110
sctx[i] = NULL;
21012111
actx[i] = NULL;
21022112
}
21032113

21042114
if (vctx)
21052115
{
2116+
#if FFMPEG8
2117+
avcodec_free_context(&vctx);
2118+
#else
21062119
avcodec_close(vctx);
2120+
#endif
21072121
vctx = NULL;
21082122
}
21092123

record/drivers/record_ffmpeg.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ extern "C" {
7373
#define FFMPEG3 ((LIBAVUTIL_VERSION_INT < (56, 6, 100)) || \
7474
(LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 10, 100)))
7575
#endif
76+
77+
#ifndef FFMPEG8
78+
#define FFMPEG8 (LIBAVCODEC_VERSION_MAJOR >= 62)
79+
#endif
80+
81+
#ifndef AV_INPUT_BUFFER_MIN_SIZE
82+
#define AV_INPUT_BUFFER_MIN_SIZE 16384
83+
#endif
84+
7685
#define HAVE_CH_LAYOUT (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100))
7786

7887
struct ff_video_info
@@ -952,15 +961,23 @@ static void ffmpeg_free(void *data)
952961

953962
if (handle->audio.codec)
954963
{
964+
#if FFMPEG8
965+
avcodec_free_context(&handle->audio.codec);
966+
#else
955967
avcodec_close(handle->audio.codec);
968+
#endif
956969
av_free(handle->audio.codec);
957970
}
958971

959972
av_free(handle->audio.buffer);
960973

961974
if (handle->video.codec)
962975
{
976+
#if FFMPEG8
977+
avcodec_free_context(&handle->video.codec);
978+
#else
963979
avcodec_close(handle->video.codec);
980+
#endif
964981
av_free(handle->video.codec);
965982
}
966983

0 commit comments

Comments
 (0)