~phablet-team/+junk/qtmultimedia

« back to all changes in this revision

Viewing changes to .pc/adding_media_role_property.patch/src/imports/multimedia/qdeclarativeaudio_p.h

  • Committer: Jim Hodapp
  • Date: 2015-05-15 19:17:49 UTC
  • Revision ID: jim.hodapp@canonical.com-20150515191749-r4xausjaaphme9ok
Initial import.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
 
4
** Contact: http://www.qt-project.org/legal
 
5
**
 
6
** This file is part of the Qt Toolkit.
 
7
**
 
8
** $QT_BEGIN_LICENSE:LGPL21$
 
9
** Commercial License Usage
 
10
** Licensees holding valid commercial Qt licenses may use this file in
 
11
** accordance with the commercial license agreement provided with the
 
12
** Software or, alternatively, in accordance with the terms contained in
 
13
** a written agreement between you and Digia. For licensing terms and
 
14
** conditions see http://qt.digia.com/licensing. For further information
 
15
** use the contact form at http://qt.digia.com/contact-us.
 
16
**
 
17
** GNU Lesser General Public License Usage
 
18
** Alternatively, this file may be used under the terms of the GNU Lesser
 
19
** General Public License version 2.1 or version 3 as published by the Free
 
20
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
 
21
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
 
22
** following information to ensure the GNU Lesser General Public License
 
23
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
 
24
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 
25
**
 
26
** In addition, as a special exception, Digia gives you certain additional
 
27
** rights. These rights are described in the Digia Qt LGPL Exception
 
28
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 
29
**
 
30
** $QT_END_LICENSE$
 
31
**
 
32
****************************************************************************/
 
33
 
 
34
#ifndef QDECLARATIVEAUDIO_P_H
 
35
#define QDECLARATIVEAUDIO_P_H
 
36
 
 
37
//
 
38
//  W A R N I N G
 
39
//  -------------
 
40
//
 
41
// This file is not part of the Qt API.  It exists for the convenience
 
42
// of other Qt classes.  This header file may change from version to
 
43
// version without notice, or even be removed.
 
44
//
 
45
// We mean it.
 
46
//
 
47
 
 
48
#include <QtCore/qbasictimer.h>
 
49
#include <QtQml/qqmlparserstatus.h>
 
50
#include <QtQml/qqml.h>
 
51
 
 
52
#include <qmediaplayer.h>
 
53
 
 
54
QT_BEGIN_NAMESPACE
 
55
 
 
56
class QTimerEvent;
 
57
class QMediaPlayerControl;
 
58
class QMediaService;
 
59
class QMediaServiceProvider;
 
60
class QMetaDataReaderControl;
 
61
class QDeclarativeMediaBaseAnimation;
 
62
class QDeclarativeMediaMetaData;
 
63
class QMediaAvailabilityControl;
 
64
 
 
65
class QDeclarativeAudio : public QObject, public QQmlParserStatus
 
66
{
 
67
    Q_OBJECT
 
68
    Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
 
69
    Q_PROPERTY(int loops READ loopCount WRITE setLoopCount NOTIFY loopCountChanged)
 
70
    Q_PROPERTY(PlaybackState playbackState READ playbackState NOTIFY playbackStateChanged)
 
71
    Q_PROPERTY(bool autoPlay READ autoPlay WRITE setAutoPlay NOTIFY autoPlayChanged)
 
72
    Q_PROPERTY(bool autoLoad READ isAutoLoad WRITE setAutoLoad NOTIFY autoLoadChanged)
 
73
    Q_PROPERTY(Status status READ status NOTIFY statusChanged)
 
74
    Q_PROPERTY(int duration READ duration NOTIFY durationChanged)
 
75
    Q_PROPERTY(int position READ position NOTIFY positionChanged)
 
76
    Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged)
 
77
    Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
 
78
    Q_PROPERTY(bool hasAudio READ hasAudio NOTIFY hasAudioChanged)
 
79
    Q_PROPERTY(bool hasVideo READ hasVideo NOTIFY hasVideoChanged)
 
80
    Q_PROPERTY(qreal bufferProgress READ bufferProgress NOTIFY bufferProgressChanged)
 
81
    Q_PROPERTY(bool seekable READ isSeekable NOTIFY seekableChanged)
 
82
    Q_PROPERTY(qreal playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged)
 
83
    Q_PROPERTY(Error error READ error NOTIFY errorChanged)
 
84
    Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
 
85
    Q_PROPERTY(QDeclarativeMediaMetaData *metaData READ metaData CONSTANT)
 
86
    Q_PROPERTY(QObject *mediaObject READ mediaObject NOTIFY mediaObjectChanged SCRIPTABLE false DESIGNABLE false)
 
87
    Q_PROPERTY(Availability availability READ availability NOTIFY availabilityChanged)
 
88
    Q_ENUMS(Status)
 
89
    Q_ENUMS(Error)
 
90
    Q_ENUMS(Loop)
 
91
    Q_ENUMS(PlaybackState)
 
92
    Q_ENUMS(Availability)
 
93
    Q_INTERFACES(QQmlParserStatus)
 
94
public:
 
95
    enum Status
 
96
    {
 
97
        UnknownStatus = QMediaPlayer::UnknownMediaStatus,
 
98
        NoMedia       = QMediaPlayer::NoMedia,
 
99
        Loading       = QMediaPlayer::LoadingMedia,
 
100
        Loaded        = QMediaPlayer::LoadedMedia,
 
101
        Stalled       = QMediaPlayer::StalledMedia,
 
102
        Buffering     = QMediaPlayer::BufferingMedia,
 
103
        Buffered      = QMediaPlayer::BufferedMedia,
 
104
        EndOfMedia    = QMediaPlayer::EndOfMedia,
 
105
        InvalidMedia  = QMediaPlayer::InvalidMedia
 
106
    };
 
107
 
 
108
    enum Error
 
109
    {
 
110
        NoError        = QMediaPlayer::NoError,
 
111
        ResourceError  = QMediaPlayer::ResourceError,
 
112
        FormatError    = QMediaPlayer::FormatError,
 
113
        NetworkError   = QMediaPlayer::NetworkError,
 
114
        AccessDenied   = QMediaPlayer::AccessDeniedError,
 
115
        ServiceMissing = QMediaPlayer::ServiceMissingError
 
116
    };
 
117
 
 
118
    enum Loop
 
119
    {
 
120
        Infinite = -1
 
121
    };
 
122
 
 
123
    enum PlaybackState
 
124
    {
 
125
        PlayingState = QMediaPlayer::PlayingState,
 
126
        PausedState = QMediaPlayer::PausedState,
 
127
        StoppedState = QMediaPlayer::StoppedState
 
128
    };
 
129
 
 
130
    enum Availability {
 
131
        Available = QMultimedia::Available,
 
132
        Busy = QMultimedia::Busy,
 
133
        Unavailable = QMultimedia::ServiceMissing,
 
134
        ResourceMissing = QMultimedia::ResourceError
 
135
    };
 
136
 
 
137
    QDeclarativeAudio(QObject *parent = 0);
 
138
    ~QDeclarativeAudio();
 
139
 
 
140
    bool hasAudio() const;
 
141
    bool hasVideo() const;
 
142
 
 
143
    Status status() const;
 
144
    Error error() const;
 
145
    PlaybackState playbackState() const;
 
146
    void setPlaybackState(QMediaPlayer::State playbackState);
 
147
 
 
148
    void classBegin();
 
149
    void componentComplete();
 
150
 
 
151
    QObject *mediaObject() { return m_player; }
 
152
 
 
153
    Availability availability() const;
 
154
 
 
155
    QUrl source() const;
 
156
    void setSource(const QUrl &url);
 
157
 
 
158
    int loopCount() const;
 
159
    void setLoopCount(int loopCount);
 
160
 
 
161
    int duration() const;
 
162
 
 
163
    int position() const;
 
164
 
 
165
    qreal volume() const;
 
166
    void setVolume(qreal volume);
 
167
 
 
168
    bool isMuted() const;
 
169
    void setMuted(bool muted);
 
170
 
 
171
    qreal bufferProgress() const;
 
172
 
 
173
    bool isSeekable() const;
 
174
 
 
175
    qreal playbackRate() const;
 
176
    void setPlaybackRate(qreal rate);
 
177
 
 
178
    QString errorString() const;
 
179
 
 
180
    QDeclarativeMediaMetaData *metaData() const;
 
181
 
 
182
    bool isAutoLoad() const;
 
183
    void setAutoLoad(bool autoLoad);
 
184
 
 
185
    bool autoPlay() const;
 
186
    void setAutoPlay(bool autoplay);
 
187
 
 
188
public Q_SLOTS:
 
189
    void play();
 
190
    void pause();
 
191
    void stop();
 
192
    void seek(int position);
 
193
 
 
194
Q_SIGNALS:
 
195
    void sourceChanged();
 
196
    void autoLoadChanged();
 
197
    void loopCountChanged();
 
198
 
 
199
    void playbackStateChanged();
 
200
    void autoPlayChanged();
 
201
 
 
202
    void paused();
 
203
    void stopped();
 
204
    void playing();
 
205
 
 
206
    void statusChanged();
 
207
 
 
208
    void durationChanged();
 
209
    void positionChanged();
 
210
 
 
211
    void volumeChanged();
 
212
    void mutedChanged();
 
213
    void hasAudioChanged();
 
214
    void hasVideoChanged();
 
215
 
 
216
    void bufferProgressChanged();
 
217
 
 
218
    void seekableChanged();
 
219
    void playbackRateChanged();
 
220
 
 
221
    void availabilityChanged(Availability availability);
 
222
 
 
223
    void errorChanged();
 
224
    void error(QDeclarativeAudio::Error error, const QString &errorString);
 
225
 
 
226
    void mediaObjectChanged();
 
227
 
 
228
private Q_SLOTS:
 
229
    void _q_error(QMediaPlayer::Error);
 
230
    void _q_availabilityChanged(QMultimedia::AvailabilityStatus);
 
231
    void _q_statusChanged();
 
232
 
 
233
private:
 
234
    Q_DISABLE_COPY(QDeclarativeAudio)
 
235
 
 
236
    bool m_autoPlay;
 
237
    bool m_autoLoad;
 
238
    bool m_loaded;
 
239
    bool m_muted;
 
240
    bool m_complete;
 
241
    int m_loopCount;
 
242
    int m_runningCount;
 
243
    int m_position;
 
244
    qreal m_vol;
 
245
    qreal m_playbackRate;
 
246
 
 
247
    QMediaPlayer::State m_playbackState;
 
248
    QMediaPlayer::MediaStatus m_status;
 
249
    QMediaPlayer::Error m_error;
 
250
    QString m_errorString;
 
251
    QUrl m_source;
 
252
    QMediaContent m_content;
 
253
 
 
254
    QScopedPointer<QDeclarativeMediaMetaData> m_metaData;
 
255
 
 
256
    QMediaPlayer *m_player;
 
257
 
 
258
    friend class QDeclarativeMediaBaseAnimation;
 
259
};
 
260
 
 
261
QT_END_NAMESPACE
 
262
 
 
263
QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeAudio))
 
264
 
 
265
#endif