[MPlayer-dev-eng] [PATCH] towards working shared libav* support

Dominik 'Rathann' Mierzejewski dominik at rangers.eu.org
Sun Sep 14 02:51:39 CEST 2008


Here's the first patch that takes us a step close to working shared
libav* support. It doesn't break anything and fixes a couple of
problems when using ./configure --disable-libav*_a.

OK to apply?

Regards,
R.

-- 
MPlayer http://mplayerhq.hu | Livna http://rpm.livna.org
There should be a science of discontent. People need hard times and
oppression to develop psychic muscles.
	-- from "Collected Sayings of Muad'Dib" by the Princess Irulan
-------------- next part --------------
Index: Makefile
===================================================================
--- Makefile	(revision 27605)
+++ Makefile	(working copy)
@@ -634,7 +634,7 @@
 COMMON_LIBS-$(LIBAVCODEC_A)       += libavcodec/libavcodec.a
 COMMON_LIBS-$(LIBAVUTIL_A)        += libavutil/libavutil.a
 COMMON_LIBS-$(LIBPOSTPROC_A)      += libpostproc/libpostproc.a
-COMMON_LIBS  = libswscale/libswscale.a
+COMMON_LIBS-$(LIBSWSCALE_A)       += libswscale/libswscale.a
 COMMON_LIBS += $(COMMON_LIBS-yes)
 
 OBJS_COMMON    += $(addsuffix .o, $(basename $(SRCS_COMMON)))
@@ -752,7 +752,7 @@
 	$(CC) -o $@ $^ $(LDFLAGS_MPLAYER)
 
 codec-cfg$(EXESUF): codec-cfg.c codec-cfg.h help_mp.h
-	$(HOST_CC) -O -I. -DCODECS2HTML -o $@ $<
+	$(HOST_CC) -O -I. $(EXTRA_INC) -DCODECS2HTML -o $@ $<
 
 codecs.conf.h: codec-cfg$(EXESUF) etc/codecs.conf
 	./$^ > $@
Index: configure
===================================================================
--- configure	(revision 27605)
+++ configure	(working copy)
@@ -293,10 +293,12 @@
   --disable-libavcodec_a    disable static libavcodec [autodetect]
   --disable-libavformat_a   disable static libavformat [autodetect]
   --disable-libpostproc_a   disable static libpostproc [autodetect]
+  --disable-libswscale_a    disable static libswscale [autodetect]
   --disable-libavutil_so    disable shared libavutil [autodetect]
   --disable-libavcodec_so   disable shared libavcodec [autodetect]
   --disable-libavformat_so  disable shared libavformat [autodetect]
   --disable-libpostproc_so  disable shared libpostproc [autodetect]
+  --disable-libswscale_so   disable shared libswscale [autodetect]
   --disable-libavcodec_mpegaudio_hp disable high precision audio decoding
                                     in libavcodec [enabled]
   --disable-tremor-internal disable internal Tremor [enabled]
@@ -517,6 +519,8 @@
 _libavformat_so=auto
 _libpostproc_a=auto
 _libpostproc_so=auto
+_libswscale_a=auto
+_libswscale_so=auto
 _libavcodec_mpegaudio_hp=yes
 _mencoder=yes
 _mplayer=yes
@@ -1082,6 +1086,10 @@
   --disable-libpostproc_a)	_libpostproc_a=no	;;
   --enable-libpostproc_so)	_libpostproc_so=yes	;;
   --disable-libpostproc_so)	_libpostproc_so=no	;;
+  --enable-libswscale_a)	_libswscale_a=yes	;;
+  --disable-libswscale_a)	_libswscale_a=no	;;
+  --enable-libswscale_so)	_libswscale_so=yes	;;
+  --disable-libswscale_so)	_libswscale_so=no	;;
   --enable-libavcodec_mpegaudio_hp)	_libavcodec_mpegaudio_hp=yes	;;
   --disable-libavcodec_mpegaudio_hp)	_libavcodec_mpegaudio_hp=no	;;
 
@@ -6584,6 +6596,42 @@
   && _def_libpostproc_so='#define CONFIG_LIBPOSTPROC_SO 1'
 echores "$_libpostproc"
 
+echocheck "FFmpeg libswscale"
+if test "$_libswscale_a" = auto ; then
+  _libswscale_a=no
+  if test -d libswscale && test -f libswscale/swscale.h ; then
+    _libswscale_a='yes'
+    _res_comment="static"
+  fi
+elif test "$_libswscale_so" = auto ; then
+  _libswscale_so=no
+  _res_comment="using libswscale.so, but static libswscale is recommended"
+  cat > $TMPC << EOF
+  #define CONFIG_LIBSWSCALE 1
+  #include <inttypes.h>
+  #include <libswscale/swscale.h>
+  int main(void) { sws_scale(0, 0, 0, 0, 0, 0, 0); return 0; }
+EOF
+  if $_pkg_config --exists libswscale ; then
+    _inc_libswscale=`$_pkg_config --cflags libswscale`
+    _ld_tmp=`$_pkg_config --libs libswscale`
+    cc_check $_inc_libswscale $_ld_tmp && _ld_extra="$_ld_extra $_ld_tmp" \
+      && _libswscale_so=yes
+  elif cc_check -lswscale ; then
+    _ld_extra="$_ld_extra -lswscale"
+    _libswscale_so=yes
+  fi
+fi
+_libswscale=no
+_def_libswscale='#undef CONFIG_LIBSWSCALE'
+_def_libswscale_a='#undef CONFIG_LIBSWSCALE_A'
+_def_libswscale_so='#undef CONFIG_LIBSWSCALE_SO'
+test "$_libswscale_a" = yes || test "$_libswscale_so" = yes && _libswscale=yes
+test "$_libswscale"    = yes && _def_libswscale='#define CONFIG_LIBSWSCALE 1'
+test "$_libswscale_a"  = yes && _def_libswscale_a='#define CONFIG_LIBSWSCALE_A 1'
+test "$_libswscale_so" = yes \
+  && _def_libswscale_so='#define CONFIG_LIBSWSCALE_SO 1'
+echores "$_libswscale"
 
 echocheck "libamr narrowband"
 if test "$_libamr_nb" = auto ; then
@@ -7952,6 +8000,9 @@
 LIBPOSTPROC = $_libpostproc
 LIBPOSTPROC_A = $_libpostproc_a
 LIBPOSTPROC_SO = $_libpostproc_so
+LIBSWSCALE = $_libswscale
+LIBSWSCALE_A = $_libswscale_a
+LIBSWSCALE_SO = $_libswscale_so
 
 BUILD_STATIC=yes
 SRC_PATH=..
@@ -8321,6 +8372,10 @@
 $_def_libavutil_a
 $_def_libavutil_so
 
+$_def_libswscale
+$_def_libswscale_a
+$_def_libswscale_so
+
 /* Use libavcodec's decoders */
 #define CONFIG_DECODERS 1
 #define ENABLE_DECODERS 1
Index: libmpdemux/demux_lavf.c
===================================================================
--- libmpdemux/demux_lavf.c	(revision 27605)
+++ libmpdemux/demux_lavf.c	(working copy)
@@ -36,9 +36,7 @@
 
 #include "libavformat/avformat.h"
 #include "libavutil/avutil.h"
-#include "libavformat/avi.h"
 #include "libavcodec/opt.h"
-#include "libavformat/riff.h"
 
 #include "mp_taglists.h"
 


More information about the MPlayer-dev-eng mailing list