内容表

上一话题

QAudioBuffer

下一话题

QAudioDecoderControl

QAudioDecoder

QAudioDecoder class allows decoding audio. 更多

Inheritance diagram of PySide2.QtMultimedia.QAudioDecoder

概要

信号

静态函数

详细描述

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.

另请参阅

QAudioBuffer

class QAudioDecoder ( [ parent=None ] )
param parent

QObject

Construct an QAudioDecoder instance parented to parent .

PySide2.QtMultimedia.QAudioDecoder. State

定义媒体播放器的当前状态。

常量

描述

QAudioDecoder.StoppedState

The decoder is not decoding. Decoding will start at the start of the media.

QAudioDecoder.DecodingState

The audio player is currently decoding media.

PySide2.QtMultimedia.QAudioDecoder. Error

定义媒体播放器错误条件。

常量

描述

QAudioDecoder.NoError

没有发生错误。

QAudioDecoder.ResourceError

A media resource couldn’t be resolved.

QAudioDecoder.FormatError

The format of a media resource isn’t supported.

QAudioDecoder.AccessDeniedError

没有适当权限来播放媒体资源。

QAudioDecoder.ServiceMissingError

找不到有效回放服务,无法继续进行播放。开头

PySide2.QtMultimedia.QAudioDecoder. audioFormat ( )
返回类型

QAudioFormat

Returns the current audio format of the decoded stream.

Any buffers returned should have this format.

PySide2.QtMultimedia.QAudioDecoder. bufferAvailable ( )
返回类型

bool

Returns true if a buffer is available to be read, and false otherwise. If there is no buffer available, calling the read() function will return an invalid buffer.

PySide2.QtMultimedia.QAudioDecoder. bufferAvailableChanged ( arg__1 )
参数

arg__1 bool

PySide2.QtMultimedia.QAudioDecoder. bufferReady ( )
PySide2.QtMultimedia.QAudioDecoder. duration ( )
返回类型

qint64

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

PySide2.QtMultimedia.QAudioDecoder. durationChanged ( duration )
参数

duration qint64

PySide2.QtMultimedia.QAudioDecoder. error ( )
返回类型

Error

返回当前错误状态。

PySide2.QtMultimedia.QAudioDecoder. error ( error )
参数

error Error

PySide2.QtMultimedia.QAudioDecoder. errorString ( )
返回类型

unicode

PySide2.QtMultimedia.QAudioDecoder. finished ( )
PySide2.QtMultimedia.QAudioDecoder. formatChanged ( format )
参数

format QAudioFormat

static PySide2.QtMultimedia.QAudioDecoder. hasSupport ( mimeType [ , codecs=list() ] )
参数
  • mimeType – unicode

  • codecs – 字符串列表

返回类型

SupportEstimate

Returns the level of support an audio decoder has for a mimeType and a set of codecs .

PySide2.QtMultimedia.QAudioDecoder. position ( )
返回类型

qint64

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

PySide2.QtMultimedia.QAudioDecoder. positionChanged ( position )
参数

position qint64

PySide2.QtMultimedia.QAudioDecoder. read ( )
返回类型

QAudioBuffer

Read a buffer from the decoder, if one is available. Returns an invalid buffer if there are no decoded buffers currently available, or on failure. In both cases this function will not block.

You should either respond to the bufferReady() signal or check the bufferAvailable() function before calling to make sure you get useful data.

PySide2.QtMultimedia.QAudioDecoder. setAudioFormat ( format )
参数

format QAudioFormat

Set the desired audio format for decoded samples to format .

This property can only be set while the decoder is stopped. Setting this property at other times will be ignored.

If the decoder does not support this format, error() will be set to 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()

PySide2.QtMultimedia.QAudioDecoder. setSourceDevice ( device )
参数

device QIODevice

Sets the current audio QIODevice to device .

When this property is set any current decoding is stopped, and any audio buffers are discarded.

You can only specify either a source filename or a source QIODevice . Setting one will unset the other.

另请参阅

sourceDevice()

PySide2.QtMultimedia.QAudioDecoder. setSourceFilename ( fileName )
参数

fileName – unicode

Sets the current audio file name to fileName .

When this property is set any current decoding is stopped, and any audio buffers are discarded.

You can only specify either a source filename or a source QIODevice . Setting one will unset the other.

另请参阅

sourceFilename()

PySide2.QtMultimedia.QAudioDecoder. sourceChanged ( )
PySide2.QtMultimedia.QAudioDecoder. sourceDevice ( )
返回类型

QIODevice

Returns the current source QIODevice , if one was set. If setSourceFilename() was called, this will be 0.

另请参阅

setSourceDevice()

PySide2.QtMultimedia.QAudioDecoder. sourceFilename ( )
返回类型

unicode

Returns the current file name to decode. If setSourceDevice was called, this will be empty.

PySide2.QtMultimedia.QAudioDecoder. start ( )

Starts decoding the audio resource.

As data gets decoded, the bufferReady() signal will be emitted when enough data has been decoded. Calling read() will then return an audio buffer without blocking.

If you call read() before a buffer is ready, an invalid buffer will be returned, again without blocking.

另请参阅

read()

PySide2.QtMultimedia.QAudioDecoder. state ( )
返回类型

State

PySide2.QtMultimedia.QAudioDecoder. stateChanged ( newState )
参数

newState State

PySide2.QtMultimedia.QAudioDecoder. stop ( )

Stop decoding audio. Calling start() again will resume decoding from the beginning.