[vlc-commits] coreaudio: move auhal specific code in auhal.c

Thomas Guillem git at videolan.org
Fri Mar 9 11:23:49 CET 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Mar  9 09:21:11 2018 +0100| [796689c4ba9000596f793c51c8639ae902497760] | committer: Thomas Guillem

coreaudio: move auhal specific code in auhal.c

refs #19949

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

 modules/audio_output/audiounit_ios.m    |  2 +-
 modules/audio_output/auhal.c            | 17 ++++++++++++++++-
 modules/audio_output/coreaudio_common.c | 22 +++++++++-------------
 modules/audio_output/coreaudio_common.h |  3 ++-
 4 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/modules/audio_output/audiounit_ios.m b/modules/audio_output/audiounit_ios.m
index 6a8235c631..cb52e920e6 100644
--- a/modules/audio_output/audiounit_ios.m
+++ b/modules/audio_output/audiounit_ios.m
@@ -476,7 +476,7 @@ Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
         ca_LogWarn("failed to set IO mode");
 
     ret = au_Initialize(p_aout, p_sys->au_unit, fmt, layout,
-                        [p_sys->avInstance outputLatency] * CLOCK_FREQ);
+                        [p_sys->avInstance outputLatency] * CLOCK_FREQ, NULL);
     if (ret != VLC_SUCCESS)
         goto error;
 
diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index ddc6c39afa..8d392c00f9 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -1036,7 +1036,9 @@ StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt,
                    "kAudioDevicePropertyPreferredChannelLayout - using stereo");
 
     /* Do the last VLC aout setups */
-    int ret = au_Initialize(p_aout, p_sys->au_unit, fmt, layout, i_latency_us);
+    bool warn_configuration;
+    int ret = au_Initialize(p_aout, p_sys->au_unit, fmt, layout, i_latency_us,
+                            &warn_configuration);
     if (ret != VLC_SUCCESS)
         goto error;
 
@@ -1053,6 +1055,19 @@ StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt,
     MuteSet(p_aout, p_sys->b_mute);
 
     free(layout);
+
+    if (warn_configuration)
+    {
+        msg_Err(p_aout, "You should configure your speaker layout with "
+                "Audio Midi Setup in /Applications/Utilities. VLC will "
+                "output Stereo only.");
+        vlc_dialog_display_error(p_aout,
+            _("Audio device is not configured"), "%s",
+            _("You should configure your speaker layout with "
+            "\"Audio Midi Setup\" in /Applications/"
+            "Utilities. VLC will output Stereo only."));
+    }
+
     return VLC_SUCCESS;
 error:
     AudioComponentInstanceDispose(p_sys->au_unit);
diff --git a/modules/audio_output/coreaudio_common.c b/modules/audio_output/coreaudio_common.c
index 0fbe41afe7..0413dea570 100644
--- a/modules/audio_output/coreaudio_common.c
+++ b/modules/audio_output/coreaudio_common.c
@@ -399,7 +399,7 @@ GetLayoutDescription(audio_output_t *p_aout,
 
 static int
 MapOutputLayout(audio_output_t *p_aout, audio_sample_format_t *fmt,
-                const AudioChannelLayout *outlayout)
+                const AudioChannelLayout *outlayout, bool *warn_configuration)
 {
     /* Fill VLC physical_channels from output layout */
     fmt->i_physical_channels = 0;
@@ -477,16 +477,8 @@ MapOutputLayout(audio_output_t *p_aout, audio_sample_format_t *fmt,
         if (fmt->i_physical_channels == 0)
         {
             fmt->i_physical_channels = AOUT_CHANS_STEREO;
-            msg_Err(p_aout, "You should configure your speaker layout with "
-                    "Audio Midi Setup in /Applications/Utilities. VLC will "
-                    "output Stereo only.");
-#if !TARGET_OS_IPHONE
-            vlc_dialog_display_error(p_aout,
-                _("Audio device is not configured"), "%s",
-                _("You should configure your speaker layout with "
-                "\"Audio Midi Setup\" in /Applications/"
-                "Utilities. VLC will output Stereo only."));
-#endif
+            if (warn_configuration)
+                *warn_configuration = true;
         }
 
     }
@@ -682,18 +674,22 @@ SetupInputLayout(audio_output_t *p_aout, const audio_sample_format_t *fmt,
 
 int
 au_Initialize(audio_output_t *p_aout, AudioUnit au, audio_sample_format_t *fmt,
-              const AudioChannelLayout *outlayout, mtime_t i_dev_latency_us)
+              const AudioChannelLayout *outlayout, mtime_t i_dev_latency_us,
+              bool *warn_configuration)
 {
     int ret;
     AudioChannelLayoutTag inlayout_tag;
 
+    if (warn_configuration)
+        *warn_configuration = false;
+
     /* Set the desired format */
     AudioStreamBasicDescription desc;
     if (aout_BitsPerSample(fmt->i_format) != 0)
     {
         /* PCM */
         fmt->i_format = VLC_CODEC_FL32;
-        ret = MapOutputLayout(p_aout, fmt, outlayout);
+        ret = MapOutputLayout(p_aout, fmt, outlayout, warn_configuration);
         if (ret != VLC_SUCCESS)
             return ret;
 
diff --git a/modules/audio_output/coreaudio_common.h b/modules/audio_output/coreaudio_common.h
index 1f81c1c608..4fb4e5fb64 100644
--- a/modules/audio_output/coreaudio_common.h
+++ b/modules/audio_output/coreaudio_common.h
@@ -91,6 +91,7 @@ AudioUnit au_NewOutputInstance(audio_output_t *p_aout, OSType comp_sub_type);
 
 int  au_Initialize(audio_output_t *p_aout, AudioUnit au,
                    audio_sample_format_t *fmt,
-                   const AudioChannelLayout *outlayout, mtime_t i_dev_latency_us);
+                   const AudioChannelLayout *outlayout, mtime_t i_dev_latency_us,
+                   bool *warn_configuration);
 
 void au_Uninitialize(audio_output_t *p_aout, AudioUnit au);



More information about the vlc-commits mailing list