]> git.sesse.net Git - vlc/commitdiff
* backport of [11404]
authorDerk-Jan Hartman <hartman@videolan.org>
Sun, 12 Jun 2005 21:06:29 +0000 (21:06 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Sun, 12 Jun 2005 21:06:29 +0000 (21:06 +0000)
modules/audio_output/auhal.c

index 6b5a242df14a12359b957827cb950c4e93cdeaaa..60e61487fa5d31e66a38a503bcc0e906fa4debd1 100644 (file)
@@ -82,6 +82,7 @@ static void     Play                    ( aout_instance_t *);
 
 static int      Probe                   ( aout_instance_t * );
 static int      DeviceDigitalMode       ( aout_instance_t *, AudioDeviceID );
+int             AudioDeviceHasOutput    ( AudioDeviceID );
 static int      DigitalInit             ( aout_instance_t * );
 
 static OSStatus RenderCallbackAnalog    ( vlc_object_t *, AudioUnitRenderActionFlags *, const AudioTimeStamp *,
@@ -165,6 +166,7 @@ static int Open( vlc_object_t * p_this )
         return VLC_EGENERIC;
     }
     */
+    
     if( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) && p_sys->b_supports_digital )
     {
         p_sys->b_digital = VLC_TRUE;
@@ -568,7 +570,7 @@ static int Probe( aout_instance_t * p_aout )
         char psz_devuid[1024];
         char psz_name[1024];
         CFStringRef devUID;
-            
+
         i_param_size = sizeof psz_name;
         err = AudioDeviceGetProperty(
                     p_devices[i], 0, VLC_FALSE,
@@ -589,6 +591,12 @@ static int Probe( aout_instance_t * p_aout )
         msg_Dbg( p_aout, "DevID: %lu  DevName: %s  DevUID: %s", p_devices[i], psz_name, psz_devuid );
         CFRelease( devUID );
 
+        if( !AudioDeviceHasOutput(p_aout, p_devices[i]) )
+        {
+            msg_Dbg( p_aout, "this device is INPUT only. skipping..." );
+            continue;
+        }
+
         val.i_int = (int) p_devices[i];
         text.psz_string = psz_name;
         var_Change( p_aout, "audio-device", VLC_VAR_ADDCHOICE, &val, &text );
@@ -780,6 +788,17 @@ error:
     return VLC_EGENERIC;
 }
 
+int AudioDeviceHasOutput( AudioDeviceID i_dev_id )
+{
+    UInt32                     dataSize;
+    Boolean                    isWritable;
+       
+    verify_noerr( AudioDeviceGetPropertyInfo( i_dev_id, 0, FALSE, kAudioDevicePropertyStreams, &dataSize, &isWritable) );
+    if (dataSize == 0) return FALSE;
+    
+    return TRUE;
+}
+
 
 /*****************************************************************************
  * HardwareListener: Warns us of changes in the list of registered devices