[vlc-devel] [PATCH] auhal: Use encoded audio output if this was stored before

david.fuhrmann at gmail.com david.fuhrmann at gmail.com
Sat Feb 15 12:37:25 CET 2020


From: David Fuhrmann <dfuhrmann at videolan.org>

Encoded output is stored in VLCs settings by adding the
AOUT_VAR_SPDIF_FLAG flag to the integer. Make sure this
configuration is also picked up again after restart, if it is stored
and actually available.

Credits: Andrey Y.
fixes #21170
---

Hello all,

Patch is taken from the user comment in #21170 and has been successfully tested and
verified by me again.
I asked the user in the forum (where he posted the same patch again) if we wants to send a git-patch to get correct authorship.
As he did not respond and I do not know his full name, I would apply it
as proposed, they are no objections.

This should be also backported for 3.0.9.

BR. David


 modules/audio_output/auhal.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index b56e609bc397..643c3fd19450 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -540,6 +540,9 @@ RebuildDeviceList(audio_output_t * p_aout, UInt32 *p_id_exists)
             CFArrayAppendValue(currentListOfDevices, deviceNumber);
             CFRelease(deviceNumber);
             free(psz_encoded_name);
+
+            if (p_id_exists && i_id == i_id_exists)
+                *p_id_exists = i_id;
         }
 
         // TODO: only register once for each device
@@ -1749,6 +1752,11 @@ static int Open(vlc_object_t *obj)
     {
         int dev_id_int = atoi(psz_audio_device);
         UInt32 dev_id = dev_id_int < 0 ? 0 : dev_id_int;
+
+        bool isDigital = (dev_id & AOUT_VAR_SPDIF_FLAG) != 0;
+        msg_Dbg(obj, "Trying to use stored audio device %d (%s)",
+                (dev_id & ~AOUT_VAR_SPDIF_FLAG), isDigital ? "digital" : "analog");
+
         RebuildDeviceList(p_aout, &dev_id);
         p_sys->i_new_selected_dev = dev_id;
         free(psz_audio_device);
-- 
2.21.1 (Apple Git-122.3)



More information about the vlc-devel mailing list