$OpenBSD: patch-media_media_gyp,v 1.33 2015/01/22 11:16:41 robert Exp $
--- media/media.gyp.orig.port	Wed Dec  3 03:32:12 2014
+++ media/media.gyp	Sat Dec  6 11:34:27 2014
@@ -21,7 +21,7 @@
         'media_use_libvpx%': 1,
       }],
       # Enable ALSA and Pulse for runtime selection.
-      ['(OS=="linux" or OS=="freebsd" or OS=="solaris") and (embedded!=1 or (chromecast==1 and target_arch!="arm"))', {
+      ['(OS=="linux" or OS=="freebsd" or OS=="solaris") and (embedded!=1 or (chromecast==1 and target_arch!="arm")) and os_bsd != 1', {
         # ALSA is always needed for Web MIDI even if the cras is enabled.
         'use_alsa%': 1,
         'conditions': [
@@ -35,6 +35,10 @@
         'use_alsa%': 0,
         'use_pulseaudio%': 0,
       }],
+      # Override to dynamically link the sndio library.
+      ['OS=="openbsd"', {
+        'use_sndioaudio%': 0,
+      }],
       ['sysroot!=""', {
         'pkg-config': '../build/linux/pkg-config-wrapper "<(sysroot)" "<(target_arch)" "<(system_libdir)"',
       }, {
@@ -165,6 +169,8 @@
         'audio/pulse/pulse_input.h',
         'audio/pulse/pulse_output.cc',
         'audio/pulse/pulse_output.h',
+        'audio/sndio/sndio_output.cc',
+        'audio/sndio/sndio_output.h',
         'audio/pulse/pulse_util.cc',
         'audio/pulse/pulse_util.h',
         'audio/sample_rates.cc',
@@ -678,6 +684,24 @@
             'filters/h264_bitstream_buffer.h',
           ],
         }],
+        ['use_sndio == 1', {
+          'link_settings': {
+            'libraries': [
+              '-lsndio',
+            ],
+          },
+          'defines': [
+            'USE_SNDIO',
+          ],
+          'sources!': [
+            'audio/linux/audio_manager_linux.cc',
+          ],
+        }, {  # else: use_sndio == 0
+          'sources!': [
+            'audio/sndio/sndio_output.cc',
+            'audio/sndio/sndio_output.h',
+          ],
+        }],
         ['use_alsa==1', {
           'link_settings': {
             'libraries': [
@@ -699,7 +723,7 @@
             'audio/openbsd/audio_manager_openbsd.h',
           ],
         }],
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="openbsd"', {
           'conditions': [
             ['use_x11==1', {
               'dependencies': [
@@ -789,7 +813,7 @@
             'ozone/media_ozone_platform.h',
           ]
         }],
-        ['OS!="linux"', {
+        ['OS!="linux" and OS!="openbsd"', {
           'sources!': [
             'audio/cras/audio_manager_cras.cc',
             'audio/cras/audio_manager_cras.h',
@@ -1009,7 +1033,7 @@
             'base/simd/convert_yuv_to_rgb_x86.cc',
           ],
         }],
-        ['OS!="linux" and OS!="win"', {
+        ['OS!="linux" and OS!="win" and os_bsd!=1', {
           'sources!': [
             'base/keyboard_event_counter.cc',
             'base/keyboard_event_counter.h',
@@ -1359,7 +1383,7 @@
             'USE_PULSEAUDIO',
           ],
         }],
-        ['os_posix==1 and OS!="mac"', {
+        ['os_posix==1 and OS!="mac" and OS!="openbsd"', {
           'conditions': [
             ['use_allocator!="none"', {
               'dependencies': [
@@ -1898,7 +1922,7 @@
             'filters/pipeline_integration_test_base.cc',
           ],
           'conditions': [
-            ['os_posix==1 and OS!="mac"', {
+            ['os_posix==1 and OS!="mac" and OS!="openbsd"', {
               'conditions': [
                 ['use_allocator!="none"', {
                   'dependencies': [
