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

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes | Friends

# StreamInterface Class Reference

Search for all occurrences

## Detailed Description

Backend interface to handle media streams (AbstractMediaStream).

Author:
  Matthias Kretz <kretz@kde.org>

Definition at line 44 of file streaminterface.h.

`#include <Phonon/StreamInterface>`

List of all members.

## Public Member Functions
virtual | ~StreamInterface ()
virtual void | writeData (const QByteArray &data)=0
| Called by the application to send a chunk of (encoded) media data.
virtual void | endOfData ()=0
| Called when no more media data is available and writeData will not be called anymore.
virtual void | setStreamSize (qint64 newSize)=0
| Called at the start of the stream to tell how many bytes will be sent through writeData (if no seeks happen, of course).
virtual void | setStreamSeekable (bool s)=0
| Tells whether the stream is seekable.
void | connectToSource (const MediaSource &mediaSource)
| Call this function from the constructor of your StreamInterface implementation (or as soon as you get the MediaSource object).
void | needData ()
| Call this function to tell the AbstractMediaStream that you need more data.
void | enoughData ()
| Call this function to tell the AbstractMediaStream that you have enough data in your buffer and that it should pause calling writeData if possible.
void | seekStream (qint64 seekTo)
| If the stream is seekable, calling this function will make the next call to writeData pass data that starts at the byte offset `seekTo`.
void | reset ()
| Resets the AbstractMediaStream.
## Protected Member Functions
| StreamInterface ()
## Protected Attributes
StreamInterfacePrivate *const | d
## Friends
class | StreamInterfacePrivate
class | AbstractMediaStreamPrivate

## Constructor & Destructor Documentation

virtual ~StreamInterface | ( |  | ) | `[virtual]`

StreamInterface | ( |  | ) | `[protected]`

## Member Function Documentation

virtual void writeData | ( | const QByteArray & | data | ) | `[pure virtual]`

Search for all occurrences

Called by the application to send a chunk of (encoded) media data.

It is recommended to keep the QByteArray object until the data is consumed so that no memcopy is needed.

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

Search for all occurrences

Called when no more media data is available and writeData will not be called anymore.

virtual void setStreamSize | ( | qint64 | newSize | ) | `[pure virtual]`

Search for all occurrences

Called at the start of the stream to tell how many bytes will be sent through writeData (if no seeks happen, of course).

If this value is negative the stream size cannot be determined (might be a "theoretically infinite" stream - like webradio).

virtual void setStreamSeekable | ( | bool | s | ) | `[pure virtual]`

Search for all occurrences

Tells whether the stream is seekable.

void connectToSource | ( | const MediaSource & | mediaSource | ) |

Search for all occurrences

Call this function from the constructor of your StreamInterface implementation (or as soon as you get the MediaSource object).

This will connect your object to the AbstractMediaStream object. Only after the connection is done will the following functions have an effect.

void needData | ( |  | ) |

Search for all occurrences

Call this function to tell the AbstractMediaStream that you need more data.

The data will arrive through writeData. Don't rely on writeData getting called from needData, though some AbstractMediaStream implementations might do so.

Depending on the buffering you need you either treat needData as a replacement for a read call like QIODevice::read, or you start calling needData whenever your buffer reaches a certain lower threshold.

void enoughData | ( |  | ) |

Search for all occurrences

Call this function to tell the AbstractMediaStream that you have enough data in your buffer and that it should pause calling writeData if possible.

void seekStream | ( | qint64 | seekTo | ) |

Search for all occurrences

If the stream is seekable, calling this function will make the next call to writeData pass data that starts at the byte offset `seekTo`.

void reset | ( |  | ) |

Search for all occurrences

Resets the AbstractMediaStream.

E.g. this can be useful for non-seekable streams to start over again.

## Friends And Related Function Documentation

friend class StreamInterfacePrivate `[friend]`

Search for all occurrences

Definition at line 46 of file streaminterface.h.

friend class AbstractMediaStreamPrivate `[friend]`

Search for all occurrences

Definition at line 47 of file streaminterface.h.

## Member Data Documentation

StreamInterfacePrivate* const d `[protected]`

Search for all occurrences

Definition at line 112 of file streaminterface.h.

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

- phonon/streaminterface.h

StreamInterface StreamInterface StreamInterface StreamInterface StreamInterface StreamInterface StreamInterface StreamInterface StreamInterface StreamInterface
StreamInterface StreamInterface StreamInterface StreamInterface StreamInterface StreamInterface StreamInterface StreamInterface StreamInterface StreamInterface