1 | /**
|
---|
2 | * This file has no copyright assigned and is placed in the Public Domain.
|
---|
3 | * This file is part of the mingw-w64 runtime package.
|
---|
4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
---|
5 | */
|
---|
6 | #ifndef __MSPCALL_H_
|
---|
7 | #define __MSPCALL_H_
|
---|
8 |
|
---|
9 | class ATL_NO_VTABLE CMSPCallBase : public CComObjectRootEx<CComMultiThreadModelNoCS>,public IDispatchImpl<ITStreamControl,&IID_ITStreamControl,&LIBID_TAPI3Lib> {
|
---|
10 | public:
|
---|
11 | DECLARE_POLY_AGGREGATABLE(CMSPCallBase)
|
---|
12 | BEGIN_COM_MAP(CMSPCallBase)
|
---|
13 | COM_INTERFACE_ENTRY(IDispatch)
|
---|
14 | COM_INTERFACE_ENTRY(ITStreamControl)
|
---|
15 | END_COM_MAP()
|
---|
16 | DECLARE_GET_CONTROLLING_UNKNOWN()
|
---|
17 | DECLARE_VQI()
|
---|
18 | CMSPCallBase();
|
---|
19 | virtual ~CMSPCallBase();
|
---|
20 | virtual ULONG MSPCallAddRef (void) = 0;
|
---|
21 | virtual ULONG MSPCallRelease (void) = 0;
|
---|
22 | STDMETHOD (CreateStream) (__LONG32 lMediaType,TERMINAL_DIRECTION Direction,ITStream **ppStream);
|
---|
23 | STDMETHOD (EnumerateStreams) (IEnumStream **ppEnumStream);
|
---|
24 | STDMETHOD (RemoveStream) (ITStream *pStream) = 0;
|
---|
25 | STDMETHOD (get_Streams) (VARIANT *pStreams);
|
---|
26 | virtual HRESULT Init(CMSPAddress *pMSPAddress,MSP_HANDLE htCall,DWORD dwReserved,DWORD dwMediaType) = 0;
|
---|
27 | virtual HRESULT ShutDown() = 0;
|
---|
28 | virtual HRESULT ReceiveTSPCallData(PBYTE pBuffer,DWORD dwSize);
|
---|
29 | HRESULT HandleStreamEvent(MSPEVENTITEM *EventItem) const;
|
---|
30 | protected:
|
---|
31 | virtual HRESULT InternalCreateStream(DWORD dwMediaType,TERMINAL_DIRECTION Direction,ITStream **ppStream) = 0;
|
---|
32 | virtual HRESULT CreateStreamObject(DWORD dwMediaType,TERMINAL_DIRECTION Direction,IMediaEvent *pGraph,ITStream **ppStream) = 0;
|
---|
33 | protected:
|
---|
34 | CMSPAddress *m_pMSPAddress;
|
---|
35 | MSP_HANDLE m_htCall;
|
---|
36 | DWORD m_dwMediaType;
|
---|
37 | CMSPArray <ITStream *> m_Streams;
|
---|
38 | CMSPCritSection m_lock;
|
---|
39 | };
|
---|
40 |
|
---|
41 | class ATL_NO_VTABLE CMSPCallMultiGraph : public CMSPCallBase {
|
---|
42 | public:
|
---|
43 | typedef struct {
|
---|
44 | CMSPCallMultiGraph *pMSPCall;
|
---|
45 | ITStream *pITStream;
|
---|
46 | IMediaEvent *pIMediaEvent;
|
---|
47 | } MSPSTREAMCONTEXT,*PMSPSTREAMCONTEXT;
|
---|
48 | typedef struct _THREADPOOLWAITBLOCK {
|
---|
49 | HANDLE hWaitHandle;
|
---|
50 | MSPSTREAMCONTEXT *pContext;
|
---|
51 | WINBOOL operator ==(struct _THREADPOOLWAITBLOCK &t) { return ((hWaitHandle==t.hWaitHandle) && (pContext==t.pContext)); }
|
---|
52 | } THREADPOOLWAITBLOCK,*PTHREADPOOLWAITBLOCK;
|
---|
53 | public:
|
---|
54 | CMSPCallMultiGraph();
|
---|
55 | virtual ~CMSPCallMultiGraph();
|
---|
56 | STDMETHOD (RemoveStream) (ITStream *ppStream);
|
---|
57 | HRESULT Init(CMSPAddress *pMSPAddress,MSP_HANDLE htCall,DWORD dwReserved,DWORD dwMediaType);
|
---|
58 | HRESULT ShutDown();
|
---|
59 | static VOID NTAPI DispatchGraphEvent(VOID *pContext,BOOLEAN bFlag);
|
---|
60 | virtual VOID HandleGraphEvent(MSPSTREAMCONTEXT *pContext);
|
---|
61 | virtual HRESULT ProcessGraphEvent(ITStream *pITStream,__LONG32 lEventCode,LONG_PTR lParam1,LONG_PTR lParam2);
|
---|
62 | protected:
|
---|
63 | HRESULT RegisterWaitEvent(IMediaEvent *pIMediaEvent,ITStream *pITStream);
|
---|
64 | HRESULT UnregisterWaitEvent(int index);
|
---|
65 | virtual HRESULT InternalCreateStream(DWORD dwMediaType,TERMINAL_DIRECTION Direction,ITStream **ppStream);
|
---|
66 | protected:
|
---|
67 | CMSPArray <THREADPOOLWAITBLOCK> m_ThreadPoolWaitBlocks;
|
---|
68 | };
|
---|
69 |
|
---|
70 | struct MULTI_GRAPH_EVENT_DATA {
|
---|
71 | CMSPCallMultiGraph *pCall;
|
---|
72 | ITStream *pITStream;
|
---|
73 | __LONG32 lEventCode;
|
---|
74 | LONG_PTR lParam1;
|
---|
75 | LONG_PTR lParam2;
|
---|
76 | IMediaEvent *pIMediaEvent;
|
---|
77 | MULTI_GRAPH_EVENT_DATA() : pIMediaEvent(NULL),pITStream(NULL),lEventCode(0),lParam1(0),lParam2(0) { }
|
---|
78 | };
|
---|
79 |
|
---|
80 | DWORD WINAPI AsyncMultiGraphEvent(LPVOID pVoid);
|
---|
81 | #endif
|
---|