Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwindowsmediacapture.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5
10#include "qmediadevices.h"
11#include "qaudiodevice.h"
12#include "private/qplatformaudioinput_p.h"
13#include "private/qplatformaudiooutput_p.h"
14
16
17QWindowsMediaCaptureService::QWindowsMediaCaptureService()
18{
19 m_mediaDeviceSession = new QWindowsMediaDeviceSession(this);
20}
21
23{
24 delete m_mediaDeviceSession;
25}
26
28{
29 return m_camera;
30}
31
32void QWindowsMediaCaptureService::setCamera(QPlatformCamera *camera)
33{
34 QWindowsCamera *control = static_cast<QWindowsCamera*>(camera);
35 if (m_camera == control)
36 return;
37
38 if (m_camera)
39 m_camera->setCaptureSession(nullptr);
40
41 m_camera = control;
42 if (m_camera)
43 m_camera->setCaptureSession(this);
44 emit cameraChanged();
45}
46
51
52void QWindowsMediaCaptureService::setImageCapture(QPlatformImageCapture *imageCapture)
53{
54 QWindowsImageCapture *control = static_cast<QWindowsImageCapture *>(imageCapture);
55 if (m_imageCapture == control)
56 return;
57
58 if (m_imageCapture)
59 m_imageCapture->setCaptureSession(nullptr);
60
61 m_imageCapture = control;
62 if (m_imageCapture)
63 m_imageCapture->setCaptureSession(this);
64 emit imageCaptureChanged();
65}
66
71
72void QWindowsMediaCaptureService::setMediaRecorder(QPlatformMediaRecorder *recorder)
73{
74 QWindowsMediaEncoder *control = static_cast<QWindowsMediaEncoder *>(recorder);
75 if (m_encoder == control)
76 return;
77
78 if (m_encoder)
79 m_encoder->setCaptureSession(nullptr);
80
81 m_encoder = control;
82 if (m_encoder)
83 m_encoder->setCaptureSession(this);
84 emit encoderChanged();
85}
86
87void QWindowsMediaCaptureService::setAudioInput(QPlatformAudioInput *input)
88{
89 m_mediaDeviceSession->setAudioInput(input ? input->q : nullptr);
90}
91
92void QWindowsMediaCaptureService::setAudioOutput(QPlatformAudioOutput *output)
93{
94 m_mediaDeviceSession->setAudioOutput(output ? output->q : nullptr);
95}
96
98{
99 m_mediaDeviceSession->setVideoSink(sink);
100}
101
103{
104 return m_mediaDeviceSession;
105}
106
107QT_END_NAMESPACE
108
109#include "moc_qwindowsmediacapture_p.cpp"
QPlatformImageCapture * imageCapture() override
void setCamera(QPlatformCamera *camera) override
void setAudioInput(QPlatformAudioInput *) override
void setVideoPreview(QVideoSink *sink) override
QPlatformCamera * camera() override
QPlatformMediaRecorder * mediaRecorder() override
void setImageCapture(QPlatformImageCapture *imageCapture) override
void setAudioOutput(QPlatformAudioOutput *output) override
void setMediaRecorder(QPlatformMediaRecorder *recorder) override
QWindowsMediaDeviceSession * session() const
void setAudioOutput(QAudioOutput *output)
void setCaptureSession(QPlatformMediaCaptureSession *session)