]> git.sesse.net Git - vlc/commitdiff
--enable-merge-ffmpeg: kludge to make avcodec and avformat plugins one
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 20 Sep 2009 20:18:49 +0000 (23:18 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 20 Sep 2009 20:19:42 +0000 (23:19 +0300)
This is ugly, but can save a few megabytes at download-, install- and
run-time when avcodec is linked in statically.

configure.ac
modules/codec/avcodec/Modules.am
modules/codec/avcodec/avcodec.c
modules/demux/avformat/avformat.c

index b6a241e16f852b8129c5d54a2fd80c13c462a2b9..a067aa5abe62dd3741761a42625e971085d14c51 100644 (file)
@@ -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.])
index 062c5ca3eace29bdd6752f555a3898f1c30d915f..1a345f53f05d4f7d2a1f23214619ba97d6d6802b 100644 (file)
@@ -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)
 
index 092bb90ab6472232bff4c17397cfc0420a18fc24..cdbc794bea9914faaafdd48cb71f7d9139cad36c 100644 (file)
@@ -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 ()
 
 /*****************************************************************************
index 35a26f61fb511bcd3ebae522097c6814dca9e462..b5974a42670d43768cdbba2d451be90303ee0f9c 100644 (file)
@@ -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
 
 #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