[vlc-commits] mmdevice: support WASAPI device endpoint activation events

Thomas Guillem git at videolan.org
Wed May 25 14:35:07 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue May 17 12:36:40 2016 -0400| [56866554f6500ffd5f3b3f6d515c196d963e8353] | committer: Thomas Guillem

mmdevice: support WASAPI device endpoint activation events

Some devices expose more than one endpoint such as speakers and headphone
output. Disconnecting headphones does not remove the endpoint but instead marks
it as being in unplugged state.

Respond to the appropriate activation events in order to enable/disable
endpoints correctly when they are added/removed from set of "active" endpoints.

Fix #15966

Original patch by Sean McGovern <gseanmcg at gmail.com>

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

 modules/audio_output/mmdevice.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index a46449f..a975ecc 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -619,7 +619,7 @@ vlc_MMNotificationClient_OnDeviceStateChanged(IMMNotificationClient *this,
             break;
         case DEVICE_STATE_ACTIVE:
             msg_Dbg(aout, "device %ls state changed: active", wid);
-            break;
+            return DeviceUpdated(aout, wid);
         case DEVICE_STATE_DISABLED:
             msg_Dbg(aout, "device %ls state changed: disabled", wid);
             break;
@@ -628,9 +628,16 @@ vlc_MMNotificationClient_OnDeviceStateChanged(IMMNotificationClient *this,
             break;
         default:
             msg_Dbg(aout, "device %ls state changed: unknown: %08lx", wid, state);
-            break;
+            return E_FAIL;
     }
 
+    /* Unplugged, disabled or notpresent */
+    char *id = FromWide(wid);
+    if (unlikely(id == NULL))
+        return E_OUTOFMEMORY;
+    aout_HotplugReport(aout, id, NULL);
+    free(id);
+
     return S_OK;
 }
 



More information about the vlc-commits mailing list