mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Platform: Remove deprecated code paths that will never be called
This commit is contained in:
parent
5cdf6abf95
commit
a858f91354
6 changed files with 54 additions and 479 deletions
|
|
@ -34,8 +34,6 @@
|
|||
|
||||
#if JUCE_PLUGINHOST_AU && (JUCE_MAC || JUCE_IOS)
|
||||
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
|
||||
|
||||
#if JUCE_MAC
|
||||
#include <AudioUnit/AUCocoaUIView.h>
|
||||
#include <CoreAudioKit/AUGenericView.h>
|
||||
|
|
@ -227,85 +225,16 @@ namespace AudioUnitFormatHelpers
|
|||
if (manuString != nullptr && CFGetTypeID (manuString) == CFStringGetTypeID())
|
||||
manufacturer = String::fromCFString ((CFStringRef) manuString);
|
||||
|
||||
class ScopedBundleResourceMap final
|
||||
{
|
||||
public:
|
||||
explicit ScopedBundleResourceMap (CFBundleRef refIn) : ref (refIn),
|
||||
resFileId (CFBundleOpenBundleResourceMap (ref)),
|
||||
valid (resFileId != -1)
|
||||
{
|
||||
if (valid)
|
||||
UseResFile (resFileId);
|
||||
}
|
||||
NSBundle* bundle = [[NSBundle alloc] initWithPath: (NSString*) fileOrIdentifier.toCFString()];
|
||||
|
||||
~ScopedBundleResourceMap()
|
||||
{
|
||||
if (valid)
|
||||
CFBundleCloseBundleResourceMap (ref, resFileId);
|
||||
}
|
||||
NSArray* audioComponents = [bundle objectForInfoDictionaryKey: @"AudioComponents"];
|
||||
NSDictionary* dict = [audioComponents objectAtIndex: 0];
|
||||
|
||||
bool isValid() const noexcept
|
||||
{
|
||||
return valid;
|
||||
}
|
||||
desc.componentManufacturer = stringToOSType (nsStringToJuce ((NSString*) [dict valueForKey: @"manufacturer"]));
|
||||
desc.componentType = stringToOSType (nsStringToJuce ((NSString*) [dict valueForKey: @"type"]));
|
||||
desc.componentSubType = stringToOSType (nsStringToJuce ((NSString*) [dict valueForKey: @"subtype"]));
|
||||
|
||||
private:
|
||||
const CFBundleRef ref;
|
||||
const ResFileRefNum resFileId;
|
||||
const bool valid;
|
||||
};
|
||||
|
||||
const ScopedBundleResourceMap resourceMap { bundleRef.get() };
|
||||
|
||||
const OSType thngType = stringToOSType ("thng");
|
||||
auto numResources = Count1Resources (thngType);
|
||||
|
||||
if (resourceMap.isValid() && numResources > 0)
|
||||
{
|
||||
for (ResourceIndex i = 1; i <= numResources; ++i)
|
||||
{
|
||||
if (Handle h = Get1IndResource (thngType, i))
|
||||
{
|
||||
HLock (h);
|
||||
uint32 types[3];
|
||||
std::memcpy (types, *h, sizeof (types));
|
||||
|
||||
if (types[0] == kAudioUnitType_MusicDevice
|
||||
|| types[0] == kAudioUnitType_MusicEffect
|
||||
|| types[0] == kAudioUnitType_Effect
|
||||
|| types[0] == kAudioUnitType_Generator
|
||||
|| types[0] == kAudioUnitType_Panner
|
||||
|| types[0] == kAudioUnitType_Mixer
|
||||
|| types[0] == kAudioUnitType_MIDIProcessor)
|
||||
{
|
||||
desc.componentType = types[0];
|
||||
desc.componentSubType = types[1];
|
||||
desc.componentManufacturer = types[2];
|
||||
|
||||
if (AudioComponent comp = AudioComponentFindNext (nullptr, &desc))
|
||||
getNameAndManufacturer (comp, name, manufacturer);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
HUnlock (h);
|
||||
ReleaseResource (h);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSBundle* bundle = [[NSBundle alloc] initWithPath: (NSString*) fileOrIdentifier.toCFString()];
|
||||
|
||||
NSArray* audioComponents = [bundle objectForInfoDictionaryKey: @"AudioComponents"];
|
||||
NSDictionary* dict = [audioComponents objectAtIndex: 0];
|
||||
|
||||
desc.componentManufacturer = stringToOSType (nsStringToJuce ((NSString*) [dict valueForKey: @"manufacturer"]));
|
||||
desc.componentType = stringToOSType (nsStringToJuce ((NSString*) [dict valueForKey: @"type"]));
|
||||
desc.componentSubType = stringToOSType (nsStringToJuce ((NSString*) [dict valueForKey: @"subtype"]));
|
||||
|
||||
[bundle release];
|
||||
}
|
||||
[bundle release];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1707,7 +1636,7 @@ public:
|
|||
CFUniquePtr<CFWriteStreamRef> stream (CFWriteStreamCreateWithAllocatedBuffers (kCFAllocatorDefault, kCFAllocatorDefault));
|
||||
CFWriteStreamOpen (stream.get());
|
||||
|
||||
CFIndex bytesWritten = CFPropertyListWriteToStream (propertyList.object, stream.get(), kCFPropertyListBinaryFormat_v1_0, nullptr);
|
||||
const auto bytesWritten = CFPropertyListWrite (propertyList.object, stream.get(), kCFPropertyListBinaryFormat_v1_0, 0, nullptr);
|
||||
CFWriteStreamClose (stream.get());
|
||||
|
||||
CFUniquePtr<CFDataRef> data ((CFDataRef) CFWriteStreamCopyProperty (stream.get(), kCFStreamPropertyDataWritten));
|
||||
|
|
@ -1729,8 +1658,12 @@ public:
|
|||
CFReadStreamOpen (stream.get());
|
||||
|
||||
CFPropertyListFormat format = kCFPropertyListBinaryFormat_v1_0;
|
||||
CFObjectHolder<CFPropertyListRef> propertyList { CFPropertyListCreateFromStream (kCFAllocatorDefault, stream.get(), 0,
|
||||
kCFPropertyListImmutable, &format, nullptr) };
|
||||
CFObjectHolder<CFPropertyListRef> propertyList { CFPropertyListCreateWithStream (kCFAllocatorDefault,
|
||||
stream.get(),
|
||||
0,
|
||||
kCFPropertyListImmutable,
|
||||
&format,
|
||||
nullptr) };
|
||||
|
||||
if (propertyList.object != nullptr)
|
||||
{
|
||||
|
|
@ -3011,6 +2944,4 @@ FileSearchPath AudioUnitPluginFormat::getDefaultLocationsToSearch()
|
|||
|
||||
} // namespace juce
|
||||
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -43,11 +43,6 @@
|
|||
namespace juce
|
||||
{
|
||||
|
||||
#if ! (defined (__IPHONE_16_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_16_0)
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
|
||||
#define JUCE_DEPRECATION_IGNORED 1
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
class FileChooser::Native final : public FileChooser::Pimpl,
|
||||
public detail::NativeModalWrapperComponent,
|
||||
|
|
@ -335,10 +330,6 @@ std::shared_ptr<FileChooser::Pimpl> FileChooser::showPlatformDialog (FileChooser
|
|||
return Native::make (owner, flags);
|
||||
}
|
||||
|
||||
#if JUCE_DEPRECATION_IGNORED
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
#endif
|
||||
|
||||
} // namespace juce
|
||||
|
||||
@implementation FileChooserControllerClass
|
||||
|
|
@ -367,14 +358,6 @@ std::shared_ptr<FileChooser::Pimpl> FileChooser::showPlatformDialog (FileChooser
|
|||
return self;
|
||||
}
|
||||
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-implementations")
|
||||
- (void) documentPicker: (UIDocumentPickerViewController*) controller didPickDocumentAtURL: (NSURL*) url
|
||||
{
|
||||
if (owner != nullptr)
|
||||
owner->didPickDocumentAtURL (url);
|
||||
}
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
|
||||
- (void) documentPicker: (UIDocumentPickerViewController*) controller didPickDocumentsAtURLs: (NSArray<NSURL*>*) urls
|
||||
{
|
||||
if (owner != nullptr)
|
||||
|
|
|
|||
|
|
@ -85,24 +85,6 @@ namespace juce
|
|||
withResponseInfo: (NSDictionary*) responseInfo
|
||||
completionHandler: (void(^)()) completionHandler;
|
||||
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
|
||||
|
||||
- (void) application: (UIApplication*) application
|
||||
didRegisterUserNotificationSettings: (UIUserNotificationSettings*) notificationSettings;
|
||||
- (void) application: (UIApplication*) application
|
||||
didReceiveLocalNotification: (UILocalNotification*) notification;
|
||||
- (void) application: (UIApplication*) application
|
||||
handleActionWithIdentifier: (NSString*) identifier
|
||||
forLocalNotification: (UILocalNotification*) notification
|
||||
completionHandler: (void(^)()) completionHandler;
|
||||
- (void) application: (UIApplication*) application
|
||||
handleActionWithIdentifier: (NSString*) identifier
|
||||
forLocalNotification: (UILocalNotification*) notification
|
||||
withResponseInfo: (NSDictionary*) responseInfo
|
||||
completionHandler: (void(^)()) completionHandler;
|
||||
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
|
||||
- (void) userNotificationCenter: (UNUserNotificationCenter*) center
|
||||
willPresentNotification: (UNNotification*) notification
|
||||
withCompletionHandler: (void (^)(UNNotificationPresentationOptions options)) completionHandler;
|
||||
|
|
@ -328,96 +310,6 @@ JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
|||
}
|
||||
}
|
||||
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
|
||||
|
||||
- (void) application: (UIApplication*) application
|
||||
didRegisterUserNotificationSettings: (UIUserNotificationSettings*) notificationSettings
|
||||
{
|
||||
ignoreUnused (application);
|
||||
|
||||
SEL selector = @selector (application:didRegisterUserNotificationSettings:);
|
||||
|
||||
if (_pushNotificationsDelegate != nil && [_pushNotificationsDelegate respondsToSelector:selector])
|
||||
{
|
||||
NSInvocation* invocation = [NSInvocation invocationWithMethodSignature: [_pushNotificationsDelegate methodSignatureForSelector: selector]];
|
||||
[invocation setSelector: selector];
|
||||
[invocation setTarget: _pushNotificationsDelegate];
|
||||
[invocation setArgument: &application atIndex: 2];
|
||||
[invocation setArgument: ¬ificationSettings atIndex: 3];
|
||||
|
||||
[invocation invoke];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) application: (UIApplication*) application
|
||||
didReceiveLocalNotification: (UILocalNotification*) notification
|
||||
{
|
||||
ignoreUnused (application);
|
||||
|
||||
SEL selector = @selector (application:didReceiveLocalNotification:);
|
||||
|
||||
if (_pushNotificationsDelegate != nil && [_pushNotificationsDelegate respondsToSelector: selector])
|
||||
{
|
||||
NSInvocation* invocation = [NSInvocation invocationWithMethodSignature: [_pushNotificationsDelegate methodSignatureForSelector: selector]];
|
||||
[invocation setSelector: selector];
|
||||
[invocation setTarget: _pushNotificationsDelegate];
|
||||
[invocation setArgument: &application atIndex: 2];
|
||||
[invocation setArgument: ¬ification atIndex: 3];
|
||||
|
||||
[invocation invoke];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) application: (UIApplication*) application
|
||||
handleActionWithIdentifier: (NSString*) identifier
|
||||
forLocalNotification: (UILocalNotification*) notification
|
||||
completionHandler: (void(^)()) completionHandler
|
||||
{
|
||||
ignoreUnused (application);
|
||||
|
||||
SEL selector = @selector (application:handleActionWithIdentifier:forLocalNotification:completionHandler:);
|
||||
|
||||
if (_pushNotificationsDelegate != nil && [_pushNotificationsDelegate respondsToSelector: selector])
|
||||
{
|
||||
NSInvocation* invocation = [NSInvocation invocationWithMethodSignature: [_pushNotificationsDelegate methodSignatureForSelector: selector]];
|
||||
[invocation setSelector: selector];
|
||||
[invocation setTarget: _pushNotificationsDelegate];
|
||||
[invocation setArgument: &application atIndex:2];
|
||||
[invocation setArgument: &identifier atIndex:3];
|
||||
[invocation setArgument: ¬ification atIndex:4];
|
||||
[invocation setArgument: &completionHandler atIndex:5];
|
||||
|
||||
[invocation invoke];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) application: (UIApplication*) application
|
||||
handleActionWithIdentifier: (NSString*) identifier
|
||||
forLocalNotification: (UILocalNotification*) notification
|
||||
withResponseInfo: (NSDictionary*) responseInfo
|
||||
completionHandler: (void(^)()) completionHandler
|
||||
{
|
||||
ignoreUnused (application);
|
||||
|
||||
SEL selector = @selector (application:handleActionWithIdentifier:forLocalNotification:withResponseInfo:completionHandler:);
|
||||
|
||||
if (_pushNotificationsDelegate != nil && [_pushNotificationsDelegate respondsToSelector: selector])
|
||||
{
|
||||
NSInvocation* invocation = [NSInvocation invocationWithMethodSignature: [_pushNotificationsDelegate methodSignatureForSelector: selector]];
|
||||
[invocation setSelector: selector];
|
||||
[invocation setTarget: _pushNotificationsDelegate];
|
||||
[invocation setArgument: &application atIndex:2];
|
||||
[invocation setArgument: &identifier atIndex:3];
|
||||
[invocation setArgument: ¬ification atIndex:4];
|
||||
[invocation setArgument: &responseInfo atIndex:5];
|
||||
[invocation setArgument: &completionHandler atIndex:6];
|
||||
|
||||
[invocation invoke];
|
||||
}
|
||||
}
|
||||
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
|
||||
- (void) userNotificationCenter: (UNUserNotificationCenter*) center
|
||||
willPresentNotification: (UNNotification*) notification
|
||||
withCompletionHandler: (void (^)(UNNotificationPresentationOptions options)) completionHandler
|
||||
|
|
|
|||
|
|
@ -74,31 +74,6 @@ struct PushNotificationsDelegateDetails
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
|
||||
static UILocalNotification* juceNotificationToUILocalNotification (const PushNotifications::Notification& n)
|
||||
{
|
||||
auto notification = [[UILocalNotification alloc] init];
|
||||
|
||||
notification.alertTitle = juceStringToNS (n.title);
|
||||
notification.alertBody = juceStringToNS (n.body);
|
||||
notification.category = juceStringToNS (n.category);
|
||||
notification.applicationIconBadgeNumber = n.badgeNumber;
|
||||
|
||||
auto triggerTime = Time::getCurrentTime() + RelativeTime (n.triggerIntervalSec);
|
||||
notification.fireDate = [NSDate dateWithTimeIntervalSince1970: (double) triggerTime.toMilliseconds() / 1000.0];
|
||||
notification.userInfo = varToNSDictionary (n.properties);
|
||||
|
||||
auto soundToPlayString = n.soundToPlay.toString (true);
|
||||
|
||||
if (soundToPlayString == "default_os_sound")
|
||||
notification.soundName = UILocalNotificationDefaultSoundName;
|
||||
else if (soundToPlayString.isNotEmpty())
|
||||
notification.soundName = juceStringToNS (soundToPlayString);
|
||||
|
||||
return notification;
|
||||
}
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
|
||||
static UNNotificationRequest* juceNotificationToUNNotificationRequest (const PushNotifications::Notification& n)
|
||||
{
|
||||
// content
|
||||
|
|
@ -118,8 +93,8 @@ struct PushNotificationsDelegateDetails
|
|||
else if (soundToPlayString.isNotEmpty())
|
||||
content.sound = [UNNotificationSound soundNamed: juceStringToNS (soundToPlayString)];
|
||||
|
||||
auto* propsDict = (NSMutableDictionary*) varToNSDictionary (n.properties);
|
||||
[propsDict setObject: juceStringToNS (soundToPlayString) forKey: nsStringLiteral ("com.juce.soundName")];
|
||||
auto* propsDict = (NSMutableDictionary*) [varToNSDictionary (n.properties) mutableCopy];
|
||||
[propsDict setObject: juceStringToNS (soundToPlayString) forKey: @"com.juce.soundName"];
|
||||
content.userInfo = propsDict;
|
||||
|
||||
// trigger
|
||||
|
|
@ -245,59 +220,6 @@ struct PushNotificationsDelegateDetails
|
|||
return unNotificationRequestToJuceNotification (n.request);
|
||||
}
|
||||
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
|
||||
static PushNotifications::Notification uiLocalNotificationToJuceNotification (UILocalNotification* n)
|
||||
{
|
||||
PushNotifications::Notification notif;
|
||||
|
||||
notif.title = nsStringToJuce (n.alertTitle);
|
||||
notif.body = nsStringToJuce (n.alertBody);
|
||||
|
||||
if (n.fireDate != nil)
|
||||
{
|
||||
NSDate* dateNow = [NSDate date];
|
||||
NSDate* fireDate = n.fireDate;
|
||||
|
||||
notif.triggerIntervalSec = [dateNow timeIntervalSinceDate: fireDate];
|
||||
}
|
||||
|
||||
notif.soundToPlay = URL (nsStringToJuce (n.soundName));
|
||||
notif.badgeNumber = (int) n.applicationIconBadgeNumber;
|
||||
notif.category = nsStringToJuce (n.category);
|
||||
notif.properties = nsDictionaryToVar (n.userInfo);
|
||||
|
||||
return notif;
|
||||
}
|
||||
|
||||
static Action uiUserNotificationActionToAction (UIUserNotificationAction* a)
|
||||
{
|
||||
Action action;
|
||||
|
||||
action.identifier = nsStringToJuce (a.identifier);
|
||||
action.title = nsStringToJuce (a.title);
|
||||
action.style = a.behavior == UIUserNotificationActionBehaviorTextInput
|
||||
? Action::text
|
||||
: Action::button;
|
||||
|
||||
action.triggerInBackground = a.activationMode == UIUserNotificationActivationModeBackground;
|
||||
action.destructive = a.destructive;
|
||||
action.parameters = nsDictionaryToVar (a.parameters);
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
static Category uiUserNotificationCategoryToCategory (UIUserNotificationCategory* c)
|
||||
{
|
||||
Category category;
|
||||
category.identifier = nsStringToJuce (c.identifier);
|
||||
|
||||
for (UIUserNotificationAction* a in [c actionsForContext: UIUserNotificationActionContextDefault])
|
||||
category.actions.add (uiUserNotificationActionToAction (a));
|
||||
|
||||
return category;
|
||||
}
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
|
||||
static Action unNotificationActionToAction (UNNotificationAction* a)
|
||||
{
|
||||
Action action;
|
||||
|
|
@ -591,46 +513,6 @@ private:
|
|||
completionHandler();
|
||||
}
|
||||
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
|
||||
|
||||
void didRegisterUserNotificationSettings (UIUserNotificationSettings*)
|
||||
{
|
||||
requestSettingsUsed();
|
||||
}
|
||||
|
||||
void didReceiveLocalNotification (UILocalNotification* notification)
|
||||
{
|
||||
auto n = PushNotificationsDelegateDetails::uiLocalNotificationToJuceNotification (notification);
|
||||
|
||||
owner.listeners.call ([&] (Listener& l) { l.handleNotification (true, n); });
|
||||
}
|
||||
|
||||
void handleActionForLocalNotificationCompletionHandler (NSString* actionIdentifier,
|
||||
UILocalNotification* notification,
|
||||
void (^completionHandler)())
|
||||
{
|
||||
handleActionForLocalNotificationWithResponseCompletionHandler (actionIdentifier,
|
||||
notification,
|
||||
nil,
|
||||
completionHandler);
|
||||
}
|
||||
|
||||
void handleActionForLocalNotificationWithResponseCompletionHandler (NSString* actionIdentifier,
|
||||
UILocalNotification* notification,
|
||||
NSDictionary* responseInfo,
|
||||
void (^completionHandler)())
|
||||
{
|
||||
auto n = PushNotificationsDelegateDetails::uiLocalNotificationToJuceNotification (notification);
|
||||
auto actionString = nsStringToJuce (actionIdentifier);
|
||||
auto response = PushNotificationsDelegateDetails::getUserResponseFromNSDictionary (responseInfo);
|
||||
|
||||
owner.listeners.call ([&] (Listener& l) { l.handleNotificationAction (true, n, actionString, response); });
|
||||
|
||||
completionHandler();
|
||||
}
|
||||
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
|
||||
void willPresentNotificationWithCompletionHandler ([[maybe_unused]] UNNotification* notification,
|
||||
void (^completionHandler)(UNNotificationPresentationOptions options))
|
||||
{
|
||||
|
|
@ -700,30 +582,6 @@ private:
|
|||
getThis (self).handleActionForRemoteNotificationCompletionHandler (actionIdentifier, userInfo, responseInfo, completionHandler);
|
||||
});
|
||||
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
|
||||
|
||||
addMethod (@selector (application:didRegisterUserNotificationSettings:), [] (id self, SEL, UIApplication*, UIUserNotificationSettings* settingsToUse)
|
||||
{
|
||||
getThis (self).didRegisterUserNotificationSettings (settingsToUse);
|
||||
});
|
||||
|
||||
addMethod (@selector (application:didReceiveLocalNotification:), [] (id self, SEL, UIApplication*, UILocalNotification* notification)
|
||||
{
|
||||
getThis (self).didReceiveLocalNotification (notification);
|
||||
});
|
||||
|
||||
addMethod (@selector (application:handleActionWithIdentifier:forLocalNotification:completionHandler:), [] (id self, SEL, UIApplication*, NSString* actionIdentifier, UILocalNotification* notification, void (^completionHandler)())
|
||||
{
|
||||
getThis (self).handleActionForLocalNotificationCompletionHandler (actionIdentifier, notification, completionHandler);
|
||||
});
|
||||
|
||||
addMethod (@selector (application:handleActionWithIdentifier:forLocalNotification:withResponseInfo:completionHandler:), [] (id self, SEL, UIApplication*, NSString* actionIdentifier, UILocalNotification* notification, NSDictionary* responseInfo, void (^completionHandler)())
|
||||
{
|
||||
getThis (self). handleActionForLocalNotificationWithResponseCompletionHandler (actionIdentifier, notification, responseInfo, completionHandler);
|
||||
});
|
||||
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
|
||||
addMethod (@selector (userNotificationCenter:willPresentNotification:withCompletionHandler:), [] (id self, SEL, UNUserNotificationCenter*, UNNotification* notification, void (^completionHandler)(UNNotificationPresentationOptions options))
|
||||
{
|
||||
getThis (self).willPresentNotificationWithCompletionHandler (notification, completionHandler);
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
|
||||
|
||||
namespace juce
|
||||
{
|
||||
|
||||
|
|
@ -535,5 +533,3 @@ private:
|
|||
};
|
||||
|
||||
} // namespace juce
|
||||
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
|
||||
|
||||
struct CameraDevice::Pimpl
|
||||
{
|
||||
using InternalOpenCameraResultCallback = std::function<void (const String& /*cameraId*/, const String& /*error*/)>;
|
||||
|
|
@ -583,42 +581,12 @@ private:
|
|||
|
||||
if (auto* connection = findVideoConnection (captureOutput))
|
||||
{
|
||||
if ([captureOutput isKindOfClass: [AVCapturePhotoOutput class]])
|
||||
{
|
||||
auto* photoOutput = (AVCapturePhotoOutput*) captureOutput;
|
||||
auto outputConnection = [photoOutput connectionWithMediaType: AVMediaTypeVideo];
|
||||
outputConnection.videoOrientation = orientationToUse;
|
||||
|
||||
[photoOutput capturePhotoWithSettings: [AVCapturePhotoSettings photoSettings]
|
||||
delegate: id<AVCapturePhotoCaptureDelegate> (photoOutputDelegate.get())];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
auto* stillImageOutput = (AVCaptureStillImageOutput*) captureOutput;
|
||||
auto outputConnection = [stillImageOutput connectionWithMediaType: AVMediaTypeVideo];
|
||||
auto* photoOutput = (AVCapturePhotoOutput*) captureOutput;
|
||||
auto outputConnection = [photoOutput connectionWithMediaType: AVMediaTypeVideo];
|
||||
outputConnection.videoOrientation = orientationToUse;
|
||||
|
||||
[stillImageOutput captureStillImageAsynchronouslyFromConnection: connection completionHandler:
|
||||
^(CMSampleBufferRef imageSampleBuffer, NSError* error)
|
||||
{
|
||||
takingPicture = false;
|
||||
|
||||
if (error != nil)
|
||||
{
|
||||
JUCE_CAMERA_LOG ("Still picture capture failed, error: " + nsStringToJuce (error.localizedDescription));
|
||||
jassertfalse;
|
||||
return;
|
||||
}
|
||||
|
||||
NSData* imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation: imageSampleBuffer];
|
||||
|
||||
auto image = ImageFileFormat::loadFrom (imageData.bytes, (size_t) imageData.length);
|
||||
|
||||
callListeners (image);
|
||||
|
||||
MessageManager::callAsync ([this, image] { notifyPictureTaken (image); });
|
||||
}];
|
||||
[photoOutput capturePhotoWithSettings: [AVCapturePhotoSettings photoSettings]
|
||||
delegate: id<AVCapturePhotoCaptureDelegate> (photoOutputDelegate.get())];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -635,65 +603,47 @@ private:
|
|||
|
||||
static void printImageOutputDebugInfo (AVCaptureOutput* captureOutput)
|
||||
{
|
||||
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));
|
||||
|
||||
typesString.clear();
|
||||
|
||||
for (AVFileType type in photoOutput.availablePhotoFileTypes)
|
||||
typesString << nsStringToJuce (type) << " ";
|
||||
|
||||
JUCE_CAMERA_LOG ("Available photo file types: " + typesString);
|
||||
|
||||
typesString.clear();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
auto* stillImageOutput = (AVCaptureStillImageOutput*) captureOutput;
|
||||
auto* photoOutput = (AVCapturePhotoOutput*) captureOutput;
|
||||
|
||||
String typesString;
|
||||
|
||||
for (id type in stillImageOutput.availableImageDataCodecTypes)
|
||||
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) stillImageOutput.stillImageStabilizationSupported));
|
||||
JUCE_CAMERA_LOG ("Automatically enables still image stabilization when available: " + String ((int) stillImageOutput.automaticallyEnablesStillImageStabilizationWhenAvailable));
|
||||
|
||||
JUCE_CAMERA_LOG ("Output settings for image output: " + nsStringToJuce ([stillImageOutput.outputSettings description]));
|
||||
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.availablePhotoFileTypes)
|
||||
typesString << nsStringToJuce (type) << " ";
|
||||
|
||||
JUCE_CAMERA_LOG ("Available photo file types: " + typesString);
|
||||
|
||||
typesString.clear();
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -851,39 +801,6 @@ private:
|
|||
return CGSizeMake ((CGFloat) width, (CGFloat) height);
|
||||
}
|
||||
|
||||
static void didFinishProcessingPhotoSampleBuffer (id self, SEL, AVCapturePhotoOutput*,
|
||||
CMSampleBufferRef imageBuffer, CMSampleBufferRef imagePreviewBuffer,
|
||||
AVCaptureResolvedPhotoSettings*, AVCaptureBracketedStillImageSettings*,
|
||||
NSError* error)
|
||||
{
|
||||
getOwner (self).takingPicture = false;
|
||||
|
||||
[[maybe_unused]] String errorString = error != nil ? nsStringToJuce (error.localizedDescription) : String();
|
||||
|
||||
JUCE_CAMERA_LOG ("didFinishProcessingPhotoSampleBuffer(), error = " + errorString);
|
||||
|
||||
if (error != nil)
|
||||
{
|
||||
JUCE_CAMERA_LOG ("Still picture capture failed, error: " + nsStringToJuce (error.localizedDescription));
|
||||
jassertfalse;
|
||||
return;
|
||||
}
|
||||
|
||||
NSData* origImageData = [AVCapturePhotoOutput JPEGPhotoDataRepresentationForJPEGSampleBuffer: imageBuffer previewPhotoSampleBuffer: imagePreviewBuffer];
|
||||
auto origImage = [UIImage imageWithData: origImageData];
|
||||
auto imageOrientation = uiImageOrientationToCGImageOrientation (origImage.imageOrientation);
|
||||
|
||||
auto* uiImage = getImageWithCorrectOrientation (imageOrientation, origImage.CGImage);
|
||||
|
||||
auto* imageData = UIImageJPEGRepresentation (uiImage, 0.f);
|
||||
|
||||
auto image = ImageFileFormat::loadFrom (imageData.bytes, (size_t) imageData.length);
|
||||
|
||||
getOwner (self).callListeners (image);
|
||||
|
||||
MessageManager::callAsync ([self, image]() { getOwner (self).notifyPictureTaken (image); });
|
||||
}
|
||||
|
||||
static CGImagePropertyOrientation uiImageOrientationToCGImageOrientation (UIImageOrientation orientation)
|
||||
{
|
||||
switch (orientation)
|
||||
|
|
@ -1243,5 +1160,3 @@ String CameraDevice::getFileExtension()
|
|||
{
|
||||
return ".mov";
|
||||
}
|
||||
|
||||
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue