class QAudioBufferInput

The QAudioBufferInput class is used for providing custom audio buffers to QMediaRecorder through QMediaCaptureSession . More

Inheritance diagram of PySide6.QtMultimedia.QAudioBufferInput

Added in version 6.8.

Synopsis

Methods

Signals

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

__init__([parent=None])
Parameters:

parentQObject

Constructs a new QAudioBufferInput object with parent.

__init__(format[, parent=None])
Parameters:

Constructs a new QAudioBufferInput object with audio format and parent.

The specified format will work as a hint for the initialization of the matching audio encoder upon invoking record() . If the format is not specified or not valid, the audio encoder will be initialized upon sending the first audio buffer.

We recommend specifying the format if you know in advance what kind of audio buffers you’re going to send.

captureSession()
Return type:

QMediaCaptureSession

Returns the capture session this audio buffer input is connected to, or a nullptr if the audio buffer input is not connected to a capture session.

Use setAudioBufferInput() to connect the audio buffer input to a session.

format()
Return type:

QAudioFormat

Returns the audio format that was specified upon construction of the audio buffer input.

readyToSendAudioBuffer()

Signals that a new audio buffer can be sent to the audio buffer input. After receiving the signal, if you have audio date to be sent, invoke sendAudioBuffer once or in a loop until it returns false.

sendAudioBuffer(audioBuffer)
Parameters:

audioBufferQAudioBuffer

Return type:

bool

Sends QAudioBuffer to QMediaRecorder through QMediaCaptureSession .

Returns true if the specified audioBuffer has been sent successfully to the destination. Returns false, if the buffer hasn’t been sent, which can happen if the instance is not assigned to QMediaCaptureSession , the session doesn’t have a media recorder, the media recorder is not started or its queue is full. The signal readyToSendAudiobuffer will be sent as soon as the destination is able to handle a new audio buffer.

Sending of an empty audio buffer is treated by QMediaRecorder as an end of the input stream. QMediaRecorder stops the recording automatically if autoStop is true and all the inputs have reported the end of the stream.