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

Steve Lhomme robux4 at videolabs.io
Sat Nov 11 19:08:31 CET 2017


---
 modules/codec/Makefile.am      | 35 ++++++++++++-----------------------
 modules/demux/Makefile.am      |  9 ++++-----
 modules/mux/Makefile.am        | 10 +++++++---
 modules/packetizer/Makefile.am | 11 +++++------
 4 files changed, 28 insertions(+), 37 deletions(-)

diff --git a/modules/codec/Makefile.am b/modules/codec/Makefile.am
index 944d6a9dd2..28d9df9c29 100644
--- a/modules/codec/Makefile.am
+++ b/modules/codec/Makefile.am
@@ -341,11 +341,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
+	packetizer/h264_slice.c packetizer/h264_slice.h
 if HAVE_OSX
 libvideotoolbox_plugin_la_OBJCFLAGS = $(AM_OBJCFLAGS) -mmacosx-version-min=10.8
 endif
@@ -356,6 +353,7 @@ if HAVE_TVOS
 libvideotoolbox_plugin_la_OBJCFLAGS = $(AM_OBJCFLAGS) -mtvos-version-min=10.2
 endif
 libvideotoolbox_plugin_la_LDFLAGS = video_chroma_copy.la $(AM_LDFLAGS) -rpath '$(codecdir)' -Wl,-framework,Foundation -Wl,-framework,VideoToolbox -Wl,-framework,CoreMedia -Wl,-framework,CoreVideo
+libvideotoolbox_plugin_la_LIBADD = vlc_hxxx_nal.la
 EXTRA_LTLIBRARIES += libvideotoolbox_plugin.la
 codec_LTLIBRARIES += $(LTLIBvideotoolbox)
 
@@ -417,10 +415,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 = $(LIBCOM) -lshlwapi -luuid vlc_hxxx_nal.la
 if HAVE_AVCODEC_DXVA2
 codec_LTLIBRARIES += libdxva2_plugin.la
 endif
@@ -428,10 +424,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 \
-	video_chroma/d3d11_fmt.h video_chroma/dxgi_fmt.c video_chroma/dxgi_fmt.h \
-	packetizer/h264_nal.c packetizer/h264_nal.h \
-	packetizer/hevc_nal.c packetizer/hevc_nal.h
-libd3d11va_plugin_la_LIBADD = $(LIBCOM) -luuid
+	video_chroma/d3d11_fmt.h video_chroma/dxgi_fmt.c video_chroma/dxgi_fmt.h
+libd3d11va_plugin_la_LIBADD = $(LIBCOM) -luuid vlc_hxxx_nal.la
 if HAVE_WINSTORE
 libd3d11va_plugin_la_LIBADD += -ld3d11
 endif
@@ -455,8 +449,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
@@ -464,7 +456,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 = video_chroma_copy.la $(LIBDL)
+libomxil_plugin_la_LIBADD = video_chroma_copy.la $(LIBDL) vlc_hxxx_nal.la
 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
@@ -481,11 +473,8 @@ libmediacodec_plugin_la_SOURCES = codec/omxil/mediacodec.c codec/omxil/mediacode
 	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 = video_chroma_copy.la 
+	codec/hxxx_helper.c codec/hxxx_helper.h
+libmediacodec_plugin_la_LIBADD = video_chroma_copy.la vlc_hxxx_nal.la
 codec_LTLIBRARIES += $(LTLIBomxil) $(LTLIBomxil_vout)
 EXTRA_LTLIBRARIES += libomxil_plugin.la libomxil_vout_plugin.la
 if HAVE_ANDROID
@@ -570,9 +559,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) vlc_hxxx_nal.la
 EXTRA_LTLIBRARIES += libcrystalhd_plugin.la
 codec_LTLIBRARIES += $(LTLIBcrystalhd)
 
@@ -594,9 +583,9 @@ 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
 if HAVE_WIN32
-libmft_plugin_la_LIBADD = $(LIBCOM) -luuid -lmfuuid -lmfplat
+libmft_plugin_la_LIBADD = $(LIBCOM) -luuid -lmfuuid -lmfplat vlc_hxxx_nal.la
 codec_LTLIBRARIES += libmft_plugin.la
 endif
 
diff --git a/modules/demux/Makefile.am b/modules/demux/Makefile.am
index 020ccb5659..909ef7e439 100644
--- a/modules/demux/Makefile.am
+++ b/modules/demux/Makefile.am
@@ -170,8 +170,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 = vlc_hxxx_nal.la
 demux_LTLIBRARIES += libh26x_plugin.la
 
 libmkv_plugin_la_SOURCES = \
@@ -448,8 +448,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)
@@ -457,7 +456,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 = $(SOCKET_LIBS) $(LIBM) vlc_hxxx_nal.la
 if HAVE_ZLIB
 libadaptive_plugin_la_LIBADD += -lz
 endif
diff --git a/modules/mux/Makefile.am b/modules/mux/Makefile.am
index 2dd5fcd246..4aba525448 100644
--- a/modules/mux/Makefile.am
+++ b/modules/mux/Makefile.am
@@ -2,13 +2,17 @@ muxdir = $(pluginsdir)/mux
 
 libmux_dummy_plugin_la_SOURCES = mux/dummy.c
 
+vlc_hxxx_nal_la_SOURCES = packetizer/hxxx_nal.c packetizer/hxxx_nal.h \
+	packetizer/h264_nal.c packetizer/h264_nal.h \
+	packetizer/hevc_nal.c packetizer/hevc_nal.h
+noinst_LTLIBRARIES += vlc_hxxx_nal.la
+
 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 = vlc_hxxx_nal.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 80ed2018e1..eb8c93428f 100644
--- a/modules/packetizer/Makefile.am
+++ b/modules/packetizer/Makefile.am
@@ -6,21 +6,20 @@ 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/h264.c \
 	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
+libpacketizer_h264_plugin_la_LIBADD = vlc_hxxx_nal.la
+libpacketizer_vc1_plugin_la_SOURCES = packetizer/vc1.c
+libpacketizer_vc1_plugin_la_LIBADD = vlc_hxxx_nal.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_LIBADD = vlc_hxxx_nal.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