[vlc-commits] [Git][videolan/vlc][master] 4 commits: audiounit_ios: remove extrageneous extern qualifiers

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Feb 10 17:29:25 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
16b3dd23 by Alexandre Janniaux at 2023-02-10T16:59:01+00:00
audiounit_ios: remove extrageneous extern qualifiers

The variable is assigned right where it's defined, so there is no need
for extern, as opposed to a variable declaration.

- - - - -
74526950 by Alexandre Janniaux at 2023-02-10T16:59:01+00:00
audiounit_ios: fix compatibility with iOS < 13

AVAudioSessionRouteSharingPolicyLongFormAudio and
AVAudioSessionRouteSharingPolicyLongFormVideo are available starting
with iOS 13.0 and were not available in the previous SDKs, so expose
them as AVAudioSessionRouteSharingPolicyLongForm in older SDKs (which
is the LongFormAudio alias).

- - - - -
ddb2782a by Alexandre Janniaux at 2023-02-10T16:59:01+00:00
audiounit_ios: fix compatibility with iOS < 12

AVAudioSessionMode type is available starting with the SDK for iOS 12,
as well as AVAudioSessionCategory. Use the value directly instead of
storing the values in the variables.

- - - - -
b90f1b4c by Alexandre Janniaux at 2023-02-10T16:59:01+00:00
audiounit_ios: fix compatibility with iOS < 11

AVAudioSessionRouteSharingPolicy type and values are available starting
with SDK iOS 11. This commit is tagging the structures properly so that
it doesn't raise warning/errors and move the functions to runtime
availability.

- - - - -


1 changed file:

- modules/audio_output/audiounit_ios.m


Changes:

=====================================
modules/audio_output/audiounit_ios.m
=====================================
@@ -58,8 +58,8 @@ static const struct {
 
 #if ((__IPHONE_OS_VERSION_MAX_ALLOWED && __IPHONE_OS_VERSION_MAX_ALLOWED < 150000) || (__TV_OS_MAX_VERSION_ALLOWED && __TV_OS_MAX_VERSION_ALLOWED < 150000))
 
-extern NSString *const AVAudioSessionSpatialAudioEnabledKey = @"AVAudioSessionSpatializationEnabledKey";
-extern NSString *const AVAudioSessionSpatialPlaybackCapabilitiesChangedNotification = @"AVAudioSessionSpatialPlaybackCapabilitiesChangedNotification";
+NSString *const AVAudioSessionSpatialAudioEnabledKey = @"AVAudioSessionSpatializationEnabledKey";
+NSString *const AVAudioSessionSpatialPlaybackCapabilitiesChangedNotification = @"AVAudioSessionSpatialPlaybackCapabilitiesChangedNotification";
 
 @interface AVAudioSession (iOS15RoutingConfiguration)
 - (BOOL)setSupportsMultichannelContent:(BOOL)inValue error:(NSError **)outError;
@@ -335,21 +335,29 @@ avas_GetPortType(audio_output_t *p_aout, enum port_type *pport_type)
     return VLC_SUCCESS;
 }
 
-struct role2policy
+struct API_AVAILABLE(ios(11.0))
+role2policy
 {
     char role[sizeof("accessibility")];
     AVAudioSessionRouteSharingPolicy policy;
 };
 
-static int role2policy_cmp(const void *key, const void *val)
+static int API_AVAILABLE(ios(11.0))
+role2policy_cmp(const void *key, const void *val)
 {
     const struct role2policy *entry = val;
     return strcmp(key, entry->role);
 }
 
-static AVAudioSessionRouteSharingPolicy
+static AVAudioSessionRouteSharingPolicy API_AVAILABLE(ios(11.0))
 GetRouteSharingPolicy(audio_output_t *p_aout)
 {
+#if __IPHONEOS_VERSION_MAX_ALLOWED < 130000
+    AVAudioSessionRouteSharingPolicy AVAudioSessionRouteSharingPolicyLongFormAudio =
+        AVAudioSessionRouteSharingPolicyLongForm;
+    AVAudioSessionRouteSharingPolicy AVAudioSessionRouteSharingPolicyLongFormVideo =
+        AVAudioSessionRouteSharingPolicyLongForm;
+#endif
     /* LongFormAudio by default */
     AVAudioSessionRouteSharingPolicy policy = AVAudioSessionRouteSharingPolicyLongFormAudio;
     AVAudioSessionRouteSharingPolicy video_policy;
@@ -398,23 +406,22 @@ avas_SetActive(audio_output_t *p_aout, bool active, NSUInteger options)
 
     if (active)
     {
-        AVAudioSessionCategory category = AVAudioSessionCategoryPlayback;
-        AVAudioSessionMode mode = AVAudioSessionModeMoviePlayback;
-        AVAudioSessionRouteSharingPolicy policy = GetRouteSharingPolicy(p_aout);
-
         if (@available(iOS 11.0, tvOS 11.0, *))
         {
-            ret = [instance setCategory:category
-                                   mode:mode
+            AVAudioSessionRouteSharingPolicy policy = GetRouteSharingPolicy(p_aout);
+
+            ret = [instance setCategory:AVAudioSessionCategoryPlayback
+                                   mode:AVAudioSessionModeMoviePlayback
                      routeSharingPolicy:policy
                                 options:0
                                   error:&error];
         }
         else
         {
-            ret = [instance setCategory:category
+            ret = [instance setCategory:AVAudioSessionCategoryPlayback
                                   error:&error];
-            ret = ret && [instance setMode:mode error:&error];
+            ret = ret && [instance setMode:AVAudioSessionModeMoviePlayback
+                                     error:&error];
             /* Not AVAudioSessionRouteSharingPolicy on older devices */
         }
         if (@available(iOS 15.0, tvOS 15.0, *)) {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fb14c6a1114ba2c5227eaf9d61cdc0831c66a0ed...b90f1b4c57cc6777b7e45647bf77f05aa8e34cb1

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fb14c6a1114ba2c5227eaf9d61cdc0831c66a0ed...b90f1b4c57cc6777b7e45647bf77f05aa8e34cb1
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list