QAudioDecoder Class
The QAudioDecoder class allows decoding audio. More...
| Header: | #include <QAudioDecoder> |
| qmake: | QT += multimedia |
| Inherits: | QMediaObject |
This class is under development and is subject to change.
Public Types
| enum | Error { NoError, ResourceError, FormatError, AccessDeniedError, ServiceMissingError } |
| enum | State { StoppedState, DecodingState } |
Properties
- bufferAvailable : const bool
- error : const QString
- sourceFilename : QString
- state : const State
Public Functions
| bool | bufferAvailable() const |
| QString | errorString() const |
| void | setSourceFilename(const QString &fileName) |
| QString | sourceFilename() const |
| QAudioDecoder::State | state() const |
Signals
| void | bufferAvailableChanged(bool) |
| void | sourceChanged() |
| void | stateChanged(QAudioDecoder::State newState) |
Detailed Description
The QAudioDecoder class is a high level class for decoding local audio media files. It is similar to the QMediaPlayer class except that audio is provided back through this API rather than routed directly to audio hardware, and playlists and network and streaming based media is not supported.
See also QAudioBuffer.
Member Type Documentation
enum QAudioDecoder::Error
Defines a media player error condition.
| Constant | Value | Description |
|---|---|---|
QAudioDecoder::NoError | 0 | No error has occurred. |
QAudioDecoder::ResourceError | 1 | A media resource couldn't be resolved. |
QAudioDecoder::FormatError | 2 | The format of a media resource isn't supported. |
QAudioDecoder::AccessDeniedError | 3 | There are not the appropriate permissions to play a media resource. |
QAudioDecoder::ServiceMissingError | 4 | A valid playback service was not found, playback cannot proceed. |
enum QAudioDecoder::State
Defines the current state of a media player.
| Constant | Value | Description |
|---|---|---|
QAudioDecoder::StoppedState | 0 | The decoder is not decoding. Decoding will start at the start of the media. |
QAudioDecoder::DecodingState | 1 | The audio player is currently decoding media. |
Property Documentation
bufferAvailable : const bool
This property holds whether there is a decoded audio buffer available
Access functions:
| bool | bufferAvailable() const |
Notifier signal:
| void | bufferAvailableChanged(bool) |
error : const QString
This property holds a string describing the last error condition.
Access functions:
| QString | errorString() const |
See also error().
sourceFilename : QString
This property holds the active filename being decoded by the decoder object.
Access functions:
| QString | sourceFilename() const |
| void | setSourceFilename(const QString &fileName) |
Notifier signal:
| void | sourceChanged() |
state : const State
This property holds the audio decoder's playback state.
By default this property is QAudioDecoder::Stopped
Access functions:
| QAudioDecoder::State | state() const |
Notifier signal:
| void | stateChanged(QAudioDecoder::State newState) |
See also start() and stop().