[vlc-devel] [PATCH] avcodec: move the common code between ffmpeg modules in a static library

Steve Lhomme robux4 at videolabs.io
Sat Nov 11 19:07:43 CET 2017


---
 modules/codec/Makefile.am      | 10 +++++-----
 modules/demux/Makefile.am      |  7 ++-----
 modules/packetizer/Makefile.am |  6 ++----
 3 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/modules/codec/Makefile.am b/modules/codec/Makefile.am
index 1fd99cfee3..944d6a9dd2 100644
--- a/modules/codec/Makefile.am
+++ b/modules/codec/Makefile.am
@@ -360,22 +360,21 @@ EXTRA_LTLIBRARIES += libvideotoolbox_plugin.la
 codec_LTLIBRARIES += $(LTLIBvideotoolbox)
 
 ### FFmpeg/libav ###
+vlc_avcodec_common_la_SOURCES = codec/avcodec/fourcc.c codec/avcodec/avcommon.h \
+	codec/avcodec/chroma.c codec/avcodec/chroma.h \
+	codec/avcodec/avcommon_compat.h
 
 libavcodec_plugin_la_SOURCES = \
-	codec/avcodec/avcommon_compat.h \
-	codec/avcodec/avcommon.h \
 	codec/avcodec/video.c \
 	codec/avcodec/subtitle.c \
 	codec/avcodec/audio.c \
-	codec/avcodec/fourcc.c \
-	codec/avcodec/chroma.c codec/avcodec/chroma.h \
 	codec/avcodec/va.c codec/avcodec/va.h \
 	codec/avcodec/avcodec.c codec/avcodec/avcodec.h
 if ENABLE_SOUT
 libavcodec_plugin_la_SOURCES += codec/avcodec/encoder.c
 endif
 libavcodec_plugin_la_CFLAGS = $(AVCODEC_CFLAGS) $(AM_CFLAGS)
-libavcodec_plugin_la_LIBADD = $(AVCODEC_LIBS) $(LIBM)
+libavcodec_plugin_la_LIBADD = $(AVCODEC_LIBS) $(LIBM) vlc_avcodec_common.la
 libavcodec_plugin_la_LDFLAGS = $(AM_LDFLAGS) $(SYMBOLIC_LDFLAGS)
 
 if MERGE_FFMPEG
@@ -391,6 +390,7 @@ if HAVE_DARWIN
 libavcodec_plugin_la_LDFLAGS += -Wl,-framework,Foundation -Wl,-framework,Security,-framework,CoreFoundation
 endif
 if HAVE_AVCODEC
+noinst_LTLIBRARIES += vlc_avcodec_common.la
 codec_LTLIBRARIES += libavcodec_plugin.la
 endif
 
diff --git a/modules/demux/Makefile.am b/modules/demux/Makefile.am
index 6456c00974..020ccb5659 100644
--- a/modules/demux/Makefile.am
+++ b/modules/demux/Makefile.am
@@ -140,17 +140,13 @@ libcaf_plugin_la_LIBADD = $(LIBM)
 demux_LTLIBRARIES += libcaf_plugin.la
 
 libavformat_plugin_la_SOURCES = demux/avformat/demux.c \
-	codec/avcodec/fourcc.c \
-	codec/avcodec/chroma.c \
-	codec/avcodec/avcommon.h \
-	codec/avcodec/avcommon_compat.h \
 	demux/vobsub.h \
 	demux/avformat/avformat.c demux/avformat/avformat.h
 if ENABLE_SOUT
 libavformat_plugin_la_SOURCES += demux/avformat/mux.c
 endif
 libavformat_plugin_la_CFLAGS = $(AM_CFLAGS) $(AVFORMAT_CFLAGS) $(AVUTIL_CFLAGS)
-libavformat_plugin_la_LIBADD = $(AVFORMAT_LIBS) $(AVUTIL_LIBS) $(LIBM)
+libavformat_plugin_la_LIBADD = $(AVFORMAT_LIBS) $(AVUTIL_LIBS) $(LIBM) vlc_avcodec_common.la
 libavformat_plugin_la_LDFLAGS = $(AM_LDFLAGS) $(SYMBOLIC_LDFLAGS)
 if HAVE_ZLIB
 libavformat_plugin_la_LIBADD += -lz
@@ -161,6 +157,7 @@ endif
 if HAVE_AVFORMAT
 if !MERGE_FFMPEG
 demux_LTLIBRARIES += libavformat_plugin.la
+noinst_LTLIBRARIES += vlc_avcodec_common.la
 endif
 endif
 
diff --git a/modules/packetizer/Makefile.am b/modules/packetizer/Makefile.am
index ad8dc21050..80ed2018e1 100644
--- a/modules/packetizer/Makefile.am
+++ b/modules/packetizer/Makefile.am
@@ -27,11 +27,9 @@ libpacketizer_dts_plugin_la_SOURCES = packetizer/dts.c \
 
 libpacketizer_avparser_plugin_la_SOURCES = packetizer/avparser.c \
 	packetizer/avparser.h \
-	codec/avcodec/avcommon.h \
-	codec/avcodec/avcodec.h \
-	codec/avcodec/fourcc.c
+	codec/avcodec/avcodec.h
 libpacketizer_avparser_plugin_la_CFLAGS = $(AVCODEC_CFLAGS) $(AVUTIL_CFLAGS) $(AM_CFLAGS)
-libpacketizer_avparser_plugin_la_LIBADD = $(AVCODEC_LIBS) $(AVUTIL_LIBS) $(LIBM)
+libpacketizer_avparser_plugin_la_LIBADD = $(AVCODEC_LIBS) $(AVUTIL_LIBS) $(LIBM) vlc_avcodec_common.la
 
 noinst_HEADERS += packetizer/packetizer_helper.h packetizer/startcode_helper.h
 
-- 
2.14.2



More information about the vlc-devel mailing list