[vlc-devel] commit: --enable-merge-ffmpeg: kludge to make avcodec and avformat plugins one ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Sep 20 22:20:28 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Sep 20 23:18:49 2009 +0300| [2c68d5a40d7c4eff0a18b0d9275fe218848cd27c] | committer: Rémi Denis-Courmont 

--enable-merge-ffmpeg: kludge to make avcodec and avformat plugins one

This is ugly, but can save a few megabytes at download-, install- and
run-time when avcodec is linked in statically.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2c68d5a40d7c4eff0a18b0d9275fe218848cd27c
---

 configure.ac                      |   17 ++++++++++++++---
 modules/codec/avcodec/Modules.am  |   10 ++++++++++
 modules/codec/avcodec/avcodec.c   |    8 ++++++++
 modules/demux/avformat/avformat.c |   10 ++++------
 4 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index b6a241e..a067aa5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2861,6 +2861,12 @@ AS_IF([test "${enable_id3tag}" = "yes"], [
     ])
 ])
 
+AC_ARG_ENABLE(merge-ffmpeg,
+[  --enable-merged-ffmpeg  merge FFMPEG-based plugins (default disabled)],, [
+  enable_merge_ffmpeg="no"
+])
+AM_CONDITIONAL([MERGE_FFMPEG], [test "$enable_merge_ffmpeg" != "no"])
+
 dnl
 dnl  avcodec decoder/encoder plugin
 dnl
@@ -2921,9 +2927,14 @@ then
       CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}"
       AC_CHECK_HEADERS(libavformat/avformat.h ffmpeg/avformat.h)
       AC_CHECK_HEADERS(libavutil/avutil.h ffmpeg/avutil.h)
-      VLC_ADD_PLUGIN([avformat])
-      VLC_ADD_LIBS([avformat],[$AVFORMAT_LIBS $AVUTIL_LIBS])
-      VLC_ADD_CFLAGS([avformat],[$AVFORMAT_CFLAGS $AVUTIL_CFLAGS])
+      AS_IF([test "$enable_merge_ffmpeg" = "no"], [
+        VLC_ADD_PLUGIN([avformat])
+        VLC_ADD_LIBS([avformat],[$AVFORMAT_LIBS $AVUTIL_LIBS])
+        VLC_ADD_CFLAGS([avformat],[$AVFORMAT_CFLAGS $AVUTIL_CFLAGS])
+      ], [
+        VLC_ADD_LIBS([avcodec],[$AVFORMAT_LIBS $AVUTIL_LIBS])
+        VLC_ADD_CFLAGS([avcodec],[$AVFORMAT_CFLAGS $AVUTIL_CFLAGS])
+      ])
       VLC_RESTORE_FLAGS
     ],[
       AC_MSG_ERROR([Could not find libavformat or libavutil. Use --disable-avformat to ignore this error.])
diff --git a/modules/codec/avcodec/Modules.am b/modules/codec/avcodec/Modules.am
index 062c5ca..1a345f5 100644
--- a/modules/codec/avcodec/Modules.am
+++ b/modules/codec/avcodec/Modules.am
@@ -19,6 +19,16 @@ libavcodec_plugin_la_CFLAGS = $(AM_CFLAGS)
 libavcodec_plugin_la_LIBADD = $(AM_LIBADD)
 libavcodec_plugin_la_DEPENDENCIES =
 
+if MERGE_FFMPEG
+libavcodec_plugin_la_SOURCES += \
+	../../demux/avformat/demux.c
+if ENABLE_SOUT
+libavcodec_plugin_la_SOURCES += \
+	../../demux/avformat/mux.c
+endif
+libavcodec_plugin_la_CFLAGS += -DMERGE_FFMPEG
+endif
+
 libvlc_LTLIBRARIES += \
 	$(LTLIBavcodec)
 
diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index 092bb90..cdbc794 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -78,6 +78,10 @@ static const char *const enc_hq_list_text[] = {
     N_("rd"), N_("bits"), N_("simple") };
 #endif
 
+#ifdef MERGE_FFMPEG
+# include "../../demux/avformat/avformat.h"
+#endif
+
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
@@ -206,6 +210,10 @@ vlc_module_begin ()
     set_description( N_("FFmpeg deinterlace video filter") )
     add_shortcut( "ffmpeg-deinterlace" )
 
+#ifdef MERGE_FFMPEG
+    add_submodule ()
+#   include "../../demux/avformat/avformat.c"
+#endif
 vlc_module_end ()
 
 /*****************************************************************************
diff --git a/modules/demux/avformat/avformat.c b/modules/demux/avformat/avformat.c
index 35a26f6..b5974a4 100644
--- a/modules/demux/avformat/avformat.c
+++ b/modules/demux/avformat/avformat.c
@@ -22,9 +22,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
+#ifndef MERGE_FFMPEG
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
@@ -34,10 +32,8 @@
 
 #include "avformat.h"
 
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
 vlc_module_begin ()
+#endif /* MERGE_FFMPEG */
     add_shortcut( "ffmpeg" )
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_DEMUX )
@@ -56,4 +52,6 @@ vlc_module_begin ()
                 MUX_LONGTEXT, true )
     set_callbacks( OpenMux, CloseMux )
 #endif
+#ifndef MERGE_FFMPEG
 vlc_module_end ()
+#endif




More information about the vlc-devel mailing list