forked from ambilight-4-mediaportal/AtmoWin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAtmoLiveViewControlImpl.cpp
More file actions
131 lines (107 loc) · 3.52 KB
/
Copy pathAtmoLiveViewControlImpl.cpp
File metadata and controls
131 lines (107 loc) · 3.52 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#include "StdAfx.h"
#include "atmoliveviewcontrolimpl.h"
#include "AtmoExternalCaptureInput.h"
#include "AtmoTools.h"
CAtmoLiveViewControlImpl::CAtmoLiveViewControlImpl(CAtmoDynData *pAtmoDynData) : m_RefCounter(1) {
this->m_pAtmoDynData = pAtmoDynData;
}
CAtmoLiveViewControlImpl::~CAtmoLiveViewControlImpl(void)
{
}
STDMETHODIMP CAtmoLiveViewControlImpl::QueryInterface(REFIID Id, void** pPointer)
{
if (IsEqualIID(Id, IID_IUnknown)) {
*pPointer = this;
} else if (IsEqualIID(Id, IID_IAtmoLiveViewControl)) {
*pPointer = this;
} else
{
*pPointer = NULL;
return E_NOINTERFACE;
}
AddRef();
return S_OK;
}
STDMETHODIMP_(ULONG) CAtmoLiveViewControlImpl::AddRef()
{
m_RefCounter++;
return m_RefCounter;
}
STDMETHODIMP_(ULONG) CAtmoLiveViewControlImpl::Release()
{
ULONG Temp = --m_RefCounter;
if (!Temp)
delete this;
return Temp;
}
STDMETHODIMP CAtmoLiveViewControlImpl::setLiveViewSource(enum ComLiveViewSource dwModus) {
HRESULT hres = S_FALSE;
m_pAtmoDynData->LockCriticalSection();
CAtmoConfig *config = m_pAtmoDynData->getAtmoConfig();
if(config!=NULL) {
if(config->getEffectMode() == emLivePicture) {
switch(dwModus) {
case lvsGDI: {
CAtmoTools::SwitchLiveSource(m_pAtmoDynData, lpsScreenCapture );
hres = S_OK;
break;
}
case lvsExternal: {
CAtmoTools::SwitchLiveSource(m_pAtmoDynData, lpsExtern );
hres = S_OK;
break;
}
}
}
}
m_pAtmoDynData->UnLockCriticalSection();
return hres;
}
STDMETHODIMP CAtmoLiveViewControlImpl::getCurrentLiveViewSource(enum ComLiveViewSource *modus) {
HRESULT hres = S_FALSE;
m_pAtmoDynData->LockCriticalSection();
CAtmoConfig *config = m_pAtmoDynData->getAtmoConfig();
if(config!=NULL) {
if(config->getEffectMode() == emLivePicture) {
switch(m_pAtmoDynData->getLivePictureSource())
{
case lpsDisabled:
break;
case lpsScreenCapture:
*modus = lvsGDI;
hres = S_OK;
break;
case lpsExtern:
*modus = lvsExternal;
hres = S_OK;
break;
}
}
}
m_pAtmoDynData->UnLockCriticalSection();
return hres;
}
STDMETHODIMP CAtmoLiveViewControlImpl::setPixelData(SAFEARRAY * bitmapInfoHeader, SAFEARRAY * pixelData) {
HRESULT hres = S_FALSE;
CAtmoConfig *config = m_pAtmoDynData->getAtmoConfig();
if(config != NULL) {
if(config->getEffectMode() == emLivePicture) {
CAtmoLiveView *pAtmoLiveView = (CAtmoLiveView *)m_pAtmoDynData->getEffectThread();
if(pAtmoLiveView!= NULL) {
if( m_pAtmoDynData->getLivePictureSource() == lpsExtern ) {
CAtmoExternalCaptureInput *input = (CAtmoExternalCaptureInput *)m_pAtmoDynData->getLiveInput();
if(input != NULL) {
void *pPixelData;
BITMAPINFOHEADER *pBitmapInfoHeader;
SafeArrayAccessData(pixelData,(void **)&pPixelData);
SafeArrayAccessData(bitmapInfoHeader,(void **)&pBitmapInfoHeader);
input->DeliverNewSourceDataPaket(pBitmapInfoHeader,pPixelData);
SafeArrayUnaccessData(pixelData);
SafeArrayUnaccessData(bitmapInfoHeader);
}
}
}
}
}
return hres;
}