QMediaCaptureSession Class

The QMediaCaptureSession class allows capturing of audio and video content. 更多...

頭: #include <QMediaCaptureSession>
CMake: find_package(Qt6 REQUIRED COMPONENTS Multimedia)
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 ()
QScreenCapture * screenCapture ()
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 setVideoOutput (QObject * output )
void setVideoSink (QVideoSink * sink )
QObject * videoOutput () const
QVideoSink * videoSink () const

信號

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

詳細描述

The QMediaCaptureSession is the central class that manages capturing of media on the local device.

You can connect a camera and a microphone to QMediaCaptureSession using setCamera () 和 setAudioInput (). A preview of the captured media can be seen by setting a QVideoSink of QVideoWidget 使用 setVideoOutput () and heard by routing the audio to an output device using setAudioOutput ().

You can capture still images from a camera by setting a QImageCapture object on the capture session, and record audio/video using a QMediaRecorder .

另請參閱 QCamera , QAudioDevice , QMediaRecorder , QImageCapture ,和 QMediaRecorder .

特性文檔編製

audioInput : QAudioInput *

Returns the device that is being used to capture audio.

訪問函數:

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

通知程序信號:

void audioInputChanged ()

audioOutput : QAudioOutput *

Returns the audio output for the session.

訪問函數:

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 *

This property holds the object used to capture still images.

添加 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 *

This property holds the recorder object used to capture audio/video.

添加 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 window or screen view.

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

This property was introduced in Qt 6.5.

訪問函數:

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

通知程序信號:

void screenCaptureChanged ()

videoOutput : QObject *

Returns the video output for the session.

訪問函數:

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

通知程序信號:

void videoOutputChanged ()

成員函數文檔編製

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

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

[虛擬] QMediaCaptureSession:: ~QMediaCaptureSession ()

Destroys the session.

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.

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

The previously set preview is detached.

注意: 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 .

The previously set preview is detached.

另請參閱 videoSink ().

QVideoSink *QMediaCaptureSession:: videoSink () const

返迴 QVideoSink for the session.

另請參閱 setVideoSink ().