blob: d349b2c430dfefeb3b9d43c80b4bb01431cffaaf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwindowsmediacapture_p.h"
#include "qwindowsmediaencoder_p.h"
#include "qwindowscamera_p.h"
#include "qwindowsmediadevicesession_p.h"
#include "qwindowsimagecapture_p.h"
#include "qmediadevices.h"
#include "qaudiodevice.h"
#include "private/qplatformaudioinput_p.h"
#include "private/qplatformaudiooutput_p.h"
QT_BEGIN_NAMESPACE
QWindowsMediaCaptureService::QWindowsMediaCaptureService()
{
m_mediaDeviceSession = new QWindowsMediaDeviceSession(this);
}
QWindowsMediaCaptureService::~QWindowsMediaCaptureService()
{
delete m_mediaDeviceSession;
}
QPlatformCamera *QWindowsMediaCaptureService::camera()
{
return m_camera;
}
void QWindowsMediaCaptureService::setCamera(QPlatformCamera *camera)
{
QWindowsCamera *control = static_cast<QWindowsCamera*>(camera);
if (m_camera == control)
return;
if (m_camera)
m_camera->setCaptureSession(nullptr);
m_camera = control;
if (m_camera)
m_camera->setCaptureSession(this);
emit cameraChanged();
}
QPlatformImageCapture *QWindowsMediaCaptureService::imageCapture()
{
return m_imageCapture;
}
void QWindowsMediaCaptureService::setImageCapture(QPlatformImageCapture *imageCapture)
{
QWindowsImageCapture *control = static_cast<QWindowsImageCapture *>(imageCapture);
if (m_imageCapture == control)
return;
if (m_imageCapture)
m_imageCapture->setCaptureSession(nullptr);
m_imageCapture = control;
if (m_imageCapture)
m_imageCapture->setCaptureSession(this);
emit imageCaptureChanged();
}
QPlatformMediaRecorder *QWindowsMediaCaptureService::mediaRecorder()
{
return m_encoder;
}
void QWindowsMediaCaptureService::setMediaRecorder(QPlatformMediaRecorder *recorder)
{
QWindowsMediaEncoder *control = static_cast<QWindowsMediaEncoder *>(recorder);
if (m_encoder == control)
return;
if (m_encoder)
m_encoder->setCaptureSession(nullptr);
m_encoder = control;
if (m_encoder)
m_encoder->setCaptureSession(this);
emit encoderChanged();
}
void QWindowsMediaCaptureService::setAudioInput(QPlatformAudioInput *input)
{
m_mediaDeviceSession->setAudioInput(input ? input->q : nullptr);
}
void QWindowsMediaCaptureService::setAudioOutput(QPlatformAudioOutput *output)
{
m_mediaDeviceSession->setAudioOutput(output ? output->q : nullptr);
}
void QWindowsMediaCaptureService::setVideoPreview(QVideoSink *sink)
{
m_mediaDeviceSession->setVideoSink(sink);
}
QWindowsMediaDeviceSession *QWindowsMediaCaptureService::session() const
{
return m_mediaDeviceSession;
}
QT_END_NAMESPACE
#include "moc_qwindowsmediacapture_p.cpp"
|