QAudioDecoderControl Class

The QAudioDecoderControl class provides access to the audio decoding functionality of a QMediaService. 更多...

头: #include <QAudioDecoderControl>
qmake: QT += multimedia
继承: QMediaControl

该类在开发且可能改变。

公共函数

virtual ~QAudioDecoderControl ()
virtual QAudioFormat audioFormat () const = 0
virtual bool bufferAvailable () const = 0
virtual qint64 duration () const = 0
virtual qint64 position () const = 0
virtual QAudioBuffer read () = 0
virtual void setAudioFormat (const QAudioFormat & format ) = 0
virtual void setSourceDevice (QIODevice * device ) = 0
virtual void setSourceFilename (const QString & fileName ) = 0
virtual QIODevice * sourceDevice () const = 0
virtual QString sourceFilename () const = 0
virtual void start () = 0
virtual QAudioDecoder::State state () const = 0
virtual void stop () = 0

信号

void bufferAvailableChanged (bool available )
void bufferReady ()
void durationChanged (qint64 duration )
void error (int error , const QString & errorString )
void finished ()
void formatChanged (const QAudioFormat & format )
void positionChanged (qint64 position )
void sourceChanged ()
void stateChanged (QAudioDecoder::State newState )

保护函数

QAudioDecoderControl (QObject * parent = nullptr)

QAudioDecoderControl_iid

详细描述

The functionality provided by this control is exposed to application code through the QAudioDecoder 类。

The interface name of QAudioDecoderControl is org.qt-project.qt.audiodecodercontrol/5.0 作为定义在 QAudioDecoderControl_iid .

另请参阅 QMediaService::requestControl () 和 QAudioDecoder .

成员函数文档编制

[protected] QAudioDecoderControl:: QAudioDecoderControl ( QObject * parent = nullptr)

Constructs a new audio decoder control with the given parent .

[signal] void QAudioDecoderControl:: bufferAvailableChanged ( bool available )

信号 bufferAvailable property has changed to available .

[signal] void QAudioDecoderControl:: bufferReady ()

Signals that a new buffer is ready for reading.

[signal] void QAudioDecoderControl:: durationChanged ( qint64 duration )

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

另请参阅 positionChanged ().

[signal] void QAudioDecoderControl:: error ( int error , const QString & errorString )

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

[signal] void QAudioDecoderControl:: finished ()

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

另请参阅 start (), stop (),和 error ().

[signal] void QAudioDecoderControl:: formatChanged (const QAudioFormat & format )

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

另请参阅 audioFormat () 和 setAudioFormat ().

[signal] void QAudioDecoderControl:: positionChanged ( qint64 position )

Signals that the current position of the decoder has changed.

另请参阅 durationChanged ().

[signal] void QAudioDecoderControl:: sourceChanged ()

Signals that the current source of the decoder has changed.

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

[signal] void QAudioDecoderControl:: stateChanged ( QAudioDecoder::State newState )

Signals that the state of a player control has changed to newState .

另请参阅 state ().

[虚拟] QAudioDecoderControl:: ~QAudioDecoderControl ()

Destroys an audio decoder control.

[pure virtual] QAudioFormat QAudioDecoderControl:: audioFormat () const

Returns the current audio format of the decoded stream.

Any buffers returned should have this format.

另请参阅 setAudioFormat () 和 formatChanged ().

[pure virtual] bool QAudioDecoderControl:: bufferAvailable () const

Returns true if a buffer is available to be read, and false otherwise.

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

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

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

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

[pure virtual] QAudioBuffer QAudioDecoderControl:: 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 QAudioDecoderControl:: setAudioFormat (const QAudioFormat & format )

Set the desired audio format for decoded samples to format .

If the decoder does not support this format, error () 会被设为 FormatError .

If you do not specify a format, the format of the decoded audio itself will be used. Otherwise, some format conversion will be applied.

If you wish to reset the decoded format to that of the original audio file, you can specify an invalid format .

另请参阅 audioFormat ().

[pure virtual] void QAudioDecoderControl:: 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] void QAudioDecoderControl:: setSourceFilename (const QString & 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.

另请参阅 sourceFilename ().

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

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

另请参阅 setSourceDevice ().

[pure virtual] QString QAudioDecoderControl:: sourceFilename () const

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

另请参阅 setSourceFilename ().

[pure virtual] void QAudioDecoderControl:: start ()

Starts decoding the current media.

If successful the player control will immediately enter the decoding 状态。

另请参阅 state () 和 read ().

[pure virtual] QAudioDecoder::State QAudioDecoderControl:: state () const

Returns the state of a player control.

[pure virtual] void QAudioDecoderControl:: stop ()

Stops playback of the current media and discards any buffers.

If successful the player control will immediately enter the stopped 状态。

宏文档编制

QAudioDecoderControl_iid

org.qt-project.qt.audiodecodercontrol/5.0

定义接口名为 QAudioDecoderControl 类。