1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

Check CameraFeed type

This commit is contained in:
Jason Kuo
2024-12-18 10:37:06 +08:00
parent 6e2cf2aa7b
commit 9655d7d948
2 changed files with 12 additions and 0 deletions

View File

@@ -52,6 +52,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);
@@ -84,6 +87,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;
}