[vlc-commits] aout: mmdevice: setup DTS_HD output only when needed

Thomas Guillem git at videolan.org
Thu Dec 21 10:53:11 CET 2017


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Dec 20 14:09:48 2017 +0100| [d7b2ea4ffb9d4d261bffbc9749d67daed3fbec78] | committer: Jean-Baptiste Kempf

aout: mmdevice: setup DTS_HD output only when needed

(cherry picked from commit ae9c49598c65155f960cd6dae1eb738895e48412)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/audio_output/mmdevice.c |  3 +++
 modules/audio_output/wasapi.c   | 35 +++++++++++++++--------------------
 2 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index be1c3587de..e225eaab12 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -1100,6 +1100,9 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
             case MM_PASSTHROUGH_ENABLED:
                 if (b_hdmi)
                     return -1;
+                else if (fmt->i_format == VLC_CODEC_DTS)
+                    var_SetBool(aout, "dtshd", false );
+                /* falltrough */
             case MM_PASSTHROUGH_ENABLED_HD:
                 break;
         }
diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c
index 5f56fd6979..1d8795c348 100644
--- a/modules/audio_output/wasapi.c
+++ b/modules/audio_output/wasapi.c
@@ -450,8 +450,8 @@ static unsigned vlc_CheckWaveOrder (const WAVEFORMATEX *restrict wf,
 }
 
 
-static HRESULT Restart(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
-                       const GUID *sid, bool force_dts_spdif)
+static HRESULT Start(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
+                     const GUID *sid)
 {
     static INIT_ONCE freq_once = INIT_ONCE_STATIC_INIT;
 
@@ -472,6 +472,17 @@ static HRESULT Restart(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
     audio_sample_format_t fmt = *pfmt;
     bool b_spdif = AOUT_FMT_SPDIF(&fmt);
     bool b_hdmi = AOUT_FMT_HDMI(&fmt);
+    bool b_dtshd = false;
+
+    if (fmt.i_format == VLC_CODEC_DTS)
+    {
+        b_dtshd = var_GetBool(s->obj.parent, "dtshd");
+        if (b_dtshd)
+        {
+            b_hdmi = true;
+            b_spdif = false;
+        }
+    }
 
     void *pv;
     HRESULT hr = aout_stream_Activate(s, &IID_IAudioClient, NULL, &pv);
@@ -482,17 +493,6 @@ static HRESULT Restart(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
     }
     sys->client = pv;
 
-    if (fmt.i_format == VLC_CODEC_DTS && !force_dts_spdif && fmt.i_rate >= 48000
-     && var_InheritInteger(s, "mmdevice-passthrough") == MM_PASSTHROUGH_ENABLED_HD)
-    {
-        /* Try to configure the output rate (IEC958 rate) at 768kHz. Indeed,
-         * DTS-HD (and other DTS extensions like DTS-X) can only be transmitted
-         * at 768kHz. We'll also be able to transmit DTS-Core only at this
-         * rate. */
-        b_spdif = false;
-        b_hdmi = true;
-    }
-
     if (b_spdif)
     {
         vlc_SpdifToWave(pwfe, &fmt);
@@ -549,7 +549,8 @@ static HRESULT Restart(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
                      "fallback to 48kHz (S/PDIF)");
             IAudioClient_Release(sys->client);
             free(sys);
-            return Restart(s, pfmt, sid, true);
+            var_SetBool(s->obj.parent, "dtshd", false);
+            return Start(s, pfmt, sid);
         }
         msg_Err(s, "cannot negotiate audio format (error 0x%lx)%s", hr,
                 hr == AUDCLNT_E_UNSUPPORTED_FORMAT
@@ -624,12 +625,6 @@ error:
     return hr;
 }
 
-static HRESULT Start(aout_stream_t *s, audio_sample_format_t *restrict pfmt,
-                     const GUID *sid)
-{
-    return Restart(s, pfmt, sid, false);
-}
-
 static void Stop(aout_stream_t *s)
 {
     aout_stream_sys_t *sys = s->sys;



More information about the vlc-commits mailing list