kdemm Library API Documentation

player.h

00001 /*  This file is part of the KDE project
00002     Copyright (C) 2004 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 Library General Public
00006     License version 2 as published by the Free Software Foundation.
00007 
00008     This library is distributed in the hope that it will be useful,
00009     but WITHOUT ANY WARRANTY; without even the implied warranty of
00010     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011     Library General Public License for more details.
00012 
00013     You should have received a copy of the GNU Library General Public License
00014     along with this library; see the file COPYING.LIB.  If not, write to
00015     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00016     Boston, MA 02111-1307, USA.
00017 
00018 */
00019 
00020 #ifndef PLAYOBJECT_H
00021 #define PLAYOBJECT_H
00022 
00023 #include <kdelibs_export.h>
00024 #include <qobject.h>
00025 
00026 class KURL;
00027 
00028 namespace KDE
00029 {
00030 namespace Multimedia
00031 {
00032     class Channel;
00039     class KDE_EXPORT Player : public QObject
00040     {
00041         Q_OBJECT
00042         public:
00046             enum State
00047             {
00053                 NoMedia,
00060                 Loading,
00065                 Stopped,
00069                 Playing,
00074                 Buffering,
00078                 Paused
00079             };
00080 
00081             virtual ~Player();
00082 
00090             virtual bool setOutputChannel( Channel * device ) = 0;
00091 
00095             virtual State state() const;
00096 
00102             virtual bool hasVolumeControl() const = 0;
00103 
00109             virtual float volume() const = 0;
00110 
00114             virtual long totalTime() const = 0;
00115 
00119             virtual long remainingTime() const = 0;
00120 
00124             virtual long currentTime() const = 0;
00125 
00131             virtual bool seekable() const = 0;
00132 
00136             virtual long tickInterval() const = 0;
00137 
00138         public slots:
00148             virtual bool load( const KURL & url ) = 0;
00149 
00153             virtual bool play() = 0;
00154 
00158             virtual bool pause() = 0;
00159 
00163             virtual bool stop() = 0;
00164 
00176             virtual bool setVolume( float volume ) = 0;
00177 
00185             virtual bool seek( long time ) = 0;
00186 
00195             virtual bool setTickInterval( long ms ) = 0;
00196 
00197         signals:
00203             void finished();
00204 
00205             //XXX do we want a aboutToFinish() signal?
00206 
00215             void stateChanged( KDE::Multimedia::Player::State newstate, KDE::Multimedia::Player::State oldstate );
00216 
00224             void tick( long time );
00225 
00232             void length( long length );
00233 
00234         protected:
00239             Player( QObject * parent, const char * name );
00240 
00248             void setState( State newstate );
00249 
00250         private:
00251             class Private;
00252             Private * d;
00253 
00254             State m_state;
00255     };
00256 }} //namespaces
00257 
00258 // vim: sw=4 ts=4 tw=80 noet
00259 #endif // PLAYOBJECT_H
KDE Logo
This file is part of the documentation for kdemm Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Sep 13 04:04:37 2005 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003