diff --git a/buildspec.json b/buildspec.json index 1ba0fe5..7b4be61 100644 --- a/buildspec.json +++ b/buildspec.json @@ -38,7 +38,7 @@ }, "name": "osi-src-link", "displayName": "SRC-Link Plugin", - "version": "0.5.7", + "version": "0.5.8", "author": "OPENSPHERE Inc.", "website": "https://opensphere.co.jp/", "email": "info@opensphere.co.jp", diff --git a/src/UI/egress-link-connection-widget.cpp b/src/UI/egress-link-connection-widget.cpp index a55a0fc..63f0fda 100644 --- a/src/UI/egress-link-connection-widget.cpp +++ b/src/UI/egress-link-connection-widget.cpp @@ -156,8 +156,19 @@ void EgressLinkConnectionWidget::updateSourceList() auto type = obs_source_get_type(_source); auto flags = obs_source_get_output_flags(_source); - if (flags & OBS_SOURCE_VIDEO && (type == OBS_SOURCE_TYPE_INPUT || type == OBS_SOURCE_TYPE_SCENE) && - isSourceAvailable(_source)) { + if (flags & OBS_SOURCE_VIDEO && type == OBS_SOURCE_TYPE_INPUT && isSourceAvailable(_source)) { + widget->ui->videoSourceComboBox->addItem(obs_source_get_name(_source), obs_source_get_uuid(_source)); + } + return true; + }, + this + ); + obs_enum_scenes( + [](void *param, obs_source_t *_source) { + auto widget = (EgressLinkConnectionWidget *)param; + auto type = obs_source_get_type(_source); + + if (type == OBS_SOURCE_TYPE_SCENE && isSourceAvailable(_source)) { widget->ui->videoSourceComboBox->addItem(obs_source_get_name(_source), obs_source_get_uuid(_source)); } return true; diff --git a/src/UI/egress-link-dock.ui b/src/UI/egress-link-dock.ui index d05cd4b..4992b3a 100644 --- a/src/UI/egress-link-dock.ui +++ b/src/UI/egress-link-dock.ui @@ -7,13 +7,13 @@ 0 0 350 - 454 + 449 350 - 0 + 210 @@ -36,8 +36,8 @@ - 320 - 400 + 0 + 0 @@ -61,7 +61,7 @@ 0 0 350 - 400 + 395 diff --git a/src/outputs/egress-link-output.cpp b/src/outputs/egress-link-output.cpp index de3cc32..f56a531 100644 --- a/src/outputs/egress-link-output.cpp +++ b/src/outputs/egress-link-output.cpp @@ -508,7 +508,7 @@ void EgressLinkOutput::start() if (activeSourceUuid != "program") { // Get reference for specific source source = obs_get_source_by_uuid(qUtf8Printable(activeSourceUuid)); - if (!source || !isSourceAvailable(source)) { + if (!source || !isSourceAvailable(source) || !isSourceVisible(source)) { obs_log(LOG_ERROR, "%s: Source not found: %s", qUtf8Printable(name), qUtf8Printable(activeSourceUuid)); setStatus(EGRESS_LINK_OUTPUT_STATUS_ERROR); return; @@ -862,7 +862,7 @@ void EgressLinkOutput::onMonitoringTimerTimeout() return; } - if (source && !isSourceAvailable(source)) { + if (source && (!isSourceAvailable(source) || !isSourceAvailable(source))) { obs_log(LOG_DEBUG, "%s: Source removed or inactive", qUtf8Printable(name)); stop(); return; diff --git a/src/utils.hpp b/src/utils.hpp index cc969cf..1437e3b 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -215,14 +215,17 @@ inline bool sourceIsPrivate(obs_source_t *source) return finder != nullptr; } -inline bool isSourceAvailable(obs_source_t *source) +inline bool isSourceVisible(obs_source_t *source) { auto width = obs_source_get_width(source); + width += (width & 1); auto height = obs_source_get_height(source); - if (width == 0 || height == 0) { - return false; - } + height += (height & 1); + return width != 0 && height != 0; +} +inline bool isSourceAvailable(obs_source_t *source) +{ auto found = !!obs_scene_from_source(source); if (found) { return true; @@ -230,12 +233,16 @@ inline bool isSourceAvailable(obs_source_t *source) obs_frontend_source_list scenes = {0}; obs_frontend_get_scenes(&scenes); - - for (size_t i = 0; i < scenes.sources.num && !found; i++) { - obs_scene_t *scene = obs_scene_from_source(scenes.sources.array[i]); - found = !!obs_scene_find_source_recursive(scene, obs_source_get_name(source)); + { + for (size_t i = 0; i < scenes.sources.num && !found; i++) { + if (scenes.sources.array[i] == source) { + found = true; + break; + } + obs_scene_t *scene = obs_scene_from_source(scenes.sources.array[i]); + found = !!obs_scene_find_source_recursive(scene, obs_source_get_name(source)); + } } - obs_frontend_source_list_free(&scenes); return found;