[vlc-devel] [PATCH 4/4] mmdevice: handle direct mode

Thomas Guillem thomas at gllm.fr
Fri Mar 30 13:57:12 CEST 2018


---
 modules/audio_output/mmdevice.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index c2f190f01f..03e96e2f37 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -1122,10 +1122,17 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
     const bool b_hdmi = AOUT_FMT_HDMI(fmt);
     if (b_spdif || b_hdmi)
     {
+        enum aout_direct_mode direct_mode = aout_GetDirectMode(aout);
+        if (direct_mode == AOUT_DIRECT_DISABLED)
+            return -1;
+
         switch (var_InheritInteger(aout, "mmdevice-passthrough"))
         {
             case MM_PASSTHROUGH_DISABLED:
-                return -1;
+                /* Check if passtrough is enabled for the current track */
+                if (direct_mode != AOUT_DIRECT_ENABLED)
+                    return -1;
+                break;
             case MM_PASSTHROUGH_ENABLED:
                 if (b_hdmi)
                     return -1;
@@ -1186,6 +1193,8 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
 
     if (sys->module != NULL)
     {
+        aout->current_sink_info.direct = AOUT_DIRECT_NOT_CAPABLE;
+
         IPropertyStore *props;
         HRESULT hr = IMMDevice_OpenPropertyStore(sys->dev, STGM_READ, &props);
         if (SUCCEEDED(hr))
@@ -1201,6 +1210,11 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
                     case Headset:
                         aout->current_sink_info.headphones = true;
                         break;
+                    case UnknownDigitalPassthrough:
+                    case SPDIF:
+                    case DigitalAudioDisplayDevice:
+                        aout->current_sink_info.direct = AOUT_DIRECT_CAPABLE;
+                        break;
                 }
                 PropVariantClear(&v);
             }
-- 
2.11.0



More information about the vlc-devel mailing list