-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvlcwrapper.h
More file actions
92 lines (74 loc) · 1.73 KB
/
vlcwrapper.h
File metadata and controls
92 lines (74 loc) · 1.73 KB
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
#ifndef VLCWRAPPER_H
#define VLCWRAPPER_H
#include <vlc/vlc.h>
#include <QDebug>
#include <QLabel>
#include <QMessageBox>
#include <QPainter>
#include <QPushButton>
#include <QSlider>
#include <QTimer>
#include <QWidget>
#include <QMutex>
#include "Audio/audiomanager.h"
#include "Video/videomanager.h"
struct contextVideo
{
QMutex m_mutex;
uchar *m_pixels;
VideoManager* m_manager;
};
struct contextAudio
{
AudioManager* m_manager;
};
class VLCWrapper : public QWidget
{
Q_OBJECT
public:
VLCWrapper(QWidget *parent = nullptr);
~VLCWrapper();
// General
bool isStarted() { return m_isStarted; }
VideoManager* getVideoManager() const { return ctxVideo.m_manager; }
AudioManager* getAudioManager() const { return ctxAudio.m_manager; }
// Controls
bool start(QString const& vdev, QString const& adev);
void stop();
bool takeSnapshot(QString const& path);
// State
enum VLCState
{
NONE,
OPENING,
BUFFERING,
PLAYING,
PAUSED,
STOPPED,
ENDED,
ERROR
};
VLCState getState() { return m_state; }
bool isPlaying() { return m_state == VLCState::PLAYING; }
private slots:
void timeout();
void setVolume(int volume);
public slots:
void setHue(double value);
void setSaturation(double value);
void setGamma(double value);
signals:
void stateChanged(VLCState);
private:
// LibVLC
libvlc_instance_t* m_instance;
libvlc_media_player_t* m_mediaPlayer;
libvlc_media_t* m_media;
// Custom video/audio context
struct contextVideo ctxVideo;
struct contextAudio ctxAudio;
// Qt Members
bool m_isStarted;
VLCState m_state;
};
#endif // VLCWRAPPER_H