224 lines
7.6 KiB
C++
Executable File
224 lines
7.6 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* AvmPlaybackMenu
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Christian Fröbel, SLSE, 2017-06-26
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "ui_avm_playback_menu.h"
|
|
#include "interval_model.h"
|
|
#include <LtsSession/lts_session.h>
|
|
#include <AudioVideoManagement/ava_types.h>
|
|
#include <AudioVideoManagement/Shared/playback_app.h>
|
|
#include <AudioVideoManagement/logger.h>
|
|
#include <MarkerManagement/mrk_ftc.h>
|
|
#include <QString>
|
|
#include <boost/optional.hpp>
|
|
#include <memory>
|
|
|
|
|
|
namespace MarkerManagement
|
|
{
|
|
class MarkerManagementDialogModel;
|
|
class MarkerSortFilterProxyModel;
|
|
class ForeignDataInterface;
|
|
}
|
|
|
|
namespace LtsUtils
|
|
{
|
|
class RequestHelper;
|
|
}
|
|
|
|
|
|
namespace AudioVideoManagement
|
|
{
|
|
|
|
class AvaSession;
|
|
class AvaControl;
|
|
class AvsSequence;
|
|
class StreamNameMapping;
|
|
class AvmPlaybackMenu;
|
|
|
|
|
|
class QueryTimeline : public QObject
|
|
{
|
|
Q_OBJECT
|
|
private:
|
|
friend class AvmPlaybackMenu;
|
|
|
|
QueryTimeline(const AvaStream &stream, const AvaTimePoint &start, const AvaTimePoint &end, AvaControl *control);
|
|
|
|
AvaControl *m_avaCtrl { nullptr };
|
|
|
|
private slots:
|
|
//void slotTimelineComplete(const AvaTimeline &timeline);
|
|
|
|
signals:
|
|
void signalTimelineComplete(const AvaTimeline &timeline);
|
|
};
|
|
|
|
|
|
class AvmPlaybackMenu : public QWidget,
|
|
protected MarkerManagement::Interface::Ftc::MarkerModifyReplyHandler
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit AvmPlaybackMenu(QWidget *parent = nullptr);
|
|
~AvmPlaybackMenu();
|
|
|
|
bool init(LtsSession::LtsSession *session, AvaSession *avaSession, PlaybackAppHandle &&appHandle,
|
|
StreamNameMapping* streamNameMapping, bool isAudio, bool insideTopicEditor,
|
|
const boost::optional<QString> &streamName = boost::none,
|
|
const boost::optional<AvaTimePoint> &startTime = boost::none, bool setInitialSearchContentMarkers = true);
|
|
|
|
void setPlaybackPreset(const QString &streamName, const AvaTimePoint &startTime, bool autostartPresetAfterInit);
|
|
void setMarkerPreset(int markerId, bool autostartPresetAfterInit);
|
|
|
|
QueryTimeline *queryTimeline(const AvaTimePoint &start, const AvaTimePoint &end);
|
|
|
|
void onMarkerModifyReply(const Core::FunctionReplyObject &replyObject) override final;
|
|
|
|
void retranslate();
|
|
|
|
//void setStreamTime(AvaTimePoint t);
|
|
void setStreamTime(qint64 time);
|
|
void hideStreamSelection();
|
|
qint64 getCurrentTime() const;
|
|
AvaSpeed getSpeed() const;
|
|
void setSpeed(AvaSpeed newSpeed);
|
|
int getVolume() const;
|
|
void setVolume(int newVolume);
|
|
void setStreamByName(const QString &name);
|
|
//QString selectedStreamName() const;
|
|
QString getInternalStreamName() const;
|
|
void setStreamName(const QString &internalStreamName);
|
|
bool getSkipPause() const;
|
|
void setSkipPause(bool bSkip);
|
|
void startPlayback(bool usePresets = false);
|
|
void setSavedPos(qint64 msecs);
|
|
int currentOffset() const { return m_currentOffset; }
|
|
void selectMarker(const MarkerManagement::Marker &marker);
|
|
void selectMarker(int markerId);
|
|
|
|
signals:
|
|
void signalSetOverlay(QWidget *widget);
|
|
void signalUnsetOverlay();
|
|
|
|
void setTopicButtonStates(bool enable);
|
|
void markerSelected(const QString &description);
|
|
|
|
// both for topic editor
|
|
void signalSetStart(qint64 start);
|
|
void signalSetEnd(qint64 end);
|
|
void signalCurrentStreamChanged(const QString &displayName);
|
|
void signalTimezoneChanged(int timezoneHoursOffset);
|
|
|
|
public slots:
|
|
void onStreamSelectionChanged(const QVector<AvaStream> &selectedStreams);
|
|
|
|
private slots:
|
|
void onSessionEstablished();
|
|
void onDisconnected();
|
|
|
|
void onStreamListReceived(const QVector<AvaStream> &streams);
|
|
void onTimelineComplete(const AvaTimeline &timeline);
|
|
void onStreamPositionReceived(const QString &dialogId, const QString &streamName, AvaTimePoint);
|
|
void onVolumeReceived(AvaVolume db);
|
|
void onCommandQueueEmpty();
|
|
|
|
void onUiTimeChanged(AvaTimePoint t);
|
|
void onIntervalActivated(const QModelIndex &index);
|
|
void onMarkerClicked(const QModelIndex &index);
|
|
void onSetMarkerClicked();
|
|
void onStartClicked();
|
|
void onPauseClicked();
|
|
void onStopClicked();
|
|
void onSkipPauseClicked();
|
|
void onAllStreams();
|
|
void onIntervalBackwardClicked();
|
|
void onIntervalForwardClicked();
|
|
void onSpeedChanged();
|
|
void onVolumeChanged(int percent);
|
|
void onCurrentIntervalChanged(bool hasPreviousInterval, bool hasNextInterval, const QModelIndex &rowIndex);
|
|
void onStreamSelected();
|
|
void onMarkerStreamSelected();
|
|
void onStreamNameMappingChanged(/*int32_t mountingPointId, const QString &internalName, const QString &displayName*/);
|
|
void onAddStreamClip();
|
|
void onAddStreamMarker();
|
|
void onRemoveSelectedStreams();
|
|
void onTabChanged(int index);
|
|
void onPauseFromPlaybackApp();
|
|
void onResumeFromPlaybackApp();
|
|
|
|
|
|
private:
|
|
enum class ButtonStates
|
|
{
|
|
AllOff, //!< initial state when no stream is selected or when disconnected
|
|
Started,
|
|
Paused,
|
|
Stopped
|
|
};
|
|
|
|
void processPresets();
|
|
void preselectStream(const QString &fallbackInternalStreamName);
|
|
AvaSpeed currentSpeed() const;
|
|
void setButtonStates(ButtonStates);
|
|
void enableAll(bool enabled = true);
|
|
void disableAll() { enableAll(false); }
|
|
bool trySelectedStreams();
|
|
void addStream(QComboBox *cb);
|
|
|
|
void applyAvsPos();
|
|
void applyAvsVolume();
|
|
//void onStreamListReceived(const QVector<AvaStream> &streams);
|
|
|
|
PlaybackAppHandle m_playbackApp;
|
|
bool m_isAudio = false;
|
|
StreamNameMapping *m_streamNameMapping = nullptr;
|
|
boost::optional<QString> m_presetStreamName;
|
|
boost::optional<int> m_markerIdPreset;
|
|
boost::optional<AvaTimePoint> m_presetStartTime;
|
|
|
|
class TimelineBuilder;
|
|
std::unique_ptr<TimelineBuilder> m_timelineBuilder;
|
|
|
|
std::unique_ptr<Ui::Playback> m_ui;
|
|
|
|
class TimeControl;
|
|
std::unique_ptr<TimeControl> m_timeControl;
|
|
|
|
boost::optional<QVector<AvaStream>> m_selectedStreams;
|
|
IntervalModel m_intervalModel;
|
|
boost::optional<AvaTimePoint> m_savedPos;
|
|
std::unique_ptr<MarkerManagement::MarkerManagementDialogModel> m_markerModel;
|
|
std::unique_ptr<MarkerManagement::MarkerSortFilterProxyModel> m_markerProxy;
|
|
AvaControl *m_avaCtrl = nullptr;
|
|
LtsSession::LtsSession *m_session = nullptr;
|
|
bool m_skipEmpty = true;
|
|
ButtonStates m_currentButtonState;
|
|
std::shared_ptr<MarkerManagement::ForeignDataInterface> m_mrkDataIfc;
|
|
boost::optional<AvaTimePoint> m_lastAvsPos;
|
|
boost::optional<AvaVolume> m_lastAvsVolume;
|
|
std::unique_ptr<LtsUtils::RequestHelper> m_requestHelper;
|
|
QVector<AvaStream> m_streams;
|
|
boost::optional<AvaStream> m_currentStream;
|
|
bool m_autostartOnce { false };
|
|
int m_maxSelectedStreams = 12;
|
|
bool m_queryTimelineActive { false };
|
|
int m_currentOffset = 0;
|
|
|
|
bool m_videoScreenSelectionDone { false };
|
|
bool m_timelineIsComplete { false };
|
|
ButtonStates m_buttonStateBeforePlaybackAppPause { ButtonStates::AllOff };
|
|
|
|
LOGGER_T m_logger;
|
|
};
|
|
|
|
} // namespace AudioVideoManagement
|