Update stream button status

This commit is contained in:
Exeldro 2024-07-16 13:24:32 +02:00
parent ad33461aaa
commit 3a52231f3c
No known key found for this signature in database
GPG Key ID: 97269A83FC715751

View File

@ -293,8 +293,60 @@ MultistreamDock::MultistreamDock(QWidget *parent) : QFrame(parent)
obs_encoder_set_video(venc, mainVideo);
}
}
int idx = 1;
while (auto item = mainCanvasLayout->itemAt(idx++)) {
auto streamGroup = item->widget();
std::string name = streamGroup->objectName().toUtf8().constData();
if (name.empty())
continue;
auto it = outputs.find(name);
if (it != outputs.end() && it->second) {
auto active = obs_output_active(it->second);
foreach(QObject * c, streamGroup->children())
{
std::string cn = c->metaObject()->className();
if (cn == "QPushButton") {
auto pb = (QPushButton *)c;
if (pb->isChecked() != active) {
pb->setChecked(active);
outputButtonStyle(pb);
}
}
}
}
}
auto ph = obs_get_proc_handler();
struct calldata cd;
calldata_init(&cd);
idx = 0;
while (auto item = verticalCanvasLayout->itemAt(idx++)) {
auto streamGroup = item->widget();
std::string name = streamGroup->objectName().toUtf8().constData();
if (name.empty())
continue;
obs_output_t *output = nullptr;
calldata_set_string(&cd, "name", name.c_str());
if (proc_handler_call(ph, "aitum_vertical_get_stream_output", &cd)) {
output = (obs_output_t *)calldata_ptr(&cd, "output");
}
bool active = obs_output_active(output);
obs_output_release(output);
foreach(QObject * c, streamGroup->children())
{
std::string cn = c->metaObject()->className();
if (cn == "QPushButton") {
auto pb = (QPushButton *)c;
if (pb->isChecked() != active) {
pb->setChecked(active);
outputButtonStyle(pb);
}
}
}
}
calldata_free(&cd);
});
videoCheckTimer.start(1000);
videoCheckTimer.start(500);
}
MultistreamDock::~MultistreamDock()