-
Notifications
You must be signed in to change notification settings - Fork 3
/
AtmoRemoteControlImpl.cpp
114 lines (98 loc) · 3.52 KB
/
AtmoRemoteControlImpl.cpp
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
#include "stdafx.h"
#include "atmoremotecontrolimpl.h"
#include "AtmoLiveView.h"
#include "AtmoExternalCaptureInput.h"
#include "AtmoDefs.h"
CAtmoRemoteControlImpl::CAtmoRemoteControlImpl(CAtmoDynData *pDynData) : m_RefCounter(1), m_LiveViewSource(lvsGDI) {
this->m_pAtmoDynData = pDynData;
}
CAtmoRemoteControlImpl::~CAtmoRemoteControlImpl(void) {
}
STDMETHODIMP CAtmoRemoteControlImpl::QueryInterface(REFIID Id, void** pPointer)
{
if (IsEqualIID(Id, IID_IUnknown)) {
*pPointer = this;
} else if (IsEqualIID(Id, IID_IAtmoWinRemoteControl)) {
*pPointer = this;
} else
{
*pPointer = NULL;
return E_NOINTERFACE;
}
AddRef();
return S_OK;
}
STDMETHODIMP_(ULONG) CAtmoRemoteControlImpl::AddRef()
{
m_RefCounter++;
return m_RefCounter;
}
STDMETHODIMP_(ULONG) CAtmoRemoteControlImpl::Release()
{
ULONG Temp = --m_RefCounter;
if (!Temp)
delete this;
return Temp;
}
STDMETHODIMP CAtmoRemoteControlImpl::getCurrentLiveViewSource(ComLiveViewSource *modus) {
CAtmoConfig *cfg = this->m_pAtmoDynData->getAtmoConfig();
CAtmoLiveView *liveViewThread;
if(cfg->getEffectMode() == emLivePicture) {
liveViewThread = (CAtmoLiveView *)m_pAtmoDynData->getEffectThread();
if(liveViewThread != NULL) {
LiveEffectSource les = liveViewThread->getLiveEffectSource();
if(les == lesGDI)
*modus = lvsGDI;
if(les == lesExternal)
*modus = lvsExternal;
}
} else {
*modus = lvsGDI;
}
return S_OK;
}
STDMETHODIMP CAtmoRemoteControlImpl::setLiveViewSource(ComLiveViewSource dwModus) {
CAtmoConfig *cfg = this->m_pAtmoDynData->getAtmoConfig();
CAtmoLiveView *liveViewThread;
switch(dwModus) {
case lvsGDI:
if(cfg->getEffectMode() == emLivePicture) {
liveViewThread = (CAtmoLiveView *)m_pAtmoDynData->getEffectThread();
liveViewThread->setLiveEffectSource(lesGDI);
Sleep(50);
}
break;
case lvsExternal:
if(cfg->getEffectMode() == emLivePicture) {
liveViewThread = (CAtmoLiveView *)m_pAtmoDynData->getEffectThread();
liveViewThread->setLiveEffectSource(lesExternal);
// weil diese Änderung nicht sofort eintritt - sondern nur alle paar ms darauf reagiert wird wartet ich hier!
Sleep(50);
}
break;
}
return S_OK;
}
STDMETHODIMP CAtmoRemoteControlImpl::setPixelData(SAFEARRAY *bitmapInfoHeader, SAFEARRAY *pixelData) {
void *pPixelData;
BITMAPINFOHEADER *pBitmapInfoHeader;
CAtmoConfig *cfg = this->m_pAtmoDynData->getAtmoConfig();
CAtmoLiveView *liveViewThread;
if(cfg->getEffectMode() == emLivePicture) {
liveViewThread = (CAtmoLiveView *)m_pAtmoDynData->getEffectThread();
if(liveViewThread!=NULL) {
if(liveViewThread->getLiveEffectSource() == lesExternal) {
CAtmoExternalCaptureInput *input = (CAtmoExternalCaptureInput *)liveViewThread->LockAtmoInput();
if(input!=NULL) {
SafeArrayAccessData(pixelData,(void **)&pPixelData);
SafeArrayAccessData(bitmapInfoHeader,(void **)&pBitmapInfoHeader);
input->DeliverNewSourceDataPaket(pBitmapInfoHeader,pPixelData);
SafeArrayUnaccessData(pixelData);
SafeArrayUnaccessData(bitmapInfoHeader);
}
liveViewThread->UnlockAtmoInput();
}
}
}
return S_OK;
}