Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
mfvideorenderercontrol.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 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#include "mfactivate_p.h"
6
8
9#include <private/qplatformvideosink_p.h>
10
12
14{
15public:
17
18 STDMETHODIMP ActivateObject(REFIID riid, void **ppv) override;
19 STDMETHODIMP ShutdownObject() override;
20 STDMETHODIMP DetachObject() override;
21
22 void setSink(QVideoSink *sink);
23 void setCropRect(QRect cropRect);
24
25private:
26 // Destructor is not public. Caller should call Release.
28
29 EVRCustomPresenter *m_presenter;
30 QVideoSink *m_videoSink;
31 QRect m_cropRect;
32 QMutex m_mutex;
33};
34
35
40
45
47{
48 if (m_sink)
50
51 if (m_presenterActivate) {
52 m_presenterActivate->ShutdownObject();
53 m_presenterActivate->Release();
54 m_presenterActivate = NULL;
55 }
56
57 if (m_currentActivate) {
58 m_currentActivate->ShutdownObject();
59 m_currentActivate->Release();
60 }
61 m_currentActivate = NULL;
62}
63
65{
66 m_sink = sink;
67
68 if (m_presenterActivate)
69 m_presenterActivate->setSink(m_sink);
70}
71
73{
74 if (m_presenterActivate)
75 m_presenterActivate->setCropRect(cropRect);
76}
77
79{
81
82 if (m_sink) {
83 // Create the EVR media sink, but replace the presenter with our own
84 if (SUCCEEDED(MFCreateVideoRendererActivate(::GetShellWindow(), &m_currentActivate))) {
85 m_presenterActivate = new EVRCustomPresenterActivate(m_sink);
86 m_currentActivate->SetUnknown(MF_ACTIVATE_CUSTOM_VIDEO_PRESENTER_ACTIVATE, m_presenterActivate);
87 }
88 }
89
90 return m_currentActivate;
91}
92
98
100{
101 if (!ppv)
102 return E_INVALIDARG;
103 QMutexLocker locker(&m_mutex);
104 if (!m_presenter) {
105 m_presenter = new EVRCustomPresenter(m_videoSink);
106 m_presenter->setCropRect(m_cropRect);
107 }
108 return m_presenter->QueryInterface(riid, ppv);
109}
110
112{
113 // The presenter does not implement IMFShutdown so
114 // this function is the same as DetachObject()
115 return DetachObject();
116}
117
119{
120 QMutexLocker locker(&m_mutex);
121 if (m_presenter) {
122 m_presenter->Release();
123 m_presenter = 0;
124 }
125 return S_OK;
126}
127
129{
130 QMutexLocker locker(&m_mutex);
131 if (m_videoSink == sink)
132 return;
133
134 m_videoSink = sink;
135
136 if (m_presenter)
137 m_presenter->setSink(sink);
138}
139
141{
142 QMutexLocker locker(&m_mutex);
143 if (m_cropRect == cropRect)
144 return;
145
146 m_cropRect = cropRect;
147
148 if (m_presenter)
149 m_presenter->setCropRect(cropRect);
150}
151
STDMETHODIMP ActivateObject(REFIID riid, void **ppv) override
STDMETHODIMP ShutdownObject() override
STDMETHODIMP DetachObject() override
STDMETHODIMP QueryInterface(REFIID riid, void **ppv) override
void setCropRect(QRect cropRect)
void setSink(QVideoSink *sink)
void setCropRect(const QRect &cropRect)
void setSink(QVideoSink *surface)
MFVideoRendererControl(QObject *parent=0)
\inmodule QtCore
Definition qmutex.h:313
\inmodule QtCore
Definition qmutex.h:281
\inmodule QtCore
Definition qobject.h:103
virtual void setVideoFrame(const QVideoFrame &frame)
\inmodule QtCore\reentrant
Definition qrect.h:30
The QVideoFrame class represents a frame of video data.
Definition qvideoframe.h:27
The QVideoSink class represents a generic sink for video data.
Definition qvideosink.h:22
QPlatformVideoSink * platformVideoSink() const
Combined button and popup list for selecting options.
GLsizei GLenum GLboolean sink
IUIViewSettingsInterop __RPC__in REFIID riid
IUIViewSettingsInterop __RPC__in REFIID __RPC__deref_out_opt void ** ppv
long HRESULT