2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Network Provider for MPEG2 based networks
4 * FILE: dll/directx/msdvbnp/pin.cpp
5 * PURPOSE: IPin interface
7 * PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org)
11 const GUID KSDATAFORMAT_TYPE_BDA_ANTENNA
= {0x71985f41, 0x1ca1, 0x11d3, {0x9c, 0xc8, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0}};
12 const GUID GUID_NULL
= {0x00000000L
, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
14 class CPin
: public IPin
17 STDMETHODIMP
QueryInterface( REFIID InterfaceId
, PVOID
* Interface
);
19 STDMETHODIMP_(ULONG
) AddRef()
21 InterlockedIncrement(&m_Ref
);
24 STDMETHODIMP_(ULONG
) Release()
26 InterlockedDecrement(&m_Ref
);
36 HRESULT STDMETHODCALLTYPE
Connect(IPin
*pReceivePin
, const AM_MEDIA_TYPE
*pmt
);
37 HRESULT STDMETHODCALLTYPE
ReceiveConnection(IPin
*pConnector
, const AM_MEDIA_TYPE
*pmt
);
38 HRESULT STDMETHODCALLTYPE
Disconnect();
39 HRESULT STDMETHODCALLTYPE
ConnectedTo(IPin
**pPin
);
40 HRESULT STDMETHODCALLTYPE
ConnectionMediaType(AM_MEDIA_TYPE
*pmt
);
41 HRESULT STDMETHODCALLTYPE
QueryPinInfo(PIN_INFO
*pInfo
);
42 HRESULT STDMETHODCALLTYPE
QueryDirection(PIN_DIRECTION
*pPinDir
);
43 HRESULT STDMETHODCALLTYPE
QueryId(LPWSTR
*Id
);
44 HRESULT STDMETHODCALLTYPE
QueryAccept(const AM_MEDIA_TYPE
*pmt
);
45 HRESULT STDMETHODCALLTYPE
EnumMediaTypes(IEnumMediaTypes
**ppEnum
);
46 HRESULT STDMETHODCALLTYPE
QueryInternalConnections(IPin
**apPin
, ULONG
*nPin
);
47 HRESULT STDMETHODCALLTYPE
EndOfStream();
48 HRESULT STDMETHODCALLTYPE
BeginFlush();
49 HRESULT STDMETHODCALLTYPE
EndFlush();
50 HRESULT STDMETHODCALLTYPE
NewSegment(REFERENCE_TIME tStart
, REFERENCE_TIME tStop
, double dRate
);
52 CPin(IBaseFilter
* ParentFilter
) : m_Ref(0), m_ParentFilter(ParentFilter
){};
55 static LPCWSTR PIN_ID
;
59 IBaseFilter
* m_ParentFilter
;
63 LPCWSTR
CPin::PIN_ID
= L
"Antenna Out";
71 if (IsEqualGUID(refiid
, IID_IUnknown
))
73 *Output
= PVOID(this);
74 reinterpret_cast<IUnknown
*>(*Output
)->AddRef();
77 if (IsEqualGUID(refiid
, IID_IPin
))
79 *Output
= (IPin
*)(this);
80 reinterpret_cast<IPin
*>(*Output
)->AddRef();
84 WCHAR Buffer
[MAX_PATH
];
86 StringFromCLSID(refiid
, &lpstr
);
87 swprintf(Buffer
, L
"CPin::QueryInterface: NoInterface for %s\n", lpstr
);
88 OutputDebugStringW(Buffer
);
94 //-------------------------------------------------------------------
99 CPin::Connect(IPin
*pReceivePin
, const AM_MEDIA_TYPE
*pmt
)
101 OutputDebugStringW(L
"CPin::Connect called\n");
107 CPin::ReceiveConnection(IPin
*pConnector
, const AM_MEDIA_TYPE
*pmt
)
109 OutputDebugStringW(L
"CPin::ReceiveConnection called\n");
114 CPin::Disconnect( void)
116 OutputDebugStringW(L
"CPin::Disconnect called\n");
121 CPin::ConnectedTo(IPin
**pPin
)
123 OutputDebugStringW(L
"CPin::ConnectedTo called\n");
124 return VFW_E_NOT_CONNECTED
;
128 CPin::ConnectionMediaType(AM_MEDIA_TYPE
*pmt
)
130 OutputDebugStringW(L
"CPin::ConnectionMediaType called\n");
135 CPin::QueryPinInfo(PIN_INFO
*pInfo
)
137 wcscpy(pInfo
->achName
, PIN_ID
);
138 pInfo
->dir
= PINDIR_OUTPUT
;
139 pInfo
->pFilter
= m_ParentFilter
;
140 m_ParentFilter
->AddRef();
146 CPin::QueryDirection(PIN_DIRECTION
*pPinDir
)
150 *pPinDir
= PINDIR_OUTPUT
;
158 CPin::QueryId(LPWSTR
*Id
)
160 *Id
= (LPWSTR
)CoTaskMemAlloc(sizeof(PIN_ID
));
162 return E_OUTOFMEMORY
;
169 CPin::QueryAccept(const AM_MEDIA_TYPE
*pmt
)
171 OutputDebugStringW(L
"CPin::QueryAccept called\n");
176 CPin::EnumMediaTypes(IEnumMediaTypes
**ppEnum
)
178 AM_MEDIA_TYPE
*MediaType
= (AM_MEDIA_TYPE
*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE
));
182 return E_OUTOFMEMORY
;
185 MediaType
->majortype
= KSDATAFORMAT_TYPE_BDA_ANTENNA
;
186 MediaType
->subtype
= MEDIASUBTYPE_None
;
187 MediaType
->formattype
= GUID_NULL
;
188 MediaType
->bFixedSizeSamples
= true;
189 MediaType
->bTemporalCompression
= false;
190 MediaType
->lSampleSize
= sizeof(CHAR
);
191 MediaType
->pUnk
= NULL
;
192 MediaType
->cbFormat
= 0;
193 MediaType
->pbFormat
= NULL
;
195 return CEnumMediaTypes_fnConstructor(NULL
, 1, MediaType
, IID_IEnumMediaTypes
, (void**)ppEnum
);
199 CPin::QueryInternalConnections(IPin
**apPin
, ULONG
*nPin
)
201 OutputDebugStringW(L
"CPin::QueryInternalConnections called\n");
206 CPin::EndOfStream( void)
208 OutputDebugStringW(L
"CPin::EndOfStream called\n");
213 CPin::BeginFlush( void)
215 OutputDebugStringW(L
"CPin::BeginFlush called\n");
220 CPin::EndFlush( void)
222 OutputDebugStringW(L
"CPin::EndFlush called\n");
227 CPin::NewSegment(REFERENCE_TIME tStart
, REFERENCE_TIME tStop
, double dRate
)
229 OutputDebugStringW(L
"CPin::NewSegment called\n");
237 IBaseFilter
* ParentFilter
,
241 CPin
* handler
= new CPin(ParentFilter
);
244 WCHAR Buffer
[MAX_PATH
];
246 StringFromCLSID(riid
, &lpstr
);
247 swprintf(Buffer
, L
"CPin_fnConstructor riid %s pUnknown %p\n", lpstr
, pUnknown
);
248 OutputDebugStringW(Buffer
);
252 return E_OUTOFMEMORY
;
254 if (FAILED(handler
->QueryInterface(riid
, ppv
)))
258 return E_NOINTERFACE
;