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 _MSPSTRM_H_
|
---|
7 | #define _MSPSTRM_H_
|
---|
8 |
|
---|
9 | #define STRM_INITIAL 0x00000000
|
---|
10 | #define STRM_TERMINALSELECTED 0x00000001
|
---|
11 | #define STRM_CONFIGURED 0x00000002
|
---|
12 | #define STRM_RUNNING 0x00000004
|
---|
13 | #define STRM_PAUSED 0x00000008
|
---|
14 | #define STRM_STOPPED 0x00000010
|
---|
15 |
|
---|
16 | class CMSPStream;
|
---|
17 |
|
---|
18 | class ATL_NO_VTABLE CPTEventSink : public CComObjectRootEx<CComMultiThreadModel>,public ITPluggableTerminalEventSink {
|
---|
19 | public:
|
---|
20 | CPTEventSink();
|
---|
21 | ~CPTEventSink();
|
---|
22 | BEGIN_COM_MAP(CPTEventSink)
|
---|
23 | COM_INTERFACE_ENTRY(ITPluggableTerminalEventSink)
|
---|
24 | END_COM_MAP()
|
---|
25 | public:
|
---|
26 | STDMETHOD(FireEvent)(const MSP_EVENT_INFO *pMspEventInfo);
|
---|
27 | public:
|
---|
28 | HRESULT SetSinkStream(CMSPStream *pStream);
|
---|
29 | private:
|
---|
30 | struct AsyncEventStruct {
|
---|
31 | CMSPStream *pMSPStream;
|
---|
32 | MSPEVENTITEM *pEventItem;
|
---|
33 | AsyncEventStruct() : pMSPStream(NULL),pEventItem(NULL) {
|
---|
34 | LOG((MSP_TRACE,"AsyncEventStruct::AsyncEventStruct[%p]",this));
|
---|
35 | }
|
---|
36 | ~AsyncEventStruct() {
|
---|
37 | pMSPStream = NULL;
|
---|
38 | pEventItem = NULL;
|
---|
39 | LOG((MSP_TRACE,"AsyncEventStruct::~AsyncEventStruct[%p]",this));
|
---|
40 | }
|
---|
41 | };
|
---|
42 | static DWORD WINAPI FireEventCallBack(LPVOID pEventStructure);
|
---|
43 | private:
|
---|
44 | CMSPStream *m_pMSPStream;
|
---|
45 | };
|
---|
46 |
|
---|
47 | class ATL_NO_VTABLE CMSPStream : public CComObjectRootEx<CComMultiThreadModelNoCS>,public IDispatchImpl<ITStream,&IID_ITStream,&LIBID_TAPI3Lib> {
|
---|
48 | public:
|
---|
49 | BEGIN_COM_MAP(CMSPStream)
|
---|
50 | COM_INTERFACE_ENTRY(IDispatch)
|
---|
51 | COM_INTERFACE_ENTRY(ITStream)
|
---|
52 | COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal,m_pFTM)
|
---|
53 | END_COM_MAP()
|
---|
54 | DECLARE_GET_CONTROLLING_UNKNOWN()
|
---|
55 | CMSPStream();
|
---|
56 | ~CMSPStream();
|
---|
57 | virtual void FinalRelease();
|
---|
58 | STDMETHOD (get_MediaType) (__LONG32 *plMediaType);
|
---|
59 | STDMETHOD (get_Direction) (TERMINAL_DIRECTION *pTerminalDirection);
|
---|
60 | STDMETHOD (get_Name) (BSTR *ppName) = 0;
|
---|
61 | STDMETHOD (SelectTerminal) (ITTerminal *pTerminal);
|
---|
62 | STDMETHOD (UnselectTerminal) (ITTerminal *pTerminal);
|
---|
63 | STDMETHOD (EnumerateTerminals) (IEnumTerminal **ppEnumTerminal);
|
---|
64 | STDMETHOD (get_Terminals) (VARIANT *pTerminals);
|
---|
65 | STDMETHOD (StartStream) ();
|
---|
66 | STDMETHOD (PauseStream) ();
|
---|
67 | STDMETHOD (StopStream) ();
|
---|
68 | virtual HRESULT Init(HANDLE hAddress,CMSPCallBase *pMSPCall,IMediaEvent *pGraph,DWORD dwMediaType,TERMINAL_DIRECTION Direction);
|
---|
69 | virtual HRESULT ShutDown();
|
---|
70 | virtual HRESULT GetState(DWORD *pdwStatus) { return E_NOTIMPL; }
|
---|
71 | virtual HRESULT HandleTSPData(BYTE *pData,DWORD dwSize);
|
---|
72 | virtual HRESULT ProcessGraphEvent(__LONG32 lEventCode,LONG_PTR lParam1,LONG_PTR lParam2);
|
---|
73 | protected:
|
---|
74 | HRESULT RegisterPluggableTerminalEventSink(ITTerminal *pTerminal);
|
---|
75 | HRESULT UnregisterPluggableTerminalEventSink(ITTerminal *pTerminal);
|
---|
76 | HRESULT ReleaseSink();
|
---|
77 | ULONG InternalAddRef();
|
---|
78 | ULONG InternalRelease();
|
---|
79 | public:
|
---|
80 | HRESULT HandleSinkEvent(MSPEVENTITEM *pEventItem);
|
---|
81 | protected:
|
---|
82 | IUnknown *m_pFTM;
|
---|
83 | DWORD m_dwState;
|
---|
84 | DWORD m_dwMediaType;
|
---|
85 | TERMINAL_DIRECTION m_Direction;
|
---|
86 | HANDLE m_hAddress;
|
---|
87 | CMSPCallBase *m_pMSPCall;
|
---|
88 | IGraphBuilder *m_pIGraphBuilder;
|
---|
89 | IMediaControl *m_pIMediaControl;
|
---|
90 | CMSPArray <ITTerminal *> m_Terminals;
|
---|
91 | CMSPCritSection m_lock;
|
---|
92 | CMSPCritSection m_lockRefCount;
|
---|
93 | ITPluggableTerminalEventSink *m_pPTEventSink;
|
---|
94 | __LONG32 m_lMyPersonalRefcount;
|
---|
95 | WINBOOL m_bFirstAddRef;
|
---|
96 | };
|
---|
97 |
|
---|
98 | #endif
|
---|