mirror of
https://github.com/Aitum/obs-aitum-multistream.git
synced 2024-11-22 02:12:40 +01:00
Update stream button status
This commit is contained in:
parent
ad33461aaa
commit
3a52231f3c
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user