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
6#include <mediacapture/qwindowscamera_p.h>
7#include <mediacapture/qwindowsimagecapture_p.h>
8#include <mediacapture/qwindowsmediadevicesession_p.h>
9#include <mediacapture/qwindowsmediaencoder_p.h>
10
11#include <QtMultimedia/qaudiodevice.h>
12#include <QtMultimedia/qmediadevices.h>
13
14#include <QtMultimedia/private/qplatformaudioinput_p.h>
15#include <QtMultimedia/private/qplatformaudiooutput_p.h>
16
18
19QWindowsMediaCaptureService::QWindowsMediaCaptureService()
20{
21 m_mediaDeviceSession = new QWindowsMediaDeviceSession(this);
22}
23
25{
26 delete m_mediaDeviceSession;
27}
28
30{
31 return m_camera;
32}
33
34void QWindowsMediaCaptureService::setCamera(QPlatformCamera *camera)
35{
36 QWindowsCamera *control = static_cast<QWindowsCamera*>(camera);
37 if (m_camera == control)
38 return;
39
40 if (m_camera)
41 m_camera->setCaptureSession(nullptr);
42
43 m_camera = control;
44 if (m_camera)
45 m_camera->setCaptureSession(this);
46 emit cameraChanged();
47}
48
53
54void QWindowsMediaCaptureService::setImageCapture(QPlatformImageCapture *imageCapture)
55{
56 QWindowsImageCapture *control = static_cast<QWindowsImageCapture *>(imageCapture);
57 if (m_imageCapture == control)
58 return;
59
60 if (m_imageCapture)
61 m_imageCapture->setCaptureSession(nullptr);
62
63 m_imageCapture = control;
64 if (m_imageCapture)
65 m_imageCapture->setCaptureSession(this);
66 emit imageCaptureChanged();
67}
68
73
74void QWindowsMediaCaptureService::setMediaRecorder(QPlatformMediaRecorder *recorder)
75{
76 QWindowsMediaEncoder *control = static_cast<QWindowsMediaEncoder *>(recorder);
77 if (m_encoder == control)
78 return;
79
80 if (m_encoder)
81 m_encoder->setCaptureSession(nullptr);
82
83 m_encoder = control;
84 if (m_encoder)
85 m_encoder->setCaptureSession(this);
86 emit encoderChanged();
87}
88
89void QWindowsMediaCaptureService::setAudioInput(QPlatformAudioInput *input)
90{
91 m_mediaDeviceSession->setAudioInput(input ? input->q : nullptr);
92}
93
94void QWindowsMediaCaptureService::setAudioOutput(QPlatformAudioOutput *output)
95{
96 m_mediaDeviceSession->setAudioOutput(output ? output->q : nullptr);
97}
98
99void QWindowsMediaCaptureService::setVideoPreview(QVideoSink *sink)
100{
101 m_mediaDeviceSession->setVideoSink(sink);
102}
103
105{
106 return m_mediaDeviceSession;
107}
108
109QT_END_NAMESPACE
110
111#include "moc_qwindowsmediacapture_p.cpp"
QPlatformImageCapture * imageCapture() override
void setCamera(QPlatformCamera *camera) override
void setAudioInput(QPlatformAudioInput *) 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)
Combined button and popup list for selecting options.