-
Notifications
You must be signed in to change notification settings - Fork 3
/
Filters.h
76 lines (63 loc) · 3.3 KB
/
Filters.h
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
#pragma once
#define DECLARE_PTR(type, ptr, expr) type* ptr = (type*)(expr);
EXTERN_C const GUID CLSID_VirtualCam;
class CVCamStream;
class CVCam : public CSource
{
public:
//////////////////////////////////////////////////////////////////////////
// IUnknown
//////////////////////////////////////////////////////////////////////////
static CUnknown * WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT *phr);
STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
IFilterGraph *GetGraph() {return m_pGraph;}
private:
CVCam(LPUNKNOWN lpunk, HRESULT *phr);
};
class CVCamStream : public CSourceStream, public IAMStreamConfig, public IKsPropertySet
{
public:
//////////////////////////////////////////////////////////////////////////
// IUnknown
//////////////////////////////////////////////////////////////////////////
STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
STDMETHODIMP_(ULONG) AddRef() { return GetOwner()->AddRef(); } \
STDMETHODIMP_(ULONG) Release() { return GetOwner()->Release(); }
//////////////////////////////////////////////////////////////////////////
// IQualityControl
//////////////////////////////////////////////////////////////////////////
STDMETHODIMP Notify(IBaseFilter * pSender, Quality q);
//////////////////////////////////////////////////////////////////////////
// IAMStreamConfig
//////////////////////////////////////////////////////////////////////////
HRESULT STDMETHODCALLTYPE SetFormat(AM_MEDIA_TYPE *pmt);
HRESULT STDMETHODCALLTYPE GetFormat(AM_MEDIA_TYPE **ppmt);
HRESULT STDMETHODCALLTYPE GetNumberOfCapabilities(int *piCount, int *piSize);
HRESULT STDMETHODCALLTYPE GetStreamCaps(int iIndex, AM_MEDIA_TYPE **pmt, BYTE *pSCC);
//////////////////////////////////////////////////////////////////////////
// IKsPropertySet
//////////////////////////////////////////////////////////////////////////
HRESULT STDMETHODCALLTYPE Set(REFGUID guidPropSet, DWORD dwID, void *pInstanceData, DWORD cbInstanceData, void *pPropData, DWORD cbPropData);
HRESULT STDMETHODCALLTYPE Get(REFGUID guidPropSet, DWORD dwPropID, void *pInstanceData,DWORD cbInstanceData, void *pPropData, DWORD cbPropData, DWORD *pcbReturned);
HRESULT STDMETHODCALLTYPE QuerySupported(REFGUID guidPropSet, DWORD dwPropID, DWORD *pTypeSupport);
//////////////////////////////////////////////////////////////////////////
// CSourceStream
//////////////////////////////////////////////////////////////////////////
CVCamStream(HRESULT *phr, CVCam *pParent, LPCWSTR pPinName);
~CVCamStream();
HRESULT FillBuffer(IMediaSample *pms);
HRESULT DecideBufferSize(IMemAllocator *pIMemAlloc, ALLOCATOR_PROPERTIES *pProperties);
HRESULT CheckMediaType(const CMediaType *pMediaType);
HRESULT GetMediaType(int iPosition, CMediaType *pmt);
HRESULT SetMediaType(const CMediaType *pmt);
HRESULT OnThreadCreate(void);
HRESULT OnThreadDestroy(void);
private:
CVCam *m_pParent;
CCritSec m_cSharedState;
int m_iFrameNumber;
REFERENCE_TIME m_rtFrameLength;
RECT m_rScreen; // Rect containing entire screen coordinates
int m_nCurrentBitDepth; // Screen bit depth
CMediaType m_MediaType;
};