1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

Platform: Remove compatibility checks for iOS 10

This commit is contained in:
reuk 2024-07-01 17:45:06 +01:00
parent e71ebb3407
commit 6428f43eeb
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
6 changed files with 153 additions and 367 deletions

View file

@ -298,10 +298,8 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater
{
options |= AVAudioSessionCategoryOptionDefaultToSpeaker
| AVAudioSessionCategoryOptionAllowBluetooth
| AVAudioSessionCategoryOptionAllowAirPlay;
if (@available (iOS 10.0, *))
options |= AVAudioSessionCategoryOptionAllowBluetoothA2DP;
| AVAudioSessionCategoryOptionAllowAirPlay
| AVAudioSessionCategoryOptionAllowBluetoothA2DP;
}
JUCE_NSERROR_CHECK ([[AVAudioSession sharedInstance] setCategory: category
@ -739,18 +737,9 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater
&dataSize);
if (err == noErr)
{
if (@available (iOS 10.0, *))
{
[[UIApplication sharedApplication] openURL: (NSURL*) hostUrl
options: @{}
completionHandler: nil];
return;
}
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
[[UIApplication sharedApplication] openURL: (NSURL*) hostUrl];
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
[[UIApplication sharedApplication] openURL: (NSURL*) hostUrl
options: @{}
completionHandler: nil];
}
}

View file

@ -633,7 +633,7 @@ public:
{
const auto value = (newValue != nullptr ? *newValue : juceParam->getValue()) * getMaximumParameterValue (*juceParam);
if (@available (macOS 10.12, iOS 10.0, *))
if (@available (macOS 10.12, *))
{
[param setValue: value
originator: editorObserverToken.get()

View file

@ -395,18 +395,11 @@ bool JUCE_CALLTYPE Process::openDocument (const String& fileName, [[maybe_unused
: [NSURL URLWithString: fileNameAsNS];
#if JUCE_IOS
if (@available (iOS 10.0, *))
{
[[UIApplication sharedApplication] openURL: filenameAsURL
options: @{}
completionHandler: nil];
[[UIApplication sharedApplication] openURL: filenameAsURL
options: @{}
completionHandler: nil];
return true;
}
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
return [[UIApplication sharedApplication] openURL: filenameAsURL];
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
return true;
#else
NSWorkspace* workspace = [NSWorkspace sharedWorkspace];

View file

@ -1159,12 +1159,7 @@ static bool doKeysUp (UIViewComponentPeer* owner, NSSet<UIPress*>* presses, UIPr
if (auto* target = [self getTextInputTarget])
{
if (action == @selector (paste:))
{
if (@available (iOS 10, *))
return [[UIPasteboard generalPasteboard] hasStrings];
return [[UIPasteboard generalPasteboard] string] != nil;
}
return [[UIPasteboard generalPasteboard] hasStrings];
}
return [super canPerformAction: action withSender: sender];

View file

@ -43,77 +43,34 @@ struct PushNotificationsDelegateDetails
static void* actionToNSAction (const Action& a)
{
if (@available (iOS 10, *))
if (a.style == Action::text)
{
if (a.style == Action::text)
{
return [UNTextInputNotificationAction actionWithIdentifier: juceStringToNS (a.identifier)
title: juceStringToNS (a.title)
options: NSUInteger (a.destructive << 1 | (! a.triggerInBackground) << 2)
textInputButtonTitle: juceStringToNS (a.textInputButtonText)
textInputPlaceholder: juceStringToNS (a.textInputPlaceholder)];
}
return [UNNotificationAction actionWithIdentifier: juceStringToNS (a.identifier)
title: juceStringToNS (a.title)
options: NSUInteger (a.destructive << 1 | (! a.triggerInBackground) << 2)];
return [UNTextInputNotificationAction actionWithIdentifier: juceStringToNS (a.identifier)
title: juceStringToNS (a.title)
options: NSUInteger (a.destructive << 1 | (! a.triggerInBackground) << 2)
textInputButtonTitle: juceStringToNS (a.textInputButtonText)
textInputPlaceholder: juceStringToNS (a.textInputPlaceholder)];
}
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
auto action = [[UIMutableUserNotificationAction alloc] init];
action.identifier = juceStringToNS (a.identifier);
action.title = juceStringToNS (a.title);
action.behavior = a.style == Action::text ? UIUserNotificationActionBehaviorTextInput
: UIUserNotificationActionBehaviorDefault;
action.parameters = varToNSDictionary (a.parameters);
action.activationMode = a.triggerInBackground ? UIUserNotificationActivationModeBackground
: UIUserNotificationActivationModeForeground;
action.destructive = (bool) a.destructive;
[action autorelease];
return action;
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
return [UNNotificationAction actionWithIdentifier: juceStringToNS (a.identifier)
title: juceStringToNS (a.title)
options: NSUInteger (a.destructive << 1 | (! a.triggerInBackground) << 2)];
}
static void* categoryToNSCategory (const Category& c)
{
if (@available (iOS 10, *))
{
auto actions = [NSMutableArray arrayWithCapacity: (NSUInteger) c.actions.size()];
for (const auto& a : c.actions)
{
auto* action = (UNNotificationAction*) actionToNSAction (a);
[actions addObject: action];
}
return [UNNotificationCategory categoryWithIdentifier: juceStringToNS (c.identifier)
actions: actions
intentIdentifiers: @[]
options: c.sendDismissAction ? UNNotificationCategoryOptionCustomDismissAction : 0];
}
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
auto category = [[UIMutableUserNotificationCategory alloc] init];
category.identifier = juceStringToNS (c.identifier);
auto actions = [NSMutableArray arrayWithCapacity: (NSUInteger) c.actions.size()];
for (const auto& a : c.actions)
{
auto* action = (UIUserNotificationAction*) actionToNSAction (a);
auto* action = (UNNotificationAction*) actionToNSAction (a);
[actions addObject: action];
}
[category setActions: actions forContext: UIUserNotificationActionContextDefault];
[category setActions: actions forContext: UIUserNotificationActionContextMinimal];
[category autorelease];
return category;
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
return [UNNotificationCategory categoryWithIdentifier: juceStringToNS (c.identifier)
actions: actions
intentIdentifiers: @[]
options: c.sendDismissAction ? UNNotificationCategoryOptionCustomDismissAction : 0];
}
//==============================================================================
@ -418,10 +375,7 @@ private:
//==============================================================================
bool PushNotifications::Notification::isValid() const noexcept
{
if (@available (iOS 10, *))
return title.isNotEmpty() && body.isNotEmpty() && identifier.isNotEmpty() && category.isNotEmpty();
return title.isNotEmpty() && body.isNotEmpty() && category.isNotEmpty();
return title.isNotEmpty() && body.isNotEmpty() && identifier.isNotEmpty() && category.isNotEmpty();
}
//==============================================================================
@ -446,170 +400,87 @@ struct PushNotifications::Pimpl
auto categories = [NSMutableSet setWithCapacity: (NSUInteger) settings.categories.size()];
if (@available (iOS 10, *))
for (const auto& c : settings.categories)
{
for (const auto& c : settings.categories)
{
auto* category = (UNNotificationCategory*) PushNotificationsDelegateDetails::categoryToNSCategory (c);
[categories addObject: category];
}
UNAuthorizationOptions authOptions = NSUInteger ((bool)settings.allowBadge << 0
| (bool)settings.allowSound << 1
| (bool)settings.allowAlert << 2);
[[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories: categories];
[[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions: authOptions
completionHandler: ^(BOOL /*granted*/, NSError* /*error*/)
{
requestSettingsUsed();
}];
auto* category = (UNNotificationCategory*) PushNotificationsDelegateDetails::categoryToNSCategory (c);
[categories addObject: category];
}
else
{
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
for (const auto& c : settings.categories)
{
auto* category = (UIUserNotificationCategory*) PushNotificationsDelegateDetails::categoryToNSCategory (c);
[categories addObject: category];
}
UNAuthorizationOptions authOptions = NSUInteger ((bool)settings.allowBadge << 0
| (bool)settings.allowSound << 1
| (bool)settings.allowAlert << 2);
UIUserNotificationType type = NSUInteger ((bool)settings.allowBadge << 0
| (bool)settings.allowSound << 1
| (bool)settings.allowAlert << 2);
UIUserNotificationSettings* s = [UIUserNotificationSettings settingsForTypes: type categories: categories];
[[UIApplication sharedApplication] registerUserNotificationSettings: s];
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
}
[[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories: categories];
[[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions: authOptions
completionHandler: ^(BOOL /*granted*/, NSError* /*error*/)
{
requestSettingsUsed();
}];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
void requestSettingsUsed()
{
if (@available (iOS 10, *))
{
[[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:
^(UNNotificationSettings* s)
{
[[UNUserNotificationCenter currentNotificationCenter] getNotificationCategoriesWithCompletionHandler:
^(NSSet<UNNotificationCategory*>* categories)
{
settings.allowBadge = s.badgeSetting == UNNotificationSettingEnabled;
settings.allowSound = s.soundSetting == UNNotificationSettingEnabled;
settings.allowAlert = s.alertSetting == UNNotificationSettingEnabled;
[[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:
^(UNNotificationSettings* s)
{
[[UNUserNotificationCenter currentNotificationCenter] getNotificationCategoriesWithCompletionHandler:
^(NSSet<UNNotificationCategory*>* categories)
{
settings.allowBadge = s.badgeSetting == UNNotificationSettingEnabled;
settings.allowSound = s.soundSetting == UNNotificationSettingEnabled;
settings.allowAlert = s.alertSetting == UNNotificationSettingEnabled;
for (UNNotificationCategory* c in categories)
settings.categories.add (PushNotificationsDelegateDetails::unNotificationCategoryToCategory (c));
for (UNNotificationCategory* c in categories)
settings.categories.add (PushNotificationsDelegateDetails::unNotificationCategoryToCategory (c));
owner.listeners.call ([&] (Listener& l) { l.notificationSettingsReceived (settings); });
}
];
}];
}
else
{
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
UIUserNotificationSettings* s = [UIApplication sharedApplication].currentUserNotificationSettings;
settings.allowBadge = s.types & UIUserNotificationTypeBadge;
settings.allowSound = s.types & UIUserNotificationTypeSound;
settings.allowAlert = s.types & UIUserNotificationTypeAlert;
for (UIUserNotificationCategory *c in s.categories)
settings.categories.add (PushNotificationsDelegateDetails::uiUserNotificationCategoryToCategory (c));
owner.listeners.call ([&] (Listener& l) { l.notificationSettingsReceived (settings); });
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
}
owner.listeners.call ([&] (Listener& l) { l.notificationSettingsReceived (settings); });
}
];
}];
}
bool areNotificationsEnabled() const { return true; }
void sendLocalNotification (const Notification& n)
{
if (@available (iOS 10, *))
{
UNNotificationRequest* request = PushNotificationsDelegateDetails::juceNotificationToUNNotificationRequest (n);
UNNotificationRequest* request = PushNotificationsDelegateDetails::juceNotificationToUNNotificationRequest (n);
[[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest: request
withCompletionHandler: ^(NSError* error)
{
jassert (error == nil);
[[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest: request
withCompletionHandler: ^(NSError* error)
{
jassert (error == nil);
if (error != nil)
NSLog (nsStringLiteral ("addNotificationRequest error: %@"), error);
}];
}
else
{
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
auto* notification = PushNotificationsDelegateDetails::juceNotificationToUILocalNotification (n);
[[UIApplication sharedApplication] scheduleLocalNotification: notification];
[notification release];
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
}
if (error != nil)
NSLog (nsStringLiteral ("addNotificationRequest error: %@"), error);
}];
}
void getDeliveredNotifications() const
{
if (@available (iOS 10, *))
{
[[UNUserNotificationCenter currentNotificationCenter] getDeliveredNotificationsWithCompletionHandler:
^(NSArray<UNNotification*>* notifications)
{
Array<PushNotifications::Notification> notifs;
[[UNUserNotificationCenter currentNotificationCenter] getDeliveredNotificationsWithCompletionHandler:
^(NSArray<UNNotification*>* notifications)
{
Array<PushNotifications::Notification> notifs;
for (UNNotification* n in notifications)
notifs.add (PushNotificationsDelegateDetails::unNotificationToJuceNotification (n));
for (UNNotification* n in notifications)
notifs.add (PushNotificationsDelegateDetails::unNotificationToJuceNotification (n));
owner.listeners.call ([&] (Listener& l) { l.deliveredNotificationsListReceived (notifs); });
}];
}
else
{
// Not supported on this platform
jassertfalse;
owner.listeners.call ([] (Listener& l) { l.deliveredNotificationsListReceived ({}); });
}
owner.listeners.call ([&] (Listener& l) { l.deliveredNotificationsListReceived (notifs); });
}];
}
void removeAllDeliveredNotifications()
{
if (@available (iOS 10, *))
{
[[UNUserNotificationCenter currentNotificationCenter] removeAllDeliveredNotifications];
}
else
{
// Not supported on this platform
jassertfalse;
}
[[UNUserNotificationCenter currentNotificationCenter] removeAllDeliveredNotifications];
}
void removeDeliveredNotification ([[maybe_unused]] const String& identifier)
{
if (@available (iOS 10, *))
{
NSArray<NSString*>* identifiers = [NSArray arrayWithObject: juceStringToNS (identifier)];
NSArray<NSString*>* identifiers = [NSArray arrayWithObject: juceStringToNS (identifier)];
[[UNUserNotificationCenter currentNotificationCenter] removeDeliveredNotificationsWithIdentifiers: identifiers];
}
else
{
// Not supported on this platform
jassertfalse;
}
[[UNUserNotificationCenter currentNotificationCenter] removeDeliveredNotificationsWithIdentifiers: identifiers];
}
void setupChannels ([[maybe_unused]] const Array<ChannelGroup>& groups, [[maybe_unused]] const Array<Channel>& channels)
@ -618,64 +489,27 @@ struct PushNotifications::Pimpl
void getPendingLocalNotifications() const
{
if (@available (iOS 10, *))
{
[[UNUserNotificationCenter currentNotificationCenter] getPendingNotificationRequestsWithCompletionHandler:
^(NSArray<UNNotificationRequest*>* requests)
{
Array<PushNotifications::Notification> notifs;
[[UNUserNotificationCenter currentNotificationCenter] getPendingNotificationRequestsWithCompletionHandler:
^(NSArray<UNNotificationRequest*>* requests)
{
Array<PushNotifications::Notification> notifs;
for (UNNotificationRequest* r : requests)
notifs.add (PushNotificationsDelegateDetails::unNotificationRequestToJuceNotification (r));
for (UNNotificationRequest* r : requests)
notifs.add (PushNotificationsDelegateDetails::unNotificationRequestToJuceNotification (r));
owner.listeners.call ([&] (Listener& l) { l.pendingLocalNotificationsListReceived (notifs); });
}
];
}
else
{
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
Array<PushNotifications::Notification> notifs;
for (UILocalNotification* n in [UIApplication sharedApplication].scheduledLocalNotifications)
notifs.add (PushNotificationsDelegateDetails::uiLocalNotificationToJuceNotification (n));
owner.listeners.call ([&] (Listener& l) { l.pendingLocalNotificationsListReceived (notifs); });
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
}
owner.listeners.call ([&] (Listener& l) { l.pendingLocalNotificationsListReceived (notifs); });
}];
}
void removePendingLocalNotification (const String& identifier)
{
if (@available (iOS 10, *))
{
NSArray<NSString*>* identifiers = [NSArray arrayWithObject: juceStringToNS (identifier)];
[[UNUserNotificationCenter currentNotificationCenter] removePendingNotificationRequestsWithIdentifiers: identifiers];
}
else
{
// Not supported on this platform
jassertfalse;
}
NSArray<NSString*>* identifiers = [NSArray arrayWithObject: juceStringToNS (identifier)];
[[UNUserNotificationCenter currentNotificationCenter] removePendingNotificationRequestsWithIdentifiers: identifiers];
}
void removeAllPendingLocalNotifications()
{
if (@available (iOS 10, *))
{
[[UNUserNotificationCenter currentNotificationCenter] removeAllPendingNotificationRequests];
}
else
{
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
[[UIApplication sharedApplication] cancelAllLocalNotifications];
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
}
[[UNUserNotificationCenter currentNotificationCenter] removeAllPendingNotificationRequests];
}
String getDeviceToken()

View file

@ -147,27 +147,21 @@ struct CameraDevice::Pimpl
private:
static NSArray<AVCaptureDevice*>* getDevices()
{
if (@available (iOS 10.0, *))
{
std::unique_ptr<NSMutableArray<AVCaptureDeviceType>, NSObjectDeleter> deviceTypes ([[NSMutableArray alloc] initWithCapacity: 2]);
std::unique_ptr<NSMutableArray<AVCaptureDeviceType>, NSObjectDeleter> deviceTypes ([[NSMutableArray alloc] initWithCapacity: 2]);
[deviceTypes.get() addObject: AVCaptureDeviceTypeBuiltInWideAngleCamera];
[deviceTypes.get() addObject: AVCaptureDeviceTypeBuiltInTelephotoCamera];
[deviceTypes.get() addObject: AVCaptureDeviceTypeBuiltInWideAngleCamera];
[deviceTypes.get() addObject: AVCaptureDeviceTypeBuiltInTelephotoCamera];
if (@available (iOS 10.2, *))
[deviceTypes.get() addObject: AVCaptureDeviceTypeBuiltInDualCamera];
[deviceTypes.get() addObject: AVCaptureDeviceTypeBuiltInDualCamera];
if (@available (iOS 11.1, *))
[deviceTypes.get() addObject: AVCaptureDeviceTypeBuiltInTrueDepthCamera];
if (@available (iOS 11.1, *))
[deviceTypes.get() addObject: AVCaptureDeviceTypeBuiltInTrueDepthCamera];
auto discoverySession = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes: deviceTypes.get()
mediaType: AVMediaTypeVideo
position: AVCaptureDevicePositionUnspecified];
auto discoverySession = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes: deviceTypes.get()
mediaType: AVMediaTypeVideo
position: AVCaptureDevicePositionUnspecified];
return [discoverySession devices];
}
return [AVCaptureDevice devicesWithMediaType: AVMediaTypeVideo];
return [discoverySession devices];
}
//==============================================================================
@ -211,11 +205,8 @@ private:
JUCE_CAMERA_LOG ("Supports custom exposure: " + String ((int)[device isExposureModeSupported: AVCaptureExposureModeCustom]));
JUCE_CAMERA_LOG ("Supports point of interest exposure: " + String ((int)device.exposurePointOfInterestSupported));
if (@available (iOS 10.0, *))
{
JUCE_CAMERA_LOG ("Device type: " + nsStringToJuce (device.deviceType));
JUCE_CAMERA_LOG ("Locking focus with custom lens position supported: " + String ((int)device.lockingFocusWithCustomLensPositionSupported));
}
JUCE_CAMERA_LOG ("Device type: " + nsStringToJuce (device.deviceType));
JUCE_CAMERA_LOG ("Locking focus with custom lens position supported: " + String ((int)device.lockingFocusWithCustomLensPositionSupported));
if (@available (iOS 11.0, *))
{
@ -238,23 +229,20 @@ private:
{
JUCE_CAMERA_LOG ("Media type: " + nsStringToJuce (format.mediaType));
if (@available (iOS 10.0, *))
String colourSpaces;
for (NSNumber* number in format.supportedColorSpaces)
{
String colourSpaces;
for (NSNumber* number in format.supportedColorSpaces)
switch ([number intValue])
{
switch ([number intValue])
{
case AVCaptureColorSpace_sRGB: colourSpaces << "sRGB "; break;
case AVCaptureColorSpace_P3_D65: colourSpaces << "P3_D65 "; break;
default: break;
}
case AVCaptureColorSpace_sRGB: colourSpaces << "sRGB "; break;
case AVCaptureColorSpace_P3_D65: colourSpaces << "P3_D65 "; break;
default: break;
}
JUCE_CAMERA_LOG ("Supported colour spaces: " + colourSpaces);
}
JUCE_CAMERA_LOG ("Supported colour spaces: " + colourSpaces);
JUCE_CAMERA_LOG ("Video field of view: " + String (format.videoFieldOfView));
JUCE_CAMERA_LOG ("Video max zoom factor: " + String (format.videoMaxZoomFactor));
JUCE_CAMERA_LOG ("Video zoom factor upscale threshold: " + String (format.videoZoomFactorUpscaleThreshold));
@ -582,12 +570,9 @@ private:
captureOutput (createCaptureOutput()),
photoOutputDelegate (nullptr)
{
if (@available (iOS 10.0, *))
{
static PhotoOutputDelegateClass cls;
photoOutputDelegate.reset ([cls.createInstance() init]);
PhotoOutputDelegateClass::setOwner (photoOutputDelegate.get(), this);
}
static PhotoOutputDelegateClass cls;
photoOutputDelegate.reset ([cls.createInstance() init]);
PhotoOutputDelegateClass::setOwner (photoOutputDelegate.get(), this);
captureSession.addOutputIfPossible (captureOutput);
}
@ -607,19 +592,16 @@ private:
if (auto* connection = findVideoConnection (captureOutput))
{
if (@available (iOS 10.0, *))
if ([captureOutput isKindOfClass: [AVCapturePhotoOutput class]])
{
if ([captureOutput isKindOfClass: [AVCapturePhotoOutput class]])
{
auto* photoOutput = (AVCapturePhotoOutput*) captureOutput;
auto outputConnection = [photoOutput connectionWithMediaType: AVMediaTypeVideo];
outputConnection.videoOrientation = orientationToUse;
auto* photoOutput = (AVCapturePhotoOutput*) captureOutput;
auto outputConnection = [photoOutput connectionWithMediaType: AVMediaTypeVideo];
outputConnection.videoOrientation = orientationToUse;
[photoOutput capturePhotoWithSettings: [AVCapturePhotoSettings photoSettings]
delegate: id<AVCapturePhotoCaptureDelegate> (photoOutputDelegate.get())];
[photoOutput capturePhotoWithSettings: [AVCapturePhotoSettings photoSettings]
delegate: id<AVCapturePhotoCaptureDelegate> (photoOutputDelegate.get())];
return;
}
return;
}
auto* stillImageOutput = (AVCaptureStillImageOutput*) captureOutput;
@ -657,66 +639,60 @@ private:
private:
static AVCaptureOutput* createCaptureOutput()
{
if (@available (iOS 10.0, *))
return [AVCapturePhotoOutput new];
return [AVCaptureStillImageOutput new];
return [AVCapturePhotoOutput new];
}
static void printImageOutputDebugInfo (AVCaptureOutput* captureOutput)
{
if (@available (iOS 10.0, *))
if ([captureOutput isKindOfClass: [AVCapturePhotoOutput class]])
{
if ([captureOutput isKindOfClass: [AVCapturePhotoOutput class]])
auto* photoOutput = (AVCapturePhotoOutput*) captureOutput;
String typesString;
for (id type in photoOutput.availablePhotoCodecTypes)
typesString << nsStringToJuce (type) << " ";
JUCE_CAMERA_LOG ("Available image codec types: " + typesString);
JUCE_CAMERA_LOG ("Still image stabilization supported: " + String ((int) photoOutput.stillImageStabilizationSupported));
JUCE_CAMERA_LOG ("Dual camera fusion supported: " + String ((int) photoOutput.dualCameraFusionSupported));
JUCE_CAMERA_LOG ("Supports flash: " + String ((int) [photoOutput.supportedFlashModes containsObject: @(AVCaptureFlashModeOn)]));
JUCE_CAMERA_LOG ("Supports auto flash: " + String ((int) [photoOutput.supportedFlashModes containsObject: @(AVCaptureFlashModeAuto)]));
JUCE_CAMERA_LOG ("Max bracketed photo count: " + String (photoOutput.maxBracketedCapturePhotoCount));
JUCE_CAMERA_LOG ("Lens stabilization during bracketed capture supported: " + String ((int) photoOutput.lensStabilizationDuringBracketedCaptureSupported));
JUCE_CAMERA_LOG ("Live photo capture supported: " + String ((int) photoOutput.livePhotoCaptureSupported));
if (@available (iOS 11.0, *))
{
auto* photoOutput = (AVCapturePhotoOutput*) captureOutput;
typesString.clear();
String typesString;
for (id type in photoOutput.availablePhotoCodecTypes)
for (AVFileType type in photoOutput.availablePhotoFileTypes)
typesString << nsStringToJuce (type) << " ";
JUCE_CAMERA_LOG ("Available image codec types: " + typesString);
JUCE_CAMERA_LOG ("Available photo file types: " + typesString);
JUCE_CAMERA_LOG ("Still image stabilization supported: " + String ((int) photoOutput.stillImageStabilizationSupported));
JUCE_CAMERA_LOG ("Dual camera fusion supported: " + String ((int) photoOutput.dualCameraFusionSupported));
JUCE_CAMERA_LOG ("Supports flash: " + String ((int) [photoOutput.supportedFlashModes containsObject: @(AVCaptureFlashModeOn)]));
JUCE_CAMERA_LOG ("Supports auto flash: " + String ((int) [photoOutput.supportedFlashModes containsObject: @(AVCaptureFlashModeAuto)]));
JUCE_CAMERA_LOG ("Max bracketed photo count: " + String (photoOutput.maxBracketedCapturePhotoCount));
JUCE_CAMERA_LOG ("Lens stabilization during bracketed capture supported: " + String ((int) photoOutput.lensStabilizationDuringBracketedCaptureSupported));
JUCE_CAMERA_LOG ("Live photo capture supported: " + String ((int) photoOutput.livePhotoCaptureSupported));
typesString.clear();
for (AVFileType type in photoOutput.availableRawPhotoFileTypes)
typesString << nsStringToJuce (type) << " ";
if (@available (iOS 11.0, *))
{
typesString.clear();
JUCE_CAMERA_LOG ("Available RAW photo file types: " + typesString);
for (AVFileType type in photoOutput.availablePhotoFileTypes)
typesString << nsStringToJuce (type) << " ";
typesString.clear();
JUCE_CAMERA_LOG ("Available photo file types: " + typesString);
for (AVFileType type in photoOutput.availableLivePhotoVideoCodecTypes)
typesString << nsStringToJuce (type) << " ";
typesString.clear();
JUCE_CAMERA_LOG ("Available live photo video codec types: " + typesString);
for (AVFileType type in photoOutput.availableRawPhotoFileTypes)
typesString << nsStringToJuce (type) << " ";
JUCE_CAMERA_LOG ("Available RAW photo file types: " + typesString);
typesString.clear();
for (AVFileType type in photoOutput.availableLivePhotoVideoCodecTypes)
typesString << nsStringToJuce (type) << " ";
JUCE_CAMERA_LOG ("Available live photo video codec types: " + typesString);
JUCE_CAMERA_LOG ("Dual camera dual photo delivery supported: " + String ((int) photoOutput.dualCameraDualPhotoDeliverySupported));
JUCE_CAMERA_LOG ("Camera calibration data delivery supported: " + String ((int) photoOutput.cameraCalibrationDataDeliverySupported));
JUCE_CAMERA_LOG ("Depth data delivery supported: " + String ((int) photoOutput.depthDataDeliverySupported));
}
return;
JUCE_CAMERA_LOG ("Dual camera dual photo delivery supported: " + String ((int) photoOutput.dualCameraDualPhotoDeliverySupported));
JUCE_CAMERA_LOG ("Camera calibration data delivery supported: " + String ((int) photoOutput.cameraCalibrationDataDeliverySupported));
JUCE_CAMERA_LOG ("Depth data delivery supported: " + String ((int) photoOutput.depthDataDeliverySupported));
}
return;
}
auto* stillImageOutput = (AVCaptureStillImageOutput*) captureOutput;
@ -745,7 +721,7 @@ private:
}
//==============================================================================
class API_AVAILABLE (ios (10.0)) PhotoOutputDelegateClass : public ObjCClass<NSObject>
class PhotoOutputDelegateClass : public ObjCClass<NSObject>
{
public:
PhotoOutputDelegateClass() : ObjCClass<NSObject> ("PhotoOutputDelegateClass_")
@ -996,8 +972,7 @@ private:
void startRecording (const File& file, AVCaptureVideoOrientation orientationToUse)
{
if (@available (iOS 10.0, *))
printVideoOutputDebugInfo (movieFileOutput);
printVideoOutputDebugInfo (movieFileOutput);
auto url = [NSURL fileURLWithPath: juceStringToNS (file.getFullPathName())
isDirectory: NO];