This commit is contained in:
Spartan322
2024-12-21 04:33:40 -05:00
746 changed files with 15841 additions and 4689 deletions

View File

@@ -32,6 +32,8 @@
#include "camera_feed_linux.h"
#include "servers/rendering_server.h"
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>

View File

@@ -54,6 +54,9 @@ void CameraLinux::_update_devices() {
for (int i = feeds.size() - 1; i >= 0; i--) {
Ref<CameraFeedLinux> feed = (Ref<CameraFeedLinux>)feeds[i];
if (feed.is_null()) {
continue;
}
String device_name = feed->get_device_name();
if (!_is_active(device_name)) {
remove_feed(feed);
@@ -86,6 +89,9 @@ void CameraLinux::_update_devices() {
bool CameraLinux::_has_device(const String &p_device_name) {
for (int i = 0; i < feeds.size(); i++) {
Ref<CameraFeedLinux> feed = (Ref<CameraFeedLinux>)feeds[i];
if (feed.is_null()) {
continue;
}
if (feed->get_device_name() == p_device_name) {
return true;
}

View File

@@ -325,6 +325,9 @@ void CameraMacOS::update_feeds() {
// remove devices that are gone..
for (int i = feeds.size() - 1; i >= 0; i--) {
Ref<CameraFeedMacOS> feed = (Ref<CameraFeedMacOS>)feeds[i];
if (feed.is_null()) {
continue;
}
if (![devices containsObject:feed->get_device()]) {
// remove it from our array, this will also destroy it ;)
@@ -336,6 +339,9 @@ void CameraMacOS::update_feeds() {
bool found = false;
for (int i = 0; i < feeds.size() && !found; i++) {
Ref<CameraFeedMacOS> feed = (Ref<CameraFeedMacOS>)feeds[i];
if (feed.is_null()) {
continue;
}
if (feed->get_device() == device) {
found = true;
};