[vlc-devel] [PATCH] hxxx: move the common H26x NAL parsing code in a common static library

Steve Lhomme robux4 at videolabs.io
Thu Nov 16 18:20:39 CET 2017


--
replaces https://patches.videolan.org/patch/18614/
- apply on top of https://patches.videolan.org/patch/18694/
- add more common code
- make the internal lib link with -static
---
 modules/codec/Makefile.am      | 50 +++++++++++++++++++-----------------------
 modules/demux/Makefile.am      |  9 ++++----
 modules/mux/Makefile.am        |  5 ++---
 modules/packetizer/Makefile.am | 17 +++++---------
 4 files changed, 35 insertions(+), 46 deletions(-)

diff --git a/modules/codec/Makefile.am b/modules/codec/Makefile.am
index 20899d88d1..c3188ce24e 100644
--- a/modules/codec/Makefile.am
+++ b/modules/codec/Makefile.am
@@ -96,6 +96,15 @@ codec_LTLIBRARIES += $(LTLIBwma_fixed)
 
 ### Video codecs ###
 
+libhxxx_la_SOURCES = codec/hxxx_helper.c codec/hxxx_helper.h \
+	packetizer/hxxx_nal.h packetizer/hxxx_nal.c \
+	packetizer/hxxx_sei.h packetizer/hxxx_sei.c \
+	packetizer/h264_nal.c packetizer/h264_nal.h \
+	packetizer/hevc_nal.c packetizer/hevc_nal.h \
+	packetizer/hxxx_common.c packetizer/hxxx_common.h
+libhxxx_la_LDFLAGS = -static
+noinst_LTLIBRARIES += libhxxx.la
+
 libcdg_plugin_la_SOURCES = codec/cdg.c
 codec_LTLIBRARIES += libcdg_plugin.la
 
@@ -340,12 +349,8 @@ codec_LTLIBRARIES += $(LTLIBoggspots)
 
 libvideotoolbox_plugin_la_SOURCES = \
 	codec/vt_utils.c codec/vt_utils.h \
-	codec/videotoolbox.m codec/hxxx_helper.c codec/hxxx_helper.h \
-	packetizer/hxxx_nal.h packetizer/hxxx_nal.c \
-	packetizer/hxxx_sei.h packetizer/hxxx_sei.c \
-	packetizer/h264_slice.c packetizer/h264_slice.h \
-	packetizer/h264_nal.c packetizer/h264_nal.h \
-	packetizer/hevc_nal.c packetizer/hevc_nal.h
+	codec/videotoolbox.m \
+	packetizer/h264_slice.c packetizer/h264_slice.h
 if HAVE_OSX
 libvideotoolbox_plugin_la_OBJCFLAGS = $(AM_OBJCFLAGS) -mmacosx-version-min=10.8
 endif
@@ -355,7 +360,7 @@ endif
 if HAVE_TVOS
 libvideotoolbox_plugin_la_OBJCFLAGS = $(AM_OBJCFLAGS) -mtvos-version-min=10.2
 endif
-libvideotoolbox_plugin_la_LIBADD = libchroma_copy.la
+libvideotoolbox_plugin_la_LIBADD = libchroma_copy.la libhxxx.la
 libvideotoolbox_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(codecdir)' -Wl,-framework,Foundation -Wl,-framework,VideoToolbox -Wl,-framework,CoreMedia -Wl,-framework,CoreVideo
 EXTRA_LTLIBRARIES += libvideotoolbox_plugin.la
 codec_LTLIBRARIES += $(LTLIBvideotoolbox)
@@ -420,10 +425,8 @@ endif
 libdxva2_plugin_la_SOURCES = \
 	codec/avcodec/dxva2.c codec/avcodec/directx_va.c codec/avcodec/directx_va.h \
         codec/avcodec/va_surface.c codec/avcodec/va_surface.h codec/avcodec/va_surface_internal.h \
-	packetizer/h264_nal.c packetizer/h264_nal.h \
-	packetizer/hevc_nal.c packetizer/hevc_nal.h \
 	video_chroma/d3d9_fmt.h
-libdxva2_plugin_la_LIBADD = $(LIBCOM) -lshlwapi -luuid
+libdxva2_plugin_la_LIBADD = libhxxx.la $(LIBCOM) -lshlwapi -luuid
 if HAVE_AVCODEC_DXVA2
 codec_LTLIBRARIES += libdxva2_plugin.la
 endif
@@ -437,10 +440,8 @@ endif
 
 libd3d11va_plugin_la_SOURCES = \
 	codec/avcodec/d3d11va.c codec/avcodec/directx_va.c codec/avcodec/directx_va.h \
-        codec/avcodec/va_surface.c codec/avcodec/va_surface.h codec/avcodec/va_surface_internal.h \
-	packetizer/h264_nal.c packetizer/h264_nal.h \
-	packetizer/hevc_nal.c packetizer/hevc_nal.h
-libd3d11va_plugin_la_LIBADD = libd3d11_common.la $(LIBCOM) -luuid
+        codec/avcodec/va_surface.c codec/avcodec/va_surface.h codec/avcodec/va_surface_internal.h
+libd3d11va_plugin_la_LIBADD = libd3d11_common.la libhxxx.la $(LIBCOM) -luuid
 if HAVE_WINSTORE
 libd3d11va_plugin_la_LIBADD += -ld3d11
 endif
@@ -464,8 +465,6 @@ noinst_HEADERS += \
 
 libomxil_plugin_la_SOURCES = \
 	codec/omxil/utils.c codec/omxil/omxil_utils.h \
-	packetizer/h264_nal.c packetizer/h264_nal.h \
-	packetizer/hevc_nal.c packetizer/hevc_nal.h \
 	codec/omxil/qcom.c codec/omxil/qcom.h \
 	codec/omxil/omxil.c codec/omxil/omxil.h codec/omxil/omxil_core.c codec/omxil/omxil_core.h
 if HAVE_ANDROID
@@ -473,7 +472,7 @@ libomxil_plugin_la_SOURCES += video_output/android/utils.c video_output/android/
 	video_output/android/display.h
 endif
 libomxil_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/codec/omxil $(CFLAGS_omxil)
-libomxil_plugin_la_LIBADD = libchroma_copy.la $(LIBDL)
+libomxil_plugin_la_LIBADD = libchroma_copy.la libhxxx.la $(LIBDL)
 libomxil_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(codecdir)'
 
 libomxil_vout_plugin_la_SOURCES = codec/omxil/vout.c codec/omxil/omxil_core.c codec/omxil/utils.c codec/omxil/qcom.c
@@ -489,12 +488,8 @@ libmediacodec_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/codec/omxil
 libmediacodec_plugin_la_SOURCES = codec/omxil/mediacodec.c codec/omxil/mediacodec.h \
 	codec/omxil/mediacodec_jni.c codec/omxil/mediacodec_ndk.c codec/omxil/utils.c \
 	video_output/android/utils.c video_output/android/utils.h \
-	video_output/android/display.h \
-	codec/hxxx_helper.c codec/hxxx_helper.h \
-	packetizer/hxxx_nal.h packetizer/hxxx_nal.c \
-	packetizer/h264_nal.c packetizer/h264_nal.h \
-	packetizer/hevc_nal.c packetizer/hevc_nal.h
-libmediacodec_plugin_la_LIBADD = libchroma_copy.la 
+	video_output/android/display.h
+libmediacodec_plugin_la_LIBADD = libchroma_copy.la libhxxx.la
 codec_LTLIBRARIES += $(LTLIBomxil) $(LTLIBomxil_vout)
 EXTRA_LTLIBRARIES += libomxil_plugin.la libomxil_vout_plugin.la
 if HAVE_ANDROID
@@ -579,9 +574,9 @@ codec_LTLIBRARIES += $(LTLIBtwolame)
 
 ### Hardware encoders ###
 
-libcrystalhd_plugin_la_SOURCES = codec/crystalhd.c packetizer/h264_nal.c packetizer/h264_nal.h
+libcrystalhd_plugin_la_SOURCES = codec/crystalhd.c
 libcrystalhd_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(codecdir)'
-libcrystalhd_plugin_la_LIBADD = $(LIBS_crystalhd)
+libcrystalhd_plugin_la_LIBADD = $(LIBS_crystalhd) libhxxx.la
 EXTRA_LTLIBRARIES += libcrystalhd_plugin.la
 codec_LTLIBRARIES += $(LTLIBcrystalhd)
 
@@ -603,9 +598,10 @@ libdmo_plugin_la_LIBADD += $(LIBCOM) -luuid
 codec_LTLIBRARIES += libdmo_plugin.la
 endif
 
-libmft_plugin_la_SOURCES = codec/mft.c packetizer/h264_nal.c packetizer/h264_nal.h
+libmft_plugin_la_SOURCES = codec/mft.c
+libmft_plugin_la_LIBADD = libhxxx.la
 if HAVE_WIN32
-libmft_plugin_la_LIBADD = $(LIBCOM) -luuid -lmfuuid -lmfplat
+libmft_plugin_la_LIBADD += $(LIBCOM) -luuid -lmfuuid -lmfplat
 codec_LTLIBRARIES += libmft_plugin.la
 endif
 
diff --git a/modules/demux/Makefile.am b/modules/demux/Makefile.am
index 1151a14c26..bc3a55550f 100644
--- a/modules/demux/Makefile.am
+++ b/modules/demux/Makefile.am
@@ -171,8 +171,8 @@ libes_plugin_la_SOURCES  = demux/mpeg/es.c \
                            packetizer/dts_header.c packetizer/dts_header.h
 demux_LTLIBRARIES += libes_plugin.la
 
-libh26x_plugin_la_SOURCES = demux/mpeg/h26x.c \
-                            packetizer/h264_nal.c packetizer/hevc_nal.h
+libh26x_plugin_la_SOURCES = demux/mpeg/h26x.c
+libh26x_plugin_la_LIBADD = libhxxx.la
 demux_LTLIBRARIES += libh26x_plugin.la
 
 libmkv_plugin_la_SOURCES = \
@@ -449,8 +449,7 @@ libadaptive_smooth_SOURCES = \
     demux/smooth/SmoothManager.cpp \
     demux/smooth/SmoothStream.hpp \
     demux/smooth/SmoothStream.cpp
-libadaptive_smooth_SOURCES += mux/mp4/libmp4mux.c mux/mp4/libmp4mux.h \
-				packetizer/h264_nal.c packetizer/h264_nal.h
+libadaptive_smooth_SOURCES += mux/mp4/libmp4mux.c mux/mp4/libmp4mux.h
 
 libadaptive_plugin_la_SOURCES += $(libadaptive_hls_SOURCES)
 libadaptive_plugin_la_SOURCES += $(libadaptive_dash_SOURCES)
@@ -458,7 +457,7 @@ libadaptive_plugin_la_SOURCES += $(libadaptive_smooth_SOURCES)
 libadaptive_plugin_la_SOURCES += demux/adaptive/adaptive.cpp
 libadaptive_plugin_la_SOURCES += demux/mp4/libmp4.c demux/mp4/libmp4.h
 libadaptive_plugin_la_CXXFLAGS = $(AM_CXXFLAGS) -I$(srcdir)/demux/adaptive
-libadaptive_plugin_la_LIBADD = $(SOCKET_LIBS) $(LIBM)
+libadaptive_plugin_la_LIBADD = libhxxx.la $(SOCKET_LIBS) $(LIBM)
 if HAVE_ZLIB
 libadaptive_plugin_la_LIBADD += -lz
 endif
diff --git a/modules/mux/Makefile.am b/modules/mux/Makefile.am
index 2dd5fcd246..d2fe086c6f 100644
--- a/modules/mux/Makefile.am
+++ b/modules/mux/Makefile.am
@@ -6,9 +6,8 @@ libmux_asf_plugin_la_SOURCES = mux/asf.c demux/asf/libasf_guid.h
 libmux_avi_plugin_la_SOURCES = mux/avi.c
 libmux_mp4_plugin_la_SOURCES = mux/mp4/mp4.c \
 	mux/mp4/libmp4mux.c mux/mp4/libmp4mux.h \
-       demux/mp4/libmp4.h \
-	packetizer/hxxx_nal.c packetizer/hxxx_nal.h \
-        packetizer/h264_nal.c packetizer/h264_nal.h
+       demux/mp4/libmp4.h
+libmux_mp4_plugin_la_LIBADD = libhxxx.la
 libmux_mpjpeg_plugin_la_SOURCES = mux/mpjpeg.c
 libmux_ps_plugin_la_SOURCES = \
 	mux/mpeg/pes.c mux/mpeg/pes.h \
diff --git a/modules/packetizer/Makefile.am b/modules/packetizer/Makefile.am
index 102ae38148..c8a6e1317e 100644
--- a/modules/packetizer/Makefile.am
+++ b/modules/packetizer/Makefile.am
@@ -6,21 +6,16 @@ libpacketizer_mpeg4video_plugin_la_SOURCES = packetizer/mpeg4video.c
 libpacketizer_mpeg4audio_plugin_la_SOURCES = packetizer/mpeg4audio.c
 libpacketizer_mpegaudio_plugin_la_SOURCES = packetizer/mpegaudio.c
 libpacketizer_h264_plugin_la_SOURCES = \
-	packetizer/h264_nal.c packetizer/h264_nal.h \
 	packetizer/h264_slice.c packetizer/h264_slice.h \
-	packetizer/h264.c packetizer/hxxx_nal.h \
-	packetizer/hxxx_sei.c packetizer/hxxx_sei.h \
-	packetizer/hxxx_common.c packetizer/hxxx_common.h
-libpacketizer_vc1_plugin_la_SOURCES = packetizer/vc1.c \
-        packetizer/hxxx_nal.h
+	packetizer/h264.c \
+libpacketizer_h264_plugin_la_LIBADD = libhxxx.la
+libpacketizer_vc1_plugin_la_SOURCES = packetizer/vc1.c
+libpacketizer_vc1_plugin_la_LIBADD = libhxxx.la
 libpacketizer_mlp_plugin_la_SOURCES = packetizer/mlp.c
 libpacketizer_dirac_plugin_la_SOURCES = packetizer/dirac.c
 libpacketizer_flac_plugin_la_SOURCES = packetizer/flac.c
-libpacketizer_hevc_plugin_la_SOURCES = packetizer/hevc.c \
-	packetizer/hevc_nal.h packetizer/hevc_nal.c \
-	packetizer/hxxx_sei.c packetizer/hxxx_sei.h \
-	packetizer/hxxx_nal.h \
-	packetizer/hxxx_common.c packetizer/hxxx_common.h
+libpacketizer_hevc_plugin_la_SOURCES = packetizer/hevc.c
+libpacketizer_hevc_plugin_la_LIBADD = libhxxx.la
 libpacketizer_a52_plugin_la_SOURCES = packetizer/a52.c packetizer/a52.h
 libpacketizer_dts_plugin_la_SOURCES = packetizer/dts.c \
 	packetizer/dts_header.c packetizer/dts_header.h
-- 
2.14.2



More information about the vlc-devel mailing list