- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions

# MediaObjectInterface Class Reference

Search for all occurrences

## Detailed Description

Backend interface for media sources.

The backend implementation has to provide two signals, that are not defined in this interface:

- void stateChanged(Phonon::State newstate, Phonon::State oldstate)

  Emitted when the state of the MediaObject 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.

- void tick(qint64 time)

  This signal gets emitted every tickInterval milliseconds.

  Parameters:

    time | The position of the media file in milliseconds.

  See also:
    setTickInterval()
    tickInterval()

Author:
  Matthias Kretz <kretz@kde.org>

See also:
  MediaObject

Definition at line 68 of file mediaobjectinterface.h.

`#include <Phonon/MediaObjectInterface>`

List of all members.

## Public Member Functions
virtual | ~MediaObjectInterface ()
virtual void | play ()=0
| Requests the playback to start.
virtual void | pause ()=0
| Requests the playback to pause.
virtual void | stop ()=0
| Requests the playback to be stopped.
virtual void | seek (qint64 milliseconds)=0
| Requests the playback to be seeked to the given time.
virtual qint32 | tickInterval () const =0
| Return the time interval in milliseconds between two ticks.
virtual void | setTickInterval (qint32 interval)=0
| Change the interval the tick signal is emitted.
virtual bool | hasVideo () const =0
| Check whether the media data includes a video stream.
virtual bool | isSeekable () const =0
| If the current media may be seeked returns true.
virtual qint64 | currentTime () const =0
| Get the current time (in milliseconds) of the file currently being played.
virtual Phonon::State | state () const =0
| Get the current state.
virtual QString | errorString () const =0
| A translated string describing the error.
virtual Phonon::ErrorType | errorType () const =0
| Tells your program what to do about the error.
virtual qint64 | totalTime () const =0
| Returns the total time of the media in milliseconds.
virtual MediaSource | source () const =0
| Returns the current source.
virtual void | setSource (const MediaSource &)=0
| Sets the current source.
virtual void | setNextSource (const MediaSource &source)=0
| Sets the next source to be used for transitions.
virtual qint64 | remainingTime () const
virtual qint32 | prefinishMark () const =0
virtual void | setPrefinishMark (qint32)=0
virtual qint32 | transitionTime () const =0
virtual void | setTransitionTime (qint32)=0

## Constructor & Destructor Documentation

virtual ~MediaObjectInterface | ( |  | ) | `[inline, virtual]`

Definition at line 71 of file mediaobjectinterface.h.

## Member Function Documentation

virtual void play | ( |  | ) | `[pure virtual]`

Search for all occurrences

Requests the playback to start.

This method is only called if the state transition to PlayingState is possible.

The backend should react immediately by either going into PlayingState or BufferingState if the former is not possible.

virtual void pause | ( |  | ) | `[pure virtual]`

Search for all occurrences

Requests the playback to pause.

This method is only called if the state transition to PausedState is possible.

The backend should react as fast as possible. Go to PausedState as soon as playback is paused.

virtual void stop | ( |  | ) | `[pure virtual]`

Search for all occurrences

Requests the playback to be stopped.

This method is only called if the state transition to StoppedState is possible.

The backend should react as fast as possible. Go to StoppedState as soon as playback is stopped.

A subsequent call to play() will start playback at the beginning of the media.

virtual void seek | ( | qint64 | milliseconds | ) | `[pure virtual]`

Search for all occurrences

Requests the playback to be seeked to the given time.

The backend does not have to finish seeking while in this function (i.e. the backend does not need to block the thread until the seek is finished; even worse it might lead to deadlocks when using a ByteStream which gets its data from the thread this function would block).

As soon as the seek is done the currentTime() function and the tick() signal will report it.

Parameters:

  milliseconds | The time where playback should seek to in milliseconds.

virtual qint32 tickInterval | ( |  | ) | const `[pure virtual]`

Search for all occurrences

Return the time interval in milliseconds between two ticks.

Returns:
  Returns the tick interval that it was set to (might not be the same as you asked for).

virtual void setTickInterval | ( | qint32 | interval | ) | `[pure virtual]`

Search for all occurrences

Change the interval the tick signal is emitted.

If you set `interval` to 0 the signal gets disabled.

Parameters:

  interval | tick interval in milliseconds

Returns:
  Returns the tick interval that it was set to (might not be the same as you asked for).

virtual bool hasVideo | ( |  | ) | const `[pure virtual]`

Search for all occurrences

Check whether the media data includes a video stream.

Returns:
  returns `true` if the media contains video data

virtual bool isSeekable | ( |  | ) | const `[pure virtual]`

Search for all occurrences

If the current media may be seeked returns true.

Returns:
  whether the current media may be seeked.

virtual qint64 currentTime | ( |  | ) | const `[pure virtual]`

Search for all occurrences

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

virtual Phonon::State state | ( |  | ) | const `[pure virtual]`

Search for all occurrences

Get the current state.

virtual QString errorString | ( |  | ) | const `[pure virtual]`

Search for all occurrences

A translated string describing the error.

virtual Phonon::ErrorType errorType | ( |  | ) | const `[pure virtual]`

Search for all occurrences

Tells your program what to do about the error.

See also:
  Phonon::ErrorType

virtual qint64 totalTime | ( |  | ) | const `[pure virtual]`

Search for all occurrences

Returns the total time of the media in milliseconds.

If the total time is not know return -1. Do not block until it is known, instead emit the totalTimeChanged signal as soon as the total time is known or changes.

virtual MediaSource source | ( |  | ) | const `[pure virtual]`

Search for all occurrences

Returns the current source.

virtual void setSource | ( | const MediaSource & |  | ) | `[pure virtual]`

Search for all occurrences

Sets the current source.

When this function is called the MediaObject is expected to stop all current activity and start loading the new source (i.e. go into LoadingState).

It is expected that the backend now starts preloading the media data, filling the audio and video buffers and making all media meta data available. It will also trigger the totalTimeChanged signal.

If the backend does not know how to handle the source it needs to change state to Phonon::ErrorState. Don't bother about handling KIO URLs. It is enough to handle AbstractMediaStream sources correctly.

Warning:
  Keep the MediaSource object around as long as the backend uses the AbstractMediaStream returned by the MediaSource. In case that no other reference to the MediaSource exists and it is set to MediaSource::autoDelete, the AbstractMediaStream is deleted when the last MediaSource ref is deleted.

virtual void setNextSource | ( | const MediaSource & | source | ) | `[pure virtual]`

Search for all occurrences

Sets the next source to be used for transitions.

When a next source is set playback should continue with the new source. In that case finished and prefinishMarkReached are not emitted.

Parameters:

  source | The source to transition to (crossfade/gapless/gap). If `source` is an invalid MediaSource object then the queue is empty and the playback should stop normally.

Warning:
  Keep the MediaSource object around as long as the backend uses the AbstractMediaStream returned by the MediaSource. In case that no other reference to the MediaSource exists and it is set to MediaSource::autoDelete, the AbstractMediaStream is deleted when the last MediaSource ref is deleted.

virtual qint64 remainingTime | ( |  | ) | const `[inline, virtual]`

Search for all occurrences

Definition at line 228 of file mediaobjectinterface.h.

virtual qint32 prefinishMark | ( |  | ) | const `[pure virtual]`

Search for all occurrences

virtual void setPrefinishMark | ( | qint32 |  | ) | `[pure virtual]`

Search for all occurrences

virtual qint32 transitionTime | ( |  | ) | const `[pure virtual]`

Search for all occurrences

virtual void setTransitionTime | ( | qint32 |  | ) | `[pure virtual]`

Search for all occurrences

The documentation for this class was generated from the following file:

- phonon/mediaobjectinterface.h

MediaObjectInterface MediaObjectInterface MediaObjectInterface MediaObjectInterface MediaObjectInterface MediaObjectInterface MediaObjectInterface MediaObjectInterface MediaObjectInterface MediaObjectInterface
MediaObjectInterface MediaObjectInterface MediaObjectInterface MediaObjectInterface MediaObjectInterface MediaObjectInterface MediaObjectInterface MediaObjectInterface MediaObjectInterface MediaObjectInterface