1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

iOS: Remove iOS 10 preprocessor checks

The current minimum-supported Xcode (10.1) includes the iOS 12.1 SDK, so
APIs from iOS 10 will always be available.
This commit is contained in:
reuk 2022-07-19 13:53:58 +01:00
parent 3d82933904
commit f821015080
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
8 changed files with 6 additions and 96 deletions

View file

@ -23,10 +23,7 @@
==============================================================================
*/
#if (defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0)
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
#define JUCE_USE_NEW_CAMERA_API 1
#endif
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
struct CameraDevice::Pimpl
{
@ -141,7 +138,6 @@ struct CameraDevice::Pimpl
private:
static NSArray<AVCaptureDevice*>* getDevices()
{
#if JUCE_USE_NEW_CAMERA_API
if (@available (iOS 10.0, *))
{
std::unique_ptr<NSMutableArray<AVCaptureDeviceType>, NSObjectDeleter> deviceTypes ([[NSMutableArray alloc] initWithCapacity: 2]);
@ -161,7 +157,6 @@ private:
return [discoverySession devices];
}
#endif
return [AVCaptureDevice devicesWithMediaType: AVMediaTypeVideo];
}
@ -207,13 +202,11 @@ 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 JUCE_USE_NEW_CAMERA_API
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));
}
#endif
#if defined (__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0
if (@available (iOS 11.0, *))
@ -238,7 +231,6 @@ private:
{
JUCE_CAMERA_LOG ("Media type: " + nsStringToJuce (format.mediaType));
#if JUCE_USE_NEW_CAMERA_API
if (@available (iOS 10.0, *))
{
String colourSpaces;
@ -255,7 +247,6 @@ private:
JUCE_CAMERA_LOG ("Supported colour spaces: " + colourSpaces);
}
#endif
JUCE_CAMERA_LOG ("Video field of view: " + String (format.videoFieldOfView));
JUCE_CAMERA_LOG ("Video max zoom factor: " + String (format.videoMaxZoomFactor));
@ -592,14 +583,12 @@ private:
captureOutput (createCaptureOutput()),
photoOutputDelegate (nullptr)
{
#if JUCE_USE_NEW_CAMERA_API
if (@available (iOS 10.0, *))
{
static PhotoOutputDelegateClass cls;
photoOutputDelegate.reset ([cls.createInstance() init]);
PhotoOutputDelegateClass::setOwner (photoOutputDelegate.get(), this);
}
#endif
captureSession.addOutputIfPossible (captureOutput);
}
@ -619,7 +608,6 @@ private:
if (auto* connection = findVideoConnection (captureOutput))
{
#if JUCE_USE_NEW_CAMERA_API
if (@available (iOS 10.0, *))
{
if ([captureOutput isKindOfClass: [AVCapturePhotoOutput class]])
@ -634,7 +622,6 @@ private:
return;
}
}
#endif
auto* stillImageOutput = (AVCaptureStillImageOutput*) captureOutput;
auto outputConnection = [stillImageOutput connectionWithMediaType: AVMediaTypeVideo];
@ -671,17 +658,14 @@ private:
private:
static AVCaptureOutput* createCaptureOutput()
{
#if JUCE_USE_NEW_CAMERA_API
if (@available (iOS 10.0, *))
return [AVCapturePhotoOutput new];
#endif
return [AVCaptureStillImageOutput new];
}
static void printImageOutputDebugInfo (AVCaptureOutput* captureOutput)
{
#if JUCE_USE_NEW_CAMERA_API
if (@available (iOS 10.0, *))
{
if ([captureOutput isKindOfClass: [AVCapturePhotoOutput class]])
@ -737,7 +721,6 @@ private:
return;
}
}
#endif
auto* stillImageOutput = (AVCaptureStillImageOutput*) captureOutput;
@ -765,7 +748,6 @@ private:
}
//==============================================================================
#if JUCE_USE_NEW_CAMERA_API
class API_AVAILABLE (ios (10.0)) PhotoOutputDelegateClass : public ObjCClass<NSObject>
{
public:
@ -972,7 +954,6 @@ private:
}
}
};
#endif
//==============================================================================
void callListeners (const Image& image)
@ -1023,10 +1004,8 @@ private:
void startRecording (const File& file, AVCaptureVideoOrientation orientationToUse)
{
#if JUCE_USE_NEW_CAMERA_API
if (@available (iOS 10.0, *))
printVideoOutputDebugInfo (movieFileOutput);
#endif
auto url = [NSURL fileURLWithPath: juceStringToNS (file.getFullPathName())
isDirectory: NO];
@ -1332,6 +1311,4 @@ String CameraDevice::getFileExtension()
return ".mov";
}
#if JUCE_USE_NEW_CAMERA_API
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
#endif
JUCE_END_IGNORE_WARNINGS_GCC_LIKE