Update live player captions independently of playback state
This commit is contained in:
1 parent
9d2ddcc496
commit
3ff5ca7009
2 files changed
+16
-3
No files matched your search
@@ -127,9 +127,10 @@ StreamPlayerWindow::StreamPlayerWindow(uint64_t group, uint64_t source, uint64_t
|
||||
m_playback->group = group; m_playback->source = source; m_playback->epoch = epoch;
|
||||
DEBUG_INFO(DEBUG_CATEGORY_STREAM, "desktop viewer requested id=%llu source=%llx epoch=%llx",
|
||||
(unsigned long long)m_playback->id, (unsigned long long)source, (unsigned long long)epoch);
|
||||
setWindowTitle(text("Live stream: %1").arg(name)); resize(800, 500);
|
||||
resize(800, 500);
|
||||
setObjectName(QStringLiteral("streamPlayer_%1").arg(source));
|
||||
auto* layout = new QVBoxLayout(this); auto* title = new QLabel(name, this); layout->addWidget(title);
|
||||
auto* layout = new QVBoxLayout(this); m_title = new QLabel(this); layout->addWidget(m_title);
|
||||
setSourceName(name);
|
||||
m_status = new QLabel(text("Connecting…"), this); layout->addWidget(m_status);
|
||||
m_render = new VideoRenderWidget(this, true); layout->addWidget(m_render, 1);
|
||||
m_telemetry = new QLabel(this); m_telemetry->setObjectName(QStringLiteral("streamTelemetry"));
|
||||
@@ -145,7 +146,7 @@ StreamPlayerWindow::StreamPlayerWindow(uint64_t group, uint64_t source, uint64_t
|
||||
auto* close = new QPushButton(text("Close player"), this); controls->addWidget(close); layout->addLayout(controls);
|
||||
if (embedded) {
|
||||
fullscreen->hide(); close->hide(); layout->setContentsMargins(3, 3, 3, 3); layout->setSpacing(2);
|
||||
title->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred); title->setToolTip(name);
|
||||
m_title->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
|
||||
m_status->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred); setMinimumSize(0, 0);
|
||||
}
|
||||
connect(volume, &QSlider::valueChanged, this, [this](int value) { m_playback->volume = value / 100.0f; });
|
||||
@@ -160,6 +161,15 @@ StreamPlayerWindow::StreamPlayerWindow(uint64_t group, uint64_t source, uint64_t
|
||||
|
||||
StreamPlayerWindow::~StreamPlayerWindow() { stop(); }
|
||||
|
||||
/* Имя относится к представлению, а не идентичности media-сессии. */
|
||||
void StreamPlayerWindow::setSourceName(const QString& name) {
|
||||
m_title->setText(name); m_title->setToolTip(name);
|
||||
setWindowTitle(text("Live stream: %1").arg(name));
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_STREAM, "desktop viewer name id=%llu source=%llx epoch=%llx name=%s",
|
||||
(unsigned long long)m_playback->id, (unsigned long long)m_playback->source,
|
||||
(unsigned long long)m_playback->epoch, qPrintable(name));
|
||||
}
|
||||
|
||||
bool StreamPlayerWindow::finished() const { return m_playback->complete; }
|
||||
bool StreamPlayerWindow::failed() const { return m_playback->failed; }
|
||||
int StreamPlayerWindow::drainTimeoutMs() const {
|
||||
|
||||
@@ -19,6 +19,8 @@ public:
|
||||
explicit StreamPlayerWindow(uint64_t group, uint64_t source, uint64_t epoch, const QString& name,
|
||||
QWidget* parent = nullptr, bool embedded = false);
|
||||
~StreamPlayerWindow() override;
|
||||
// GUI-поток: обновить подпись, tooltip и заголовок окна; decoder, reader, аудиочасы и громкость сохраняются.
|
||||
void setSourceName(const QString& name);
|
||||
void stop();
|
||||
bool finished() const;
|
||||
bool failed() const;
|
||||
@@ -35,6 +37,7 @@ private:
|
||||
bool m_audioAttached = false;
|
||||
QTimer m_timer;
|
||||
VideoRenderWidget* m_render = nullptr;
|
||||
QLabel* m_title = nullptr; // Подпись источника; принадлежит QObject-дереву окна, меняется без перезапуска playback.
|
||||
QLabel* m_status = nullptr;
|
||||
QLabel* m_telemetry = nullptr;
|
||||
int64_t m_telemetryAt = 0;
|
||||
|
||||
Reference in new issue
Block a user