kdemm Library API Documentation

KDE::Multimedia::Player Class Reference

Interface for accessing media playback functions. More...

#include <player.h>

Inheritance diagram for KDE::Multimedia::Player:

Inheritance graph
[legend]
Collaboration diagram for KDE::Multimedia::Player:

Collaboration graph
[legend]
List of all members.

Public Types

enum  State {
  NoMedia, Loading, Stopped, Playing,
  Buffering, Paused
}

Public Slots

virtual bool load (const KURL &url)=0
virtual bool play ()=0
virtual bool pause ()=0
virtual bool stop ()=0
virtual bool setVolume (float volume)=0
virtual bool seek (long time)=0
virtual bool setTickInterval (long ms)=0

Signals

void finished ()
void stateChanged (KDE::Multimedia::Player::State newstate, KDE::Multimedia::Player::State oldstate)
void tick (long time)
void length (long length)

Public Member Functions

virtual ~Player ()
virtual bool setOutputChannel (Channel *device)=0
virtual State state () const
virtual bool hasVolumeControl () const =0
virtual float volume () const =0
virtual long totalTime () const =0
virtual long remainingTime () const =0
virtual long currentTime () const =0
virtual bool seekable () const =0
virtual long tickInterval () const =0

Protected Member Functions

 Player (QObject *parent, const char *name)
void setState (State newstate)

Detailed Description

Interface for accessing media playback functions.

Author:
Matthias Kretz <kretz@kde.org>
Since:
4.0

Definition at line 39 of file player.h.


Member Enumeration Documentation

enum KDE::Multimedia::Player::State
 

The state the playobject is in at the moment.

Enumerator:
NoMedia  The load method wasn't called or didn't succeed.

If the object is in this state the next thing you have to do is to call load.

Loading  After calling load it might take a while before the Player is ready to play().

Normally this doesn't happen for local files, but can happen for remote files where the asynchronous mimetype detection can take a while.

Stopped  The Player has a valid media file loaded and is ready for playing.
Playing  The Player is playing a media file.
Buffering  The Player is waiting for data to be able to continue playing.
Paused  The Player is paused currently.

Definition at line 46 of file player.h.


Constructor & Destructor Documentation

KDE::Multimedia::Player::Player QObject parent,
const char *  name
[protected]
 

You can not instantiate players yourself, use the Factory to create them.

Definition at line 24 of file player.cpp.


Member Function Documentation

virtual bool KDE::Multimedia::Player::setOutputChannel Channel device  )  [pure virtual]
 

Set the output device the Player should use.

Returns:
Returns true on success. If it returns false the output device wasn't changed. This could happen if you pass a Channel with Channel::direction() == Channel::Input.

Referenced by KDE::Multimedia::Backend::playSoundEvent().

Player::State KDE::Multimedia::Player::state  )  const [virtual]
 

Get the current state.

Definition at line 34 of file player.cpp.

virtual bool KDE::Multimedia::Player::hasVolumeControl  )  const [pure virtual]
 

Check whether the Player supports to control the volume.

Returns:
Return true if the Player can change its volume.

virtual float KDE::Multimedia::Player::volume  )  const [pure virtual]
 

Get the current volume.

Returns:
the current volume

virtual long KDE::Multimedia::Player::totalTime  )  const [pure virtual]
 

Get the total time (in milliseconds) of the file currently being played.

virtual long KDE::Multimedia::Player::remainingTime  )  const [pure virtual]
 

Get the remaining time (in milliseconds) of the file currently being played.

virtual long KDE::Multimedia::Player::currentTime  )  const [pure virtual]
 

Get the current time (in milliseconds) of the file currently being played.

virtual bool KDE::Multimedia::Player::seekable  )  const [pure virtual]
 

If the current media may be seeked returns true.

Returns:
whether the current media may be seeked.

virtual long KDE::Multimedia::Player::tickInterval  )  const [pure virtual]
 

Return the time interval in milliseconds between two ticks.

virtual bool KDE::Multimedia::Player::load const KURL url  )  [pure virtual, slot]
 

Load a media file.

If another media is currently loaded it is stopped and unloaded.

Parameters:
url The location of the media file
Returns:
If the call was successfull (the media file was found and can be read and decoded) returns true

Referenced by KDE::Multimedia::Backend::playSoundEvent().

virtual bool KDE::Multimedia::Player::play  )  [pure virtual, slot]
 

Play the media file.

Referenced by KDE::Multimedia::Backend::playSoundEvent().

virtual bool KDE::Multimedia::Player::pause  )  [pure virtual, slot]
 

Pause a playing media.

If it was paused before nothing changes.

virtual bool KDE::Multimedia::Player::stop  )  [pure virtual, slot]
 

Stop a playback.

virtual bool KDE::Multimedia::Player::setVolume float  volume  )  [pure virtual, slot]
 

Set the volume of the playback.

Parameters:
volume 0.0 is complete silence and 1.0 is full volume. Higher values than 1.0 are possible but might result in distortion of the sound.
Returns:
returns true if the call was successfull, returns false if the volume change didn't work and therefor didn't change.

virtual bool KDE::Multimedia::Player::seek long  time  )  [pure virtual, slot]
 

Seek to the time indicated.

Parameters:
time The time in milliseconds where to continue playing.
Returns:
whether the seek was successfull.

virtual bool KDE::Multimedia::Player::setTickInterval long  ms  )  [pure virtual, slot]
 

Change the interval the tick signal is emitted.

If you set ms to 0 the signal gets disabled.

Parameters:
ms tick interval in milliseconds
Returns:
Returns true if the tick intervall was changed.

void KDE::Multimedia::Player::finished  )  [signal]
 

Emitted when the file has finished playing on its own.

I.e. it is not emitted if you call stop(), pause() or load(), but only on end-of-file or a critical error.

void KDE::Multimedia::Player::stateChanged KDE::Multimedia::Player::State  newstate,
KDE::Multimedia::Player::State  oldstate
[signal]
 

Emitted when the state of the Player has changed.

In case you're not interested in the old state you can also connect to a slot that only has one State argument.

Parameters:
newstate The state the Player is in now
oldstate The state the Player was in before

Referenced by setState().

void KDE::Multimedia::Player::tick long  time  )  [signal]
 

This signal gets emitted every tickInterval milliseconds.

Parameters:
time The position of the media file in milliseconds.
See also:
setTickInterval, tickInterval

void KDE::Multimedia::Player::length long  length  )  [signal]
 

This signal is emitted as soon as the length of the media file is known or has changed.

Parameters:
length The length of the media file in milliseconds.

void KDE::Multimedia::Player::setState State  newstate  )  [protected]
 

Call this in your reimplementation for state changes.

It emits the stateChanged signal if the state has really changed.

Parameters:
newstate The new state of the Player. If newstate is equal to the old state() the call will be ignored.

Definition at line 39 of file player.cpp.

References stateChanged().


The documentation for this class was generated from the following files:
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:43 2005 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003