blob: 7cb8dd908659fed38532d605a0b645c40af62bff (
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
|
// 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 "qwindowsintegration_p.h"
#include <private/qwindowsmediadevices_p.h>
#include <qwindowsformatinfo_p.h>
#include <qwindowsmediacapture_p.h>
#include <qwindowsimagecapture_p.h>
#include <qwindowscamera_p.h>
#include <qwindowsmediaencoder_p.h>
#include <mfplayercontrol_p.h>
#include <mfaudiodecodercontrol_p.h>
#include <mfevrvideowindowcontrol_p.h>
#include <private/qplatformmediaplugin_p.h>
QT_BEGIN_NAMESPACE
class QWindowsMediaPlugin : public QPlatformMediaPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QPlatformMediaPlugin_iid FILE "windows.json")
public:
QWindowsMediaPlugin()
: QPlatformMediaPlugin()
{}
QPlatformMediaIntegration* create(const QString &name) override
{
if (name == QLatin1String("windows"))
return new QWindowsMediaIntegration;
return nullptr;
}
};
QWindowsMediaIntegration::QWindowsMediaIntegration()
{
CoInitialize(NULL);
MFStartup(MF_VERSION);
m_videoDevices = new QWindowsVideoDevices(this);
}
QWindowsMediaIntegration::~QWindowsMediaIntegration()
{
delete m_formatInfo;
MFShutdown();
CoUninitialize();
}
QPlatformMediaFormatInfo *QWindowsMediaIntegration::formatInfo()
{
if (!m_formatInfo)
m_formatInfo = new QWindowsFormatInfo();
return m_formatInfo;
}
QMaybe<QPlatformMediaCaptureSession *> QWindowsMediaIntegration::createCaptureSession()
{
return new QWindowsMediaCaptureService();
}
QMaybe<QPlatformAudioDecoder *> QWindowsMediaIntegration::createAudioDecoder(QAudioDecoder *decoder)
{
return new MFAudioDecoderControl(decoder);
}
QMaybe<QPlatformMediaPlayer *> QWindowsMediaIntegration::createPlayer(QMediaPlayer *parent)
{
return new MFPlayerControl(parent);
}
QMaybe<QPlatformCamera *> QWindowsMediaIntegration::createCamera(QCamera *camera)
{
return new QWindowsCamera(camera);
}
QMaybe<QPlatformMediaRecorder *> QWindowsMediaIntegration::createRecorder(QMediaRecorder *recorder)
{
return new QWindowsMediaEncoder(recorder);
}
QMaybe<QPlatformImageCapture *> QWindowsMediaIntegration::createImageCapture(QImageCapture *imageCapture)
{
return new QWindowsImageCapture(imageCapture);
}
QMaybe<QPlatformVideoSink *> QWindowsMediaIntegration::createVideoSink(QVideoSink *sink)
{
return new MFEvrVideoWindowControl(sink);
}
QT_END_NAMESPACE
#include "qwindowsintegration.moc"
|