meson: Add build files for osxaudio, osxvideo, waveform
authorNirbheek Chauhan <nirbheek@centricular.com>
Fri, 17 Aug 2018 13:26:54 +0000 (18:56 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Fri, 17 Aug 2018 14:35:25 +0000 (20:05 +0530)
osxaudio is for macOS and iOS
osxvideo is for macOS
waveform is for Windows

meson_options.txt
sys/directsound/meson.build
sys/meson.build
sys/osxaudio/meson.build [new file with mode: 0644]
sys/osxvideo/meson.build [new file with mode: 0644]
sys/waveform/meson.build [new file with mode: 0644]

index a3b5cd8..e41c244 100644 (file)
@@ -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')
 
index 7deaed5..d120cc0 100644 (file)
@@ -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
index c226db5..c5c8d64 100644 (file)
@@ -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 (file)
index 0000000..995705f
--- /dev/null
@@ -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 (file)
index 0000000..5c5667e
--- /dev/null
@@ -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 (file)
index 0000000..6c9bc95
--- /dev/null
@@ -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 <windows.h>')
+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