Rename OSX to macOS and iPhoneOS to iOS.

This commit is contained in:
bruvzg
2022-07-20 09:28:22 +03:00
parent 292c952e3b
commit 8823eae328
245 changed files with 1151 additions and 1149 deletions

View File

@@ -9,6 +9,6 @@ if env["platform"] == "windows":
env_camera.add_source_files(env.modules_sources, "register_types.cpp")
env_camera.add_source_files(env.modules_sources, "camera_win.cpp")
elif env["platform"] == "osx":
elif env["platform"] == "macos":
env_camera.add_source_files(env.modules_sources, "register_types.cpp")
env_camera.add_source_files(env.modules_sources, "camera_osx.mm")
env_camera.add_source_files(env.modules_sources, "camera_macos.mm")

View File

@@ -1,5 +1,5 @@
/*************************************************************************/
/* camera_osx.h */
/* camera_macos.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,19 +28,19 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef CAMERAOSX_H
#define CAMERAOSX_H
#ifndef CAMERA_MACOS_H
#define CAMERA_MACOS_H
///@TODO this is a near duplicate of CameraIOS, we should find a way to combine those to minimize code duplication!!!!
// If you fix something here, make sure you fix it there as well!
#include "servers/camera_server.h"
class CameraOSX : public CameraServer {
class CameraMacOS : public CameraServer {
public:
CameraOSX();
CameraMacOS();
void update_feeds();
};
#endif /* CAMERAOSX_H */
#endif /* CAMERA_MACOS_H */

View File

@@ -1,5 +1,5 @@
/*************************************************************************/
/* camera_osx.mm */
/* camera_macos.mm */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -31,7 +31,7 @@
///@TODO this is a near duplicate of CameraIOS, we should find a way to combine those to minimize code duplication!!!!
// If you fix something here, make sure you fix it there as well!
#include "camera_osx.h"
#include "camera_macos.h"
#include "servers/camera/camera_feed.h"
#import <AVFoundation/AVFoundation.h>
@@ -191,9 +191,9 @@
@end
//////////////////////////////////////////////////////////////////////////
// CameraFeedOSX - Subclass for camera feeds in OSX
// CameraFeedMacOS - Subclass for camera feeds in macOS
class CameraFeedOSX : public CameraFeed {
class CameraFeedMacOS : public CameraFeed {
private:
AVCaptureDevice *device;
MyCaptureSession *capture_session;
@@ -201,7 +201,7 @@ private:
public:
AVCaptureDevice *get_device() const;
CameraFeedOSX();
CameraFeedMacOS();
void set_device(AVCaptureDevice *p_device);
@@ -209,16 +209,16 @@ public:
void deactivate_feed();
};
AVCaptureDevice *CameraFeedOSX::get_device() const {
AVCaptureDevice *CameraFeedMacOS::get_device() const {
return device;
};
CameraFeedOSX::CameraFeedOSX() {
CameraFeedMacOS::CameraFeedMacOS() {
device = nullptr;
capture_session = nullptr;
};
void CameraFeedOSX::set_device(AVCaptureDevice *p_device) {
void CameraFeedMacOS::set_device(AVCaptureDevice *p_device) {
device = p_device;
// get some info
@@ -232,7 +232,7 @@ void CameraFeedOSX::set_device(AVCaptureDevice *p_device) {
};
};
bool CameraFeedOSX::activate_feed() {
bool CameraFeedMacOS::activate_feed() {
if (capture_session) {
// Already recording!
} else {
@@ -258,7 +258,7 @@ bool CameraFeedOSX::activate_feed() {
return true;
};
void CameraFeedOSX::deactivate_feed() {
void CameraFeedMacOS::deactivate_feed() {
// end camera capture if we have one
if (capture_session) {
[capture_session cleanup];
@@ -271,7 +271,7 @@ void CameraFeedOSX::deactivate_feed() {
// when devices are connected/disconnected
@interface MyDeviceNotifications : NSObject {
CameraOSX *camera_server;
CameraMacOS *camera_server;
}
@end
@@ -282,7 +282,7 @@ void CameraFeedOSX::deactivate_feed() {
camera_server->update_feeds();
}
- (id)initForServer:(CameraOSX *)p_server {
- (id)initForServer:(CameraMacOS *)p_server {
if (self = [super init]) {
camera_server = p_server;
@@ -303,9 +303,9 @@ void CameraFeedOSX::deactivate_feed() {
MyDeviceNotifications *device_notifications = nil;
//////////////////////////////////////////////////////////////////////////
// CameraOSX - Subclass for our camera server on OSX
// CameraMacOS - Subclass for our camera server on macOS
void CameraOSX::update_feeds() {
void CameraMacOS::update_feeds() {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
AVCaptureDeviceDiscoverySession *session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:[NSArray arrayWithObjects:AVCaptureDeviceTypeExternalUnknown, AVCaptureDeviceTypeBuiltInWideAngleCamera, nil] mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified];
NSArray *devices = session.devices;
@@ -315,7 +315,7 @@ void CameraOSX::update_feeds() {
// remove devices that are gone..
for (int i = feeds.size() - 1; i >= 0; i--) {
Ref<CameraFeedOSX> feed = (Ref<CameraFeedOSX>)feeds[i];
Ref<CameraFeedMacOS> feed = (Ref<CameraFeedMacOS>)feeds[i];
if (![devices containsObject:feed->get_device()]) {
// remove it from our array, this will also destroy it ;)
@@ -326,14 +326,14 @@ void CameraOSX::update_feeds() {
for (AVCaptureDevice *device in devices) {
bool found = false;
for (int i = 0; i < feeds.size() && !found; i++) {
Ref<CameraFeedOSX> feed = (Ref<CameraFeedOSX>)feeds[i];
Ref<CameraFeedMacOS> feed = (Ref<CameraFeedMacOS>)feeds[i];
if (feed->get_device() == device) {
found = true;
};
};
if (!found) {
Ref<CameraFeedOSX> newfeed;
Ref<CameraFeedMacOS> newfeed;
newfeed.instantiate();
newfeed->set_device(device);
@@ -346,7 +346,7 @@ void CameraOSX::update_feeds() {
};
};
CameraOSX::CameraOSX() {
CameraMacOS::CameraMacOS() {
// Find available cameras we have at this time
update_feeds();

View File

@@ -1,5 +1,5 @@
def can_build(env, platform):
return platform == "osx" or platform == "windows"
return platform == "macos" or platform == "windows"
def configure(env):

View File

@@ -33,8 +33,8 @@
#if defined(WINDOWS_ENABLED)
#include "camera_win.h"
#endif
#if defined(OSX_ENABLED)
#include "camera_osx.h"
#if defined(MACOS_ENABLED)
#include "camera_macos.h"
#endif
void initialize_camera_module(ModuleInitializationLevel p_level) {
@@ -45,8 +45,8 @@ void initialize_camera_module(ModuleInitializationLevel p_level) {
#if defined(WINDOWS_ENABLED)
CameraServer::make_default<CameraWindows>();
#endif
#if defined(OSX_ENABLED)
CameraServer::make_default<CameraOSX>();
#if defined(MACOS_ENABLED)
CameraServer::make_default<CameraMacOS>();
#endif
}