[macOS] Enable Objective-C ARC

This commit is contained in:
bruvzg
2022-01-25 10:07:01 +02:00
parent ea12094f19
commit 33d6d4bdf7
7 changed files with 46 additions and 118 deletions

View File

@ -39,7 +39,6 @@
class CameraOSX : public CameraServer {
public:
CameraOSX();
~CameraOSX();
void update_feeds();
};

View File

@ -114,18 +114,12 @@
if (output) {
[self removeOutput:output];
[output setSampleBufferDelegate:nil queue:nullptr];
[output release];
output = nullptr;
}
[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..
@ -208,7 +202,6 @@ public:
AVCaptureDevice *get_device() const;
CameraFeedOSX();
~CameraFeedOSX();
void set_device(AVCaptureDevice *p_device);
@ -227,7 +220,6 @@ CameraFeedOSX::CameraFeedOSX() {
void CameraFeedOSX::set_device(AVCaptureDevice *p_device) {
device = p_device;
[device retain];
// get some info
NSString *device_name = p_device.localizedName;
@ -240,18 +232,6 @@ void CameraFeedOSX::set_device(AVCaptureDevice *p_device) {
};
};
CameraFeedOSX::~CameraFeedOSX() {
if (capture_session != nullptr) {
[capture_session release];
capture_session = nullptr;
};
if (device != nullptr) {
[device release];
device = nullptr;
};
};
bool CameraFeedOSX::activate_feed() {
if (capture_session) {
// Already recording!
@ -282,7 +262,6 @@ void CameraFeedOSX::deactivate_feed() {
// end camera capture if we have one
if (capture_session) {
[capture_session cleanup];
[capture_session release];
capture_session = nullptr;
};
};
@ -317,8 +296,6 @@ void CameraFeedOSX::deactivate_feed() {
// remove notifications
[[NSNotificationCenter defaultCenter] removeObserver:self name:AVCaptureDeviceWasConnectedNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:AVCaptureDeviceWasDisconnectedNotification object:nil];
[super dealloc];
}
@end
@ -376,7 +353,3 @@ CameraOSX::CameraOSX() {
// should only have one of these....
device_notifications = [[MyDeviceNotifications alloc] initForServer:this];
};
CameraOSX::~CameraOSX() {
[device_notifications release];
};