summaryrefslogtreecommitdiff
path: root/modules/camera
diff options
context:
space:
mode:
authorSergey Minakov <naithar@icloud.com>2020-10-01 22:18:39 +0300
committerSergey Minakov <naithar@icloud.com>2020-10-02 15:04:51 +0300
commit3cd1cb53a0bccecf5c3d429255d41987d16d4727 (patch)
treeb284f0ea092705a6675e0f2c71b752b1315f91a1 /modules/camera
parent19f72beebbf1d233eb2dd345ed70a5ac143e2353 (diff)
iOS: Refactoring
Enabled ARC for iOS. Weakify/Strongify macros for objc blocks. Removed old version checks. Specific types for ObjC++ modules to exclude unneeded bridging. Separate DeviceMetrics class for device specific data. Replaced old/deprecated functionality.
Diffstat (limited to 'modules/camera')
-rw-r--r--modules/camera/camera_ios.mm24
1 files changed, 6 insertions, 18 deletions
diff --git a/modules/camera/camera_ios.mm b/modules/camera/camera_ios.mm
index c10b13b2af..e4cb928805 100644
--- a/modules/camera/camera_ios.mm
+++ b/modules/camera/camera_ios.mm
@@ -124,18 +124,12 @@
if (output) {
[self removeOutput:output];
[output setSampleBufferDelegate:nil queue:NULL];
- [output release];
output = nil;
}
[self commitConfiguration];
}
-- (void)dealloc {
- // bye bye
- [super dealloc];
-}
-
- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {
// This gets called every time our camera has a new image for us to process.
// May need to investigate in a way to throttle this if we get more images then we're rendering frames..
@@ -272,7 +266,6 @@ CameraFeedIOS::CameraFeedIOS() {
void CameraFeedIOS::set_device(AVCaptureDevice *p_device) {
device = p_device;
- [device retain];
// get some info
NSString *device_name = p_device.localizedName;
@@ -286,14 +279,12 @@ void CameraFeedIOS::set_device(AVCaptureDevice *p_device) {
};
CameraFeedIOS::~CameraFeedIOS() {
- if (capture_session != NULL) {
- [capture_session release];
- capture_session = NULL;
+ if (capture_session) {
+ capture_session = nil;
};
- if (device != NULL) {
- [device release];
- device = NULL;
+ if (device) {
+ device = nil;
};
};
@@ -312,8 +303,7 @@ void CameraFeedIOS::deactivate_feed() {
// end camera capture if we have one
if (capture_session) {
[capture_session cleanup];
- [capture_session release];
- capture_session = NULL;
+ capture_session = nil;
};
};
@@ -347,8 +337,6 @@ void CameraFeedIOS::deactivate_feed() {
// remove notifications
[[NSNotificationCenter defaultCenter] removeObserver:self name:AVCaptureDeviceWasConnectedNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:AVCaptureDeviceWasDisconnectedNotification object:nil];
-
- [super dealloc];
}
@end
@@ -453,5 +441,5 @@ CameraIOS::CameraIOS() {
};
CameraIOS::~CameraIOS() {
- [device_notifications release];
+ device_notifications = nil;
};