changeset 17354:60189cd9bbc8

added support for external libavformat
author nicodvb
date Mon, 09 Jan 2006 19:35:44 +0000
parents 0bc4869be931
children 7a99d216c6b7
files cfg-mencoder.h configure libmpcodecs/ae_lavc.c libmpdemux/Makefile libmpdemux/demux_lavf.c libmpdemux/demuxer.c libmpdemux/muxer.c libmpdemux/muxer_lavf.c
diffstat 8 files changed, 49 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-mencoder.h	Mon Jan 09 15:44:15 2006 +0000
+++ b/cfg-mencoder.h	Mon Jan 09 19:35:44 2006 +0000
@@ -55,7 +55,7 @@
 
 extern m_option_t nuvopts_conf[];
 extern m_option_t mpegopts_conf[];
-#ifdef USE_LIBAVFORMAT
+#if defined(USE_LIBAVFORMAT) ||  defined(USE_LIBAVFORMAT_SO)
 extern m_option_t lavfopts_conf[];
 #endif
 
@@ -177,7 +177,7 @@
 m_option_t of_conf[]={
 	{"avi", &out_file_format, CONF_TYPE_FLAG, 0, 0, MUXER_TYPE_AVI, NULL},
 	{"mpeg", &out_file_format, CONF_TYPE_FLAG, 0, 0, MUXER_TYPE_MPEG, NULL},
-#ifdef USE_LIBAVFORMAT
+#if defined(USE_LIBAVFORMAT) ||  defined(USE_LIBAVFORMAT_SO)
 	{"lavf", &out_file_format, CONF_TYPE_FLAG, 0, 0, MUXER_TYPE_LAVF, NULL},
 #endif
 	{"rawvideo", &out_file_format, CONF_TYPE_FLAG, 0, 0, MUXER_TYPE_RAWVIDEO, NULL},
@@ -185,7 +185,7 @@
 	{"help", "\nAvailable output formats:\n"
 	"   avi      - Microsoft Audio/Video Interleaved\n"
 	"   mpeg     - MPEG-1/2 system stream format\n"
-#ifdef USE_LIBAVFORMAT
+#if defined(USE_LIBAVFORMAT) ||  defined(USE_LIBAVFORMAT_SO)
 	"   lavf     - FFmpeg libavformat muxers\n"
 #endif
 	"   rawvideo - (video only, one stream only) raw stream, no muxing\n"
@@ -298,7 +298,7 @@
 
 	{"nuvopts",  nuvopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
 	{"mpegopts",  mpegopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
-#ifdef USE_LIBAVFORMAT
+#if defined(USE_LIBAVFORMAT) ||  defined(USE_LIBAVFORMAT_SO)
 	{"lavfopts",  lavfopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
 #endif	
 
--- a/configure	Mon Jan 09 15:44:15 2006 +0000
+++ b/configure	Mon Jan 09 19:35:44 2006 +0000
@@ -1460,6 +1460,7 @@
 _libavcodecs=`grep 'register_avcodec(&[a-z]' libavcodec/allcodecs.c  | sed 's/.*&\(.*\)).*/\1/'`
 _libavcodecso=auto 
 _libavformat=auto
+_libavformat_so=auto
 _fame=auto
 _mp1e=no
 _mencoder=yes
@@ -6060,6 +6061,19 @@
 echores "$_libavcodecso"
 fi
 
+if test "$_libavformat" != yes ; then
+echocheck "FFmpeg libavformat (dynamic)"
+if test "$_libavformat_so" = auto ; then
+  _libavformat_so=no
+  cat > $TMPC <<EOF
+  #include <ffmpeg/avformat.h>
+  int main(void) { av_alloc_format_context(); return 0; }
+EOF
+  cc_check $_ld_lm -lavformat && _libavformat_so=yes
+fi
+echores "$_libavformat_so"
+fi
+
 _def_libavcodec='#undef USE_LIBAVCODEC'
 _def_libavcodecso='#undef USE_LIBAVCODEC_SO'
 _def_ffpostprocess='#undef FF_POSTPROCESS'
@@ -6083,6 +6097,7 @@
 fi
 
 _def_libavformat='#undef USE_LIBAVFORMAT'
+_def_libavformat_so='#undef USE_LIBAVFORMAT_SO'
 _def_libavformat_win32='#undef CONFIG_WIN32'
 if test "$_libavformat" = yes ; then
   _def_libavformat='#define USE_LIBAVFORMAT 1'
@@ -6091,6 +6106,14 @@
   if win32 ; then
     _def_libavformat_win32='#define CONFIG_WIN32 1'
   fi
+else
+  if test "$_libavformat_so" = yes ; then
+    _def_libavformat_so='#define USE_LIBAVFORMAT_SO 1'
+    _ld_libavformat='-lavformat'
+    if win32 ; then
+      _def_libavformat_win32='#define CONFIG_WIN32 1'
+    fi
+  fi
 fi
 
 echocheck "amr narrowband"
@@ -7184,6 +7207,7 @@
 CONFIG_LIBAVCODEC = $_libavcodec
 CONFIG_LIBAVCODECSO = $_libavcodecso
 CONFIG_LIBAVFORMAT = $_libavformat
+CONFIG_LIBAVFORMAT_SO = $_libavformat_so
 ZORAN = $_zr
 FAME = $_fame
 FAME_LIB = $_ld_fame
@@ -7576,6 +7600,7 @@
 
 /* ffmpeg's libavformat support (requires libavformat source) */
 $_def_libavformat
+$_def_libavformat_so
 $_def_libavformat_win32
 
 /* Use libavcodec's decoders */
--- a/libmpcodecs/ae_lavc.c	Mon Jan 09 15:44:15 2006 +0000
+++ b/libmpcodecs/ae_lavc.c	Mon Jan 09 19:35:44 2006 +0000
@@ -26,7 +26,7 @@
 extern int  lavc_param_atag;
 extern int  avcodec_inited;
 static int compressed_frame_size = 0;
-#ifdef USE_LIBAVFORMAT
+#if defined(USE_LIBAVFORMAT) ||  defined(USE_LIBAVFORMAT_SO)
 extern unsigned int codec_get_wav_tag(int id);
 #endif
 
@@ -167,7 +167,7 @@
 	}
 	if(lavc_param_atag == 0)
 	{
-#ifdef USE_LIBAVFORMAT
+#if defined(USE_LIBAVFORMAT) ||  defined(USE_LIBAVFORMAT_SO)
 		lavc_param_atag = codec_get_wav_tag(lavc_acodec->id);
 #else
 		lavc_param_atag = lavc_find_atag(lavc_param_acodec);
--- a/libmpdemux/Makefile	Mon Jan 09 15:44:15 2006 +0000
+++ b/libmpdemux/Makefile	Mon Jan 09 19:35:44 2006 +0000
@@ -64,7 +64,6 @@
         demux_film.c \
         demux_fli.c \
         demux_gif.c \
-        demux_lavf.c \
         demux_lmlm4.c \
         demux_mf.c \
         demux_mov.c \
@@ -117,7 +116,12 @@
 endif
 ifeq ($(CONFIG_LIBAVFORMAT),yes)
 LIBAV_INC += -I../libavformat
-SRCS += muxer_lavf.c
+SRCS += demux_lavf.c \
+	muxer_lavf.c
+endif
+ifeq ($(CONFIG_LIBAVFORMAT_SO),yes)
+SRCS += demux_lavf.c \
+	muxer_lavf.c
 endif
 
 ifeq ($(MPLAYER_NETWORK),yes)
--- a/libmpdemux/demux_lavf.c	Mon Jan 09 15:44:15 2006 +0000
+++ b/libmpdemux/demux_lavf.c	Mon Jan 09 19:35:44 2006 +0000
@@ -28,10 +28,12 @@
 #include "demuxer.h"
 #include "stheader.h"
 
-#ifdef USE_LIBAVFORMAT
-
+#ifdef USE_LIBAVFORMAT_SO
+#include <ffmpeg/avformat.h>
+#else
 #include "avformat.h"
 #include "avi.h"
+#endif
 
 #define PROBE_BUF_SIZE 2048
 
@@ -451,4 +453,3 @@
   demux_lavf_control
 };
 
-#endif // USE_LIBAVFORMAT
--- a/libmpdemux/demuxer.c	Mon Jan 09 15:44:15 2006 +0000
+++ b/libmpdemux/demuxer.c	Mon Jan 09 19:35:44 2006 +0000
@@ -62,7 +62,9 @@
 extern demuxer_desc_t demuxer_desc_xmms;
 extern demuxer_desc_t demuxer_desc_mpeg_ty;
 extern demuxer_desc_t demuxer_desc_rtp;
+#if defined(USE_LIBAVFORMAT) ||  defined(USE_LIBAVFORMAT_SO)
 extern demuxer_desc_t demuxer_desc_lavf;
+#endif
 extern demuxer_desc_t demuxer_desc_aac;
 
 demuxer_desc_t* demuxer_list[] = {
@@ -119,7 +121,7 @@
 #ifdef STREAMING_LIVE555
   &demuxer_desc_rtp,
 #endif
-#ifdef USE_LIBAVFORMAT
+#if defined(USE_LIBAVFORMAT) ||  defined(USE_LIBAVFORMAT_SO)
   &demuxer_desc_lavf,
 #endif
   &demuxer_desc_aac,
--- a/libmpdemux/muxer.c	Mon Jan 09 15:44:15 2006 +0000
+++ b/libmpdemux/muxer.c	Mon Jan 09 19:35:44 2006 +0000
@@ -35,7 +35,7 @@
         if(! muxer_init_muxer_rawaudio(muxer))
           return NULL;
         break;
-#ifdef USE_LIBAVFORMAT
+#if defined(USE_LIBAVFORMAT) || defined(USE_LIBAVFORMAT_SO)
       case MUXER_TYPE_LAVF:
         if(! muxer_init_muxer_lavf(muxer))
 	  return NULL;
--- a/libmpdemux/muxer_lavf.c	Mon Jan 09 15:44:15 2006 +0000
+++ b/libmpdemux/muxer_lavf.c	Mon Jan 09 19:35:44 2006 +0000
@@ -17,7 +17,11 @@
 #include "demuxer.h"
 #include "stheader.h"
 #include "m_option.h"
+#ifdef USE_LIBAVFORMAT_SO
+#include <ffmpeg/avformat.h>
+#else
 #include "avformat.h"
+#endif
 
 extern unsigned int codec_get_wav_tag(int id);
 extern enum CodecID codec_get_bmp_id(unsigned int tag);