blob: 109f7964b364d53a2ffe9bafc18a528aad61b3bf (
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
|
// Copyright (C) 2016 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 "mfevrvideowindowcontrol_p.h"
#include <qdebug.h>
MFEvrVideoWindowControl::MFEvrVideoWindowControl(QVideoSink *parent)
: EvrVideoWindowControl(parent)
, m_currentActivate(NULL)
, m_evrSink(NULL)
{
}
MFEvrVideoWindowControl::~MFEvrVideoWindowControl()
{
clear();
}
void MFEvrVideoWindowControl::clear()
{
setEvr(NULL);
if (m_evrSink)
m_evrSink->Release();
if (m_currentActivate) {
m_currentActivate->ShutdownObject();
m_currentActivate->Release();
}
m_evrSink = NULL;
m_currentActivate = NULL;
}
IMFActivate* MFEvrVideoWindowControl::createActivate()
{
clear();
if (FAILED(MFCreateVideoRendererActivate(0, &m_currentActivate))) {
qWarning() << "Failed to create evr video renderer activate!";
return NULL;
}
if (FAILED(m_currentActivate->ActivateObject(IID_IMFMediaSink, (LPVOID*)(&m_evrSink)))) {
qWarning() << "Failed to activate evr media sink!";
return NULL;
}
if (!setEvr(m_evrSink))
return NULL;
return m_currentActivate;
}
void MFEvrVideoWindowControl::releaseActivate()
{
clear();
}
|