QMediaCaptureSession 類

QMediaCaptureSession 類允許捕獲音頻/視頻內容。 更多...

頭: #include <QMediaCaptureSession>
CMake: find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
qmake: QT += multimedia
在 QML: CaptureSession
繼承: QObject

特性

公共函數

QMediaCaptureSession (QObject * parent = nullptr)
virtual ~QMediaCaptureSession () override
QAudioBufferInput * audioBufferInput () const
QAudioInput * audioInput () const
QAudioOutput * audioOutput () const
QCamera * camera () const
QImageCapture * imageCapture ()
QMediaRecorder * recorder ()
QScreenCapture * screenCapture ()
void setAudioBufferInput (QAudioBufferInput * input )
void setAudioInput (QAudioInput * input )
void setAudioOutput (QAudioOutput * output )
void setCamera (QCamera * camera )
void setImageCapture (QImageCapture * imageCapture )
void setRecorder (QMediaRecorder * recorder )
void setScreenCapture (QScreenCapture * screenCapture )
void setVideoFrameInput (QVideoFrameInput * input )
void setVideoOutput (QObject * output )
void setVideoSink (QVideoSink * sink )
void setWindowCapture (QWindowCapture * windowCapture )
QVideoFrameInput * videoFrameInput () const
QObject * videoOutput () const
QVideoSink * videoSink () const
QWindowCapture * windowCapture ()

信號

void audioBufferInputChanged ()
void audioInputChanged ()
void audioOutputChanged ()
void cameraChanged ()
void imageCaptureChanged ()
void recorderChanged ()
void screenCaptureChanged ()
void videoFrameInputChanged ()
void videoOutputChanged ()
void windowCaptureChanged ()

詳細描述

QMediaCaptureSession 是管理本地設備媒體捕獲的中心類。

可以連接視頻輸入到 QMediaCaptureSession 使用 setCamera (), setScreenCapture (), setWindowCapture () 或 setVideoFrameInput ()。可以看到捕獲媒體的預覽通過設置 QVideoWidget or QGraphicsVideoItem 使用 setVideoOutput ().

You can connect a microphone to QMediaCaptureSession using setAudioInput (), or set your custom audio input using setAudioBufferInput (). The captured sound can be heard by routing the audio to an output device using setAudioOutput ().

可以從攝像頭捕獲靜止圖像通過設置 QImageCapture 對象在捕獲會話,和錄製音頻/視頻使用 QMediaRecorder .

另請參閱 QCamera , QAudioDevice , QMediaRecorder , QImageCapture , QScreenCapture , QWindowCapture , QVideoFrameInput , QMediaRecorder ,和 QGraphicsVideoItem .

特性文檔編製

[since 6.8] audioBufferInput : QAudioBufferInput *

This property holds the object used to send custom audio buffers to QMediaRecorder .

該特性在 Qt 6.8 引入。

訪問函數:

QAudioBufferInput * audioBufferInput () const
void setAudioBufferInput (QAudioBufferInput * input )

通知程序信號:

void audioBufferInputChanged ()

audioInput : QAudioInput *

Returns the device that is being used to capture audio.

訪問函數:

QAudioInput * audioInput () const
void setAudioInput (QAudioInput * input )

通知程序信號:

void audioInputChanged ()

audioOutput : QAudioOutput *

返迴用於會話的音頻輸齣。

訪問函數:

QAudioOutput * audioOutput () const
void setAudioOutput (QAudioOutput * output )

通知程序信號:

void audioOutputChanged ()

camera : QCamera *

This property holds the camera used to capture video.

Record video or take images by adding a camera to the capture session using this property.

訪問函數:

QCamera * camera () const
void setCamera (QCamera * camera )

通知程序信號:

void cameraChanged ()

imageCapture : QImageCapture *

此特性保持用於捕獲靜止圖像的對象。

添加 QImageCapture object to the capture session to enable capturing of still images from the camera.

訪問函數:

QImageCapture * imageCapture ()
void setImageCapture (QImageCapture * imageCapture )

通知程序信號:

void imageCaptureChanged ()

recorder : QMediaRecorder *

此特性保持用於捕獲音頻/視頻的錄製器對象。

添加 QMediaRecorder object to the capture session to enable recording of audio and/or video from the capture session.

訪問函數:

QMediaRecorder * recorder ()
void setRecorder (QMediaRecorder * recorder )

通知程序信號:

void recorderChanged ()

[since 6.5] screenCapture : QScreenCapture *

This property holds the object used to capture a screen.

Record a screen by adding a screen capture object to the capture session using this property.

該特性在 Qt 6.5 引入。

訪問函數:

QScreenCapture * screenCapture ()
void setScreenCapture (QScreenCapture * screenCapture )

通知程序信號:

void screenCaptureChanged ()

[since 6.8] videoFrameInput : QVideoFrameInput *

This property holds the object used to send custom video frames to QMediaRecorder or a video output.

該特性在 Qt 6.8 引入。

訪問函數:

QVideoFrameInput * videoFrameInput () const
void setVideoFrameInput (QVideoFrameInput * input )

通知程序信號:

void videoFrameInputChanged ()

videoOutput : QObject *

返迴用於會話的視頻輸齣。

訪問函數:

QObject * videoOutput () const
void setVideoOutput (QObject * output )

通知程序信號:

void videoOutputChanged ()

[since 6.6] windowCapture : QWindowCapture *

This property holds the object used to capture a window.

Record a window by adding a window capture objet to the capture session using this property.

該特性在 Qt 6.6 引入。

訪問函數:

QWindowCapture * windowCapture ()
void setWindowCapture (QWindowCapture * windowCapture )

通知程序信號:

void windowCaptureChanged ()

成員函數文檔編製

[explicit] QMediaCaptureSession:: QMediaCaptureSession ( QObject * parent = nullptr)

Creates a session for media capture from the parent 對象。

[override virtual noexcept] QMediaCaptureSession:: ~QMediaCaptureSession ()

銷毀會話。

void QMediaCaptureSession:: setAudioInput ( QAudioInput * input )

Sets the audio input device to input . If setting it to an empty QAudioDevice the capture session will use the default input as defined by the operating system.

注意: setter 函數對於特性 audioInput .

另請參閱 audioInput ().

void QMediaCaptureSession:: setAudioOutput ( QAudioOutput * output )

Sets the audio output device to output .

Setting an audio output device enables audio routing from an audio input device.

注意: setter 函數對於特性 audioOutput .

另請參閱 audioOutput ().

void QMediaCaptureSession:: setVideoOutput ( QObject * output )

設置 QObject , ( output ), to a video preview for the capture session.

A QObject based preview is expected to have an invokable videoSink () method that returns a QVideoSink .

先前設置的預覽被分離。

注意: setter 函數對於特性 videoOutput .

另請參閱 videoOutput ().

void QMediaCaptureSession:: setVideoSink ( QVideoSink * sink )

設置 QVideoSink , ( sink ), to a video preview for the capture session.

A QObject based preview is expected to have an invokable videoSink () method that returns a QVideoSink .

先前設置的預覽被分離。

另請參閱 videoSink ().

QVideoSink *QMediaCaptureSession:: videoSink () const

返迴 QVideoSink 對於會話。

另請參閱 setVideoSink ().