Phonon  4.7.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
mediaobject.h
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 
31 
32 namespace Phonon
33 {
34  class MediaObjectPrivate;
35 
96  class PHONON_EXPORT MediaObject : public QObject, public MediaNode
97  {
98  friend class FrontendInterfacePrivate;
99  Q_OBJECT
100  P_DECLARE_PRIVATE(MediaObject)
101  PHONON_OBJECT(MediaObject)
118  Q_PROPERTY(qint32 transitionTime READ transitionTime WRITE setTransitionTime)
119 
139  Q_PROPERTY(qint32 prefinishMark READ prefinishMark WRITE setPrefinishMark)
140 
166  Q_PROPERTY(qint32 tickInterval READ tickInterval WRITE setTickInterval)
167  public:
171  ~MediaObject();
172 
181  State state() const;
182 
207  bool hasVideo() const;
208 
233  bool isSeekable() const;
234 
243  qint32 tickInterval() const;
244 
272  QStringList metaData(const QString &key) const;
273 
280  QStringList metaData(Phonon::MetaData key) const;
281 
285  QMultiMap<QString, QString> metaData() const;
286 
290  QString errorString() const;
291 
297  ErrorType errorType() const;
298 
304  MediaSource currentSource() const;
305 
321  void setCurrentSource(const MediaSource &source);
322 
327  QList<MediaSource> queue() const;
328 
337  void setQueue(const QList<MediaSource> &sources);
338 
347  void setQueue(const QList<QUrl> &urls);
348 
358  void enqueue(const MediaSource &source);
359 
366  void enqueue(const QList<MediaSource> &sources);
367 
374  void enqueue(const QList<QUrl> &urls);
375 
379  void clearQueue();
380 
388  qint64 currentTime() const;
389 
405  qint64 totalTime() const;
406 
412  qint64 remainingTime() const;
413 
414  qint32 prefinishMark() const;
415  void setPrefinishMark(qint32 msecToEnd);
416 
417  qint32 transitionTime() const;
418  void setTransitionTime(qint32 msec);
419 
420  public Q_SLOTS:
421 
429  void setTickInterval(qint32 newTickInterval);
430 
441  void play();
442 
451  void pause();
452 
461  void stop();
462 
482  void seek(qint64 time);
483 
489  void clear();
490 
491  Q_SIGNALS:
498  void stateChanged(Phonon::State newstate, Phonon::State oldstate);
499 
507  void tick(qint64 time);
508 
516  void metaDataChanged();
517 
530  void seekableChanged(bool isSeekable);
531 
545 #ifndef QT_NO_PHONON_VIDEO
546  void hasVideoChanged(bool hasVideo);
547 #endif //QT_NO_PHONON_VIDEO
548  // other names: bufferingProgress
563  void bufferStatus(int percentFilled);
564 
578  void finished();
579 
590  void currentSourceChanged(const Phonon::MediaSource &newSource);
591 
602  void aboutToFinish();
603 
618  void prefinishMarkReached(qint32 msecToEnd);
619 
637  void totalTimeChanged(qint64 newTotalTime);
638 
639  protected:
640  //MediaObject(Phonon::MediaObjectPrivate &dd, QObject *parent);
641 
642  private:
643  Q_PRIVATE_SLOT(k_func(), void _k_resumePlay())
644  Q_PRIVATE_SLOT(k_func(), void _k_resumePause())
645  Q_PRIVATE_SLOT(k_func(), void _k_metaDataChanged(const QMultiMap<QString, QString> &))
646 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
647  Q_PRIVATE_SLOT(k_func(), void _k_stateChanged(Phonon::State, Phonon::State))
648 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
649  Q_PRIVATE_SLOT(k_func(), void _k_aboutToFinish())
650  Q_PRIVATE_SLOT(k_func(), void _k_currentSourceChanged(const MediaSource &))
651  Q_PRIVATE_SLOT(k_func(), void _k_stateChanged(Phonon::State, Phonon::State))
652  };
653 
658  PHONON_EXPORT MediaObject *createPlayer(Phonon::Category category, const MediaSource &source = MediaSource());
659 } //namespace Phonon
660 
661 
662 // vim: sw=4 ts=4 tw=80
663 #endif // Phonon_MEDIAOBJECT_H