| Add proper versionned checks for avformat_close_input |
| https://bugs.gentoo.org/show_bug.cgi?id=536526 |
| |
| diff --git a/modules/ffmpeg_in/ffmpeg_demux.c b/modules/ffmpeg_in/ffmpeg_demux.c |
| index a5202ee..975a945 100644 |
| --- a/modules/ffmpeg_in/ffmpeg_demux.c |
| +++ b/modules/ffmpeg_in/ffmpeg_demux.c |
| @@ -301,7 +301,7 @@ static Bool FFD_CanHandleURL(GF_InputService *plug, const char *url) |
| } |
| |
| exit: |
| -#ifndef FF_API_CLOSE_INPUT_FILE |
| +#if LIBAVFORMAT_VERSION_MAJOR < 54 |
| if (ctx) av_close_input_file(ctx); |
| #else |
| if (ctx) avformat_close_input(&ctx); |
| @@ -680,7 +680,7 @@ static GF_Err FFD_ConnectService(GF_InputService *plug, GF_ClientService *serv, |
| |
| ffd->seekable = (av_seek_frame(ffd->ctx, -1, 0, AVSEEK_FLAG_BACKWARD)<0) ? 0 : 1; |
| if (!ffd->seekable) { |
| -#ifndef FF_API_CLOSE_INPUT_FILE |
| +#if LIBAVFORMAT_VERSION_MAJOR < 54 |
| av_close_input_file(ffd->ctx); |
| #else |
| avformat_close_input(&ffd->ctx); |
| @@ -699,7 +699,7 @@ static GF_Err FFD_ConnectService(GF_InputService *plug, GF_ClientService *serv, |
| |
| err_exit: |
| GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[FFMPEG] Error opening file %s: %s\n", url, gf_error_to_string(e))); |
| -#ifndef FF_API_CLOSE_INPUT_FILE |
| +#if LIBAVFORMAT_VERSION_MAJOR < 54 |
| if (ffd->ctx) av_close_input_file(ffd->ctx); |
| #else |
| if (ffd->ctx) avformat_close_input(&ffd->ctx); |
| @@ -757,7 +757,7 @@ static GF_Err FFD_CloseService(GF_InputService *plug) |
| |
| ffd->is_running = 0; |
| |
| -#ifndef FF_API_CLOSE_INPUT_FILE |
| +#if LIBAVFORMAT_VERSION_MAJOR < 54 |
| if (ffd->ctx) av_close_input_file(ffd->ctx); |
| #else |
| if (ffd->ctx) avformat_close_input(&ffd->ctx); |