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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
|
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtMultimedia module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/qcoreevent.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qtimer.h>
#include <QtCore/qpointer.h>
#include <QtCore/qdebug.h>
#include <QtMultimedia/qmediaplayer.h>
#include <QtMultimedia/private/qmediaobject_p.h>
#include <QtMultimedia/qmediaservice.h>
#include <QtMultimedia/qmediaplayercontrol.h>
#include <QtMultimedia/qmediaserviceprovider.h>
#include <QtMultimedia/qmediaplaylist.h>
#include <QtMultimedia/qmediaplaylistcontrol.h>
#include <QtMultimedia/qvideowidget.h>
#include <QtMultimedia/qgraphicsvideoitem.h>
//#define DEBUG_PLAYER_STATE
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Multimedia)
/*!
\class QMediaPlayer
\brief The QMediaPlayer class allows the playing of a media source.
\ingroup multimedia
\since 4.7
\preliminary
The QMediaPlayer class is a high level media playback class. It can be used
to playback such content as songs, movies and internet radio. The content
to playback is specified as a QMediaContent, which can be thought of as a
main or canonical URL with addition information attached. When provided
with a QMediaContent playback may be able to commence.
\code
player = new QMediaPlayer;
connect(player, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
player->setMedia(QUrl::fromLocalFile("/Users/me/Music/coolsong.mp3"));
player->setVolume(50);
player->play();
\endcode
QVideoWidget can be used with QMediaPlayer for video rendering and QMediaPlaylist
for accessing playlist functionality.
\code
player = new QMediaPlayer;
playlist = new QMediaPlaylist;
playlist->setMediaObject(player);
playlist->append(QUrl("http://example.com/movie1.mp4"));
playlist->append(QUrl("http://example.com/movie2.mp4"));
widget = new QVideoWidget;
widget->setMediaObject(player);
widget->show();
player->play();
\endcode
\sa QMediaObject, QMediaService, QVideoWidget, QMediaPlaylist
*/
namespace
{
class MediaPlayerRegisterMetaTypes
{
public:
MediaPlayerRegisterMetaTypes()
{
qRegisterMetaType<QMediaPlayer::State>();
qRegisterMetaType<QMediaPlayer::MediaStatus>();
qRegisterMetaType<QMediaPlayer::Error>();
}
} _registerPlayerMetaTypes;
}
class QMediaPlayerPrivate : public QMediaObjectPrivate
{
Q_DECLARE_NON_CONST_PUBLIC(QMediaPlayer)
public:
QMediaPlayerPrivate()
: provider(0)
, control(0)
, playlistControl(0)
, state(QMediaPlayer::StoppedState)
, error(QMediaPlayer::NoError)
, filterStates(false)
, playlist(0)
{}
QMediaServiceProvider *provider;
QMediaPlayerControl* control;
QMediaPlaylistControl* playlistControl;
QMediaPlayer::State state;
QMediaPlayer::Error error;
QString errorString;
bool filterStates;
QMediaPlaylist *playlist;
QPointer<QVideoWidget> videoWidget;
QPointer<QGraphicsVideoItem> videoItem;
void _q_stateChanged(QMediaPlayer::State state);
void _q_mediaStatusChanged(QMediaPlayer::MediaStatus status);
void _q_error(int error, const QString &errorString);
void _q_updateMedia(const QMediaContent&);
void _q_playlistDestroyed();
};
#define ENUM_NAME(c,e,v) (c::staticMetaObject.enumerator(c::staticMetaObject.indexOfEnumerator(e)).valueToKey((v)))
void QMediaPlayerPrivate::_q_stateChanged(QMediaPlayer::State ps)
{
Q_Q(QMediaPlayer);
#ifdef DEBUG_PLAYER_STATE
qDebug() << "State changed:" << ENUM_NAME(QMediaPlayer, "State", ps) << (filterStates ? "(filtered)" : "");
#endif
if (filterStates)
return;
if (playlist
&& !playlistControl //service should do this itself
&& ps != state && ps == QMediaPlayer::StoppedState
&& control->mediaStatus() == QMediaPlayer::EndOfMedia) {
playlist->next();
ps = control->state();
}
if (ps != state) {
state = ps;
if (ps == QMediaPlayer::PlayingState)
q->addPropertyWatch("position");
else
q->removePropertyWatch("position");
emit q->stateChanged(ps);
}
}
void QMediaPlayerPrivate::_q_mediaStatusChanged(QMediaPlayer::MediaStatus status)
{
Q_Q(QMediaPlayer);
#ifdef DEBUG_PLAYER_STATE
qDebug() << "MediaStatus changed:" << ENUM_NAME(QMediaPlayer, "MediaStatus", status);
#endif
switch (status) {
case QMediaPlayer::StalledMedia:
case QMediaPlayer::BufferingMedia:
q->addPropertyWatch("bufferStatus");
emit q->mediaStatusChanged(status);
break;
default:
q->removePropertyWatch("bufferStatus");
emit q->mediaStatusChanged(status);
break;
}
}
void QMediaPlayerPrivate::_q_error(int error, const QString &errorString)
{
Q_Q(QMediaPlayer);
this->error = QMediaPlayer::Error(error);
this->errorString = errorString;
emit q->error(this->error);
}
void QMediaPlayerPrivate::_q_updateMedia(const QMediaContent &media)
{
const QMediaPlayer::State currentState = state;
filterStates = true;
control->setMedia(media, 0);
if (!media.isNull()) {
switch (currentState) {
case QMediaPlayer::PlayingState:
control->play();
break;
case QMediaPlayer::PausedState:
control->pause();
break;
default:
break;
}
}
filterStates = false;
state = control->state();
if (state != currentState) {
#ifdef DEBUG_PLAYER_STATE
qDebug() << "State changed:" << ENUM_NAME(QMediaPlayer, "State", state);
#endif
emit q_func()->stateChanged(state);
}
}
void QMediaPlayerPrivate::_q_playlistDestroyed()
{
playlist = 0;
control->setMedia(QMediaContent(), 0);
}
static QMediaService *playerService(QMediaPlayer::Flags flags, QMediaServiceProvider *provider)
{
if (flags) {
QMediaServiceProviderHint::Features features = 0;
if (flags & QMediaPlayer::LowLatency)
features |= QMediaServiceProviderHint::LowLatencyPlayback;
if (flags & QMediaPlayer::StreamPlayback)
features |= QMediaServiceProviderHint::StreamPlayback;
return provider->requestService(Q_MEDIASERVICE_MEDIAPLAYER,
QMediaServiceProviderHint(features));
} else
return provider->requestService(Q_MEDIASERVICE_MEDIAPLAYER);
}
/*!
Construct a QMediaPlayer that uses the playback service from \a provider,
parented to \a parent and with \a flags.
If a playback service is not specified the system default will be used.
*/
QMediaPlayer::QMediaPlayer(QObject *parent, QMediaPlayer::Flags flags, QMediaServiceProvider *provider):
QMediaObject(*new QMediaPlayerPrivate,
parent,
playerService(flags,provider))
{
Q_D(QMediaPlayer);
d->provider = provider;
if (d->service == 0) {
d->error = ServiceMissingError;
} else {
d->control = qobject_cast<QMediaPlayerControl*>(d->service->control(QMediaPlayerControl_iid));
d->playlistControl = qobject_cast<QMediaPlaylistControl*>(d->service->control(QMediaPlaylistControl_iid));
if (d->control != 0) {
connect(d->control, SIGNAL(mediaChanged(QMediaContent)), SIGNAL(mediaChanged(QMediaContent)));
connect(d->control, SIGNAL(stateChanged(QMediaPlayer::State)), SLOT(_q_stateChanged(QMediaPlayer::State)));
connect(d->control, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
SLOT(_q_mediaStatusChanged(QMediaPlayer::MediaStatus)));
connect(d->control, SIGNAL(error(int,QString)), SLOT(_q_error(int,QString)));
connect(d->control, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64)));
connect(d->control, SIGNAL(positionChanged(qint64)), SIGNAL(positionChanged(qint64)));
connect(d->control, SIGNAL(audioAvailableChanged(bool)), SIGNAL(audioAvailableChanged(bool)));
connect(d->control, SIGNAL(videoAvailableChanged(bool)), SIGNAL(videoAvailableChanged(bool)));
connect(d->control, SIGNAL(volumeChanged(int)), SIGNAL(volumeChanged(int)));
connect(d->control, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged(bool)));
connect(d->control, SIGNAL(seekableChanged(bool)), SIGNAL(seekableChanged(bool)));
connect(d->control, SIGNAL(playbackRateChanged(qreal)), SIGNAL(playbackRateChanged(qreal)));
if (d->control->state() == PlayingState)
addPropertyWatch("position");
if (d->control->mediaStatus() == StalledMedia || d->control->mediaStatus() == BufferingMedia)
addPropertyWatch("bufferStatus");
}
}
}
/*!
Destroys the player object.
*/
QMediaPlayer::~QMediaPlayer()
{
Q_D(QMediaPlayer);
d->provider->releaseService(d->service);
}
QMediaContent QMediaPlayer::media() const
{
Q_D(const QMediaPlayer);
if (d->control != 0)
return d->control->media();
return QMediaContent();
}
/*!
Returns the stream source of media data.
This is only valid if a stream was passed to setMedia().
\sa setMedia()
*/
const QIODevice *QMediaPlayer::mediaStream() const
{
Q_D(const QMediaPlayer);
if (d->control != 0)
return d->control->mediaStream();
return 0;
}
QMediaPlayer::State QMediaPlayer::state() const
{
return d_func()->state;
}
QMediaPlayer::MediaStatus QMediaPlayer::mediaStatus() const
{
Q_D(const QMediaPlayer);
if (d->control != 0)
return d->control->mediaStatus();
return QMediaPlayer::UnknownMediaStatus;
}
qint64 QMediaPlayer::duration() const
{
Q_D(const QMediaPlayer);
if (d->control != 0)
return d->control->duration();
return -1;
}
qint64 QMediaPlayer::position() const
{
Q_D(const QMediaPlayer);
if (d->control != 0)
return d->control->position();
return 0;
}
int QMediaPlayer::volume() const
{
Q_D(const QMediaPlayer);
if (d->control != 0)
return d->control->volume();
return 0;
}
bool QMediaPlayer::isMuted() const
{
Q_D(const QMediaPlayer);
if (d->control != 0)
return d->control->isMuted();
return false;
}
int QMediaPlayer::bufferStatus() const
{
Q_D(const QMediaPlayer);
if (d->control != 0)
return d->control->bufferStatus();
return 0;
}
bool QMediaPlayer::isAudioAvailable() const
{
Q_D(const QMediaPlayer);
if (d->control != 0)
return d->control->isAudioAvailable();
return false;
}
bool QMediaPlayer::isVideoAvailable() const
{
Q_D(const QMediaPlayer);
if (d->control != 0)
return d->control->isVideoAvailable();
return false;
}
bool QMediaPlayer::isSeekable() const
{
Q_D(const QMediaPlayer);
if (d->control != 0)
return d->control->isSeekable();
return false;
}
qreal QMediaPlayer::playbackRate() const
{
Q_D(const QMediaPlayer);
if (d->control != 0)
return d->control->playbackRate();
return 0.0;
}
/*!
Returns the current error state.
*/
QMediaPlayer::Error QMediaPlayer::error() const
{
return d_func()->error;
}
QString QMediaPlayer::errorString() const
{
return d_func()->errorString;
}
//public Q_SLOTS:
/*!
Start or resume playing the current source.
*/
void QMediaPlayer::play()
{
Q_D(QMediaPlayer);
if (d->control == 0) {
QMetaObject::invokeMethod(this, "_q_error", Qt::QueuedConnection);
Q_ARG(int, QMediaPlayer::ServiceMissingError),
Q_ARG(QString, tr("The QMediaPlayer object does not have a valid service"));
return;
}
//if playlist control is available, the service should advance itself
if (d->playlist && !d->playlistControl && d->playlist->currentIndex() == -1 && !d->playlist->isEmpty())
d->playlist->setCurrentIndex(0);
// Reset error conditions
d->error = NoError;
d->errorString = QString();
d->control->play();
}
/*!
Pause playing the current source.
*/
void QMediaPlayer::pause()
{
Q_D(QMediaPlayer);
if (d->control != 0)
d->control->pause();
}
/*!
Stop playing, and reset the play position to the beginning.
*/
void QMediaPlayer::stop()
{
Q_D(QMediaPlayer);
if (d->control != 0)
d->control->stop();
}
void QMediaPlayer::setPosition(qint64 position)
{
Q_D(QMediaPlayer);
if (d->control == 0 || !isSeekable())
return;
d->control->setPosition(qBound(qint64(0), duration(), position));
}
void QMediaPlayer::setVolume(int v)
{
Q_D(QMediaPlayer);
if (d->control == 0)
return;
int clamped = qBound(0, v, 100);
if (clamped == volume())
return;
d->control->setVolume(clamped);
}
void QMediaPlayer::setMuted(bool muted)
{
Q_D(QMediaPlayer);
if (d->control == 0 || muted == isMuted())
return;
d->control->setMuted(muted);
}
void QMediaPlayer::setPlaybackRate(qreal rate)
{
Q_D(QMediaPlayer);
if (d->control != 0)
d->control->setPlaybackRate(rate);
}
/*!
Sets the current \a media source.
If a \a stream is supplied; media data will be read from it instead of resolving the media
source. In this case the media source may still be used to resolve additional information
about the media such as mime type.
Setting the media to a null QMediaContent will cause the player to discard all
information relating to the current media source and to cease all I/O operations related
to that media.
*/
void QMediaPlayer::setMedia(const QMediaContent &media, QIODevice *stream)
{
Q_D(QMediaPlayer);
if (d->control != 0)
d_func()->control->setMedia(media, stream);
}
/*!
\internal
*/
void QMediaPlayer::bind(QObject *obj)
{
Q_D(QMediaPlayer);
if (d->control != 0) {
QMediaPlaylist *playlist = qobject_cast<QMediaPlaylist*>(obj);
if (playlist) {
if (d->playlist)
d->playlist->setMediaObject(0);
d->playlist = playlist;
connect(d->playlist, SIGNAL(currentMediaChanged(QMediaContent)),
this, SLOT(_q_updateMedia(QMediaContent)));
connect(d->playlist, SIGNAL(destroyed()), this, SLOT(_q_playlistDestroyed()));
setMedia(playlist->currentMedia());
return;
}
QVideoWidget *videoWidget = qobject_cast<QVideoWidget*>(obj);
QGraphicsVideoItem *videoItem = qobject_cast<QGraphicsVideoItem*>(obj);
if (videoWidget || videoItem) {
//detach the current video output
if (d->videoWidget) {
d->videoWidget->setMediaObject(0);
d->videoWidget = 0;
}
if (d->videoItem) {
d->videoItem->setMediaObject(0);
d->videoItem = 0;
}
}
if (videoWidget)
d->videoWidget = videoWidget;
if (videoItem)
d->videoItem = videoItem;
}
}
/*!
\internal
*/
void QMediaPlayer::unbind(QObject *obj)
{
Q_D(QMediaPlayer);
if (obj == d->videoWidget) {
d->videoWidget = 0;
} else if (obj == d->videoItem) {
d->videoItem = 0;
} else if (obj == d->playlist) {
disconnect(d->playlist, SIGNAL(currentMediaChanged(QMediaContent)),
this, SLOT(_q_updateMedia(QMediaContent)));
disconnect(d->playlist, SIGNAL(destroyed()), this, SLOT(_q_playlistDestroyed()));
d->playlist = 0;
setMedia(QMediaContent());
}
}
/*!
Returns the level of support a media player has for a \a mimeType and a set of \a codecs.
The \a flags argument allows additional requirements such as performance indicators to be
specified.
*/
QtMultimedia::SupportEstimate QMediaPlayer::hasSupport(const QString &mimeType,
const QStringList& codecs,
Flags flags)
{
return QMediaServiceProvider::defaultServiceProvider()->hasSupport(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER),
mimeType,
codecs,
flags);
}
/*!
Returns a list of MIME types supported by the media player.
The \a flags argument causes the resultant list to be restricted to MIME types which can be supported
given additional requirements, such as performance indicators.
*/
QStringList QMediaPlayer::supportedMimeTypes(Flags flags)
{
return QMediaServiceProvider::defaultServiceProvider()->supportedMimeTypes(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER),
flags);
}
// Enums
/*!
\enum QMediaPlayer::State
Defines the current state of a media player.
\value PlayingState The media player is currently playing content.
\value PausedState The media player has paused playback, playback of the current track will
resume from the position the player was paused at.
\value StoppedState The media player is not playing content, playback will begin from the start
of the current track.
*/
/*!
\enum QMediaPlayer::MediaStatus
Defines the status of a media player's current media.
\value UnknownMediaStatus The status of the media cannot be determined.
\value NoMedia The is no current media. The player is in the StoppedState.
\value LoadingMedia The current media is being loaded. The player may be in any state.
\value LoadedMedia The current media has been loaded. The player is in the StoppedState.
\value StalledMedia Playback of the current media has stalled due to insufficient buffering or
some other temporary interruption. The player is in the PlayingState or PausedState.
\value BufferingMedia The player is buffering data but has enough data buffered for playback to
continue for the immediate future. The player is in the PlayingState or PausedState.
\value BufferedMedia The player has fully buffered the current media. The player is in the
PlayingState or PausedState.
\value EndOfMedia Playback has reached the end of the current media. The player is in the
StoppedState.
\value InvalidMedia The current media cannot be played. The player is in the StoppedState.
*/
/*!
\enum QMediaPlayer::Error
Defines a media player error condition.
\value NoError No error has occurred.
\value ResourceError A media resource couldn't be resolved.
\value FormatError The format of a media resource isn't (fully) supported. Playback may still
be possible, but without an audio or video component.
\value NetworkError A network error occurred.
\value AccessDeniedError There are not the appropriate permissions to play a media resource.
\value ServiceMissingError A valid playback service was not found, playback cannot proceed.
*/
// Signals
/*!
\fn QMediaPlayer::error(QMediaPlayer::Error error)
Signals that an \a error condition has occurred.
\sa errorString()
*/
/*!
\fn void QMediaPlayer::stateChanged(State state)
Signal the \a state of the Player object has changed.
*/
/*!
\fn QMediaPlayer::mediaStatusChanged(QMediaPlayer::MediaStatus status)
Signals that the \a status of the current media has changed.
\sa mediaStatus()
*/
/*!
\fn void QMediaPlayer::mediaChanged(const QMediaContent &media);
Signals that the current playing content will be obtained from \a media.
\sa media()
*/
/*!
\fn void QMediaPlayer::playbackRateChanged(qreal rate);
Signals the playbackRate has changed to \a rate.
*/
/*!
\fn void QMediaPlayer::seekableChanged(bool seekable);
Signals the \a seekable status of the player object has changed.
*/
// Properties
/*!
\property QMediaPlayer::state
\brief the media player's playback state.
By default this property is QMediaPlayer::Stopped
\sa mediaStatus(), play(), pause(), stop()
*/
/*!
\property QMediaPlayer::error
\brief a string describing the last error condition.
\sa error()
*/
/*!
\property QMediaPlayer::media
\brief the active media source being used by the player object.
The player object will use the QMediaContent for selection of the content to
be played.
By default this property has a null QMediaContent.
Setting this property to a null QMediaContent will cause the player to discard all
information relating to the current media source and to cease all I/O operations related
to that media.
\sa QMediaContent
*/
/*!
\property QMediaPlayer::mediaStatus
\brief the status of the current media stream.
The stream status describes how the playback of the current stream is
progressing.
By default this property is QMediaPlayer::NoMedia
\sa state
*/
/*!
\property QMediaPlayer::duration
\brief the duration of the current media.
The value is the total playback time in milliseconds of the current media.
The value may change across the life time of the QMediaPlayer object and
may not be available when initial playback begins, connect to the
durationChanged() signal to receive status notifications.
*/
/*!
\property QMediaPlayer::position
\brief the playback position of the current media.
The value is the current playback position, expressed in milliseconds since
the beginning of the media. Periodically changes in the position will be
indicated with the signal positionChanged(), the interval between updates
can be set with QMediaObject's method setNotifyInterval().
*/
/*!
\property QMediaPlayer::volume
\brief the current playback volume.
The playback volume is a linear in effect and the value can range from 0 -
100, values outside this range will be clamped.
*/
/*!
\property QMediaPlayer::muted
\brief the muted state of the current media.
The value will be true if the playback volume is muted; otherwise false.
*/
/*!
\property QMediaPlayer::bufferStatus
\brief the percentage of the temporary buffer filled before playback begins.
When the player object is buffering; this property holds the percentage of
the temporary buffer that is filled. The buffer will need to reach 100%
filled before playback can resume, at which time the MediaStatus will be
BufferedMedia.
\sa mediaStatus()
*/
/*!
\property QMediaPlayer::audioAvailable
\brief the audio availabilty status for the current media.
As the life time of QMediaPlayer can be longer than the playback of one
QMediaContent, this property may change over time, the
audioAvailableChanged signal can be used to monitor it's status.
*/
/*!
\property QMediaPlayer::videoAvailable
\brief the video availability status for the current media.
If available, the QVideoWidget class can be used to view the video. As the
life time of QMediaPlayer can be longer than the playback of one
QMediaContent, this property may change over time, the
videoAvailableChanged signal can be used to monitor it's status.
\sa QVideoWidget, QMediaContent
*/
/*!
\property QMediaPlayer::seekable
\brief the seek-able status of the current media
If seeking is supported this property will be true; false otherwise. The
status of this property may change across the life time of the QMediaPlayer
object, use the seekableChanged signal to monitor changes.
*/
/*!
\property QMediaPlayer::playbackRate
\brief the playback rate of the current media.
This value is a multiplier applied to the media's standard play rate. By
default this value is 1.0, indicating that the media is playing at the
standard pace. Values higher than 1.0 will increase the rate of play.
Values less than zero can be set and indicate the media will rewind at the
multiplier of the standard pace.
Not all playback services support change of the playback rate. It is
framework defined as to the status and quality of audio and video
while fast forwarding or rewinding.
*/
/*!
\fn void QMediaPlayer::durationChanged(qint64 duration)
Signal the duration of the content has changed to \a duration, expressed in milliseconds.
*/
/*!
\fn void QMediaPlayer::positionChanged(qint64 position)
Signal the position of the content has changed to \a position, expressed in
milliseconds.
*/
/*!
\fn void QMediaPlayer::volumeChanged(int volume)
Signal the playback volume has changed to \a volume.
*/
/*!
\fn void QMediaPlayer::mutedChanged(bool muted)
Signal the mute state has changed to \a muted.
*/
/*!
\fn void QMediaPlayer::audioAvailableChanged(bool available)
Signals the availability of audio content has changed to \a available.
*/
/*!
\fn void QMediaPlayer::videoAvailableChanged(bool videoAvailable)
Signal the availability of visual content has changed to \a videoAvailable.
*/
/*!
\fn void QMediaPlayer::bufferStatusChanged(int percentFilled)
Signal the amount of the local buffer filled as a percentage by \a percentFilled.
*/
/*!
\enum QMediaPlayer::Flag
\value LowLatency
The player is expected to be used with simple audio formats,
but playback should start without significant delay.
Such playback service can be used for beeps, ringtones, etc.
\value StreamPlayback
The player is expected to play QIODevice based streams.
If passed to QMediaPlayer constructor, the service supporting
streams playback will be choosen.
*/
QT_END_NAMESPACE
QT_END_HEADER
#include "moc_qmediaplayer.cpp"
|