Skip to content

Commit

Permalink
Merge pull request #25 from OPENSPHERE-Inc/patch-0.5.8
Browse files Browse the repository at this point in the history
0.5.8
  • Loading branch information
hanatyan128 authored Dec 31, 2024
2 parents ed610c6 + 0cb0f72 commit 301825e
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 19 deletions.
2 changes: 1 addition & 1 deletion buildspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]",
Expand Down
15 changes: 13 additions & 2 deletions src/UI/egress-link-connection-widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions src/UI/egress-link-dock.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<x>0</x>
<y>0</y>
<width>350</width>
<height>454</height>
<height>449</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>0</height>
<height>210</height>
</size>
</property>
<property name="windowTitle">
Expand All @@ -36,8 +36,8 @@
<widget class="QScrollArea" name="scrollArea">
<property name="minimumSize">
<size>
<width>320</width>
<height>400</height>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
Expand All @@ -61,7 +61,7 @@
<x>0</x>
<y>0</y>
<width>350</width>
<height>400</height>
<height>395</height>
</rect>
</property>
<layout class="QVBoxLayout" name="scrollAreaLayout">
Expand Down
4 changes: 2 additions & 2 deletions src/outputs/egress-link-output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
25 changes: 16 additions & 9 deletions src/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,27 +215,34 @@ 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;
}

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;
Expand Down

0 comments on commit 301825e

Please sign in to comment.