- Fix KSPROPSETID_Stream definition
[KSPROXY]
- Implement IKsClockPropertySet, IReferenceClock, IMediaSeeking, IKsTopology interface for CKsProxy
- Implement more of IBaseFilter::SetSyncSource for CKsProxy
- Add missing AddRef to IBaseFilter::QueryFilterInfo for CKsProxy

svn path=/trunk/; revision=46176
This commit is contained in:
Johannes Anderwald 2010-03-13 17:36:30 +00:00
parent 3e3e531b53
commit 472db0e74d
7 changed files with 1200 additions and 84 deletions

View file

@ -140,7 +140,7 @@ public:
HRESULT STDMETHODCALLTYPE CheckFormat(const AM_MEDIA_TYPE *pmt);
HRESULT STDMETHODCALLTYPE CreatePin(const AM_MEDIA_TYPE *pmt);
HRESULT STDMETHODCALLTYPE CreatePinHandle(PKSPIN_MEDIUM Medium, PKSPIN_INTERFACE Interface, const AM_MEDIA_TYPE *pmt);
CInputPin(IBaseFilter * ParentFilter, LPCWSTR PinName, HANDLE hFilter, ULONG PinId, KSPIN_COMMUNICATION Communication) : m_Ref(0), m_ParentFilter(ParentFilter), m_PinName(PinName), m_hFilter(hFilter), m_hPin(0), m_PinId(PinId), m_MemAllocator(0), m_IoCount(0), m_Communication(Communication), m_Pin(0), m_ReadOnly(0){};
CInputPin(IBaseFilter * ParentFilter, LPCWSTR PinName, HANDLE hFilter, ULONG PinId, KSPIN_COMMUNICATION Communication) : m_Ref(0), m_ParentFilter(ParentFilter), m_PinName(PinName), m_hFilter(hFilter), m_hPin(INVALID_HANDLE_VALUE), m_PinId(PinId), m_MemAllocator(0), m_IoCount(0), m_Communication(Communication), m_Pin(0), m_ReadOnly(0){};
virtual ~CInputPin(){};
protected:

View file

@ -33,6 +33,7 @@
<file>interface.cpp</file>
<file>ksproxy.cpp</file>
<file>ksproxy.rc</file>
<file>node.cpp</file>
<file>output_pin.cpp</file>
<file>proxy.cpp</file>
<file>qualityforward.cpp</file>

View file

@ -0,0 +1,157 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS WDM Streaming ActiveMovie Proxy
* FILE: dll/directx/ksproxy/node.cpp
* PURPOSE: Control Node
*
* PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org)
*/
#include "precomp.h"
class CKsNode : public IKsControl
{
public:
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;
}
//IKsControl
HRESULT STDMETHODCALLTYPE KsProperty(PKSPROPERTY Property, ULONG PropertyLength, LPVOID PropertyData, ULONG DataLength, ULONG* BytesReturned);
HRESULT STDMETHODCALLTYPE KsMethod(PKSMETHOD Method, ULONG MethodLength, LPVOID MethodData, ULONG DataLength, ULONG* BytesReturned);
HRESULT STDMETHODCALLTYPE KsEvent(PKSEVENT Event, ULONG EventLength, LPVOID EventData, ULONG DataLength, ULONG* BytesReturned);
CKsNode(IUnknown * pUnkOuter, HANDLE Handle) : m_Ref(0), m_pUnkOuter(pUnkOuter), m_Handle(Handle){};
virtual ~CKsNode()
{
CloseHandle(m_Handle);
};
protected:
LONG m_Ref;
IUnknown * m_pUnkOuter;
HANDLE m_Handle;
};
HRESULT
STDMETHODCALLTYPE
CKsNode::QueryInterface(
IN REFIID refiid,
OUT PVOID* Output)
{
if (IsEqualGUID(refiid, IID_IUnknown) ||
IsEqualGUID(refiid, IID_IKsControl))
{
*Output = PVOID(this);
reinterpret_cast<IUnknown*>(*Output)->AddRef();
return NOERROR;
}
return E_NOINTERFACE;
}
//-------------------------------------------------------------------
// IKsControl
//
HRESULT
STDMETHODCALLTYPE
CKsNode::KsProperty(
PKSPROPERTY Property,
ULONG PropertyLength,
LPVOID PropertyData,
ULONG DataLength,
ULONG* BytesReturned)
{
assert(m_Handle != 0);
return KsSynchronousDeviceControl(m_Handle, IOCTL_KS_PROPERTY, (PVOID)Property, PropertyLength, (PVOID)PropertyData, DataLength, BytesReturned);
}
HRESULT
STDMETHODCALLTYPE
CKsNode::KsMethod(
PKSMETHOD Method,
ULONG MethodLength,
LPVOID MethodData,
ULONG DataLength,
ULONG* BytesReturned)
{
assert(m_Handle != 0);
return KsSynchronousDeviceControl(m_Handle, IOCTL_KS_METHOD, (PVOID)Method, MethodLength, (PVOID)MethodData, DataLength, BytesReturned);
}
HRESULT
STDMETHODCALLTYPE
CKsNode::KsEvent(
PKSEVENT Event,
ULONG EventLength,
LPVOID EventData,
ULONG DataLength,
ULONG* BytesReturned)
{
assert(m_Handle != 0);
if (EventLength)
return KsSynchronousDeviceControl(m_Handle, IOCTL_KS_ENABLE_EVENT, (PVOID)Event, EventLength, (PVOID)EventData, DataLength, BytesReturned);
else
return KsSynchronousDeviceControl(m_Handle, IOCTL_KS_DISABLE_EVENT, (PVOID)Event, EventLength, NULL, 0, BytesReturned);
}
HRESULT
WINAPI
CKsNode_Constructor(
IUnknown * pUnkOuter,
HANDLE ParentHandle,
ULONG NodeId,
ACCESS_MASK DesiredAccess,
REFIID riid,
LPVOID * ppv)
{
HRESULT hr;
HANDLE handle;
KSNODE_CREATE NodeCreate;
OutputDebugStringW(L"CKsNode_Constructor\n");
//setup request
NodeCreate.CreateFlags = 0;
NodeCreate.Node = NodeId;
hr = KsCreateTopologyNode(ParentHandle, &NodeCreate, DesiredAccess, &handle);
if (hr != NOERROR)
{
OutputDebugString("CKsNode_Constructor failed to open device\n");
return MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, hr);
}
CKsNode * quality = new CKsNode(pUnkOuter, handle);
if (!quality)
{
// free clock handle
CloseHandle(handle);
return E_OUTOFMEMORY;
}
if (FAILED(quality->QueryInterface(riid, ppv)))
{
/* not supported */
delete quality;
return E_NOINTERFACE;
}
return NOERROR;
}

View file

@ -123,7 +123,7 @@ COutputPin::~COutputPin()
COutputPin::COutputPin(
IBaseFilter * ParentFilter,
LPCWSTR PinName,
ULONG PinId) : m_Ref(0), m_ParentFilter(ParentFilter), m_PinName(PinName), m_hPin(0), m_PinId(PinId), m_KsObjectParent(0), m_Pin(0)
ULONG PinId) : m_Ref(0), m_ParentFilter(ParentFilter), m_PinName(PinName), m_hPin(INVALID_HANDLE_VALUE), m_PinId(PinId), m_KsObjectParent(0), m_Pin(0)
{
HRESULT hr;

View file

@ -21,6 +21,20 @@
#include <assert.h>
//#include <debug.h>
interface DECLSPEC_UUID("877E4351-6FEA-11D0-B863-00AA00A216A1") IKsClock;
#undef INTERFACE
#define INTERFACE IKsClock
DECLARE_INTERFACE_(IKsClock, IUnknown)
{
STDMETHOD_(HANDLE, KsGetClockHandle)(
THIS
) PURE;
};
typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown* pUnkOuter, REFIID riid, LPVOID* ppvObject);
typedef struct {
@ -139,4 +153,15 @@ CEnumMediaTypes_fnConstructor(
REFIID riid,
LPVOID * ppv);
/* node.cpp */
HRESULT
WINAPI
CKsNode_Constructor(
IUnknown * pUnkOuter,
HANDLE ParentHandle,
ULONG NodeId,
ACCESS_MASK DesiredAccess,
REFIID riid,
LPVOID * ppv);
extern const GUID IID_IKsObject;

File diff suppressed because it is too large Load diff

View file

@ -724,8 +724,10 @@ typedef enum
Properties/Methods/Events
*/
#define KSPROPSETID_Stream \
#define STATIC_KSPROPSETID_Stream\
0x65aaba60L, 0x98ae, 0x11cf, 0xa1, 0x0d, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4
DEFINE_GUIDSTRUCT("65aaba60-98ae-11cf-a10d-0020afd156e4", KSPROPSETID_Stream);
#define KSPROPSETID_Stream DEFINE_GUIDNAMED(KSPROPSETID_Stream)
typedef enum
{
@ -2091,7 +2093,7 @@ typedef struct {
typedef struct _KSEVENT_ENTRY KSEVENT_ENTRY, *PKSEVENT_ENTRY;
#if defined(_NTDDK_)
typedef NTSTATUS (NTAPI *PFNKSADDEVENT)(
IN PIRP Irp,
IN PKSEVENTDATA EventData,