phonon/mediaobject.h Source File

mediaobject.h
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  Copyright (C) 2005 Matthias Kretz <kretz@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) version 3, or any
8  later version accepted by the membership of KDE e.V. (or its
9  successor approved by the membership of KDE e.V.), Nokia Corporation
10  (or its successors, if any) and the KDE Free Qt Foundation, which shall
11  act as a proxy defined in Section 6 of version 3 of the license.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 
21 */
22 #ifndef Phonon_MEDIAOBJECT_H
23 #define Phonon_MEDIAOBJECT_H
24 
25 #include "medianode.h"
26 #include "mediasource.h"
27 #include "phonon_export.h"
28 #include "phonondefs.h"
29 #include "phononnamespace.h"
30 
33 
34 namespace Phonon
35 {
36  class MediaObjectPrivate;
37 
84  class PHONON_EXPORT MediaObject : public QObject, public MediaNode
85  {
86  friend class FrontendInterfacePrivate;
87  Q_OBJECT
106  Q_PROPERTY(qint32 transitionTime READ transitionTime WRITE setTransitionTime)
107 
127  Q_PROPERTY(qint32 prefinishMark READ prefinishMark WRITE setPrefinishMark)
128 
154  Q_PROPERTY(qint32 tickInterval READ tickInterval WRITE setTickInterval)
155  public:
159  ~MediaObject();
160 
169  State state() const;
170 
195  bool hasVideo() const;
196 
221  bool isSeekable() const;
222 
223  qint32 tickInterval() const;
224 
252  QStringList metaData(const QString &key) const;
253 
260  QStringList metaData(Phonon::MetaData key) const;
261 
265  QMultiMap<QString, QString> metaData() const;
266 
270  QString errorString() const;
271 
277  ErrorType errorType() const;
278 
284  MediaSource currentSource() const;
285 
301  void setCurrentSource(const MediaSource &source);
302 
307  QList<MediaSource> queue() const;
308 
317  void setQueue(const QList<MediaSource> &sources);
318 
327  void setQueue(const QList<QUrl> &urls);
328 
338  void enqueue(const MediaSource &source);
339 
346  void enqueue(const QList<MediaSource> &sources);
347 
354  void enqueue(const QList<QUrl> &urls);
355 
359  void clearQueue();
360 
368  qint64 currentTime() const;
369 
377  qint64 totalTime() const;
378 
384  qint64 remainingTime() const;
385 
386  qint32 prefinishMark() const;
387  void setPrefinishMark(qint32 msecToEnd);
388 
389  qint32 transitionTime() const;
390  void setTransitionTime(qint32 msec);
391 
392  public Q_SLOTS:
393 
394  void setTickInterval(qint32 newTickInterval);
395 
406  void play();
407 
416  void pause();
417 
426  void stop();
427 
447  void seek(qint64 time);
448 
454  void clear();
455 
456  Q_SIGNALS:
463  void stateChanged(Phonon::State newstate, Phonon::State oldstate);
464 
472  void tick(qint64 time);
473 
481  void metaDataChanged();
482 
495  void seekableChanged(bool isSeekable);
496 
510 #ifndef QT_NO_PHONON_VIDEO
511  void hasVideoChanged(bool hasVideo);
512 #endif //QT_NO_PHONON_VIDEO
513  // other names: bufferingProgress
528  void bufferStatus(int percentFilled);
529 
543  void finished();
544 
555  void currentSourceChanged(const Phonon::MediaSource &newSource);
556 
567  void aboutToFinish();
568 
583  void prefinishMarkReached(qint32 msecToEnd);
584 
596  void totalTimeChanged(qint64 newTotalTime);
597 
598  protected:
599  //MediaObject(Phonon::MediaObjectPrivate &dd, QObject *parent);
600 
601  private:
602  Q_PRIVATE_SLOT(k_func(), void _k_resumePlay())
603  Q_PRIVATE_SLOT(k_func(), void _k_resumePause())
604  Q_PRIVATE_SLOT(k_func(), void _k_metaDataChanged(const QMultiMap<QString, QString> &))
605 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
606  Q_PRIVATE_SLOT(k_func(), void _k_stateChanged(Phonon::State, Phonon::State))
607 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
608  Q_PRIVATE_SLOT(k_func(), void _k_aboutToFinish())
609  Q_PRIVATE_SLOT(k_func(), void _k_currentSourceChanged(const MediaSource &))
610  };
611 
616  PHONON_EXPORT MediaObject *createPlayer(Phonon::Category category, const MediaSource &source = MediaSource());
617 } //namespace Phonon
618 
621 
622 // vim: sw=4 ts=4 tw=80
623 #endif // Phonon_MEDIAOBJECT_H
GLsizei GLsizei GLchar * source
Definition: GLee.h:1721
PHONON_EXPORT MediaObject * createPlayer(Phonon::Category category, const MediaSource &source=MediaSource())
Convenience function to create a MediaObject and AudioOutput connected by a path. ...
MetaData
Provided as keys for MediaObject::metaData for convenience, in addition to the strings defined in the...
#define QT_END_NAMESPACE
Definition: qglobal.h:128
int qint32
Definition: qglobal.h:937
#define Q_PROPERTY(text)
Definition: qobjectdefs.h:80
#define QT_BEGIN_HEADER
Definition: qglobal.h:141
State
The state the media producing object is in at the moment.
long long qint64
Definition: qglobal.h:947
#define Q_PRIVATE_SLOT(d, signature)
Definition: qobjectdefs.h:73
#define Q_SLOTS
Definition: qobjectdefs.h:71
#define Q_SIGNALS
Definition: qobjectdefs.h:72
Note that all constructors of this class are implicit, so that you can simply write.
Definition: mediasource.h:61
Interface for media playback of a given URL.
Definition: mediaobject.h:84
#define PHONON_OBJECT(classname)
Definition: phonondefs.h:108
#define QT_BEGIN_NAMESPACE
Definition: qglobal.h:127
Category
Set's the category your program should be listed in in the mixer.
#define Q_OBJECT
Definition: qobjectdefs.h:157
ErrorType
Tells your program how to recover from an error.
Definition: qurl.h:61
The KDE Multimedia classes.
#define K_DECLARE_PRIVATE(Class)
Definition: phonondefs.h:46
#define PHONON_EXPORT
Definition: phonon_export.h:38
#define QT_END_HEADER
Definition: qglobal.h:142