summaryrefslogtreecommitdiff
blob: 05abd9e284109fa2526b9672ce74d473918c4dad (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Description: Improve av_register_protocol2()/av_register_protocol() detection
Author: Angel Carpintero <motiondevelop@gmail.com>
Origin: Upstream, https://github.com/sackmotion/motion/commit/5dd9ed#svn540#svn540
Last-Update: 2012-02-12

--- a/configure.in
+++ b/configure.in
@@ -448,33 +448,6 @@
 		CFLAGS=$saved_CFLAGS
 		LIBS=$saved_LIBS
        
-        AC_MSG_CHECKING([av_register_protocol is defined in ffmpeg ?]) 
-        saved_CFLAGS=$CFLAGS
-        saved_LIBS=$LIBS
-        CFLAGS="${FFMPEG_CFLAGS} ${AVFORMAT}"
-        LIBS="$TEMP_LIBS"
-       
-        AC_COMPILE_IFELSE(
-            [
-            #include <avformat.h>
-            URLProtocol test_file_protocol;
-            int main(void){
-                av_register_protocol(&test_file_protocol);
-        	    return 0;
-            }
-            ],
-            [
-                AC_MSG_RESULT(yes)
-                TEMP_CFLAGS="${TEMP_CFLAGS} -DHAVE_FFMPEG_AV_REGISTER_PROTOCOL"
-            ],
-            [
-                AC_MSG_RESULT(no)
-            ]
-        )
-
-        CFLAGS=$saved_CFLAGS
-        LIBS=$saved_LIBS
-                                        
 	fi
 fi	
 fi
@@ -1102,6 +1075,9 @@
 
 AC_CHECK_FUNC(avformat_alloc_context, AC_DEFINE([have_avformat_alloc_context],1,[Define to 1 if you have avformat_alloc_context support]))
 AC_CHECK_FUNC(av_avformat_alloc_context, AC_DEFINE([have_av_avformat_alloc_context],1,[Define to 1 if you have av_avformat_alloc_context support]))
+AC_CHECK_FUNC(av_register_protocol2, AC_DEFINE([have_av_register_protocol2],1,[Define to 1 if you have av_register_protocol2 support]))
+AC_CHECK_FUNC(av_register_protocol, AC_DEFINE([have_av_register_protocol],1,[Define to 1 if you have av_register_protocol support]))
+
 
 #
 # Add the right exec path for rc scripts
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -233,10 +233,12 @@
     mpeg1_file_protocol.url_close = file_protocol.url_close;
 
 /* Register the append file protocol. */
-#ifdef HAVE_FFMPEG_AV_REGISTER_PROTOCOL
+#ifdef have_av_register_protocol2
+    av_register_protocol2(&mpeg1_file_protocol, sizeof(mpeg1_file_protocol));
+#elif defined have_av_register_protocol        
     av_register_protocol(&mpeg1_file_protocol);
 #else
-    av_register_protocol2(&mpeg1_file_protocol, sizeof(mpeg1_file_protocol));
+#   warning av_register_protocolXXX missing
 #endif
 }