QPlatformAudioDecoder Class

The QPlatformAudioDecoder class provides access to audio decoding functionality. More...

Header: #include <QPlatformAudioDecoder>
CMake: find_package(Qt6 COMPONENTS Multimedia REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
qmake: QT += multimedia
Inherits: QObject

This class is under development and is subject to change.

Public Functions

void bufferAvailableChanged(bool available)
void bufferReady()
virtual qint64 duration() const = 0
void durationChanged(qint64 duration)
void error(int error, const QString &errorString)
void finished()
void formatChanged(const QAudioFormat &format)
virtual qint64 position() const = 0
void positionChanged(qint64 position)
virtual QAudioBuffer read() = 0
virtual void setSource(const QUrl &fileName) = 0
virtual void setSourceDevice(QIODevice *device) = 0
virtual QUrl source() const = 0
void sourceChanged()
virtual QIODevice *sourceDevice() const = 0
virtual void start() = 0
virtual void stop() = 0

Protected Functions

QPlatformAudioDecoder(QAudioDecoder *parent)

Detailed Description

Member Function Documentation

[protected] QPlatformAudioDecoder::QPlatformAudioDecoder(QAudioDecoder *parent)

Constructs a new audio decoder control with the given parent.

void QPlatformAudioDecoder::bufferAvailableChanged(bool available)

Signals that the bufferAvailable property has changed to available.

void QPlatformAudioDecoder::bufferReady()

Signals that a new buffer is ready for reading.

[pure virtual] qint64 QPlatformAudioDecoder::duration() const

Returns total duration (in milliseconds) of the audio stream or -1 if not available.

void QPlatformAudioDecoder::durationChanged(qint64 duration)

Signals that the estimated duration of the decoded data has changed.

See also positionChanged().

void QPlatformAudioDecoder::error(int error, const QString &errorString)

Signals that an error has occurred. The errorString provides a more detailed explanation.

void QPlatformAudioDecoder::finished()

Signals that the decoding has finished successfully. If decoding fails, error signal is emitted instead.

See also start(), stop(), and error().

void QPlatformAudioDecoder::formatChanged(const QAudioFormat &format)

Signals that the current audio format of the decoder has changed to format.

[pure virtual] qint64 QPlatformAudioDecoder::position() const

Returns position (in milliseconds) of the last buffer read from the decoder or -1 if no buffers have been read.

void QPlatformAudioDecoder::positionChanged(qint64 position)

Signals that the current position of the decoder has changed.

See also durationChanged().

[pure virtual] QAudioBuffer QPlatformAudioDecoder::read()

Attempts to read a buffer from the decoder, without blocking. Returns invalid buffer if there are no decoded buffers available, or on error.

[pure virtual] void QPlatformAudioDecoder::setSource(const QUrl &fileName)

Sets the current source to fileName. Changing the source will stop any current decoding and discard any buffers.

Sources are exclusive, so only one can be set.

See also source().

[pure virtual] void QPlatformAudioDecoder::setSourceDevice(QIODevice *device)

Sets the current source to device. Changing the source will stop any current decoding and discard any buffers.

Sources are exclusive, so only one can be set.

See also sourceDevice().

[pure virtual] QUrl QPlatformAudioDecoder::source() const

Returns the current media source filename, or a null QString if none (or a device)

See also setSource().

void QPlatformAudioDecoder::sourceChanged()

Signals that the current source of the decoder has changed.

See also source() and sourceDevice().

[pure virtual] QIODevice *QPlatformAudioDecoder::sourceDevice() const

Returns the current media source QIODevice, or 0 if none (or a file).

See also setSourceDevice().

[pure virtual] void QPlatformAudioDecoder::start()

Starts decoding the current media.

See also read().

[pure virtual] void QPlatformAudioDecoder::stop()

Stops playback of the current media and discards any buffers.

If successful, the player control will immediately stop decoding.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.