QMediaCaptureSession 类

QMediaCaptureSession 类允许捕获音频/视频内容。 更多...

头: #include <QMediaCaptureSession>
CMake: find_package(Qt6 COMPONENTS Multimedia REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
qmake: QT += multimedia
实例化: CaptureSession
继承: QObject

特性

公共函数

  QMediaCaptureSession (QObject * parent = nullptr)
virtual ~QMediaCaptureSession ()
QAudioInput * audioInput () const
QAudioOutput * audioOutput () const
QCamera * camera () const
QImageCapture * imageCapture ()
QMediaRecorder * recorder ()
void setAudioInput (QAudioInput * input )
void setAudioOutput (QAudioOutput * output )
void setCamera (QCamera * camera )
void setImageCapture (QImageCapture * imageCapture )
void setRecorder (QMediaRecorder * recorder )
void setVideoOutput (QObject * output )
void setVideoSink (QVideoSink * sink )
QObject * videoOutput () const

信号

void audioInputChanged ()
void audioOutputChanged ()
void cameraChanged ()
void imageCaptureChanged ()
void recorderChanged ()
void videoOutputChanged ()

详细描述

QMediaCaptureSession 是管理本地设备媒体捕获的中心类。

可以将摄像头和麦克风连接到 QMediaCaptureSession 使用 setCamera () 和 setAudioInput ()。可以看到捕获媒体的预览通过设置 QVideoSink of QVideoWidget 使用 setVideoOutput () 和通过将音频路由到输出设备以收听使用 setAudioOutput ().

可以从摄像头捕获静止图像通过设置 QImageCapture 对象在捕获会话,和录制音频/视频使用 QMediaRecorder .

另请参阅 QCamera , QAudioDevice , QMediaRecorder , QImageCapture ,和 QMediaRecorder .

特性文档编制

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 ()

成员函数文档编制

QMediaCaptureSession:: QMediaCaptureSession ( QObject * parent = nullptr)

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

[虚拟] QMediaCaptureSession:: ~QMediaCaptureSession ()

Destroys the session.

QAudioInput *QMediaCaptureSession:: audioInput () const

Returns the device that is being used to capture audio.

注意: Getter function for property audioInput.

另请参阅 setAudioInput ().

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 .

注意: setter 函数对于特性 audioOutput .

另请参阅 audioOutput ().

void QMediaCaptureSession:: setVideoOutput ( QObject * output )

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

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.

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

先前设置的预览被分离。