[vlc-devel] [PATCH 1/4] mmdevice: be informative about device state changes

Thomas Guillem thomas at gllm.fr
Mon May 23 09:39:22 CEST 2016


From: Sean McGovern <gseanmcg at gmail.com>

Signed-off-by: Thomas Guillem <thomas at gllm.fr>
---
 modules/audio_output/mmdevice.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index 286bc9d..a58b7dc 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -613,8 +613,24 @@ vlc_MMNotificationClient_OnDeviceStateChanged(IMMNotificationClient *this,
     aout_sys_t *sys = vlc_MMNotificationClient_sys(this);
     audio_output_t *aout = sys->aout;
 
-    /* TODO: show device state / ignore missing devices */
-    msg_Dbg(aout, "device %ls state changed %08lx", wid, state);
+    switch (state) {
+        case DEVICE_STATE_UNPLUGGED:
+            msg_Warn(aout, "device %ls was unplugged", wid);
+            break;
+        case DEVICE_STATE_ACTIVE:
+            msg_Warn(aout, "device %ls became active", wid);
+            break;
+        case DEVICE_STATE_DISABLED:
+            msg_Warn(aout, "device %ls was disabled", wid);
+            break;
+        case DEVICE_STATE_NOTPRESENT:
+            msg_Warn(aout, "device %ls is not present anymore", wid);
+            break;
+        default:
+            msg_Warn(aout, "device %ls: unknown state %08lx", wid, state);
+            break;
+    }
+
     return S_OK;
 }
 
-- 
2.8.1



More information about the vlc-devel mailing list