2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS WDM Streaming ActiveMovie Proxy
4 * FILE: dll/directx/ksproxy/proxy.cpp
5 * PURPOSE: IKsProxy interface
7 * PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org)
12 const GUID IID_IPersistPropertyBag
= {0x37D84F60, 0x42CB, 0x11CE, {0x81, 0x35, 0x00, 0xAA, 0x00, 0x4B, 0xB8, 0x51}};
13 const GUID GUID_NULL
= {0x00000000L
, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
16 const GUID IID_IBDA_DeviceControl
= {0xFD0A5AF3, 0xB41D, 0x11d2, {0x9C, 0x95, 0x00, 0xC0, 0x4F, 0x79, 0x71, 0xE0}};
17 const GUID IID_IKsAggregateControl
= {0x7F40EAC0, 0x3947, 0x11D2, {0x87, 0x4E, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
18 const GUID IID_IKsClockPropertySet
= {0x5C5CBD84, 0xE755, 0x11D0, {0xAC, 0x18, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
19 const GUID IID_IKsTopology
= {0x28F54683, 0x06FD, 0x11D2, {0xB2, 0x7A, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
22 Needs IKsClock, IKsNotifyEvent
25 class CKsProxy
: public IBaseFilter
,
27 public IPersistPropertyBag
,
29 public IPersistStream
,
30 public IAMDeviceRemoval
,
31 public ISpecifyPropertyPages
,
32 public IReferenceClock
,
34 public IKsPropertySet
,
35 public IKsClockPropertySet
,
36 public IAMFilterMiscFlags
,
39 public IKsAggregateControl
43 typedef std::vector
<IUnknown
*>ProxyPluginVector
;
44 typedef std::vector
<IPin
*> PinVector
;
46 STDMETHODIMP
QueryInterface( REFIID InterfaceId
, PVOID
* Interface
);
48 STDMETHODIMP_(ULONG
) AddRef()
50 InterlockedIncrement(&m_Ref
);
53 STDMETHODIMP_(ULONG
) Release()
55 InterlockedDecrement(&m_Ref
);
64 // IBaseFilter methods
65 HRESULT STDMETHODCALLTYPE
GetClassID(CLSID
*pClassID
);
66 HRESULT STDMETHODCALLTYPE
Stop( void);
67 HRESULT STDMETHODCALLTYPE
Pause( void);
68 HRESULT STDMETHODCALLTYPE
Run(REFERENCE_TIME tStart
);
69 HRESULT STDMETHODCALLTYPE
GetState(DWORD dwMilliSecsTimeout
, FILTER_STATE
*State
);
70 HRESULT STDMETHODCALLTYPE
SetSyncSource(IReferenceClock
*pClock
);
71 HRESULT STDMETHODCALLTYPE
GetSyncSource(IReferenceClock
**pClock
);
72 HRESULT STDMETHODCALLTYPE
EnumPins(IEnumPins
**ppEnum
);
73 HRESULT STDMETHODCALLTYPE
FindPin(LPCWSTR Id
, IPin
**ppPin
);
74 HRESULT STDMETHODCALLTYPE
QueryFilterInfo(FILTER_INFO
*pInfo
);
75 HRESULT STDMETHODCALLTYPE
JoinFilterGraph(IFilterGraph
*pGraph
, LPCWSTR pName
);
76 HRESULT STDMETHODCALLTYPE
QueryVendorInfo(LPWSTR
*pVendorInfo
);
79 HRESULT STDMETHODCALLTYPE
GetTime(REFERENCE_TIME
*pTime
);
80 HRESULT STDMETHODCALLTYPE
AdviseTime(REFERENCE_TIME baseTime
, REFERENCE_TIME streamTime
, HEVENT hEvent
, DWORD_PTR
*pdwAdviseCookie
);
81 HRESULT STDMETHODCALLTYPE
AdvisePeriodic(REFERENCE_TIME startTime
, REFERENCE_TIME periodTime
, HSEMAPHORE hSemaphore
, DWORD_PTR
*pdwAdviseCookie
);
82 HRESULT STDMETHODCALLTYPE
Unadvise(DWORD_PTR dwAdviseCookie
);
85 HRESULT STDMETHODCALLTYPE
GetCapabilities(DWORD
*pCapabilities
);
86 HRESULT STDMETHODCALLTYPE
CheckCapabilities(DWORD
*pCapabilities
);
87 HRESULT STDMETHODCALLTYPE
IsFormatSupported(const GUID
*pFormat
);
88 HRESULT STDMETHODCALLTYPE
QueryPreferredFormat(GUID
*pFormat
);
89 HRESULT STDMETHODCALLTYPE
GetTimeFormat(GUID
*pFormat
);
90 HRESULT STDMETHODCALLTYPE
IsUsingTimeFormat(const GUID
*pFormat
);
91 HRESULT STDMETHODCALLTYPE
SetTimeFormat(const GUID
*pFormat
);
92 HRESULT STDMETHODCALLTYPE
GetDuration(LONGLONG
*pDuration
);
93 HRESULT STDMETHODCALLTYPE
GetStopPosition(LONGLONG
*pStop
);
94 HRESULT STDMETHODCALLTYPE
GetCurrentPosition(LONGLONG
*pCurrent
);
95 HRESULT STDMETHODCALLTYPE
ConvertTimeFormat(LONGLONG
*pTarget
, const GUID
*pTargetFormat
, LONGLONG Source
, const GUID
*pSourceFormat
);
96 HRESULT STDMETHODCALLTYPE
SetPositions(LONGLONG
*pCurrent
, DWORD dwCurrentFlags
, LONGLONG
*pStop
, DWORD dwStopFlags
);
97 HRESULT STDMETHODCALLTYPE
GetPositions(LONGLONG
*pCurrent
, LONGLONG
*pStop
);
98 HRESULT STDMETHODCALLTYPE
GetAvailable(LONGLONG
*pEarliest
, LONGLONG
*pLatest
);
99 HRESULT STDMETHODCALLTYPE
SetRate(double dRate
);
100 HRESULT STDMETHODCALLTYPE
GetRate(double *pdRate
);
101 HRESULT STDMETHODCALLTYPE
GetPreroll(LONGLONG
*pllPreroll
);
104 HRESULT STDMETHODCALLTYPE
Set(REFGUID guidPropSet
, DWORD dwPropID
, LPVOID pInstanceData
, DWORD cbInstanceData
, LPVOID pPropData
, DWORD cbPropData
);
105 HRESULT STDMETHODCALLTYPE
Get(REFGUID guidPropSet
, DWORD dwPropID
, LPVOID pInstanceData
, DWORD cbInstanceData
, LPVOID pPropData
, DWORD cbPropData
, DWORD
*pcbReturned
);
106 HRESULT STDMETHODCALLTYPE
QuerySupported(REFGUID guidPropSet
, DWORD dwPropID
, DWORD
*pTypeSupport
);
109 ULONG STDMETHODCALLTYPE
GetMiscFlags( void);
112 HRESULT STDMETHODCALLTYPE
KsProperty(PKSPROPERTY Property
, ULONG PropertyLength
, LPVOID PropertyData
, ULONG DataLength
, ULONG
* BytesReturned
);
113 HRESULT STDMETHODCALLTYPE
KsMethod(PKSMETHOD Method
, ULONG MethodLength
, LPVOID MethodData
, ULONG DataLength
, ULONG
* BytesReturned
);
114 HRESULT STDMETHODCALLTYPE
KsEvent(PKSEVENT Event
, ULONG EventLength
, LPVOID EventData
, ULONG DataLength
, ULONG
* BytesReturned
);
117 HRESULT STDMETHODCALLTYPE
CreateNodeInstance(ULONG NodeId
, ULONG Flags
, ACCESS_MASK DesiredAccess
, IUnknown
* UnkOuter
, REFGUID InterfaceId
, LPVOID
* Interface
);
119 //IKsAggregateControl
120 HRESULT STDMETHODCALLTYPE
KsAddAggregate(IN REFGUID AggregateClass
);
121 HRESULT STDMETHODCALLTYPE
KsRemoveAggregate(REFGUID AggregateClass
);
123 //IKsClockPropertySet
124 HRESULT STDMETHODCALLTYPE
KsGetTime(LONGLONG
* Time
);
125 HRESULT STDMETHODCALLTYPE
KsSetTime(LONGLONG Time
);
126 HRESULT STDMETHODCALLTYPE
KsGetPhysicalTime(LONGLONG
* Time
);
127 HRESULT STDMETHODCALLTYPE
KsSetPhysicalTime(LONGLONG Time
);
128 HRESULT STDMETHODCALLTYPE
KsGetCorrelatedTime(KSCORRELATED_TIME
* CorrelatedTime
);
129 HRESULT STDMETHODCALLTYPE
KsSetCorrelatedTime(KSCORRELATED_TIME
* CorrelatedTime
);
130 HRESULT STDMETHODCALLTYPE
KsGetCorrelatedPhysicalTime(KSCORRELATED_TIME
* CorrelatedTime
);
131 HRESULT STDMETHODCALLTYPE
KsSetCorrelatedPhysicalTime(KSCORRELATED_TIME
* CorrelatedTime
);
132 HRESULT STDMETHODCALLTYPE
KsGetResolution(KSRESOLUTION
* Resolution
);
133 HRESULT STDMETHODCALLTYPE
KsGetState(KSSTATE
* State
);
136 //IAMovieSetup methods
137 HRESULT STDMETHODCALLTYPE
Register( void);
138 HRESULT STDMETHODCALLTYPE
Unregister( void);
140 // IPersistPropertyBag methods
141 HRESULT STDMETHODCALLTYPE
InitNew( void);
142 HRESULT STDMETHODCALLTYPE
Load(IPropertyBag
*pPropBag
, IErrorLog
*pErrorLog
);
143 HRESULT STDMETHODCALLTYPE
Save(IPropertyBag
*pPropBag
, BOOL fClearDirty
, BOOL fSaveAllProperties
);
146 HANDLE STDMETHODCALLTYPE
KsGetObjectHandle();
149 HRESULT STDMETHODCALLTYPE
DeviceInfo(CLSID
*pclsidInterfaceClass
, LPWSTR
*pwszSymbolicLink
);
150 HRESULT STDMETHODCALLTYPE
Reassociate(void);
151 HRESULT STDMETHODCALLTYPE
Disassociate( void);
154 HRESULT STDMETHODCALLTYPE
IsDirty( void);
155 HRESULT STDMETHODCALLTYPE
Load(IStream
*pStm
);
156 HRESULT STDMETHODCALLTYPE
Save(IStream
*pStm
, BOOL fClearDirty
);
157 HRESULT STDMETHODCALLTYPE
GetSizeMax(ULARGE_INTEGER
*pcbSize
);
159 // ISpecifyPropertyPages
160 HRESULT STDMETHODCALLTYPE
GetPages(CAUUID
*pPages
);
163 CKsProxy() : m_Ref(0), m_pGraph(0), m_ReferenceClock(0), m_FilterState(State_Stopped
), m_hDevice(0), m_Plugins(), m_Pins(), m_DevicePath(0) {};
167 CloseHandle(m_hDevice
);
170 HRESULT STDMETHODCALLTYPE
GetSupportedSets(LPGUID
* pOutGuid
, PULONG NumGuids
);
171 HRESULT STDMETHODCALLTYPE
LoadProxyPlugins(LPGUID pGuids
, ULONG NumGuids
);
172 HRESULT STDMETHODCALLTYPE
GetNumberOfPins(PULONG NumPins
);
173 HRESULT STDMETHODCALLTYPE
GetPinInstanceCount(ULONG PinId
, PKSPIN_CINSTANCES Instances
);
174 HRESULT STDMETHODCALLTYPE
GetPinDataflow(ULONG PinId
, KSPIN_DATAFLOW
* DataFlow
);
175 HRESULT STDMETHODCALLTYPE
GetPinName(ULONG PinId
, KSPIN_DATAFLOW DataFlow
, ULONG PinCount
, LPWSTR
* OutPinName
);
176 HRESULT STDMETHODCALLTYPE
GetPinCommunication(ULONG PinId
, KSPIN_COMMUNICATION
* Communication
);
177 HRESULT STDMETHODCALLTYPE
CreatePins();
180 IFilterGraph
*m_pGraph
;
181 IReferenceClock
* m_ReferenceClock
;
182 FILTER_STATE m_FilterState
;
184 ProxyPluginVector m_Plugins
;
187 CLSID m_DeviceInterfaceGUID
;
192 CKsProxy::QueryInterface(
196 *Output
= (PVOID
)0xDEADDEAD;//NULL;
198 if (IsEqualGUID(refiid
, IID_IUnknown
) ||
199 IsEqualGUID(refiid
, IID_IBaseFilter
))
201 *Output
= PVOID(this);
202 reinterpret_cast<IUnknown
*>(*Output
)->AddRef();
205 else if (IsEqualGUID(refiid
, IID_IPersistPropertyBag
))
207 *Output
= (IPersistPropertyBag
*)(this);
208 reinterpret_cast<IPersistPropertyBag
*>(*Output
)->AddRef();
211 else if (IsEqualGUID(refiid
, IID_IAMDeviceRemoval
))
213 *Output
= (IAMDeviceRemoval
*)(this);
214 reinterpret_cast<IAMDeviceRemoval
*>(*Output
)->AddRef();
217 else if (IsEqualGUID(refiid
, IID_IPersistStream
))
219 *Output
= (IPersistStream
*)(this);
220 reinterpret_cast<IPersistStream
*>(*Output
)->AddRef();
223 else if (IsEqualGUID(refiid
, IID_IKsObject
))
225 *Output
= (IKsObject
*)(this);
226 reinterpret_cast<IKsObject
*>(*Output
)->AddRef();
229 else if (IsEqualGUID(refiid
, IID_IReferenceClock
))
231 *Output
= (IReferenceClock
*)(this);
232 reinterpret_cast<IReferenceClock
*>(*Output
)->AddRef();
235 else if (IsEqualGUID(refiid
, IID_IMediaSeeking
))
237 *Output
= (IMediaSeeking
*)(this);
238 reinterpret_cast<IMediaSeeking
*>(*Output
)->AddRef();
241 else if (IsEqualGUID(refiid
, IID_IAMFilterMiscFlags
))
243 *Output
= (IAMFilterMiscFlags
*)(this);
244 reinterpret_cast<IAMFilterMiscFlags
*>(*Output
)->AddRef();
247 else if (IsEqualGUID(refiid
, IID_IKsControl
))
249 *Output
= (IKsControl
*)(this);
250 reinterpret_cast<IKsControl
*>(*Output
)->AddRef();
253 else if (IsEqualGUID(refiid
, IID_IKsPropertySet
))
255 *Output
= (IKsPropertySet
*)(this);
256 reinterpret_cast<IKsPropertySet
*>(*Output
)->AddRef();
259 else if (IsEqualGUID(refiid
, IID_IKsTopology
))
261 *Output
= (IKsTopology
*)(this);
262 reinterpret_cast<IKsTopology
*>(*Output
)->AddRef();
265 else if (IsEqualGUID(refiid
, IID_IKsAggregateControl
))
267 *Output
= (IKsAggregateControl
*)(this);
268 reinterpret_cast<IKsAggregateControl
*>(*Output
)->AddRef();
271 else if (IsEqualGUID(refiid
, IID_IKsClockPropertySet
))
273 *Output
= (IKsClockPropertySet
*)(this);
274 reinterpret_cast<IKsClockPropertySet
*>(*Output
)->AddRef();
277 else if (IsEqualGUID(refiid
, IID_ISpecifyPropertyPages
))
279 *Output
= (ISpecifyPropertyPages
*)(this);
280 reinterpret_cast<ISpecifyPropertyPages
*>(*Output
)->AddRef();
284 for(ULONG Index
= 0; Index
< m_Plugins
.size(); Index
++)
288 HRESULT hr
= m_Plugins
[Index
]->QueryInterface(refiid
, Output
);
293 StringFromCLSID(refiid
, &lpstr
);
294 swprintf(Buffer
, L
"CKsProxy::QueryInterface plugin %lu supports interface %s\n", Index
, lpstr
);
295 OutputDebugStringW(Buffer
);
296 CoTaskMemFree(lpstr
);
302 WCHAR Buffer
[MAX_PATH
];
304 StringFromCLSID(refiid
, &lpstr
);
305 swprintf(Buffer
, L
"CKsProxy::QueryInterface: NoInterface for %s !!!\n", lpstr
);
306 OutputDebugStringW(Buffer
);
307 CoTaskMemFree(lpstr
);
310 return E_NOINTERFACE
;
313 //-------------------------------------------------------------------
314 // ISpecifyPropertyPages
319 CKsProxy::GetPages(CAUUID
*pPages
)
321 OutputDebugStringW(L
"CKsProxy::GetPages NotImplemented\n");
327 pPages
->pElems
= NULL
;
332 //-------------------------------------------------------------------
333 // IKsClockPropertySet interface
340 OutputDebugStringW(L
"CKsProxy::KsGetTime NotImplemented\n");
349 OutputDebugStringW(L
"CKsProxy::KsSetTime NotImplemented\n");
355 CKsProxy::KsGetPhysicalTime(
358 OutputDebugStringW(L
"CKsProxy::KsGetPhysicalTime NotImplemented\n");
364 CKsProxy::KsSetPhysicalTime(
367 OutputDebugStringW(L
"CKsProxy::KsSetPhysicalTime NotImplemented\n");
373 CKsProxy::KsGetCorrelatedTime(
374 KSCORRELATED_TIME
* CorrelatedTime
)
376 OutputDebugStringW(L
"CKsProxy::KsGetCorrelatedTime NotImplemented\n");
382 CKsProxy::KsSetCorrelatedTime(
383 KSCORRELATED_TIME
* CorrelatedTime
)
385 OutputDebugStringW(L
"CKsProxy::KsSetCorrelatedTime NotImplemented\n");
391 CKsProxy::KsGetCorrelatedPhysicalTime(
392 KSCORRELATED_TIME
* CorrelatedTime
)
394 OutputDebugStringW(L
"CKsProxy::KsGetCorrelatedPhysicalTime NotImplemented\n");
400 CKsProxy::KsSetCorrelatedPhysicalTime(
401 KSCORRELATED_TIME
* CorrelatedTime
)
403 OutputDebugStringW(L
"CKsProxy::KsSetCorrelatedPhysicalTime NotImplemented\n");
409 CKsProxy::KsGetResolution(
410 KSRESOLUTION
* Resolution
)
412 OutputDebugStringW(L
"CKsProxy::KsGetResolution NotImplemented\n");
418 CKsProxy::KsGetState(
421 OutputDebugStringW(L
"CKsProxy::KsGetState NotImplemented\n");
425 //-------------------------------------------------------------------
426 // IReferenceClock interface
431 REFERENCE_TIME
*pTime
)
433 OutputDebugStringW(L
"CKsProxy::GetTime NotImplemented\n");
439 CKsProxy::AdviseTime(
440 REFERENCE_TIME baseTime
,
441 REFERENCE_TIME streamTime
,
443 DWORD_PTR
*pdwAdviseCookie
)
445 OutputDebugStringW(L
"CKsProxy::AdviseTime NotImplemented\n");
451 CKsProxy::AdvisePeriodic(
452 REFERENCE_TIME startTime
,
453 REFERENCE_TIME periodTime
,
454 HSEMAPHORE hSemaphore
,
455 DWORD_PTR
*pdwAdviseCookie
)
457 OutputDebugStringW(L
"CKsProxy::AdvisePeriodic NotImplemented\n");
464 DWORD_PTR dwAdviseCookie
)
466 OutputDebugStringW(L
"CKsProxy::Unadvise NotImplemented\n");
470 //-------------------------------------------------------------------
471 // IMediaSeeking interface
475 CKsProxy::GetCapabilities(
476 DWORD
*pCapabilities
)
478 OutputDebugStringW(L
"CKsProxy::GetCapabilities NotImplemented\n");
484 CKsProxy::CheckCapabilities(
485 DWORD
*pCapabilities
)
487 OutputDebugStringW(L
"CKsProxy::CheckCapabilities NotImplemented\n");
493 CKsProxy::IsFormatSupported(
497 PKSMULTIPLE_ITEM FormatList
;
500 HRESULT hr
= S_FALSE
;
503 OutputDebugStringW(L
"CKsProxy::IsFormatSupported\n");
508 Property
.Set
= KSPROPSETID_MediaSeeking
;
509 Property
.Id
= KSPROPERTY_MEDIASEEKING_FORMATS
;
510 Property
.Flags
= KSPROPERTY_TYPE_GET
;
512 // query for format size list
513 hr
= KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_PROPERTY
, (PVOID
)&Property
, sizeof(KSPROPERTY
), NULL
, 0, &BytesReturned
);
515 if (hr
== MAKE_HRESULT(SEVERITY_ERROR
, FACILITY_WIN32
, ERROR_MORE_DATA
))
517 // allocate format list
518 FormatList
= (PKSMULTIPLE_ITEM
)CoTaskMemAlloc(BytesReturned
);
522 return E_OUTOFMEMORY
;
526 hr
= KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_PROPERTY
, (PVOID
)&Property
, sizeof(KSPROPERTY
), (PVOID
)FormatList
, BytesReturned
, &BytesReturned
);
529 // failed to query format list
530 CoTaskMemFree(FormatList
);
534 //iterate through format list
535 pGuid
= (LPGUID
)(FormatList
+ 1);
536 for(Index
= 0; Index
< FormatList
->Count
; Index
++)
538 if (IsEqualGUID(*pGuid
, *pFormat
))
540 OutputDebugStringW(L
"CKsProxy::IsFormatSupported found format\n");
541 CoTaskMemFree(FormatList
);
547 OutputDebugStringW(L
"CKsProxy::IsFormatSupported FormatNotFound\n");
549 CoTaskMemFree(FormatList
);
552 // check if all plugins support it
553 for(Index
= 0; Index
< m_Plugins
.size(); Index
++)
556 IUnknown
* Plugin
= m_Plugins
[Index
];
561 // query for IMediaSeeking interface
562 IMediaSeeking
*pSeek
= NULL
;
563 hr
= Plugin
->QueryInterface(IID_IMediaSeeking
, (void**)&pSeek
);
566 // plugin does not support interface
568 OutputDebugStringW(L
"CKsProxy::IsFormatSupported plugin does not support IMediaSeeking interface\n");
572 // query if it is supported
573 hr
= pSeek
->IsFormatSupported(pFormat
);
577 if (FAILED(hr
) || hr
== S_FALSE
)
586 CKsProxy::QueryPreferredFormat(
589 OutputDebugStringW(L
"CKsProxy::QueryPreferredFormat NotImplemented\n");
595 CKsProxy::GetTimeFormat(
598 OutputDebugStringW(L
"CKsProxy::GetTimeFormat NotImplemented\n");
604 CKsProxy::IsUsingTimeFormat(
607 OutputDebugStringW(L
"CKsProxy::IsUsingTimeFormat NotImplemented\n");
613 CKsProxy::SetTimeFormat(
616 OutputDebugStringW(L
"CKsProxy::SetTimeFormat NotImplemented\n");
622 CKsProxy::GetDuration(
625 OutputDebugStringW(L
"CKsProxy::GetDuration NotImplemented\n");
631 CKsProxy::GetStopPosition(
634 OutputDebugStringW(L
"CKsProxy::GetStopPosition NotImplemented\n");
640 CKsProxy::GetCurrentPosition(
643 OutputDebugStringW(L
"CKsProxy::GetCurrentPosition NotImplemented\n");
649 CKsProxy::ConvertTimeFormat(
651 const GUID
*pTargetFormat
,
653 const GUID
*pSourceFormat
)
655 OutputDebugStringW(L
"CKsProxy::ConvertTimeFormat NotImplemented\n");
661 CKsProxy::SetPositions(
663 DWORD dwCurrentFlags
,
667 OutputDebugStringW(L
"CKsProxy::SetPositions NotImplemented\n");
673 CKsProxy::GetPositions(
677 OutputDebugStringW(L
"CKsProxy::GetPositions NotImplemented\n");
683 CKsProxy::GetAvailable(
687 OutputDebugStringW(L
"CKsProxy::GetAvailable NotImplemented\n");
696 OutputDebugStringW(L
"CKsProxy::SetRate NotImplemented\n");
705 OutputDebugStringW(L
"CKsProxy::GetRate NotImplemented\n");
711 CKsProxy::GetPreroll(
712 LONGLONG
*pllPreroll
)
714 OutputDebugStringW(L
"CKsProxy::GetPreroll NotImplemented\n");
718 //-------------------------------------------------------------------
719 // IAMFilterMiscFlags interface
724 CKsProxy::GetMiscFlags()
729 PIN_DIRECTION PinDirection
;
730 KSPIN_COMMUNICATION Communication
;
732 for(Index
= 0; Index
< m_Pins
.size(); Index
++)
735 IPin
* pin
= m_Pins
[Index
];
737 hr
= pin
->QueryDirection(&PinDirection
);
740 if (PinDirection
== PINDIR_INPUT
)
742 if (SUCCEEDED(GetPinCommunication(Index
, //FIXME verify PinId
745 if (Communication
== KSPIN_COMMUNICATION_NONE
|| Communication
== KSPIN_COMMUNICATION_BRIDGE
)
747 Flags
|= AM_FILTER_MISC_FLAGS_IS_SOURCE
;
754 OutputDebugStringW(L
"CKsProxy::GetMiscFlags stub\n");
758 //-------------------------------------------------------------------
763 CKsProxy::KsProperty(
764 PKSPROPERTY Property
,
765 ULONG PropertyLength
,
768 ULONG
* BytesReturned
)
770 assert(m_hDevice
!= 0);
771 return KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_PROPERTY
, (PVOID
)Property
, PropertyLength
, (PVOID
)PropertyData
, DataLength
, BytesReturned
);
781 ULONG
* BytesReturned
)
783 assert(m_hDevice
!= 0);
784 return KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_METHOD
, (PVOID
)Method
, MethodLength
, (PVOID
)MethodData
, DataLength
, BytesReturned
);
794 ULONG
* BytesReturned
)
796 assert(m_hDevice
!= 0);
799 return KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_ENABLE_EVENT
, (PVOID
)Event
, EventLength
, (PVOID
)EventData
, DataLength
, BytesReturned
);
801 return KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_DISABLE_EVENT
, (PVOID
)Event
, EventLength
, NULL
, 0, BytesReturned
);
805 //-------------------------------------------------------------------
813 LPVOID pInstanceData
,
814 DWORD cbInstanceData
,
822 PKSPROPERTY Property
= (PKSPROPERTY
)CoTaskMemAlloc(sizeof(KSPROPERTY
) + cbInstanceData
);
824 return E_OUTOFMEMORY
;
826 Property
->Set
= guidPropSet
;
827 Property
->Id
= dwPropID
;
828 Property
->Flags
= KSPROPERTY_TYPE_SET
;
830 CopyMemory((Property
+1), pInstanceData
, cbInstanceData
);
832 HRESULT hr
= KsProperty(Property
, sizeof(KSPROPERTY
) + cbInstanceData
, pPropData
, cbPropData
, &BytesReturned
);
833 CoTaskMemFree(Property
);
840 Property
.Set
= guidPropSet
;
841 Property
.Id
= dwPropID
;
842 Property
.Flags
= KSPROPERTY_TYPE_SET
;
844 HRESULT hr
= KsProperty(&Property
, sizeof(KSPROPERTY
), pPropData
, cbPropData
, &BytesReturned
);
854 LPVOID pInstanceData
,
855 DWORD cbInstanceData
,
864 PKSPROPERTY Property
= (PKSPROPERTY
)CoTaskMemAlloc(sizeof(KSPROPERTY
) + cbInstanceData
);
866 return E_OUTOFMEMORY
;
868 Property
->Set
= guidPropSet
;
869 Property
->Id
= dwPropID
;
870 Property
->Flags
= KSPROPERTY_TYPE_GET
;
872 CopyMemory((Property
+1), pInstanceData
, cbInstanceData
);
874 HRESULT hr
= KsProperty(Property
, sizeof(KSPROPERTY
) + cbInstanceData
, pPropData
, cbPropData
, &BytesReturned
);
875 CoTaskMemFree(Property
);
882 Property
.Set
= guidPropSet
;
883 Property
.Id
= dwPropID
;
884 Property
.Flags
= KSPROPERTY_TYPE_GET
;
886 HRESULT hr
= KsProperty(&Property
, sizeof(KSPROPERTY
), pPropData
, cbPropData
, &BytesReturned
);
893 CKsProxy::QuerySupported(
901 Property
.Set
= guidPropSet
;
902 Property
.Id
= dwPropID
;
903 Property
.Flags
= KSPROPERTY_TYPE_SETSUPPORT
;
905 return KsProperty(&Property
, sizeof(KSPROPERTY
), pTypeSupport
, sizeof(DWORD
), &BytesReturned
);
909 //-------------------------------------------------------------------
910 // IKsTopology interface
914 CKsProxy::CreateNodeInstance(
917 ACCESS_MASK DesiredAccess
,
922 OutputDebugStringW(L
"CKsProxy::CreateNodeInstance NotImplemented\n");
926 //-------------------------------------------------------------------
927 // IKsAggregateControl interface
931 CKsProxy::KsAddAggregate(
932 IN REFGUID AggregateClass
)
934 OutputDebugStringW(L
"CKsProxy::KsAddAggregate NotImplemented\n");
940 CKsProxy::KsRemoveAggregate(
941 REFGUID AggregateClass
)
943 OutputDebugStringW(L
"CKsProxy::KsRemoveAggregate NotImplemented\n");
948 //-------------------------------------------------------------------
949 // IPersistStream interface
956 OutputDebugStringW(L
"CKsProxy::IsDirty Notimplemented\n");
968 AM_MEDIA_TYPE MediaType
;
973 LPOLESTR pMajor
, pSub
, pFormat
;
975 OutputDebugStringW(L
"CKsProxy::Load\n");
978 ULONG Version
= ReadInt(pStm
, hr
);
983 hr
= pStm
->Read(&Length
, sizeof(ULONG
), &BytesReturned
);
984 swprintf(Buffer
, L
"Length hr %x hr length %lu\n", hr
, Length
);
985 OutputDebugStringW(Buffer
);
989 hr
= pStm
->Read(&PinId
, sizeof(ULONG
), &BytesReturned
);
990 swprintf(Buffer
, L
"Read: hr %08x PinId %lx BytesReturned %lu\n", hr
, PinId
, BytesReturned
);
991 OutputDebugStringW(Buffer
);
993 if (FAILED(hr
) || !BytesReturned
)
996 Length
-= BytesReturned
;
998 hr
= pStm
->Read(&MediaType
, sizeof(AM_MEDIA_TYPE
), &BytesReturned
);
999 if (FAILED(hr
) || BytesReturned
!= sizeof(AM_MEDIA_TYPE
))
1001 swprintf(Buffer
, L
"Read failed with %lx\n", hr
);
1002 OutputDebugStringW(Buffer
);
1007 StringFromIID(MediaType
.majortype
, &pMajor
);
1008 StringFromIID(MediaType
.subtype
, &pSub
);
1009 StringFromIID(MediaType
.formattype
, &pFormat
);
1011 swprintf(Buffer
, L
"BytesReturned %lu majortype %s subtype %s bFixedSizeSamples %u bTemporalCompression %u lSampleSize %u formattype %s, pUnk %p cbFormat %u pbFormat %p\n", BytesReturned
, pMajor
, pSub
, MediaType
.bFixedSizeSamples
, MediaType
.bTemporalCompression
, MediaType
.lSampleSize
, pFormat
, MediaType
.pUnk
, MediaType
.cbFormat
, MediaType
.pbFormat
);
1012 OutputDebugStringW(Buffer
);
1014 Length
-= BytesReturned
;
1017 if (MediaType
.cbFormat
)
1019 MediaType
.pbFormat
= (BYTE
*)CoTaskMemAlloc(MediaType
.cbFormat
);
1020 if (!MediaType
.pbFormat
)
1021 return E_OUTOFMEMORY
;
1023 hr
= pStm
->Read(&MediaType
.pbFormat
, sizeof(MediaType
.cbFormat
), &BytesReturned
);
1026 swprintf(Buffer
, L
"ReadFormat failed with %lx\n", hr
);
1027 OutputDebugStringW(Buffer
);
1030 Length
-= BytesReturned
;
1045 OutputDebugStringW(L
"CKsProxy::Save Notimplemented\n");
1051 CKsProxy::GetSizeMax(
1052 ULARGE_INTEGER
*pcbSize
)
1054 OutputDebugStringW(L
"CKsProxy::GetSizeMax Notimplemented\n");
1059 //-------------------------------------------------------------------
1060 // IAMDeviceRemoval interface
1065 CKsProxy::DeviceInfo(CLSID
*pclsidInterfaceClass
, LPWSTR
*pwszSymbolicLink
)
1069 // object not initialized
1070 return MAKE_HRESULT(SEVERITY_ERROR
, FACILITY_WIN32
, ERROR_FILE_NOT_FOUND
);
1073 // copy device interface guid
1074 CopyMemory(pclsidInterfaceClass
, &m_DeviceInterfaceGUID
, sizeof(GUID
));
1076 if (pwszSymbolicLink
)
1078 *pwszSymbolicLink
= (LPWSTR
)CoTaskMemAlloc((wcslen(m_DevicePath
)+1) * sizeof(WCHAR
));
1079 if (!*pwszSymbolicLink
)
1080 return E_OUTOFMEMORY
;
1082 wcscpy(*pwszSymbolicLink
, m_DevicePath
);
1088 CKsProxy::Reassociate(void)
1090 if (!m_DevicePath
|| m_hDevice
)
1092 // file path not available
1093 return MAKE_HRESULT(SEVERITY_ERROR
, FACILITY_WIN32
, ERROR_FILE_NOT_FOUND
);
1096 m_hDevice
= CreateFileW(m_DevicePath
, GENERIC_READ
| GENERIC_WRITE
, 0, NULL
, OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
| FILE_FLAG_OVERLAPPED
, NULL
);
1099 // failed to open device
1100 return MAKE_HRESULT(SEVERITY_ERROR
, FACILITY_WIN32
, GetLastError());
1109 CKsProxy::Disassociate(void)
1114 CloseHandle(m_hDevice
);
1122 //-------------------------------------------------------------------
1123 // IKsObject interface
1128 CKsProxy::KsGetObjectHandle()
1133 //-------------------------------------------------------------------
1134 // IPersistPropertyBag interface
1138 CKsProxy::InitNew( void)
1145 CKsProxy::GetSupportedSets(
1149 KSPROPERTY Property
;
1151 ULONG NumProperty
= 0;
1152 ULONG NumMethods
= 0;
1153 ULONG NumEvents
= 0;
1155 ULONG BytesReturned
;
1158 Property
.Set
= GUID_NULL
;
1160 Property
.Flags
= KSPROPERTY_TYPE_SETSUPPORT
;
1162 KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_PROPERTY
, (PVOID
)&Property
, sizeof(KSPROPERTY
), NULL
, 0, &NumProperty
);
1163 KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_METHOD
, (PVOID
)&Property
, sizeof(KSPROPERTY
), NULL
, 0, &NumMethods
);
1164 KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_ENABLE_EVENT
, (PVOID
)&Property
, sizeof(KSPROPERTY
), NULL
, 0, &NumEvents
);
1166 Length
= NumProperty
+ NumMethods
+ NumEvents
;
1168 // allocate guid buffer
1169 pGuid
= (LPGUID
)CoTaskMemAlloc(Length
);
1173 return E_OUTOFMEMORY
;
1176 NumProperty
/= sizeof(GUID
);
1177 NumMethods
/= sizeof(GUID
);
1178 NumEvents
/= sizeof(GUID
);
1180 // get all properties
1181 hr
= KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_PROPERTY
, (PVOID
)&Property
, sizeof(KSPROPERTY
), (PVOID
)pGuid
, Length
, &BytesReturned
);
1184 CoTaskMemFree(pGuid
);
1187 Length
-= BytesReturned
;
1192 hr
= KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_METHOD
, (PVOID
)&Property
, sizeof(KSPROPERTY
), (PVOID
)&pGuid
[NumProperty
], Length
, &BytesReturned
);
1195 CoTaskMemFree(pGuid
);
1198 Length
-= BytesReturned
;
1204 hr
= KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_ENABLE_EVENT
, (PVOID
)&Property
, sizeof(KSPROPERTY
), (PVOID
)&pGuid
[NumProperty
+NumMethods
], Length
, &BytesReturned
);
1207 CoTaskMemFree(pGuid
);
1210 Length
-= BytesReturned
;
1213 #ifdef KSPROXY_TRACE
1215 swprintf(Buffer
, L
"NumProperty %lu NumMethods %lu NumEvents %lu\n", NumProperty
, NumMethods
, NumEvents
);
1216 OutputDebugStringW(Buffer
);
1220 *NumGuids
= NumProperty
+NumEvents
+NumMethods
;
1226 CKsProxy::LoadProxyPlugins(
1234 IUnknown
* pUnknown
;
1236 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE
, L
"SYSTEM\\CurrentControlSet\\Control\\MediaInterfaces", 0, KEY_READ
, &hKey
) != ERROR_SUCCESS
)
1238 OutputDebugStringW(L
"CKsProxy::LoadProxyPlugins failed to open MediaInterfaces key\n");
1242 // enumerate all sets
1243 for(Index
= 0; Index
< NumGuids
; Index
++)
1245 // convert to string
1246 hr
= StringFromCLSID(pGuids
[Index
], &pStr
);
1250 // now try open class key
1251 if (RegOpenKeyExW(hKey
, pStr
, 0, KEY_READ
, &hSubKey
) != ERROR_SUCCESS
)
1253 // no plugin for that set exists
1254 CoTaskMemFree(pStr
);
1259 hr
= CoCreateInstance(pGuids
[Index
], (IBaseFilter
*)this, CLSCTX_INPROC_SERVER
, IID_IUnknown
, (void**)&pUnknown
);
1263 m_Plugins
.push_back(pUnknown
);
1266 RegCloseKey(hSubKey
);
1269 // close media interfaces key
1276 CKsProxy::GetNumberOfPins(
1279 KSPROPERTY Property
;
1280 ULONG BytesReturned
;
1283 Property
.Set
= KSPROPSETID_Pin
;
1284 Property
.Id
= KSPROPERTY_PIN_CTYPES
;
1285 Property
.Flags
= KSPROPERTY_TYPE_GET
;
1287 return KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_PROPERTY
, (PVOID
)&Property
, sizeof(KSPROPERTY
), (PVOID
)NumPins
, sizeof(ULONG
), &BytesReturned
);
1292 CKsProxy::GetPinInstanceCount(
1294 PKSPIN_CINSTANCES Instances
)
1297 ULONG BytesReturned
;
1300 Property
.Property
.Set
= KSPROPSETID_Pin
;
1301 Property
.Property
.Id
= KSPROPERTY_PIN_CINSTANCES
;
1302 Property
.Property
.Flags
= KSPROPERTY_TYPE_GET
;
1303 Property
.PinId
= PinId
;
1304 Property
.Reserved
= 0;
1306 return KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_PROPERTY
, (PVOID
)&Property
, sizeof(KSP_PIN
), (PVOID
)Instances
, sizeof(KSPIN_CINSTANCES
), &BytesReturned
);
1311 CKsProxy::GetPinCommunication(
1313 KSPIN_COMMUNICATION
* Communication
)
1316 ULONG BytesReturned
;
1319 Property
.Property
.Set
= KSPROPSETID_Pin
;
1320 Property
.Property
.Id
= KSPROPERTY_PIN_COMMUNICATION
;
1321 Property
.Property
.Flags
= KSPROPERTY_TYPE_GET
;
1322 Property
.PinId
= PinId
;
1323 Property
.Reserved
= 0;
1325 return KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_PROPERTY
, (PVOID
)&Property
, sizeof(KSP_PIN
), (PVOID
)Communication
, sizeof(KSPIN_COMMUNICATION
), &BytesReturned
);
1330 CKsProxy::GetPinDataflow(
1332 KSPIN_DATAFLOW
* DataFlow
)
1335 ULONG BytesReturned
;
1338 Property
.Property
.Set
= KSPROPSETID_Pin
;
1339 Property
.Property
.Id
= KSPROPERTY_PIN_DATAFLOW
;
1340 Property
.Property
.Flags
= KSPROPERTY_TYPE_GET
;
1341 Property
.PinId
= PinId
;
1342 Property
.Reserved
= 0;
1344 return KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_PROPERTY
, (PVOID
)&Property
, sizeof(KSP_PIN
), (PVOID
)DataFlow
, sizeof(KSPIN_DATAFLOW
), &BytesReturned
);
1349 CKsProxy::GetPinName(
1351 KSPIN_DATAFLOW DataFlow
,
1353 LPWSTR
* OutPinName
)
1357 ULONG BytesReturned
;
1362 Property
.Property
.Set
= KSPROPSETID_Pin
;
1363 Property
.Property
.Id
= KSPROPERTY_PIN_NAME
;
1364 Property
.Property
.Flags
= KSPROPERTY_TYPE_GET
;
1365 Property
.PinId
= PinId
;
1366 Property
.Reserved
= 0;
1368 // #1 try get it from pin directly
1369 hr
= KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_PROPERTY
, (PVOID
)&Property
, sizeof(KSP_PIN
), NULL
, 0, &BytesReturned
);
1371 if (hr
== MAKE_HRESULT(SEVERITY_ERROR
, FACILITY_WIN32
, ERROR_MORE_DATA
))
1373 // allocate pin name
1374 PinName
= (LPWSTR
)CoTaskMemAlloc(BytesReturned
);
1376 return E_OUTOFMEMORY
;
1378 // retry with allocated buffer
1379 hr
= KsSynchronousDeviceControl(m_hDevice
, IOCTL_KS_PROPERTY
, (PVOID
)&Property
, sizeof(KSP_PIN
), PinName
, BytesReturned
, &BytesReturned
);
1382 *OutPinName
= PinName
;
1387 CoTaskMemFree(PinName
);
1391 // TODO: retrieve pin name from topology node
1394 if (DataFlow
== KSPIN_DATAFLOW_IN
)
1396 swprintf(Buffer
, L
"Input%lu", PinCount
);
1400 swprintf(Buffer
, L
"Output%lu", PinCount
);
1403 // allocate pin name
1404 PinName
= (LPWSTR
)CoTaskMemAlloc((wcslen(Buffer
)+1) * sizeof(WCHAR
));
1406 return E_OUTOFMEMORY
;
1409 wcscpy(PinName
, Buffer
);
1412 *OutPinName
= PinName
;
1419 CKsProxy::CreatePins()
1421 ULONG NumPins
, Index
;
1422 KSPIN_CINSTANCES Instances
;
1423 KSPIN_DATAFLOW DataFlow
;
1424 KSPIN_COMMUNICATION Communication
;
1430 ULONG OutputPin
= 0;
1432 // get number of pins
1433 hr
= GetNumberOfPins(&NumPins
);
1437 for(Index
= 0; Index
< NumPins
; Index
++)
1439 // query current instance count
1440 hr
= GetPinInstanceCount(Index
, &Instances
);
1444 // query pin communication;
1445 hr
= GetPinCommunication(Index
, &Communication
);
1449 if (Instances
.CurrentCount
== Instances
.PossibleCount
)
1451 // already maximum reached for this pin
1455 // get direction of pin
1456 hr
= GetPinDataflow(Index
, &DataFlow
);
1460 if (DataFlow
== KSPIN_DATAFLOW_IN
)
1461 hr
= GetPinName(Index
, DataFlow
, InputPin
, &PinName
);
1463 hr
= GetPinName(Index
, DataFlow
, OutputPin
, &PinName
);
1468 // construct the pins
1469 if (DataFlow
== KSPIN_DATAFLOW_IN
)
1471 hr
= CInputPin_Constructor((IBaseFilter
*)this, PinName
, m_hDevice
, Index
, Communication
, IID_IPin
, (void**)&pPin
);
1474 CoTaskMemFree(PinName
);
1481 hr
= COutputPin_Constructor((IBaseFilter
*)this, PinName
, Index
, IID_IPin
, (void**)&pPin
);
1484 CoTaskMemFree(PinName
);
1491 m_Pins
.push_back(pPin
);
1493 swprintf(Buffer
, L
"Index %lu DataFlow %lu Name %s\n", Index
, DataFlow
, PinName
);
1494 OutputDebugStringW(Buffer
);
1502 CKsProxy::Load(IPropertyBag
*pPropBag
, IErrorLog
*pErrorLog
)
1510 SP_DEVICE_INTERFACE_DATA DeviceInterfaceData
;
1514 varName
.vt
= VT_BSTR
;
1515 hr
= pPropBag
->Read(L
"DevicePath", &varName
, pErrorLog
);
1519 swprintf(Buffer
, L
"CKsProxy::Load Read %lx\n", hr
);
1520 OutputDebugStringW(Buffer
);
1521 return MAKE_HRESULT(SEVERITY_ERROR
, FACILITY_WIN32
, GetLastError());
1524 // create device list
1525 hList
= SetupDiCreateDeviceInfoListExW(NULL
, NULL
, NULL
, NULL
);
1526 if (hList
== INVALID_HANDLE_VALUE
)
1528 // failed to create device list
1529 return MAKE_HRESULT(SEVERITY_ERROR
, FACILITY_WIN32
, GetLastError());
1532 DeviceInterfaceData
.cbSize
= sizeof(SP_DEVICE_INTERFACE_DATA
);
1533 if (!SetupDiOpenDeviceInterfaceW(hList
, (PCWSTR
)varName
.bstrVal
, 0, &DeviceInterfaceData
))
1535 // failed to open device interface
1536 SetupDiDestroyDeviceInfoList(hList
);
1539 // FIXME handle device interface links(aliases)
1540 CopyMemory(&m_DeviceInterfaceGUID
, &DeviceInterfaceData
.InterfaceClassGuid
, sizeof(GUID
));
1542 // close device info list
1543 SetupDiDestroyDeviceInfoList(hList
);
1546 m_hDevice
= CreateFileW(varName
.bstrVal
, GENERIC_READ
| GENERIC_WRITE
, 0, NULL
, OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
| FILE_FLAG_OVERLAPPED
, NULL
);
1548 if (m_hDevice
== INVALID_HANDLE_VALUE
)
1550 // failed to open device
1551 swprintf(Buffer
, L
"CKsProxy:: failed to open device with %lx\n", GetLastError());
1552 OutputDebugStringW(Buffer
);
1554 return MAKE_HRESULT(SEVERITY_ERROR
, FACILITY_WIN32
, GetLastError());
1557 // store device path
1558 m_DevicePath
= varName
.bstrVal
;
1560 // get all supported sets
1561 hr
= GetSupportedSets(&pGuid
, &NumGuids
);
1564 CloseHandle(m_hDevice
);
1569 // load all proxy plugins
1570 hr
= LoadProxyPlugins(pGuid
, NumGuids
);
1573 CloseHandle(m_hDevice
);
1579 CoTaskMemFree(pGuid
);
1581 // now create the input / output pins
1589 CKsProxy::Save(IPropertyBag
*pPropBag
, BOOL fClearDirty
, BOOL fSaveAllProperties
)
1594 //-------------------------------------------------------------------
1595 // IBaseFilter interface
1600 CKsProxy::GetClassID(
1603 OutputDebugStringW(L
"CKsProxy::GetClassID : NotImplemented\n");
1611 OutputDebugStringW(L
"CKsProxy::Stop : NotImplemented\n");
1619 OutputDebugStringW(L
"CKsProxy::Pause : NotImplemented\n");
1626 REFERENCE_TIME tStart
)
1628 OutputDebugStringW(L
"CKsProxy::Run : NotImplemented\n");
1635 DWORD dwMilliSecsTimeout
,
1636 FILTER_STATE
*State
)
1638 *State
= m_FilterState
;
1644 CKsProxy::SetSyncSource(
1645 IReferenceClock
*pClock
)
1652 if (m_ReferenceClock
)
1654 m_ReferenceClock
->Release();
1657 m_ReferenceClock
= pClock
;
1663 CKsProxy::GetSyncSource(
1664 IReferenceClock
**pClock
)
1669 if (m_ReferenceClock
)
1670 m_ReferenceClock
->AddRef();
1672 *pClock
= m_ReferenceClock
;
1681 return CEnumPins_fnConstructor(m_Pins
, IID_IEnumPins
, (void**)ppEnum
);
1687 LPCWSTR Id
, IPin
**ppPin
)
1695 int ret
= swscanf(Id
, L
"%u", &PinId
);
1697 if (!ret
|| ret
== EOF
)
1700 return VFW_E_NOT_FOUND
;
1703 if (PinId
>= m_Pins
.size() || m_Pins
[PinId
] == NULL
)
1706 return VFW_E_NOT_FOUND
;
1710 *ppPin
= m_Pins
[PinId
];
1711 m_Pins
[PinId
]->AddRef();
1719 CKsProxy::QueryFilterInfo(
1725 pInfo
->achName
[0] = L
'\0';
1726 pInfo
->pGraph
= m_pGraph
;
1733 CKsProxy::JoinFilterGraph(
1734 IFilterGraph
*pGraph
,
1739 // joining filter graph
1754 CKsProxy::QueryVendorInfo(
1755 LPWSTR
*pVendorInfo
)
1757 OutputDebugStringW(L
"CKsProxy::QueryVendorInfo : NotImplemented\n");
1761 //-------------------------------------------------------------------
1762 // IAMovieSetup interface
1767 CKsProxy::Register()
1769 OutputDebugStringW(L
"CKsProxy::Register : NotImplemented\n");
1775 CKsProxy::Unregister()
1777 OutputDebugStringW(L
"CKsProxy::Unregister : NotImplemented\n");
1783 CKsProxy_Constructor(
1784 IUnknown
* pUnkOuter
,
1790 StringFromCLSID(riid
, &pstr
);
1791 swprintf(Buffer
, L
"CKsProxy_Constructor pUnkOuter %p riid %s\n", pUnkOuter
, pstr
);
1792 OutputDebugStringW(Buffer
);
1794 CKsProxy
* handler
= new CKsProxy();
1797 return E_OUTOFMEMORY
;
1799 if (FAILED(handler
->QueryInterface(riid
, ppv
)))
1803 return E_NOINTERFACE
;