Display stream name in clip monitor overlay when playing a multistream clip

parent 41c63e46
Pipeline #19347 passed with stage
in 9 minutes and 42 seconds
......@@ -1415,11 +1415,13 @@ void Monitor::slotOpenClip(const std::shared_ptr<ProjectClip> &controller, int i
disconnect(m_controller->getMarkerModel().get(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(checkOverlay()));
}
m_controller = controller;
m_glMonitor->getControllerProxy()->setAudioStream(QString());
m_snaps.reset(new SnapModel());
m_glMonitor->getControllerProxy()->resetZone();
if (controller) {
m_audioChannels->clear();
delete m_audioChannelsGroup;
m_audioChannelsGroup = nullptr;
if (m_controller->audioInfo()) {
QMap<int, QString> audioStreamsInfo = m_controller->audioInfo()->streamInfo(m_controller->properties());
if (audioStreamsInfo.size() > 1) {
......@@ -1435,6 +1437,7 @@ void Monitor::slotOpenClip(const std::shared_ptr<ProjectClip> &controller, int i
ac->setCheckable(true);
if (i.key() == activeStream) {
ac->setChecked(true);
m_glMonitor->getControllerProxy()->setAudioStream(ac->text().remove(QLatin1Char('&')));
}
m_audioChannelsGroup->addAction(ac);
}
......@@ -1445,11 +1448,12 @@ void Monitor::slotOpenClip(const std::shared_ptr<ProjectClip> &controller, int i
ac->setChecked(true);
}
m_audioChannelsGroup->addAction(ac);
connect(m_audioChannelsGroup, &QActionGroup::triggered, [controller] (QAction *act) {
connect(m_audioChannelsGroup, &QActionGroup::triggered, [this] (QAction *act) {
int selectedStream = act->data().toInt();
m_glMonitor->getControllerProxy()->setAudioStream(act->text().remove(QLatin1Char('&')));
QMap <QString, QString> props;
props.insert(QStringLiteral("audio_index"), QString::number(selectedStream));
controller->setProperties(props, true);
m_controller->setProperties(props, true);
});
m_audioChannels->menuAction()->setVisible(true);
} else {
......@@ -1519,6 +1523,7 @@ void Monitor::reloadActiveStream()
for (QAction *ac : actions) {
if (ac->data().toInt() == activeStream) {
ac->setChecked(true);
m_glMonitor->getControllerProxy()->setAudioStream(ac->text().remove(QLatin1Char('&')));
break;
}
}
......
......@@ -334,6 +334,13 @@ void MonitorProxy::setAudioThumb(const QUrl thumbPath)
emit audioThumbChanged();
}
void MonitorProxy::setAudioStream(const QString &name)
{
m_clipStream = name;
emit clipStreamChanged();
}
QPoint MonitorProxy::profile()
{
QSize s = pCore->getCurrentFrameSize();
......
......@@ -52,6 +52,7 @@ class MonitorProxy : public QObject
/** @brief: Contains the name of clip currently displayed in monitor
* */
Q_PROPERTY(QString clipName MEMBER m_clipName NOTIFY clipNameChanged)
Q_PROPERTY(QString clipStream MEMBER m_clipStream NOTIFY clipStreamChanged)
/** @brief: Contains the name of clip currently displayed in monitor
* */
Q_PROPERTY(int clipType MEMBER m_clipType NOTIFY clipTypeChanged)
......@@ -91,6 +92,7 @@ public:
QPoint profile();
void setClipProperties(int clipId, ClipType::ProducerType type, bool hasAV, const QString clipName);
void setAudioThumb(const QUrl thumbPath = QUrl());
void setAudioStream(const QString &name);
signals:
void positionChanged(int);
......@@ -111,6 +113,7 @@ signals:
void seekToKeyframe();
void clipHasAVChanged();
void clipNameChanged();
void clipStreamChanged();
void clipTypeChanged();
void clipIdChanged();
void audioThumbChanged();
......@@ -125,6 +128,7 @@ private:
QUrl m_audioThumb;
QString m_markerComment;
QString m_clipName;
QString m_clipStream;
int m_clipType;
int m_clipId;
bool m_seekFinished;
......
......@@ -134,6 +134,21 @@ Item {
left: parent.left
bottom: parent.bottom
}
Label {
id: clipStreamLabel
font: fixedFont
anchors {
bottom: audioThumb.isAudioClip ? parent.bottom : parent.top
horizontalCenter: parent.horizontalCenter
}
color: "white"
text: controller.clipStream
background: Rectangle {
color: "#222277"
}
visible: text != ""
padding :4
}
height: isAudioClip ? parent.height : parent.height / 6
//font.pixelSize * 3
width: parent.width
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment