[vlc-devel] [PATCH] build system: add conditional variables to differenciate between iOS and OS X

Felix Paul Kühne fkuehne at videolan.org
Thu Mar 6 13:20:12 CET 2014


This allows automagic enabling and disabling of the needed and useful aout and vout modules
---
 configure.ac                     | 74 +++++++---------------------------------
 modules/audio_output/Makefile.am | 10 ++++--
 modules/codec/avcodec/vda.c      |  1 -
 modules/video_output/Modules.am  | 24 ++++++++++---
 4 files changed, 40 insertions(+), 69 deletions(-)

diff --git a/configure.ac b/configure.ac
index c0d7add..7dd9894 100644
--- a/configure.ac
+++ b/configure.ac
@@ -97,6 +97,8 @@ dnl
 dnl  Check the operating system
 dnl
 HAVE_WIN64="0"
+HAVE_IOS="0"
+HAVE_OSX="0"
 
 YASMFLAGS=""
 case "${host}" in
@@ -172,6 +174,17 @@ case "${host_os}" in
     VLC_ADD_LIBS([avcodec access_avio swscale postproc i420_rgb_mmx x262 x264 x26410b],[-Wl,-read_only_relocs,suppress])
     VLC_ADD_LIBS([libvlccore],[-Wl,-framework,CoreFoundation,-framework,CoreServices])
 
+    AC_EGREP_CPP(yes,
+            [#import <TargetConditionals.h>
+             #if TARGET_OS_IPHONE
+             yes
+             #endif],
+             [HAVE_IOS="1"],
+             [HAVE_OSX="1"])
+
+    AM_CONDITIONAL(HAVE_IOS,   test "${HAVE_IOS}" = "1")
+    AM_CONDITIONAL(HAVE_OSX,   test "${HAVE_OSX}" = "1")
+
     dnl Allow binaries created on Lion to run on earlier releases
     AC_EGREP_CPP(yes,
            [#import <Cocoa/Cocoa.h>
@@ -3102,29 +3115,6 @@ then
    ])
 fi
 
-
-dnl
-dnl Mac Vout
-AC_ARG_ENABLE(macosx-vout,
-  [  --enable-macosx-vout    Mac OS X video output module (default enabled on Mac OS X)])
-if test "x${enable_macosx_vout}" != "xno" &&
-  (test "${SYS}" = "darwin" || test "${enable_macosx_vout}" = "yes")
-then
-  VLC_ADD_LIBS([vout_macosx],[-Wl,-framework,Cocoa])
-  VLC_ADD_LIBS([vout_macosx],[-Wl,-framework,OpenGL])
-  VLC_ADD_PLUGIN([vout_macosx])
-fi
-
-dnl
-dnl Mac CoreGraphics Layer Vout
-AC_ARG_ENABLE(coregraphicslayer-vout,
-  [  --enable-coregraphicslayer-vout CoreGraphics layered video output module (default disabled)])
-if test "${enable_coregraphicslayer_vout}" = "yes"; then
-  VLC_ADD_LIBS([vout_coregraphicslayer],[-Wl,-framework,Cocoa])
-  VLC_ADD_LIBS([vout_coregraphicslayer],[-Wl,-framework,QuartzCore])
-  VLC_ADD_PLUGIN([vout_coregraphicslayer])
-fi
-
 dnl
 dnl  freetype module
 dnl
@@ -3230,19 +3220,6 @@ if test "${enable_android_surface}" = "yes"; then
   fi
 fi
 
-
-dnl
-dnl  iOS ES2 vout module
-dnl
-AC_ARG_ENABLE(ios-vout2,
-  [  --enable-ios-vout2    iOS video output module (default disabled)])
-if test "${enable_ios_vout2}" = "yes"
-then
-  VLC_ADD_PLUGIN([vout_ios2])
-  VLC_ADD_LIBS([vout_ios2], [-Wl,-framework,OpenGLES,-framework,QuartzCore,-framework,UIKit])
-fi
-
-
 dnl
 dnl  Windows DirectX module
 dnl
@@ -3522,31 +3499,6 @@ AS_IF([test "$enable_wasapi" != "no"], [
 AM_CONDITIONAL([HAVE_WASAPI], [test "${have_wasapi}" = "yes"])
 
 dnl
-dnl  CoreAudio plugin
-dnl
-AC_ARG_ENABLE(macosx-audio,
-  [  --enable-macosx-audio   Mac OS X audio module (default enabled on MacOS X)])
-if test "x${enable_macosx_audio}" != "xno" &&
-  (test "${SYS}" = "darwin" || test "${enable_macosx_audio}" = "yes")
-then
-  AC_CHECK_HEADER([CoreAudio/CoreAudio.h],
-    [ VLC_ADD_PLUGIN([auhal])
-    ], [ AC_MSG_ERROR([cannot find CoreAudio headers]) ])
-fi
-
-dnl
-dnl  iOS CoreAudio plugin
-dnl
-AC_ARG_ENABLE(ios-audio,
-  [  --enable-ios-audio       Audio module for iOS (default disabled)])
-if test "${enable_ios_audio}" = "yes"
-then
-  AC_CHECK_HEADER([AudioUnit/AudioUnit.h],
-    [ VLC_ADD_PLUGIN([audiounit_ios])
-    ], [ AC_MSG_ERROR([cannot find AudioUnit headers]) ])
-fi
-
-dnl
 dnl  AudioQueue plugin
 dnl
 AC_ARG_ENABLE(audioqueue,
diff --git a/modules/audio_output/Makefile.am b/modules/audio_output/Makefile.am
index 2a468c4..e6cb5da 100644
--- a/modules/audio_output/Makefile.am
+++ b/modules/audio_output/Makefile.am
@@ -101,10 +101,16 @@ endif
 libauhal_plugin_la_SOURCES = audio_output/auhal.c \
 	audio_output/TPCircularBuffer.h audio_output/TPCircularBuffer.c
 libauhal_plugin_la_LDFLAGS = $(AM_LDFLAGS) -Wl,-framework,CoreAudio,-framework,AudioUnit,-framework,AudioToolbox,-framework,CoreServices -rpath '$(aoutdir)'
+if HAVE_OSX
+aout_LTLIBRARIES += libauhal_plugin.la
+endif
 libaudiounit_ios_plugin_la_SOURCES = audio_output/audiounit_ios.c \
 	audio_output/TPCircularBuffer.h audio_output/TPCircularBuffer.c
 libaudiounit_ios_plugin_la_LDFLAGS = $(libauhal_plugin_la_LDFLAGS)
+if HAVE_IOS
+aout_LTLIBRARIES += libaudiounit_ios_plugin.la
+endif
+
 libaudioqueue_plugin_la_SOURCES = audio_output/audioqueue.c
 libaudioqueue_plugin_la_LDFLAGS = $(AM_LDFLAGS) -Wl,-framework,CoreAudio,-framework,AudioUnit,-framework,AudioToolbox,-framework,CoreServices -rpath '$(aoutdir)'
-EXTRA_LTLIBRARIES += libauhal_plugin.la libaudiounit_ios_plugin.la libaudioqueue_plugin.la
-aout_LTLIBRARIES += $(LTLIBauhal) $(LTLIBaudiounit_ios) $(LTLIBaudioqueue)
+EXTRA_LTLIBRARIES += libaudioqueue_plugin.la
diff --git a/modules/codec/avcodec/vda.c b/modules/codec/avcodec/vda.c
index 3c31250..85a94c5 100644
--- a/modules/codec/avcodec/vda.c
+++ b/modules/codec/avcodec/vda.c
@@ -161,7 +161,6 @@ static int Setup( vlc_va_t *external, void **pp_hw_ctx, vlc_fourcc_t *pi_chroma,
 
     memset( &p_va->hw_ctx, 0, sizeof(p_va->hw_ctx) );
     p_va->hw_ctx.format = 'avc1';
-    p_va->hw_ctx.use_ref_buffer = 1;
 
     int i_pix_fmt = var_CreateGetInteger( p_va->p_log, "avcodec-vda-pix-fmt" );
 
diff --git a/modules/video_output/Modules.am b/modules/video_output/Modules.am
index d88d82a..35d055d 100644
--- a/modules/video_output/Modules.am
+++ b/modules/video_output/Modules.am
@@ -9,9 +9,6 @@ SOURCES_vout_sdl = sdl.c
 SOURCES_directfb = directfb.c
 SOURCES_vmem = vmem.c
 SOURCES_yuv = yuv.c
-SOURCES_vout_macosx = macosx.m opengl.h opengl.c
-SOURCES_vout_coregraphicslayer = coregraphicslayer.m
-SOURCES_vout_ios2 = ios2.m opengl.h opengl.c
 SOURCES_android_surface = android/surface.c android/utils.c
 SOURCES_android_opaque = android/opaque.c
 
@@ -22,12 +19,29 @@ libdecklinkoutput_plugin_la_LIBADD = $(LIBS_decklink) $(LIBDL)
 vout_LTLIBRARIES += libdecklinkoutput_plugin.la
 endif
 
-if HAVE_DARWIN
+if HAVE_OSX
+libvout_macosx_plugin_la_SOURCES = macosx.m opengl.c opengl.h
+libvout_macosx_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_CFLAGS)
+libvout_macosx_plugin_la_LIBADD = $(GL_LIBS)
+libvout_macosx_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' -Wl,-framework,OpenGL,-framework,Cocoa
+
+libvout_coregraphicslayer_plugin_la_SOURCES = coregraphicslayer.m
+libvout_coregraphicslayer_plugin_la_CFLAGS = $(AM_CFLAGS)
+libvout_coregraphicslayer_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' -Wl,-framework,OpenGL,-framework,Cocoa,-framework,QuartzCore
+
 libcaopengllayer_plugin_la_SOURCES = caopengllayer.m opengl.c opengl.h
 libcaopengllayer_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_CFLAGS)
 libcaopengllayer_plugin_la_LIBADD = $(GL_LIBS)
 libcaopengllayer_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' -Wl,-framework,OpenGL,-framework,Cocoa,-framework,QuartzCore
-vout_LTLIBRARIES += libcaopengllayer_plugin.la
+vout_LTLIBRARIES += libvout_macosx_plugin.la libvout_coregraphicslayer_plugin.la libcaopengllayer_plugin.la
+endif
+
+if HAVE_IOS
+libvout_ios2_plugin_la_SOURCES = ios2.m opengl.h opengl.c
+libvout_ios2_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_CFLAGS)
+libvout_ios2_plugin_la_LIBADD = $(GL_LIBS)
+libvout_ios2_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' -Wl,-framework,OpenGLES,-framework,QuartzCore,-framework,UIKit
+vout_LTLIBRARIES += libvout_ios2_plugin.la
 endif
 
 ### OpenGL ###
-- 
1.8.3.4 (Apple Git-47)




More information about the vlc-devel mailing list