QPlatformAudioDecoder Class

The QPlatformAudioDecoder class provides access to audio decoding functionality. 更多...

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

该类在开发且可能改变。

公共函数

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

保护函数

  QPlatformAudioDecoder (QAudioDecoder * parent )

详细描述

成员函数文档编制

[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.

另请参阅 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.

另请参阅 start (), stop (),和 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.

另请参阅 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.

另请参阅 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.

另请参阅 sourceDevice ().

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

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

另请参阅 setSource ().

void QPlatformAudioDecoder:: sourceChanged ()

Signals that the current source of the decoder has changed.

另请参阅 source () 和 sourceDevice ().

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

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

另请参阅 setSourceDevice ().

[pure virtual] void QPlatformAudioDecoder:: start ()

Starts decoding the current media.

另请参阅 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.