mediaobject.h

Go to the documentation of this file.
00001 /*  This file is part of the KDE project
00002     Copyright (C) 2005 Matthias Kretz <kretz@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Lesser General Public
00006     License as published by the Free Software Foundation; either
00007     version 2.1 of the License, or (at your option) version 3, or any
00008     later version accepted by the membership of KDE e.V. (or its
00009     successor approved by the membership of KDE e.V.), Nokia Corporation 
00010     (or its successors, if any) and the KDE Free Qt Foundation, which shall
00011     act as a proxy defined in Section 6 of version 3 of the license.
00012 
00013     This library is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016     Lesser General Public License for more details.
00017 
00018     You should have received a copy of the GNU Lesser General Public
00019     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 #ifndef Phonon_MEDIAOBJECT_H
00023 #define Phonon_MEDIAOBJECT_H
00024 
00025 #include "medianode.h"
00026 #include "mediasource.h"
00027 #include "phonon_export.h"
00028 #include "phonondefs.h"
00029 #include "phononnamespace.h"
00030 
00031 QT_BEGIN_HEADER
00032 QT_BEGIN_NAMESPACE
00033 
00034 namespace Phonon
00035 {
00036     class MediaObjectPrivate;
00037 
00084     class PHONON_EXPORT MediaObject : public QObject, public MediaNode
00085     {
00086         friend class FrontendInterfacePrivate;
00087         Q_OBJECT
00088         K_DECLARE_PRIVATE(MediaObject)
00089         PHONON_OBJECT(MediaObject)
00106         Q_PROPERTY(qint32 transitionTime READ transitionTime WRITE setTransitionTime)
00107 
00127         Q_PROPERTY(qint32 prefinishMark READ prefinishMark WRITE setPrefinishMark)
00128 
00154         Q_PROPERTY(qint32 tickInterval READ tickInterval WRITE setTickInterval)
00155         public:
00159             ~MediaObject();
00160 
00169             State state() const;
00170 
00195             bool hasVideo() const;
00196 
00221             bool isSeekable() const;
00222 
00223             qint32 tickInterval() const;
00224 
00252             QStringList metaData(const QString &key) const;
00253 
00260             QStringList metaData(Phonon::MetaData key) const;
00261 
00265             QMultiMap<QString, QString> metaData() const;
00266 
00270             QString errorString() const;
00271 
00277             ErrorType errorType() const;
00278 
00284             MediaSource currentSource() const;
00285 
00301             void setCurrentSource(const MediaSource &source);
00302 
00307             QList<MediaSource> queue() const;
00308 
00317             void setQueue(const QList<MediaSource> &sources);
00318 
00327             void setQueue(const QList<QUrl> &urls);
00328 
00338             void enqueue(const MediaSource &source);
00339 
00346             void enqueue(const QList<MediaSource> &sources);
00347 
00354             void enqueue(const QList<QUrl> &urls);
00355 
00359             void clearQueue();
00360 
00368             qint64 currentTime() const;
00369 
00377             qint64 totalTime() const;
00378 
00384             qint64 remainingTime() const;
00385 
00386             qint32 prefinishMark() const;
00387             void setPrefinishMark(qint32 msecToEnd);
00388 
00389             qint32 transitionTime() const;
00390             void setTransitionTime(qint32 msec);
00391 
00392         public Q_SLOTS:
00393 
00394             void setTickInterval(qint32 newTickInterval);
00395 
00406             void play();
00407 
00416             void pause();
00417 
00426             void stop();
00427 
00447             void seek(qint64 time);
00448 
00454             void clear();
00455 
00456         Q_SIGNALS:
00463             void stateChanged(Phonon::State newstate, Phonon::State oldstate);
00464 
00472             void tick(qint64 time);
00473 
00481             void metaDataChanged();
00482 
00495             void seekableChanged(bool isSeekable);
00496 
00510 #ifndef QT_NO_PHONON_VIDEO
00511             void hasVideoChanged(bool hasVideo);
00512 #endif //QT_NO_PHONON_VIDEO
00513  // other names: bufferingProgress
00528             void bufferStatus(int percentFilled);
00529 
00543             void finished();
00544 
00555             void currentSourceChanged(const Phonon::MediaSource &newSource);
00556 
00567             void aboutToFinish();
00568 
00583             void prefinishMarkReached(qint32 msecToEnd);
00584 
00596             void totalTimeChanged(qint64 newTotalTime);
00597 
00598         protected:
00599             //MediaObject(Phonon::MediaObjectPrivate &dd, QObject *parent);
00600 
00601         private:
00602             Q_PRIVATE_SLOT(k_func(), void _k_resumePlay())
00603             Q_PRIVATE_SLOT(k_func(), void _k_resumePause())
00604             Q_PRIVATE_SLOT(k_func(), void _k_metaDataChanged(const QMultiMap<QString, QString> &))
00605 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
00606             Q_PRIVATE_SLOT(k_func(), void _k_stateChanged(Phonon::State, Phonon::State))
00607 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
00608             Q_PRIVATE_SLOT(k_func(), void _k_aboutToFinish())
00609             Q_PRIVATE_SLOT(k_func(), void _k_currentSourceChanged(const MediaSource &))
00610     };
00611 
00616     PHONON_EXPORT MediaObject *createPlayer(Phonon::Category category, const MediaSource &source = MediaSource());
00617 } //namespace Phonon
00618 
00619 QT_END_NAMESPACE
00620 QT_END_HEADER
00621 
00622 // vim: sw=4 ts=4 tw=80
00623 #endif // Phonon_MEDIAOBJECT_H