Description: Improve av_register_protocol2()/av_register_protocol() detection Author: Angel Carpintero 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 - 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 }