This repository has been archived by the owner on Apr 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.h
82 lines (68 loc) · 2.33 KB
/
player.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
/*
Copyright (C) 2010 George Kiagiadakis <[email protected]>
Copyright (C) 2010 Brandon Lewis <[email protected]>
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __PLAYER_H__
#define __PLAYER_H__
#include <QGst/Global>
#include <QGst/Pipeline>
#include <QGst/ElementFactory>
#include <QGst/GhostPad>
#include <QGst/Structure>
#include <QGst/Bus>
#include <QGst/Message>
#include <QGst/Query>
#include <QGst/Clock>
#include <QGst/Event>
#include <QGst/Element>
#include <QGlib/Signal>
#include <QMetaType>
#include <QtGlobal>
#include <QTimer>
Q_DECLARE_METATYPE(QGst::State)
class Player : public QObject
{
Q_OBJECT
Q_PROPERTY(QGst::State state READ state WRITE setState NOTIFY stateChanged)
Q_PROPERTY(quint64 position READ position WRITE setPosition NOTIFY positionChanged)
Q_PROPERTY(quint64 duration READ duration NOTIFY duration)
public:
Player(const QString & fileName);
~Player();
void setState(QGst::State state);
QGst::State state();
quint64 position();
void setPosition(quint64 position);
quint64 duration();
void play(void);
void pause(void);
private Q_SLOTS:
void queryPositionDuration();
Q_SIGNALS:
void stateChanged(QGst::State);
void positionChanged(quint64);
void durationChanged(quint64);
private:
void onBusMessage(const QGst::MessagePtr & message);
void onNewDecodedPad(QGst::PadPtr newPad);
void privSetState(QGst::State state);
void privSetPosition(quint64 position);
void privSetDuration(quint64 duration);
static QGst::BinPtr createAudioSinkBin();
QGst::State m_state;
quint64 m_duration;
quint64 m_position;
QGst::PipelinePtr m_pipeline;
QTimer *position_timer;
};
#endif