-
Notifications
You must be signed in to change notification settings - Fork 4
/
mainwindow.h
106 lines (77 loc) · 2.41 KB
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QAction>
#include <QComboBox>
#include <QDockWidget>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QMenu>
#include <QPushButton>
#include <QRadioButton>
#include <QSpinBox>
#include <QToolButton>
#include <QThread>
#include <QVideoWidget>
#include <QVideoSink>
#include "detailsdockwidget.h"
#include "loggable.h"
#include "demuxer.h"
#include "audiolevelwidget.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
public slots:
void openMediaFile();
void openMediaStream();
void processStartPauseButtonClick();
void updateStreamLists(const std::vector<std::shared_ptr<StreamInfo>> &streams);
void updateProgramList(const std::map<int, std::shared_ptr<ProgramInfo>> &programs);
void updateAudioIndicatorsCount(int audioChannelsCount);
void updateAudioIndicatorLevels(const std::vector<double> &levels);
void processProgramChange();
void processStreamChange(int index);
void processPlayerStateChange(QMediaPlayer::PlaybackState state);
void processStartLockRequirement(bool locked);
signals:
void configureAndStartPlayer(const QString &path, Demuxer::SourceType type);
void selectedStreamChanged(AVMediaType type, int streamIndex);
private:
void createMenu();
void createMainUiLayout();
void createDetailsWidget();
void createSettingsWidget();
void openMedia(const QString& uri, Demuxer::SourceType type);
Ui::MainWindow *ui;
QComboBox *programsComboBox;
QComboBox *videoStreamsComboBox;
QComboBox *audioStreamsComboBox;
std::unordered_map<QComboBox*, AVMediaType> comboBoxToMediaTypeMap;
QPushButton *detailsButton;
QPushButton *settingsButton;
QHBoxLayout *mediaLayout;
QVideoWidget *videoWidget;
QToolButton *playPauseButton;
QToolButton *stopButton;
DetailsDockWidget *detailsDockWidget;
QDockWidget *settingsDockWidget;
QMenu *mediaMenu;
QAction *openFileAction;
QAction *openStreamAction;
QAction *playAction;
QAction *pauseAction;
QAction *stopAction;
QString mediaSourceUri;
Demuxer *demuxer;
QThread demuxThread;
std::vector<AudioLevelWidget*> audioIndicators;
Loggable loggable;
};
#endif // MAINWINDOW_H