summaryrefslogtreecommitdiff
blob: 5451b8e1199a5a23f85b5f229c983442d130f06b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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);