From 0adb6a63ec58c8d0343906fe60dd0320582e553e Mon Sep 17 00:00:00 2001 From: Gildas Bazin Date: Sun, 20 Apr 2003 11:57:13 +0000 Subject: [PATCH] * configure.ac.in, modules/codec/ffmpeg/*, modules/encoder/ffmpeg/*, modules/stream_out/transcode.c: fixed detection of the ffmpeg headers/libs when they are installed in their default location. --- configure.ac.in | 77 ++++++++++++++++++++-------------- modules/codec/ffmpeg/audio.c | 9 +++- modules/codec/ffmpeg/ffmpeg.c | 15 +++++-- modules/codec/ffmpeg/video.c | 16 +++++-- modules/encoder/ffmpeg/audio.c | 9 +++- modules/encoder/ffmpeg/video.c | 9 +++- modules/stream_out/transcode.c | 9 +++- 7 files changed, 99 insertions(+), 45 deletions(-) diff --git a/configure.ac.in b/configure.ac.in index 96b4424128..0996baa6c5 100644 --- a/configure.ac.in +++ b/configure.ac.in @@ -1507,41 +1507,59 @@ AC_ARG_ENABLE(ffmpeg, if test "x${enable_ffmpeg}" = "xyes" then AC_ARG_WITH(ffmpeg, - [ --with-ffmpeg=PATH path to ffmpeg installation],[],[]) - if test "x${with_ffmpeg}" != "xno" -a "x${with_ffmpeg}" != "x" - then + [ --with-ffmpeg=PATH path to ffmpeg installation]) + AC_ARG_WITH(ffmpeg-tree, + [ --with-ffmpeg-tree=PATH ffmpeg tree for static linking]) + + dnl + dnl test for --with-ffmpeg + dnl + if test "x${with_ffmpeg}" != "xno" -a "x${with_ffmpeg}" != "x"; then CPPFLAGS_ffmpeg="${CPPFLAGS_ffmpeg} -I${with_ffmpeg}/include/ffmpeg" LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -L${with_ffmpeg}/lib" CPPFLAGS_stream_out_transcode="${CPPFLAGS_stream_out_transcode} -I${with_ffmpeg}/include/ffmpeg" LDFLAGS_stream_out_transcode="${LDFLAGS_stream_out_transcode} -L${with_ffmpeg}/lib" - fi - dnl Add postprocessing modules - PLUGINS="${PLUGINS} postprocessing_c" - if test "x${ac_cv_mmx_inline}" != "xno"; then - PLUGINS="${PLUGINS} postprocessing_mmx" + dnl + dnl test for !(--with-ffmpeg) && !(--with-ffmpeg-tree) + dnl + if test "x${with_ffmpeg_tree}" == "xno" -o "x${with_ffmpeg_tree}" == "x";then + if test "x${with_ffmpeg}" == "xno" -o "x${with_ffmpeg}" == "x"; then + AC_CHECK_HEADERS(ffmpeg/avcodec.h postproc/postprocess.h) + fi fi - if test "x${ac_cv_mmxext_inline}" != "xno"; then - PLUGINS="${PLUGINS} postprocessing_mmxext" + dnl + dnl test for !(--with-ffmpeg-tree) + dnl + if test "x${with_ffmpeg}" == "xno" -o "x${with_ffmpeg}" == "x"; then + CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_ffmpeg}" + LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}" + AC_CHECK_LIB(avcodec, avcodec_init, [ + BUILTINS="${BUILTINS} ffmpeg stream_out_transcode" + LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lavcodec" + dnl XXX: we don't link with -lavcodec a 2nd time because the OS X + dnl linker would miserably barf on multiple definitions. + LDFLAGS_stream_out_transcode="${LDFLAGS_stream_out_transcode}" ], + [ AC_MSG_ERROR([Cannot find libavcodec library...]) ]) + LDFLAGS="${LDFLAGS_save}" + CPPFLAGS="${CPPFLAGS_save}" fi - AC_ARG_WITH(ffmpeg-tree, - [ --with-ffmpeg-tree=PATH ffmpeg tree for static linking]) - if test "x${with_ffmpeg_tree}" != "x" - then + dnl + dnl test for --with-ffmpeg-tree + dnl + if test "x${with_ffmpeg_tree}" != "xno" -a "x${with_ffmpeg_tree}" != "x";then AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree}) real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`" - if test "x${real_ffmpeg_tree}" = x - then + if test "x${real_ffmpeg_tree}" = x; then dnl The given directory can't be found AC_MSG_RESULT(no) AC_MSG_ERROR([cannot cd to ${with_ffmpeg_tree}]) fi - if test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a" - then + if test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a"; then dnl Use a custom libffmpeg AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a) BUILTINS="${BUILTINS} ffmpeg stream_out_transcode" @@ -1552,24 +1570,21 @@ then dnl linker would miserably barf on multiple definitions. LDFLAGS_stream_out_transcode="${LDFLAGS_stream_out_transcode} -L${real_ffmpeg_tree}/libavcodec" CPPFLAGS_stream_out_transcode="${CPPFLAGS_stream_out_transcode} -I${real_ffmpeg_tree}/libavcodec" - else dnl The given libavcodec wasn't built AC_MSG_RESULT(no) AC_MSG_ERROR([cannot find ${real_ffmpeg_tree}/libavcodec/libavcodec.a, make sure you compiled libavcodec in ${with_ffmpeg_tree}]) fi - else - CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_ffmpeg}" - LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}" - AC_CHECK_LIB(avcodec, avcodec_init, [ - BUILTINS="${BUILTINS} ffmpeg stream_out_transcode" - LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lavcodec" - dnl XXX: we don't link with -lavcodec a 2nd time because the OS X - dnl linker would miserably barf on multiple definitions. - LDFLAGS_stream_out_transcode="${LDFLAGS_stream_out_transcode}" ], - [ AC_MSG_ERROR([Cannot find libavcodec library...]) ]) - LDFLAGS="${LDFLAGS_save}" - CPPFLAGS="${CPPFLAGS_save}" + fi + + dnl Add postprocessing modules + PLUGINS="${PLUGINS} postprocessing_c" + if test "x${ac_cv_mmx_inline}" != "xno"; then + PLUGINS="${PLUGINS} postprocessing_mmx" + fi + + if test "x${ac_cv_mmxext_inline}" != "xno"; then + PLUGINS="${PLUGINS} postprocessing_mmxext" fi fi diff --git a/modules/codec/ffmpeg/audio.c b/modules/codec/ffmpeg/audio.c index 34ef406848..d38d06e9df 100644 --- a/modules/codec/ffmpeg/audio.c +++ b/modules/codec/ffmpeg/audio.c @@ -2,7 +2,7 @@ * audio.c: audio decoder using ffmpeg library ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: audio.c,v 1.15 2003/04/17 10:58:30 fenrir Exp $ + * $Id: audio.c,v 1.16 2003/04/20 11:57:13 gbazin Exp $ * * Authors: Laurent Aimar * @@ -45,7 +45,12 @@ #include "codecs.h" #include "aout_internal.h" -#include "avcodec.h" /* ffmpeg */ +/* ffmpeg header */ +#ifdef HAVE_FFMPEG_AVCODEC_H +# include +#else +# include +#endif //#include "postprocessing/postprocessing.h" #include "ffmpeg.h" diff --git a/modules/codec/ffmpeg/ffmpeg.c b/modules/codec/ffmpeg/ffmpeg.c index 983802f683..b7ff89cba4 100644 --- a/modules/codec/ffmpeg/ffmpeg.c +++ b/modules/codec/ffmpeg/ffmpeg.c @@ -2,7 +2,7 @@ * ffmpeg.c: video decoder using ffmpeg library ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: ffmpeg.c,v 1.30 2003/04/17 10:58:30 fenrir Exp $ + * $Id: ffmpeg.c,v 1.31 2003/04/20 11:57:13 gbazin Exp $ * * Authors: Laurent Aimar * @@ -38,7 +38,12 @@ # include #endif -#include "avcodec.h" /* ffmpeg */ +/* ffmpeg header */ +#ifdef HAVE_FFMPEG_AVCODEC_H +# include +#else +# include +#endif #if LIBAVCODEC_BUILD < 4655 # error You must have a libavcodec >= 4655 (get CVS) @@ -48,7 +53,11 @@ #include "ffmpeg.h" #ifdef LIBAVCODEC_PP -# include "libpostproc/postprocess.h" +# ifndef HAVE_POSTPROC_POSTPROCESS_H +# include +# else +# include +# endif #else # include "postprocessing/postprocessing.h" #endif diff --git a/modules/codec/ffmpeg/video.c b/modules/codec/ffmpeg/video.c index 7df0e832b3..3f8320c405 100644 --- a/modules/codec/ffmpeg/video.c +++ b/modules/codec/ffmpeg/video.c @@ -2,7 +2,7 @@ * video.c: video decoder using ffmpeg library ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: video.c,v 1.20 2003/04/17 10:58:30 fenrir Exp $ + * $Id: video.c,v 1.21 2003/04/20 11:57:13 gbazin Exp $ * * Authors: Laurent Aimar * Gildas Bazin @@ -39,11 +39,21 @@ # include #endif -#include "avcodec.h" /* ffmpeg */ +/* ffmpeg header */ +#ifdef HAVE_FFMPEG_AVCODEC_H +# include +#else +# include +#endif + #include "ffmpeg.h" #ifdef LIBAVCODEC_PP -# include "libpostproc/postprocess.h" +# ifdef HAVE_POSTPROC_POSTPROCESS_H +# include +# else +# include +# endif #else # include "postprocessing/postprocessing.h" #endif diff --git a/modules/encoder/ffmpeg/audio.c b/modules/encoder/ffmpeg/audio.c index 5d0fa8a688..21bc0a2d62 100644 --- a/modules/encoder/ffmpeg/audio.c +++ b/modules/encoder/ffmpeg/audio.c @@ -2,7 +2,7 @@ * audio.c : audio encoder using ffmpeg library ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: audio.c,v 1.1 2003/01/22 10:41:57 fenrir Exp $ + * $Id: audio.c,v 1.2 2003/04/20 11:57:13 gbazin Exp $ * * Authors: Laurent Aimar * @@ -33,7 +33,12 @@ #include "codecs.h" -#include +/* ffmpeg header */ +#ifdef HAVE_FFMPEG_AVCODEC_H +# include +#else +# include +#endif /***************************************************************************** * Local prototypes diff --git a/modules/encoder/ffmpeg/video.c b/modules/encoder/ffmpeg/video.c index 89d36629eb..f1e34ac283 100644 --- a/modules/encoder/ffmpeg/video.c +++ b/modules/encoder/ffmpeg/video.c @@ -2,7 +2,7 @@ * video.c : video encoder using ffmpeg library ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: video.c,v 1.1 2003/01/22 10:41:57 fenrir Exp $ + * $Id: video.c,v 1.2 2003/04/20 11:57:13 gbazin Exp $ * * Authors: Laurent Aimar * @@ -34,7 +34,12 @@ #include "codecs.h" #include "encoder.h" -#include +/* ffmpeg header */ +#ifdef HAVE_FFMPEG_AVCODEC_H +# include +#else +# include +#endif int E_( OpenEncoderVideo ) ( vlc_object_t * ); void E_( CloseEncoderVideo )( vlc_object_t * ); diff --git a/modules/stream_out/transcode.c b/modules/stream_out/transcode.c index ee5f99af71..8b22c2a791 100644 --- a/modules/stream_out/transcode.c +++ b/modules/stream_out/transcode.c @@ -2,7 +2,7 @@ * transcode.c ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: transcode.c,v 1.3 2003/04/16 16:33:35 fenrir Exp $ + * $Id: transcode.c,v 1.4 2003/04/20 11:57:13 gbazin Exp $ * * Authors: Laurent Aimar * @@ -31,7 +31,12 @@ #include #include -#include +/* ffmpeg header */ +#ifdef HAVE_FFMPEG_AVCODEC_H +# include +#else +# include +#endif /***************************************************************************** * Exported prototypes