[vlc-commits] mmdevice: add headphones detection

Thomas Guillem git at videolan.org
Fri Jul 21 11:19:20 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jul 20 14:53:51 2017 +0200| [a30e6f28817f5a413e5e94a2442f68dd138e1a94] | committer: Thomas Guillem

mmdevice: add headphones detection

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a30e6f28817f5a413e5e94a2442f68dd138e1a94
---

 modules/audio_output/mmdevice.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index f7e2aac360..4f32cf0ea8 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -1129,6 +1129,28 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
         if (ret != 0)
             break;
     }
+
+    IPropertyStore *props;
+    HRESULT hr = IMMDevice_OpenPropertyStore(sys->dev, STGM_READ, &props);
+    if (SUCCEEDED(hr))
+    {
+        PROPVARIANT v;
+        PropVariantInit(&v);
+        hr = IPropertyStore_GetValue(props, &PKEY_AudioEndpoint_FormFactor, &v);
+        if (SUCCEEDED(hr))
+        {
+            switch (v.uintVal)
+            {
+                case Headphones:
+                case Headset:
+                    aout->current_sink_info.headphones = true;
+                    break;
+            }
+            PropVariantClear(&v);
+        }
+        IPropertyStore_Release(props);
+    }
+
     LeaveCriticalSection(&sys->lock);
     LeaveMTA();
 



More information about the vlc-commits mailing list