summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2006-09-12 00:06:05 +0000
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2006-09-12 00:06:05 +0000
commita065c7dc482ea280d7f30f23626171a8303ec488 (patch)
tree13d772054bacf6230dab7e398517ecd906e69245
parentea9a0462ef4b08279957e281e2e6bc33ff4ca7ee (diff)
downloadxine-lib-a065c7dc482ea280d7f30f23626171a8303ec488.tar.gz
xine-lib-a065c7dc482ea280d7f30f23626171a8303ec488.tar.bz2
Rewrite external ffmpeg support by using pkg-config rather than ad-hoc tests. To change the prefix, simply change the variables from outside or add the directory containing the .pc files to PKG_CONFIG_PATH environment variable.
CVS patchset: 8222 CVS date: 2006/09/12 00:06:05
-rw-r--r--configure.ac40
-rw-r--r--m4/Makefile.am1
-rw-r--r--m4/ffmpeg.m4173
-rw-r--r--src/libffmpeg/Makefile.am8
-rw-r--r--src/post/planar/Makefile.am8
5 files changed, 38 insertions, 192 deletions
diff --git a/configure.ac b/configure.ac
index 68fc6824d..83b8239da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -346,10 +346,36 @@ dnl mpeg2lib and ffmpeg stuff
dnl ---------------------------------------------
AC_SUBST(LIBMPEG2_CFLAGS)
-AC_SUBST(LIBFFMPEG_CPPFLAGS)
+
+AC_ARG_WITH([external-ffmpeg], AC_HELP_STRING([--with-external-ffmpeg], [use external ffmpeg library]))
+
+if test "x$with_external_ffmpeg" = "xyes"; then
+ PKG_CHECK_MODULES([FFMPEG], [libavcodec >= 51.11.0])
+ PKG_CHECK_MODULES([FFMPEG_POSTPROC], [libpostproc >= 51.11.0])
+ AC_SUBST([FFMPEG_CFLAGS])
+ AC_SUBST([FFMPEG_LIBS])
+ AC_SUBST([FFMPEG_POSTPROC_CFLAGS])
+ AC_SUBST([FFMPEG_POSTPROC_LIBS])
+ AC_DEFINE([HAVE_FFMPEG], [1], [Define this if you have ffmpeg library])
+
+ AC_MSG_NOTICE([
+*********************************************************************
+xine is configured with external ffmpeg.
+
+This requires the same version of ffmpeg what is included in xine and
+you should know what you do. If some problems occur, please try to
+use internal ffmpeg.
+*********************************************************************])
+else
+ AC_MSG_RESULT([using included ffmpeg])
+ LIBFFMPEG_CPPFLAGS="-DSIMPLE_IDCT -DHAVE_AV_CONFIG_H -DRUNTIME_CPUDETECT -DCONFIG_RISKY -DCONFIG_DECODERS -DXINE_MPEG_ENCODER -DCONFIG_ZLIB -DCONFIG_GPL"
+ AC_SUBST([LIBFFMPEG_CPPFLAGS])
+
+ AC_CHECK_TYPES(int_fast8_t, [], [LIBFFMPEG_CPPFLAGS="$LIBFFMPEG_CPPFLAGS -DEMULATE_FAST_INT"])
+fi
+AM_CONDITIONAL(HAVE_FFMPEG, test "x$with_external_ffmpeg" = "xyes")
LIBMPEG2_CFLAGS=""
-LIBFFMPEG_CPPFLAGS="-DSIMPLE_IDCT -DHAVE_AV_CONFIG_H -DRUNTIME_CPUDETECT -DCONFIG_RISKY -DCONFIG_DECODERS -DXINE_MPEG_ENCODER -DCONFIG_ZLIB -DCONFIG_GPL"
AC_CHECK_DECL(lrintf,[
AC_DEFINE(HAVE_LRINTF,1,[Define this if the 'lrintf' function is declared in math.h])
@@ -364,8 +390,6 @@ AC_CHECK_DECL(rintf,[
#include <math.h>
])
-AC_CHECK_TYPES(int_fast8_t, [], [LIBFFMPEG_CFLAGS="$LIBFFMPEG_CFLAGS -DEMULATE_FAST_INT"])
-
AC_ARG_ENABLE([altivec],
AS_HELP_STRING([--disable-altivec], [do not use assembly codes for Motorola 74xx CPUs]))
@@ -413,10 +437,6 @@ AM_CONDITIONAL(HAVE_MLIB, test x$ac_have_mlib = "xyes")
AC_SUBST(MLIB_LIBS)
AC_SUBST(MLIB_CFLAGS)
-AM_PATH_FFMPEG(AC_DEFINE(HAVE_FFMPEG, 1, [Define this if you have ffmpeg library]))
-AM_CONDITIONAL(HAVE_FFMPEG, test x"$external_ffmpeg_found" = "xyes")
-
-
dnl ---------------------------------------------
dnl Checks for X11
dnl ---------------------------------------------
@@ -2507,7 +2527,7 @@ dnl video decoders
echo " * video decoder plugins:"
echo " - MPEG 1,2 - Amiga Bitplane"
echo " - Raw RGB - Raw YUV"
-if test x"$external_ffmpeg_found" = "xyes"; then
+if test "x$with_external_ffmpeg" = "xyes"; then
echo " - ffmpeg (external library):"
else
echo " - ffmpeg (internal library):"
@@ -2550,7 +2570,7 @@ dnl audio decoders
echo " * audio decoder plugins:"
echo " - GSM 06.10"
echo " - linear PCM - Nosefart (NSF)"
-if test x"$external_ffmpeg_found" = "xyes"; then
+if test "x$with_external_ffmpeg" = "xyes"; then
echo " - ffmpeg (external library):"
else
echo " - ffmpeg (internal library):"
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 98e559820..40f4be43a 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -19,7 +19,6 @@ EXTRA_DIST = glibc2.m4 intdiv0.m4 intmax.m4 inttypes.m4 inttypes_h.m4 inttypes-p
dl.m4 \
dvdnav.m4 \
esd.m4 \
- ffmpeg.m4 \
freetype2.m4 \
gettext.m4 \
glibc21.m4 \
diff --git a/m4/ffmpeg.m4 b/m4/ffmpeg.m4
deleted file mode 100644
index 8f056ffc8..000000000
--- a/m4/ffmpeg.m4
+++ /dev/null
@@ -1,173 +0,0 @@
-dnl
-dnl autoconf script for searching and checking ffmpeg
-dnl
-dnl written by Frantisek Dvorak <valtri@users.sourceforge.net>
-dnl
-dnl
-dnl AM_PATH_FFMPEG([ACTION IF FOUND [, ACTION IF NOT FOUND]]))
-dnl
-dnl It looks for ffmpeg, defines FFMPEG_CPPFLAGS, FFMPEG_LDFLAFS, FFMPEG_LIBS and
-dbl FFMPEG_POSTPROC_LIBS.
-dnl
-AC_DEFUN([AM_PATH_FFMPEG], [
-
-AC_ARG_WITH(external-ffmpeg, AC_HELP_STRING([--with-external-ffmpeg@<:@=DIR@:>@], [use external ffmpeg library]),
- [external_ffmpeg="$withval"],
- [external_ffmpeg="no"]
-)
-
-if test x"$external_ffmpeg" != "xno"; then
-
- dnl get the prefix, if specified
- if test x"$external_ffmpeg" != "xyes"; then
- ffmpeg_prefix="$withval"
- fi
-
- dnl disable test if requested
- AC_ARG_ENABLE(ffmpegtest,
- AC_HELP_STRING([--disable-ffmpegtest],
- [Do not try compile and run a test ffmpeg program. It will need specify custom FFMPEG_CPPFLAGS and FFMPEG_LIBS environment variables.]
- ),
- enable_ffmpegtest="$enableval",
- enable_ffmpegtest=yes
- )
-
- if test x"$enable_ffmpegtest" = "xyes"; then
- ac_save_LDFLAGS="${LDFLAGS}"
- ac_save_CPPFLAGS="${CPPFLAGS}"
- external_ffmpeg_found=no
-
- dnl look for the ffmpeg or just check specified flags
- if test x"$FFMPEG_CPPFLAGS" = "x" -a x"$FFMPEG_LDFLAGS" = "x" -a x"$FFMPEG_LIBS" = x -a x"$FFMPEG_POSTPROC_LIBS" = "x"; then
- dnl look for ffmpeg
- if test x"$ffmpeg_prefix" = "x"; then
- prefixes="/usr /usr/local /opt"
- else
- prefixes="$ffmpeg_prefix"
- fi
- for dir in $prefixes; do
- if test -d ${dir}/include/postproc ; then
- postproc=" -I${dir}/include/postproc"
- elif test -d ${dir}/include/ffmpeg/postproc ; then
- postproc=" -I${dir}/include/ffmpeg/postproc"
- fi
- FFMPEG_CPPFLAGS="-I${dir}/include/ffmpeg${postproc}"
- FFMPEG_LDFLAGS="-L${dir}/lib"
- CPPFLAGS="${FFMPEG_CPPFLAGS} ${ac_save_CPPFLAGS}"
- LDFLAGS="${FFMPEG_LDFLAGS} ${ac_save_LDFLAGS}"
-
- dnl drop the cache
- for i in "ac_cv_header_avcodec_h" "ac_cv_header_postprocess_h" \
- "ac_cv_lib_avcodec_pp_get_context" \
- "ac_cv_lib_postproc_pp_get_context" \
- "ac_cv_lib_avcodec_register_avcodec"; do
- $as_unset $i || test "${$i+set}" != set || { $i=; export $i; }
- done
-
- dnl look for headers
- AC_CHECK_HEADER(avcodec.h, , continue)
- AC_CHECK_HEADER(postprocess.h, , continue)
-
- dnl look for libpostproc and libpostproc inside libavcodec
- AC_CHECK_LIB(postproc, pp_get_context,
- [FFMPEG_POSTPROC_LIBS="-lpostproc"],
- AC_CHECK_LIB(avcodec, pp_get_context,
- [FFMPEG_POSTPROC_LIBS="-lavcodec"],
- [break],
- []
- ),
- []
- )
-
- dnl look for libavcodec
- AC_CHECK_LIB(avcodec, register_avcodec,
- [external_ffmpeg_found=yes
- FFMPEG_LIBS="-lavcodec"
- break]
- )
- done
-
- dnl result of autodetection
- if test x"$external_ffmpeg_found" = "xyes"; then
- AC_MSG_RESULT([External ffmpeg library was found in ${dir}.])
- else
- AC_MSG_ERROR([External ffmpeg library not found.
-*********************************************************************
-You can try to specify prefix of ffmpeg library by the option
---with-external-ffmpeg=prefix, or to specify custom FFMPEG_CPPFLAGS,
-FFMPEG_LIBS and FFMPEG_POSTPROC_LIBS.
-
-If you would like to use the internal ffmpeg, please remove the
-configure option --with-external-ffmpeg.
-*********************************************************************])
- fi
- else
- dnl check specified flags
- CPPFLAGS="${ac_save_CPPFLAGS} ${FFMPEG_CPPFLAGS}"
- LDFLAGS="${ac_save_LDFLAGS} ${FFMPEG_LDFLAGS} ${FFMPEG_LIBS} ${FFMPEG_POSTPROC_LIBS}"
- AC_LINK_IFELSE([#include <avcodec.h>
-#include <postprocess.h>
-
-int main() {
- register_avcodec((void *)0);
- pp_get_context(0, 0, 0);
-}
-],
- [external_ffmpeg_found=yes],
- [external_ffmpeg_found=no],
- )
-
- dnl result
- if test x"$external_ffmpeg_found" = "xyes"; then
- AC_MSG_RESULT([Using custom FFMPEG_CPPFLAGS and FFMPEG_LIBS for external ffmpeg.])
- else
- AC_MSG_ERROR([External ffmpeg library not found with specified options.
-*********************************************************************
-You can try to specify prefix of ffmpeg library by the option
---with-external-ffmpeg=prefix, or to specify different
-FFMPEG_CPPFLAGS and FFMPEG_LIBS.
-
-If you would like to use the internal ffmpeg, please remove the
-configure option --with-external-ffmpeg.
-*********************************************************************])
- fi
- fi
- CPPFLAGS="${ac_save_CPPFLAGS}"
- LDFLAGS="${ac_save_LDFLAGS}"
- else
- if test x"${FFMPEG_CPPFLAGS}" = "x" -a x"${FFMPEG_LIBS}" = "x"; then
- external_ffmpeg_found=no
- AC_MSG_ERROR([You should specify FFMPEG_CPPFLAGS and FFMPEG_LIBS.])
- else
- external_ffmpeg_found=yes
- AC_MSG_RESULT([Forced using custom FFMPEG_CPPFLAGS and FFMPEG_LIBS.])
- fi
- fi
-
-
- dnl result
- if test x"$external_ffmpeg_found" = "xyes"; then
- dnl common warning
- AC_MSG_NOTICE([
-*********************************************************************
-xine is configured with external ffmpeg.
-
-This requires the same version of ffmpeg what is included in xine and
-you should know what you do. If some problems occur, please try to
-use internal ffmpeg.
-*********************************************************************])
- ifelse([$1], , :, [$1])
- else
- ifelse([$2], , :, [$2])
- fi
-
- AC_SUBST(FFMPEG_CPPFLAGS)
- AC_SUBST(FFMPEG_LDFLAGS)
- AC_SUBST(FFMPEG_LIBS)
- AC_SUBST(FFMPEG_POSTPROC_LIBS)
-
-else
- AC_MSG_RESULT([using included ffmpeg])
-fi
-
-])
diff --git a/src/libffmpeg/Makefile.am b/src/libffmpeg/Makefile.am
index b6e1c2893..bcae2c505 100644
--- a/src/libffmpeg/Makefile.am
+++ b/src/libffmpeg/Makefile.am
@@ -1,8 +1,8 @@
include $(top_srcdir)/misc/Makefile.common
if HAVE_FFMPEG
-ff_cppflags = $(FFMPEG_CPPFLAGS)
-link_ffmpeg = $(FFMPEG_LDFLAGS) $(FFMPEG_LIBS) $(FFMPEG_POSTPROC_LIBS)
+AM_CFLAGS = $(FFMPEG_CFLAGS) $(FFMPEG_POSTPROC_CFLAGS)
+link_ffmpeg = $(FFMPEG_LIBS) $(FFMPEG_POSTPROC_LIBS)
else
ff_cppflags = -I$(top_srcdir)/src/libffmpeg/libavutil
link_ffmpeg = \
@@ -32,12 +32,12 @@ xineplug_decode_ff_la_SOURCES = xine_decoder.c audio_decoder.c video_decoder.c \
mpeg_parser.c
endif
-xineplug_decode_ff_la_CFLAGS = $(VISIBILITY_FLAG)
+xineplug_decode_ff_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS)
xineplug_decode_ff_la_LDFLAGS = -avoid-version -module @IMPURE_TEXT_LDFLAGS@
xineplug_decode_ff_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) -lm $(ZLIB_LIBS) \
$(link_ffmpeg) $(THREAD_LIBS)
-xineplug_decode_dvaudio_la_CFLAGS = $(VISIBILITY_FLAG)
+xineplug_decode_dvaudio_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS)
xineplug_decode_dvaudio_la_LDFLAGS = -avoid-version -module
xineplug_decode_dvaudio_la_SOURCES = dvaudio_decoder.c
xineplug_decode_dvaudio_la_LIBADD = $(XINE_LIB)
diff --git a/src/post/planar/Makefile.am b/src/post/planar/Makefile.am
index a79ed835b..3440ff6ec 100644
--- a/src/post/planar/Makefile.am
+++ b/src/post/planar/Makefile.am
@@ -4,16 +4,16 @@ POSTPROC_INT_LIB = $(top_builddir)/src/libffmpeg/libavcodec/libpostproc/libpostp
if HAVE_FFMPEG
postproc_lib = $(FFMPEG_POSTPROC_LIBS)
-ff_cppflags = $(FFMPEG_CPPFLAGS)
+ff_cflags = $(FFMPEG_POSTPROC_CFLAGS)
else
-ff_cppflags = -I$(top_srcdir)/src/libffmpeg/libavcodec/libpostproc
+ff_cflags = -I$(top_srcdir)/src/libffmpeg/libavcodec/libpostproc
postproc_lib = $(POSTPROC_INT_LIB)
postproc_dep = $(postproc_lib)
endif
# -fomit-frame-pointer is always needed. it might cause debug to not
# work, but at least it compiles.
-AM_CPPFLAGS = $(ff_cppflags) -fomit-frame-pointer
+AM_CFLAGS = $(ff_cflags) -fomit-frame-pointer
libdir = $(XINE_PLUGINDIR)/post
@@ -25,7 +25,7 @@ xineplug_post_planar_la_DEPENDENCIES = $(postproc_dep)
xineplug_post_planar_la_LIBADD = $(XINE_LIB) $(postproc_lib) -lm $(THREAD_LIBS)
xineplug_post_planar_la_LDFLAGS = -avoid-version -module \
@IMPURE_TEXT_LDFLAGS@
-xineplug_post_planar_la_CFLAGS = $(VISIBILITY_FLAG)
+xineplug_post_planar_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS)
$(POSTPROC_INT_LIB):
cd $(top_builddir)/src/libffmpeg/libavcodec/libpostproc && $(MAKE) libpostprocess.la