You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
Check CameraFeed type
This commit is contained in:
@@ -52,6 +52,9 @@ void CameraLinux::_update_devices() {
|
|||||||
|
|
||||||
for (int i = feeds.size() - 1; i >= 0; i--) {
|
for (int i = feeds.size() - 1; i >= 0; i--) {
|
||||||
Ref<CameraFeedLinux> feed = (Ref<CameraFeedLinux>)feeds[i];
|
Ref<CameraFeedLinux> feed = (Ref<CameraFeedLinux>)feeds[i];
|
||||||
|
if (feed.is_null()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String device_name = feed->get_device_name();
|
String device_name = feed->get_device_name();
|
||||||
if (!_is_active(device_name)) {
|
if (!_is_active(device_name)) {
|
||||||
remove_feed(feed);
|
remove_feed(feed);
|
||||||
@@ -84,6 +87,9 @@ void CameraLinux::_update_devices() {
|
|||||||
bool CameraLinux::_has_device(const String &p_device_name) {
|
bool CameraLinux::_has_device(const String &p_device_name) {
|
||||||
for (int i = 0; i < feeds.size(); i++) {
|
for (int i = 0; i < feeds.size(); i++) {
|
||||||
Ref<CameraFeedLinux> feed = (Ref<CameraFeedLinux>)feeds[i];
|
Ref<CameraFeedLinux> feed = (Ref<CameraFeedLinux>)feeds[i];
|
||||||
|
if (feed.is_null()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (feed->get_device_name() == p_device_name) {
|
if (feed->get_device_name() == p_device_name) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -323,6 +323,9 @@ void CameraMacOS::update_feeds() {
|
|||||||
// remove devices that are gone..
|
// remove devices that are gone..
|
||||||
for (int i = feeds.size() - 1; i >= 0; i--) {
|
for (int i = feeds.size() - 1; i >= 0; i--) {
|
||||||
Ref<CameraFeedMacOS> feed = (Ref<CameraFeedMacOS>)feeds[i];
|
Ref<CameraFeedMacOS> feed = (Ref<CameraFeedMacOS>)feeds[i];
|
||||||
|
if (feed.is_null()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (![devices containsObject:feed->get_device()]) {
|
if (![devices containsObject:feed->get_device()]) {
|
||||||
// remove it from our array, this will also destroy it ;)
|
// remove it from our array, this will also destroy it ;)
|
||||||
@@ -334,6 +337,9 @@ void CameraMacOS::update_feeds() {
|
|||||||
bool found = false;
|
bool found = false;
|
||||||
for (int i = 0; i < feeds.size() && !found; i++) {
|
for (int i = 0; i < feeds.size() && !found; i++) {
|
||||||
Ref<CameraFeedMacOS> feed = (Ref<CameraFeedMacOS>)feeds[i];
|
Ref<CameraFeedMacOS> feed = (Ref<CameraFeedMacOS>)feeds[i];
|
||||||
|
if (feed.is_null()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (feed->get_device() == device) {
|
if (feed->get_device() == device) {
|
||||||
found = true;
|
found = true;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user