mirror of
https://github.com/reactos/reactos.git
synced 2025-05-27 21:18:15 +00:00
[KSPROXY]
- Implement IPersistPropertyBag interface - Implement IKsObject interface - Implement enumerating supported property/method/event set from driver and loading the corresponding ksproxy plugins svn path=/trunk/; revision=45759
This commit is contained in:
parent
715db25ce6
commit
26a4722d68
10 changed files with 533 additions and 31 deletions
|
@ -8,8 +8,6 @@
|
||||||
*/
|
*/
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
const GUID IID_IBasicAudio = {0x56a868b3, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
|
||||||
|
|
||||||
class CKsBasicAudio : public IBasicAudio,
|
class CKsBasicAudio : public IBasicAudio,
|
||||||
public IDistributorNotify
|
public IDistributorNotify
|
||||||
{
|
{
|
||||||
|
@ -99,7 +97,7 @@ HRESULT
|
||||||
STDMETHODCALLTYPE
|
STDMETHODCALLTYPE
|
||||||
CKsBasicAudio::Stop()
|
CKsBasicAudio::Stop()
|
||||||
{
|
{
|
||||||
OutputDebugString("UNIMPLEMENTED\n");
|
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +105,7 @@ HRESULT
|
||||||
STDMETHODCALLTYPE
|
STDMETHODCALLTYPE
|
||||||
CKsBasicAudio::Pause()
|
CKsBasicAudio::Pause()
|
||||||
{
|
{
|
||||||
OutputDebugString("UNIMPLEMENTED\n");
|
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +114,7 @@ STDMETHODCALLTYPE
|
||||||
CKsBasicAudio::Run(
|
CKsBasicAudio::Run(
|
||||||
REFERENCE_TIME tStart)
|
REFERENCE_TIME tStart)
|
||||||
{
|
{
|
||||||
OutputDebugString("UNIMPLEMENTED\n");
|
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +123,7 @@ STDMETHODCALLTYPE
|
||||||
CKsBasicAudio::SetSyncSource(
|
CKsBasicAudio::SetSyncSource(
|
||||||
IReferenceClock *pClock)
|
IReferenceClock *pClock)
|
||||||
{
|
{
|
||||||
OutputDebugString("UNIMPLEMENTED\n");
|
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +131,7 @@ HRESULT
|
||||||
STDMETHODCALLTYPE
|
STDMETHODCALLTYPE
|
||||||
CKsBasicAudio::NotifyGraphChange()
|
CKsBasicAudio::NotifyGraphChange()
|
||||||
{
|
{
|
||||||
OutputDebugString("UNIMPLEMENTED\n");
|
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +144,7 @@ STDMETHODCALLTYPE
|
||||||
CKsBasicAudio::GetTypeInfoCount(
|
CKsBasicAudio::GetTypeInfoCount(
|
||||||
UINT *pctinfo)
|
UINT *pctinfo)
|
||||||
{
|
{
|
||||||
OutputDebugString("UNIMPLEMENTED\n");
|
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +155,7 @@ CKsBasicAudio::GetTypeInfo(
|
||||||
LCID lcid,
|
LCID lcid,
|
||||||
ITypeInfo **ppTInfo)
|
ITypeInfo **ppTInfo)
|
||||||
{
|
{
|
||||||
OutputDebugString("UNIMPLEMENTED\n");
|
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +168,7 @@ CKsBasicAudio::GetIDsOfNames(
|
||||||
LCID lcid,
|
LCID lcid,
|
||||||
DISPID *rgDispId)
|
DISPID *rgDispId)
|
||||||
{
|
{
|
||||||
OutputDebugString("UNIMPLEMENTED\n");
|
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +184,7 @@ CKsBasicAudio::Invoke(
|
||||||
EXCEPINFO *pExcepInfo,
|
EXCEPINFO *pExcepInfo,
|
||||||
UINT *puArgErr)
|
UINT *puArgErr)
|
||||||
{
|
{
|
||||||
OutputDebugString("UNIMPLEMENTED\n");
|
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +197,7 @@ STDMETHODCALLTYPE
|
||||||
CKsBasicAudio::put_Volume(
|
CKsBasicAudio::put_Volume(
|
||||||
long lVolume)
|
long lVolume)
|
||||||
{
|
{
|
||||||
OutputDebugString("UNIMPLEMENTED\n");
|
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +207,7 @@ STDMETHODCALLTYPE
|
||||||
CKsBasicAudio::get_Volume(
|
CKsBasicAudio::get_Volume(
|
||||||
long *plVolume)
|
long *plVolume)
|
||||||
{
|
{
|
||||||
OutputDebugString("UNIMPLEMENTED\n");
|
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +217,7 @@ STDMETHODCALLTYPE
|
||||||
CKsBasicAudio::put_Balance(
|
CKsBasicAudio::put_Balance(
|
||||||
long lBalance)
|
long lBalance)
|
||||||
{
|
{
|
||||||
OutputDebugString("UNIMPLEMENTED\n");
|
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +227,7 @@ STDMETHODCALLTYPE
|
||||||
CKsBasicAudio::get_Balance(
|
CKsBasicAudio::get_Balance(
|
||||||
long *plBalance)
|
long *plBalance)
|
||||||
{
|
{
|
||||||
OutputDebugString("UNIMPLEMENTED\n");
|
OutputDebugStringW(L"UNIMPLEMENTED\n");
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,6 +238,8 @@ CKsBasicAudio_Constructor(
|
||||||
REFIID riid,
|
REFIID riid,
|
||||||
LPVOID * ppv)
|
LPVOID * ppv)
|
||||||
{
|
{
|
||||||
|
OutputDebugStringW(L"CKsBasicAudio_Constructor\n");
|
||||||
|
|
||||||
CKsBasicAudio * handler = new CKsBasicAudio();
|
CKsBasicAudio * handler = new CKsBasicAudio();
|
||||||
|
|
||||||
if (!handler)
|
if (!handler)
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
*/
|
*/
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
const GUID IID_IDistributorNotify = {0x56a868af, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
|
|
||||||
const GUID KSCATEGORY_CLOCK = {0x53172480, 0x4791, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
|
const GUID KSCATEGORY_CLOCK = {0x53172480, 0x4791, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
|
||||||
|
|
||||||
class CKsClockForwarder : public IDistributorNotify,
|
class CKsClockForwarder : public IDistributorNotify,
|
||||||
|
@ -158,6 +157,8 @@ CKsClockForwarder_Constructor(
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
|
|
||||||
|
OutputDebugStringW(L"CKsClockForwarder_Constructor\n");
|
||||||
|
|
||||||
// open default clock
|
// open default clock
|
||||||
hr = KsOpenDefaultDevice(KSCATEGORY_CLOCK, GENERIC_READ | GENERIC_WRITE, &handle);
|
hr = KsOpenDefaultDevice(KSCATEGORY_CLOCK, GENERIC_READ | GENERIC_WRITE, &handle);
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
*/
|
*/
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
const GUID IID_IVPConfig = {0xbc29a660, 0x30e3, 0x11d0, {0x9e, 0x69, 0x0, 0xc0, 0x4f, 0xd7, 0xc1, 0x5b}};
|
|
||||||
|
|
||||||
class CVPConfig : public IVPConfig,
|
class CVPConfig : public IVPConfig,
|
||||||
public IDistributorNotify
|
public IDistributorNotify
|
||||||
{
|
{
|
||||||
|
@ -302,6 +300,8 @@ CVPConfig_Constructor(
|
||||||
REFIID riid,
|
REFIID riid,
|
||||||
LPVOID * ppv)
|
LPVOID * ppv)
|
||||||
{
|
{
|
||||||
|
OutputDebugStringW(L"CVPConfig_Constructor\n");
|
||||||
|
|
||||||
CVPConfig * handler = new CVPConfig();
|
CVPConfig * handler = new CVPConfig();
|
||||||
|
|
||||||
if (!handler)
|
if (!handler)
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
*/
|
*/
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
const GUID IID_IVPVBIConfig = {0xec529b00, 0x1a1f, 0x11d1, {0xba, 0xd9, 0x0, 0x60, 0x97, 0x44, 0x11, 0x1a}};
|
|
||||||
|
|
||||||
class CVPVBIConfig : public IVPVBIConfig,
|
class CVPVBIConfig : public IVPVBIConfig,
|
||||||
public IDistributorNotify
|
public IDistributorNotify
|
||||||
{
|
{
|
||||||
|
@ -274,6 +272,8 @@ CVPVBIConfig_Constructor(
|
||||||
REFIID riid,
|
REFIID riid,
|
||||||
LPVOID * ppv)
|
LPVOID * ppv)
|
||||||
{
|
{
|
||||||
|
OutputDebugStringW(L"CVPVBIConfig_Constructor\n");
|
||||||
|
|
||||||
CVPVBIConfig * handler = new CVPVBIConfig();
|
CVPVBIConfig * handler = new CVPVBIConfig();
|
||||||
|
|
||||||
if (!handler)
|
if (!handler)
|
||||||
|
|
|
@ -11,9 +11,6 @@
|
||||||
/* FIXME guid mess */
|
/* FIXME guid mess */
|
||||||
const GUID IID_IUnknown = {0x00000000, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
|
const GUID IID_IUnknown = {0x00000000, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
|
||||||
const GUID IID_IClassFactory = {0x00000001, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
|
const GUID IID_IClassFactory = {0x00000001, 0x0000, 0x0000, {0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
|
||||||
const GUID IID_IKsDataTypeHandler = {0x5FFBAA02, 0x49A3, 0x11D0, {0x9F, 0x36, 0x00, 0xAA, 0x00, 0xA2, 0x16, 0xA1}};
|
|
||||||
const GUID MEDIATYPE_Audio = {0x73647561, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
|
|
||||||
|
|
||||||
|
|
||||||
class CKsDataTypeHandler : public IKsDataTypeHandler
|
class CKsDataTypeHandler : public IKsDataTypeHandler
|
||||||
{
|
{
|
||||||
|
@ -138,6 +135,8 @@ CKsDataTypeHandler_Constructor (
|
||||||
REFIID riid,
|
REFIID riid,
|
||||||
LPVOID * ppv)
|
LPVOID * ppv)
|
||||||
{
|
{
|
||||||
|
OutputDebugStringW(L"CKsDataTypeHandler_Constructor\n");
|
||||||
|
|
||||||
CKsDataTypeHandler * handler = new CKsDataTypeHandler();
|
CKsDataTypeHandler * handler = new CKsDataTypeHandler();
|
||||||
|
|
||||||
if (!handler)
|
if (!handler)
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
*/
|
*/
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
const GUID IID_IKsInterfaceHandler = {0xD3ABC7E0, 0x9A61, 0x11D0, {0xA4, 0x0D, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
|
|
||||||
const GUID IID_IKsObject = {0x423c13a2, 0x2070, 0x11d0, {0x9e, 0xf7, 0x00, 0xaa, 0x00, 0xa2, 0x16, 0xa1}};
|
const GUID IID_IKsObject = {0x423c13a2, 0x2070, 0x11d0, {0x9e, 0xf7, 0x00, 0xaa, 0x00, 0xa2, 0x16, 0xa1}};
|
||||||
|
|
||||||
class CKsInterfaceHandler : public IKsInterfaceHandler
|
class CKsInterfaceHandler : public IKsInterfaceHandler
|
||||||
|
@ -119,6 +118,8 @@ CKsInterfaceHandler_Constructor(
|
||||||
REFIID riid,
|
REFIID riid,
|
||||||
LPVOID * ppv)
|
LPVOID * ppv)
|
||||||
{
|
{
|
||||||
|
OutputDebugStringW(L"CKsInterfaceHandler_Constructor\n");
|
||||||
|
|
||||||
CKsInterfaceHandler * handler = new CKsInterfaceHandler();
|
CKsInterfaceHandler * handler = new CKsInterfaceHandler();
|
||||||
|
|
||||||
if (!handler)
|
if (!handler)
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<library>ole32</library>
|
<library>ole32</library>
|
||||||
<library>setupapi</library>
|
<library>setupapi</library>
|
||||||
<library>msvcrt</library>
|
<library>msvcrt</library>
|
||||||
|
<library>strmiids</library>
|
||||||
<group compilerset="gcc">
|
<group compilerset="gcc">
|
||||||
<compilerflag compiler="cxx">-fno-exceptions</compilerflag>
|
<compilerflag compiler="cxx">-fno-exceptions</compilerflag>
|
||||||
<compilerflag compiler="cxx">-fno-rtti</compilerflag>
|
<compilerflag compiler="cxx">-fno-rtti</compilerflag>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#define _FORCENAMELESSUNION
|
||||||
#define BUILDING_KS
|
#define BUILDING_KS
|
||||||
#define _KSDDK_
|
#define _KSDDK_
|
||||||
#include <dshow.h>
|
#include <dshow.h>
|
||||||
|
@ -14,8 +15,8 @@
|
||||||
#include <dvp.h>
|
#include <dvp.h>
|
||||||
#include <vptype.h>
|
#include <vptype.h>
|
||||||
#include <vpconfig.h>
|
#include <vpconfig.h>
|
||||||
|
|
||||||
#include <setupapi.h>
|
#include <setupapi.h>
|
||||||
|
#include <vector>
|
||||||
//#include <debug.h>
|
//#include <debug.h>
|
||||||
|
|
||||||
typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown* pUnkOuter, REFIID riid, LPVOID* ppvObject);
|
typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown* pUnkOuter, REFIID riid, LPVOID* ppvObject);
|
||||||
|
|
|
@ -8,15 +8,20 @@
|
||||||
*/
|
*/
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
|
const GUID IID_IPersistPropertyBag = {0x37D84F60, 0x42CB, 0x11CE, {0x81, 0x35, 0x00, 0xAA, 0x00, 0x4B, 0xB8, 0x51}};
|
||||||
|
const GUID GUID_NULL = {0x00000000L, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Needs IKsClock, IKsNotifyEvent
|
Needs IKsClock, IKsNotifyEvent
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CKsProxy : public IBaseFilter,
|
class CKsProxy : public IBaseFilter,
|
||||||
public IAMovieSetup,
|
public IAMovieSetup,
|
||||||
|
public IPersistPropertyBag,
|
||||||
|
public IKsObject
|
||||||
|
/*
|
||||||
public IPersistStream,
|
public IPersistStream,
|
||||||
public ISpecifyPropertyPages,
|
public ISpecifyPropertyPages,
|
||||||
public IPersistPropertyBag,
|
|
||||||
public IReferenceClock,
|
public IReferenceClock,
|
||||||
public IMediaSeeking,
|
public IMediaSeeking,
|
||||||
public IKsObject,
|
public IKsObject,
|
||||||
|
@ -27,12 +32,490 @@ class CKsProxy : public IBaseFilter,
|
||||||
public IKsTopology,
|
public IKsTopology,
|
||||||
public IKsAggregateControl,
|
public IKsAggregateControl,
|
||||||
public IAMDeviceRemoval
|
public IAMDeviceRemoval
|
||||||
|
*/
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
typedef std::vector<IUnknown *>ProxyPluginVector;
|
||||||
|
|
||||||
|
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
|
||||||
|
|
||||||
|
STDMETHODIMP_(ULONG) AddRef()
|
||||||
|
{
|
||||||
|
InterlockedIncrement(&m_Ref);
|
||||||
|
return m_Ref;
|
||||||
|
}
|
||||||
|
STDMETHODIMP_(ULONG) Release()
|
||||||
|
{
|
||||||
|
InterlockedDecrement(&m_Ref);
|
||||||
|
if (!m_Ref)
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return m_Ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
// IBaseFilter methods
|
||||||
|
HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
|
||||||
|
HRESULT STDMETHODCALLTYPE Stop( void);
|
||||||
|
HRESULT STDMETHODCALLTYPE Pause( void);
|
||||||
|
HRESULT STDMETHODCALLTYPE Run(REFERENCE_TIME tStart);
|
||||||
|
HRESULT STDMETHODCALLTYPE GetState(DWORD dwMilliSecsTimeout, FILTER_STATE *State);
|
||||||
|
HRESULT STDMETHODCALLTYPE SetSyncSource(IReferenceClock *pClock);
|
||||||
|
HRESULT STDMETHODCALLTYPE GetSyncSource(IReferenceClock **pClock);
|
||||||
|
HRESULT STDMETHODCALLTYPE EnumPins(IEnumPins **ppEnum);
|
||||||
|
HRESULT STDMETHODCALLTYPE FindPin(LPCWSTR Id, IPin **ppPin);
|
||||||
|
HRESULT STDMETHODCALLTYPE QueryFilterInfo(FILTER_INFO *pInfo);
|
||||||
|
HRESULT STDMETHODCALLTYPE JoinFilterGraph(IFilterGraph *pGraph, LPCWSTR pName);
|
||||||
|
HRESULT STDMETHODCALLTYPE QueryVendorInfo(LPWSTR *pVendorInfo);
|
||||||
|
|
||||||
|
//IAMovieSetup methods
|
||||||
|
HRESULT STDMETHODCALLTYPE Register( void);
|
||||||
|
HRESULT STDMETHODCALLTYPE Unregister( void);
|
||||||
|
|
||||||
|
// IPersistPropertyBag methods
|
||||||
|
HRESULT STDMETHODCALLTYPE InitNew( void);
|
||||||
|
HRESULT STDMETHODCALLTYPE Load(IPropertyBag *pPropBag, IErrorLog *pErrorLog);
|
||||||
|
HRESULT STDMETHODCALLTYPE Save(IPropertyBag *pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties);
|
||||||
|
|
||||||
|
// IKsObject
|
||||||
|
HANDLE STDMETHODCALLTYPE KsGetObjectHandle();
|
||||||
|
|
||||||
|
CKsProxy() : m_Ref(0), m_pGraph(0), m_ReferenceClock(0), m_FilterState(State_Stopped), m_hDevice(0), m_Plugins(0) {};
|
||||||
|
virtual ~CKsProxy()
|
||||||
|
{
|
||||||
|
if (m_hDevice)
|
||||||
|
CloseHandle(m_hDevice);
|
||||||
|
};
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE GetSupportedSets(LPGUID * pOutGuid, PULONG NumGuids);
|
||||||
|
HRESULT STDMETHODCALLTYPE LoadProxyPlugins(LPGUID pGuids, ULONG NumGuids);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
LONG m_Ref;
|
||||||
|
IFilterGraph *m_pGraph;
|
||||||
|
IReferenceClock * m_ReferenceClock;
|
||||||
|
FILTER_STATE m_FilterState;
|
||||||
|
HANDLE m_hDevice;
|
||||||
|
ProxyPluginVector m_Plugins;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::QueryInterface(
|
||||||
|
IN REFIID refiid,
|
||||||
|
OUT PVOID* Output)
|
||||||
|
{
|
||||||
|
*Output = NULL;
|
||||||
|
|
||||||
|
if (IsEqualGUID(refiid, IID_IUnknown) ||
|
||||||
|
IsEqualGUID(refiid, IID_IBaseFilter))
|
||||||
|
{
|
||||||
|
*Output = PVOID(this);
|
||||||
|
reinterpret_cast<IUnknown*>(*Output)->AddRef();
|
||||||
|
return NOERROR;
|
||||||
|
}
|
||||||
|
else if (IsEqualGUID(refiid, IID_IPersistPropertyBag))
|
||||||
|
{
|
||||||
|
*Output = (IPersistPropertyBag*)(this);
|
||||||
|
reinterpret_cast<IPersistPropertyBag*>(*Output)->AddRef();
|
||||||
|
return NOERROR;
|
||||||
|
}
|
||||||
|
if (IsEqualGUID(refiid, IID_IKsObject))
|
||||||
|
{
|
||||||
|
*Output = (IKsObject*)(this);
|
||||||
|
reinterpret_cast<IKsObject*>(*Output)->AddRef();
|
||||||
|
return NOERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
WCHAR Buffer[MAX_PATH];
|
||||||
|
LPOLESTR lpstr;
|
||||||
|
StringFromCLSID(refiid, &lpstr);
|
||||||
|
swprintf(Buffer, L"CKsProxy::QueryInterface: NoInterface for %s !!!\n", lpstr);
|
||||||
|
OutputDebugStringW(Buffer);
|
||||||
|
CoTaskMemFree(lpstr);
|
||||||
|
|
||||||
|
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// IKsObject interface
|
||||||
|
//
|
||||||
|
|
||||||
|
HANDLE
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::KsGetObjectHandle()
|
||||||
|
{
|
||||||
|
return m_hDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// IPersistPropertyBag interface
|
||||||
|
//
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::InitNew( void)
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::GetSupportedSets(
|
||||||
|
LPGUID * pOutGuid,
|
||||||
|
PULONG NumGuids)
|
||||||
|
{
|
||||||
|
KSPROPERTY Property;
|
||||||
|
LPGUID pGuid;
|
||||||
|
ULONG NumProperty = 0;
|
||||||
|
ULONG NumMethods = 0;
|
||||||
|
ULONG NumEvents = 0;
|
||||||
|
ULONG Length;
|
||||||
|
ULONG BytesReturned;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
Property.Set = GUID_NULL;
|
||||||
|
Property.Id = 0;
|
||||||
|
Property.Flags = KSPROPERTY_TYPE_SETSUPPORT;
|
||||||
|
|
||||||
|
KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), NULL, 0, &NumProperty);
|
||||||
|
KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_METHOD, (PVOID)&Property, sizeof(KSPROPERTY), NULL, 0, &NumMethods);
|
||||||
|
KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_ENABLE_EVENT, (PVOID)&Property, sizeof(KSPROPERTY), NULL, 0, &NumEvents);
|
||||||
|
|
||||||
|
Length = NumProperty + NumMethods + NumEvents;
|
||||||
|
|
||||||
|
// allocate guid buffer
|
||||||
|
pGuid = (LPGUID)CoTaskMemAlloc(Length);
|
||||||
|
if (!pGuid)
|
||||||
|
{
|
||||||
|
// failed
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
NumProperty /= sizeof(GUID);
|
||||||
|
NumMethods /= sizeof(GUID);
|
||||||
|
NumEvents /= sizeof(GUID);
|
||||||
|
|
||||||
|
// get all properties
|
||||||
|
hr = KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)pGuid, Length, &BytesReturned);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
CoTaskMemFree(pGuid);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
Length -= BytesReturned;
|
||||||
|
|
||||||
|
// get all methods
|
||||||
|
if (Length)
|
||||||
|
{
|
||||||
|
hr = KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_METHOD, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)&pGuid[NumProperty], Length, &BytesReturned);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
CoTaskMemFree(pGuid);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
Length -= BytesReturned;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get all events
|
||||||
|
if (Length)
|
||||||
|
{
|
||||||
|
hr = KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_ENABLE_EVENT, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)&pGuid[NumProperty+NumMethods], Length, &BytesReturned);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
CoTaskMemFree(pGuid);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
Length -= BytesReturned;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef KSPROXY_TRACE
|
||||||
|
WCHAR Buffer[200];
|
||||||
|
swprintf(Buffer, L"NumProperty %lu NumMethods %lu NumEvents %lu\n", NumProperty, NumMethods, NumEvents);
|
||||||
|
OutputDebugStringW(Buffer);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
*pOutGuid = pGuid;
|
||||||
|
*NumGuids = NumProperty+NumEvents+NumMethods;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::LoadProxyPlugins(
|
||||||
|
LPGUID pGuids,
|
||||||
|
ULONG NumGuids)
|
||||||
|
{
|
||||||
|
ULONG Index;
|
||||||
|
LPOLESTR pStr;
|
||||||
|
HKEY hKey, hSubKey;
|
||||||
|
HRESULT hr;
|
||||||
|
IUnknown * pUnknown;
|
||||||
|
|
||||||
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\MediaInterfaces", 0, KEY_READ, &hKey) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
OutputDebugStringW(L"CKsProxy::LoadProxyPlugins failed to open MediaInterfaces key\n");
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// enumerate all sets
|
||||||
|
for(Index = 0; Index < NumGuids; Index++)
|
||||||
|
{
|
||||||
|
// convert to string
|
||||||
|
hr = StringFromCLSID(pGuids[Index], &pStr);
|
||||||
|
if (FAILED(hr))
|
||||||
|
return E_FAIL;
|
||||||
|
|
||||||
|
// now try open class key
|
||||||
|
if (RegOpenKeyExW(hKey, pStr, 0, KEY_READ, &hSubKey) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
// no plugin for that set exists
|
||||||
|
CoTaskMemFree(pStr);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// try load plugin
|
||||||
|
hr = CoCreateInstance(pGuids[Index], (IBaseFilter*)this, CLSCTX_INPROC_SERVER, IID_IUnknown, (void**)&pUnknown);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
// store plugin
|
||||||
|
m_Plugins.push_back(pUnknown);
|
||||||
|
}
|
||||||
|
// close key
|
||||||
|
RegCloseKey(hSubKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
// close media interfaces key
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::Load(IPropertyBag *pPropBag, IErrorLog *pErrorLog)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
WCHAR Buffer[100];
|
||||||
|
VARIANT varName;
|
||||||
|
LPGUID pGuid;
|
||||||
|
ULONG NumGuids = 0;
|
||||||
|
|
||||||
|
// read device path
|
||||||
|
varName.vt = VT_BSTR;
|
||||||
|
hr = pPropBag->Read(L"DevicePath", &varName, pErrorLog);
|
||||||
|
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
swprintf(Buffer, L"CKsProxy::Load Read %lx\n", hr);
|
||||||
|
OutputDebugStringW(Buffer);
|
||||||
|
return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, GetLastError());
|
||||||
|
}
|
||||||
|
|
||||||
|
// open device
|
||||||
|
m_hDevice = CreateFileW(varName.bstrVal, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
|
||||||
|
|
||||||
|
if (m_hDevice == INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
// failed to open device
|
||||||
|
swprintf(Buffer, L"CKsProxy:: failed to open device with %lx\n", GetLastError());
|
||||||
|
OutputDebugStringW(Buffer);
|
||||||
|
|
||||||
|
return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, GetLastError());
|
||||||
|
}
|
||||||
|
|
||||||
|
// get all supported sets
|
||||||
|
hr = GetSupportedSets(&pGuid, &NumGuids);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
CloseHandle(m_hDevice);
|
||||||
|
m_hDevice = NULL;
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// load all proxy plugins
|
||||||
|
hr = LoadProxyPlugins(pGuid, NumGuids);
|
||||||
|
|
||||||
|
CloseHandle(m_hDevice);
|
||||||
|
m_hDevice = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::Save(IPropertyBag *pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties)
|
||||||
|
{
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// IBaseFilter interface
|
||||||
|
//
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::GetClassID(
|
||||||
|
CLSID *pClassID)
|
||||||
|
{
|
||||||
|
OutputDebugStringW(L"CKsProxy::GetClassID : NotImplemented\n");
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::Stop()
|
||||||
|
{
|
||||||
|
OutputDebugStringW(L"CKsProxy::Stop : NotImplemented\n");
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::Pause()
|
||||||
|
{
|
||||||
|
OutputDebugStringW(L"CKsProxy::Pause : NotImplemented\n");
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::Run(
|
||||||
|
REFERENCE_TIME tStart)
|
||||||
|
{
|
||||||
|
OutputDebugStringW(L"CKsProxy::Run : NotImplemented\n");
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::GetState(
|
||||||
|
DWORD dwMilliSecsTimeout,
|
||||||
|
FILTER_STATE *State)
|
||||||
|
{
|
||||||
|
*State = m_FilterState;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::SetSyncSource(
|
||||||
|
IReferenceClock *pClock)
|
||||||
|
{
|
||||||
|
if (pClock)
|
||||||
|
{
|
||||||
|
pClock->AddRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_ReferenceClock)
|
||||||
|
{
|
||||||
|
m_ReferenceClock->Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ReferenceClock = pClock;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::GetSyncSource(
|
||||||
|
IReferenceClock **pClock)
|
||||||
|
{
|
||||||
|
if (!pClock)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
|
if (m_ReferenceClock)
|
||||||
|
m_ReferenceClock->AddRef();
|
||||||
|
|
||||||
|
*pClock = m_ReferenceClock;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::EnumPins(
|
||||||
|
IEnumPins **ppEnum)
|
||||||
|
{
|
||||||
|
OutputDebugStringW(L"CKsProxy::EnumPins : NotImplemented\n");
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::FindPin(
|
||||||
|
LPCWSTR Id, IPin **ppPin)
|
||||||
|
{
|
||||||
|
OutputDebugStringW(L"CKsProxy::FindPin : NotImplemented\n");
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::QueryFilterInfo(
|
||||||
|
FILTER_INFO *pInfo)
|
||||||
|
{
|
||||||
|
if (!pInfo)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
|
pInfo->achName[0] = L'\0';
|
||||||
|
pInfo->pGraph = m_pGraph;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::JoinFilterGraph(
|
||||||
|
IFilterGraph *pGraph,
|
||||||
|
LPCWSTR pName)
|
||||||
|
{
|
||||||
|
if (pGraph)
|
||||||
|
{
|
||||||
|
// joining filter graph
|
||||||
|
m_pGraph = pGraph;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// leaving graph
|
||||||
|
m_pGraph = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputDebugStringW(L"CKsProxy::JoinFilterGraph\n");
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::QueryVendorInfo(
|
||||||
|
LPWSTR *pVendorInfo)
|
||||||
|
{
|
||||||
|
OutputDebugStringW(L"CKsProxy::QueryVendorInfo : NotImplemented\n");
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// IAMovieSetup interface
|
||||||
|
//
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::Register()
|
||||||
|
{
|
||||||
|
OutputDebugStringW(L"CKsProxy::Register : NotImplemented\n");
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT
|
||||||
|
STDMETHODCALLTYPE
|
||||||
|
CKsProxy::Unregister()
|
||||||
|
{
|
||||||
|
OutputDebugStringW(L"CKsProxy::Unregister : NotImplemented\n");
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
WINAPI
|
WINAPI
|
||||||
|
@ -41,6 +524,23 @@ CKsProxy_Constructor(
|
||||||
REFIID riid,
|
REFIID riid,
|
||||||
LPVOID * ppv)
|
LPVOID * ppv)
|
||||||
{
|
{
|
||||||
OutputDebugString("CKsProxy_Constructor UNIMPLEMENTED\n");
|
WCHAR Buffer[100];
|
||||||
return E_NOTIMPL;
|
LPOLESTR pstr;
|
||||||
|
StringFromCLSID(riid, &pstr);
|
||||||
|
swprintf(Buffer, L"CKsProxy_Constructor pUnkOuter %p riid %s\n", pUnkOuter, pstr);
|
||||||
|
OutputDebugStringW(Buffer);
|
||||||
|
|
||||||
|
CKsProxy * handler = new CKsProxy();
|
||||||
|
|
||||||
|
if (!handler)
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
if (FAILED(handler->QueryInterface(riid, ppv)))
|
||||||
|
{
|
||||||
|
/* not supported */
|
||||||
|
delete handler;
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,8 +87,6 @@ CKsQualityForwarder::KsFlushClient(
|
||||||
OutputDebugString("UNIMPLEMENTED\n");
|
OutputDebugString("UNIMPLEMENTED\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
WINAPI
|
WINAPI
|
||||||
CKsQualityForwarder_Constructor(
|
CKsQualityForwarder_Constructor(
|
||||||
|
@ -99,6 +97,8 @@ CKsQualityForwarder_Constructor(
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
|
|
||||||
|
OutputDebugStringW(L"CKsQualityForwarder_Constructor\n");
|
||||||
|
|
||||||
// open default clock
|
// open default clock
|
||||||
hr = KsOpenDefaultDevice(KSCATEGORY_QUALITY, GENERIC_READ | GENERIC_WRITE, &handle);
|
hr = KsOpenDefaultDevice(KSCATEGORY_QUALITY, GENERIC_READ | GENERIC_WRITE, &handle);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue