]> git.sesse.net Git - vlc/commitdiff
modules/audio_output/waveout.c: backport of 13376.
authorGildas Bazin <gbazin@videolan.org>
Fri, 25 Nov 2005 08:46:11 +0000 (08:46 +0000)
committerGildas Bazin <gbazin@videolan.org>
Fri, 25 Nov 2005 08:46:11 +0000 (08:46 +0000)
modules/audio_output/waveout.c

index 306af9ab94595b9ad43269d31d5a4da89ff56b44..af353dba93b3db56cd7f0676497d1b461800a5b3 100644 (file)
@@ -250,6 +250,8 @@ static int Open( vlc_object_t *p_this )
     }
     else
     {
+        WAVEOUTCAPS wocaps;
+
         if( val.i_int == AOUT_VAR_5_1 )
         {
             p_aout->output.output.i_physical_channels
@@ -292,9 +294,20 @@ static int Open( vlc_object_t *p_this )
 
         aout_VolumeSoftInit( p_aout );
 
-        p_aout->output.pf_volume_infos = VolumeInfos;
-        p_aout->output.pf_volume_get = VolumeGet;
-        p_aout->output.pf_volume_set = VolumeSet;
+        /* Check for hardware volume support */
+        if( waveOutGetDevCaps( (UINT_PTR)p_aout->output.p_sys->h_waveout,
+                               &wocaps, sizeof(wocaps) == MMSYSERR_NOERROR ) &&
+            wocaps.dwSupport == WAVECAPS_VOLUME )
+        {
+            DWORD i_dummy;
+            if( waveOutGetVolume( p_aout->output.p_sys->h_waveout, &i_dummy )
+                == MMSYSERR_NOERROR )
+            {
+                p_aout->output.pf_volume_infos = VolumeInfos;
+                p_aout->output.pf_volume_get = VolumeGet;
+                p_aout->output.pf_volume_set = VolumeSet;
+            }
+        }
     }