QAudioBufferInput Class
The QAudioBufferInput class is used for providing custom audio buffers to QMediaRecorder through QMediaCaptureSession. More...
Header: | #include <QAudioBufferInput> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Multimedia) target_link_libraries(mytarget PRIVATE Qt6::Multimedia) |
qmake: | QT += multimedia |
Since: | Qt 6.8 |
Inherits: | QObject |
Public Functions
QAudioBufferInput(QObject *parent = nullptr) | |
virtual | ~QAudioBufferInput() override |
QMediaCaptureSession * | captureSession() const |
bool | sendAudioBuffer(const QAudioBuffer &audioBuffer) |
Signals
void | readyToSendAudioBuffer() |
Detailed Description
See also QMediaRecorder and QMediaCaptureSession.
Member Function Documentation
[explicit]
QAudioBufferInput::QAudioBufferInput(QObject *parent = nullptr)
Constructs a new QAudioBufferInput object with parent.
[override virtual noexcept]
QAudioBufferInput::~QAudioBufferInput()
Destroys the object.
QMediaCaptureSession *QAudioBufferInput::captureSession() const
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 QMediaCaptureSession::setAudioBufferInput() to connect the audio buffer input to a session.
[signal]
void QAudioBufferInput::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
.
See also sendAudioBuffer().
bool QAudioBufferInput::sendAudioBuffer(const QAudioBuffer &audioBuffer)
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 QMediaRecorder::autoStop is true
and all the inputs have reported the end of the stream.