From b7e78d84b491fcaefbe936a33c07bebdc99c55eb Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 17 Aug 2018 18:56:54 +0530 Subject: [PATCH] meson: Add build files for osxaudio, osxvideo, waveform osxaudio is for macOS and iOS osxvideo is for macOS waveform is for Windows --- meson_options.txt | 3 +++ sys/directsound/meson.build | 14 ++++++++------ sys/meson.build | 12 ++++-------- sys/osxaudio/meson.build | 43 +++++++++++++++++++++++++++++++++++++++++++ sys/osxvideo/meson.build | 21 +++++++++++++++++++++ sys/waveform/meson.build | 27 +++++++++++++++++++++++++++ 6 files changed, 106 insertions(+), 14 deletions(-) create mode 100644 sys/osxaudio/meson.build create mode 100644 sys/osxvideo/meson.build create mode 100644 sys/waveform/meson.build diff --git a/meson_options.txt b/meson_options.txt index a3b5cd8..e41c244 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -60,6 +60,8 @@ option('lame', type : 'feature', value : 'auto', description : 'LAME mp3 audio e option('mpg123', type : 'feature', value : 'auto', description : 'mpg123 mp3 audio decoder plugin') option('oss', type : 'feature', value : 'auto', description : 'OSS audio source/sink plugin') option('oss4', type : 'feature', value : 'auto', description : 'OSSv4 audio source/sink plugin') +option('osxaudio', type : 'feature', value : 'auto', description : 'macOS/iOS CoreAudio source/sink plugin') +option('osxvideo', type : 'feature', value : 'auto', description : 'macOS Cocoa video sink plugin') option('png', type : 'feature', value : 'auto', description : 'PNG image codec plugin') option('pulse', type : 'feature', value : 'auto', description : 'Pulseaudio audio source/sink plugin') option('qt5', type : 'feature', value : 'auto', description : 'Qt5 QML video sink plugin') @@ -69,6 +71,7 @@ option('speex', type : 'feature', value : 'auto', description : 'Speex audio cod option('taglib', type : 'feature', value : 'auto', description : 'Tag-writing plugin based on taglib') option('twolame', type : 'feature', value : 'auto', description : 'twolame mp2 audio encoder plugin') option('vpx', type : 'feature', value : 'auto', description : 'VP8 and VP9 video codec plugin') +option('waveform', type : 'feature', value : 'auto', description : 'Windows waveform audio sink plugin') option('wavpack', type : 'feature', value : 'auto', description : 'Wavpack audio codec plugin') option('x11', type : 'feature', value : 'auto', description : 'X11 ximagesrc plugin') diff --git a/sys/directsound/meson.build b/sys/directsound/meson.build index 7deaed5..d120cc0 100644 --- a/sys/directsound/meson.build +++ b/sys/directsound/meson.build @@ -12,13 +12,15 @@ directsoundsink_device_flags = [ ] have_dsound = false -# TODO: https://github.com/mesonbuild/meson/issues/3940 dsound_option = get_option('directsound') -if not dsound_option.disabled() - have_dsound = cc.has_header('dsound.h') - if not have_dsound and dsound_option.enabled() - error('directsound plugin was enabled but dsound.h was not found') - endif +if host_system != 'windows' or dsound_option.disabled() + subdir_done() +endif + +# TODO: https://github.com/mesonbuild/meson/issues/3940 +have_dsound = cc.has_header('dsound.h') +if not have_dsound and dsound_option.enabled() + error('directsound plugin was enabled but dsound.h was not found') endif if have_dsound diff --git a/sys/meson.build b/sys/meson.build index c226db5..c5c8d64 100644 --- a/sys/meson.build +++ b/sys/meson.build @@ -1,12 +1,8 @@ -if host_system == 'windows' - subdir('directsound') -endif +subdir('directsound') subdir('oss') subdir('oss4') +subdir('osxaudio') +subdir('osxvideo') subdir('v4l2') +subdir('waveform') subdir('ximage') - -# FIXME: Implement these -#subdir('osxaudio') -#subdir('osxvideo') -#subdir('waveform') diff --git a/sys/osxaudio/meson.build b/sys/osxaudio/meson.build new file mode 100644 index 0000000..995705f --- /dev/null +++ b/sys/osxaudio/meson.build @@ -0,0 +1,43 @@ +osxaudio_sources = [ + 'gstosxaudioringbuffer.c', + 'gstosxaudioelement.c', + 'gstosxaudiosink.c', + 'gstosxaudiosrc.c', + 'gstosxcoreaudiocommon.c', + 'gstosxcoreaudio.c', + 'gstosxaudio.c' +] + +have_osxaudio = false +osxaudio_option = get_option('osxaudio') +if osxaudio_option.disabled() or not ['darwin', 'ios'].contains(host_system) + subdir_done() +endif + +if host_system == 'darwin' + # TODO: https://github.com/mesonbuild/meson/issues/3940 + have_osxaudio = cc.has_header('CoreAudio/CoreAudio.h') + osxaudio_sources += ['gstosxaudiodeviceprovider.c'] +elif host_system == 'ios' + have_osxaudio = cc.has_header('CoreAudio/CoreAudioTypes.h') +endif + +if not have_osxaudio and osxaudio_option.enabled() + error('osxaudio plugin was enabled but CoreAudio headers not found') +endif + +if have_osxaudio + osxaudio_dep = [dependency('CoreAudio'), dependency('AudioToolbox')] + if host_system == 'darwin' + osxaudio_dep += [dependency('AudioUnit'), dependency('CoreServices')] + endif + + gstosxaudio = library('gstosxaudio', + osxaudio_sources, + c_args : gst_plugins_good_args, + include_directories : [configinc, libsinc], + dependencies : [gstaudio_dep] + osxaudio_dep, + install : true, + install_dir : plugins_install_dir) + pkgconfig.generate(gstosxaudio, install_dir : plugins_pkgconfig_install_dir) +endif diff --git a/sys/osxvideo/meson.build b/sys/osxvideo/meson.build new file mode 100644 index 0000000..5c5667e --- /dev/null +++ b/sys/osxvideo/meson.build @@ -0,0 +1,21 @@ +osxvideo_sources = ['osxvideosink.m', 'cocoawindow.m'] + +have_osxvideo = false +if host_system != 'darwin' + subdir_done() +endif + +osxvideo_opengl_dep = dependency('OpenGL', required : get_option('osxvideo')) +osxvideo_cocoa_dep = dependency('Cocoa', required : get_option('osxvideo')) +have_objc = add_languages('objc', required : get_option('osxvideo')) + +if have_objc and osxvideo_opengl_dep.found() and osxvideo_cocoa_dep.found() + gstosxvideo = library('gstosxvideo', + osxvideo_sources, + c_args : gst_plugins_good_args, + include_directories : [configinc], + dependencies : [gstvideo_dep, osxvideo_opengl_dep, osxvideo_cocoa_dep], + install : true, + install_dir : plugins_install_dir) + pkgconfig.generate(gstosxvideo, install_dir : plugins_pkgconfig_install_dir) +endif diff --git a/sys/waveform/meson.build b/sys/waveform/meson.build new file mode 100644 index 0000000..6c9bc95 --- /dev/null +++ b/sys/waveform/meson.build @@ -0,0 +1,27 @@ +waveformsink_sources = [ + 'gstwaveformsink.c', + 'gstwaveformplugin.c', +] + +have_waveform = false +waveform_option = get_option('waveform') +if host_system != 'windows' or waveform_option.disabled() + subdir_done() +endif + +# TODO: https://github.com/mesonbuild/meson/issues/3940 +have_waveform = cc.has_header('mmsystem.h', prefix : '#include ') +if not have_waveform and waveform_option.enabled() + error('waveform plugin was enabled but mmsystem.h was not found') +endif + +if have_waveform + gstwaveformsink = library('gstwaveform', + waveformsink_sources, + c_args : gst_plugins_good_args, + include_directories : [configinc], + dependencies : [gstaudio_dep, cc.find_library('winmm')], + install : true, + install_dir : plugins_install_dir) + pkgconfig.generate(gstwaveformsink, install_dir : plugins_pkgconfig_install_dir) +endif -- 2.7.4