ReactOS 0.4.15-dev-7924-g5949c20
CKsDataTypeHandler Class Reference
Inheritance diagram for CKsDataTypeHandler:
Collaboration diagram for CKsDataTypeHandler:

Public Member Functions

STDMETHODIMP QueryInterface (REFIID InterfaceId, PVOID *Interface)
 
 STDMETHODIMP_ (ULONG) AddRef()
 
 STDMETHODIMP_ (ULONG) Release()
 
HRESULT STDMETHODCALLTYPE KsCompleteIoOperation (IN OUT IMediaSample *Sample, IN OUT PVOID StreamHeader, IN KSIOOPERATION IoOperation, IN BOOL Cancelled)
 
HRESULT STDMETHODCALLTYPE KsIsMediaTypeInRanges (IN PVOID DataRanges)
 
HRESULT STDMETHODCALLTYPE KsPrepareIoOperation (IN OUT IMediaSample *Sample, IN OUT PVOID StreamHeader, IN KSIOOPERATION IoOperation)
 
HRESULT STDMETHODCALLTYPE KsQueryExtendedSize (OUT ULONG *ExtendedSize)
 
HRESULT STDMETHODCALLTYPE KsSetMediaType (IN const AM_MEDIA_TYPE *AmMediaType)
 
 CKsDataTypeHandler ()
 
virtual ~CKsDataTypeHandler ()
 

Protected Attributes

LONG m_Ref
 
AM_MEDIA_TYPEm_Type
 

Detailed Description

Definition at line 15 of file datatype.cpp.

Constructor & Destructor Documentation

◆ CKsDataTypeHandler()

CKsDataTypeHandler::CKsDataTypeHandler ( )
inline

Definition at line 43 of file datatype.cpp.

43: m_Ref(0), m_Type(0){};
AM_MEDIA_TYPE * m_Type
Definition: datatype.cpp:61

◆ ~CKsDataTypeHandler()

virtual CKsDataTypeHandler::~CKsDataTypeHandler ( )
inlinevirtual

Definition at line 44 of file datatype.cpp.

45 {
46 if (m_Type)
47 {
48 if (m_Type->pbFormat)
49 CoTaskMemFree(m_Type->pbFormat);
50
51 if (m_Type->pUnk)
52 m_Type->pUnk->Release();
53
55 }
56
57 };
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442

Member Function Documentation

◆ KsCompleteIoOperation()

HRESULT STDMETHODCALLTYPE CKsDataTypeHandler::KsCompleteIoOperation ( IN OUT IMediaSample Sample,
IN OUT PVOID  StreamHeader,
IN KSIOOPERATION  IoOperation,
IN BOOL  Cancelled 
)

Definition at line 84 of file datatype.cpp.

89{
90 return NOERROR;
91}
#define NOERROR
Definition: winerror.h:2354

◆ KsIsMediaTypeInRanges()

HRESULT STDMETHODCALLTYPE CKsDataTypeHandler::KsIsMediaTypeInRanges ( IN PVOID  DataRanges)

Definition at line 96 of file datatype.cpp.

98{
100 PKSDATARANGE DataRange;
101 ULONG Index;
102 //HRESULT hr = S_FALSE;
103
104#ifdef KSPROXY_TRACE
105 OutputDebugStringW(L"CKsDataTypeHandler::KsIsMediaTypeInRanges\n");
106#endif
107
108 DataList = (PKSMULTIPLE_ITEM)DataRanges;
109 DataRange = (PKSDATARANGE)(DataList + 1);
110
111 for(Index = 0; Index < DataList->Count; Index++)
112 {
113 BOOL bMatch = FALSE;
114
115 if (DataRange->FormatSize >= sizeof(KSDATARANGE))
116 {
117 bMatch = IsEqualGUID(DataRange->MajorFormat, GUID_NULL);
118 }
119
120 if (!bMatch && DataRange->FormatSize >= sizeof(KSDATARANGE_AUDIO))
121 {
122 bMatch = IsEqualGUID(DataRange->MajorFormat, MEDIATYPE_Audio);
123 }
124
125 if (bMatch)
126 {
127 if (IsEqualGUID(DataRange->SubFormat, m_Type->subtype) ||
128 IsEqualGUID(DataRange->SubFormat, GUID_NULL))
129 {
130 if (IsEqualGUID(DataRange->Specifier, m_Type->formattype) ||
131 IsEqualGUID(DataRange->Specifier, GUID_NULL))
132 {
133 if (!IsEqualGUID(m_Type->formattype, FORMAT_WaveFormatEx) && !IsEqualGUID(DataRange->Specifier, FORMAT_WaveFormatEx))
134 {
135 //found match
136 //hr = S_OK;
137 break;
138 }
139
140 if (DataRange->FormatSize >= sizeof(KSDATARANGE_AUDIO) && m_Type->cbFormat >= sizeof(WAVEFORMATEX))
141 {
143 PKSDATARANGE_AUDIO AudioRange = (PKSDATARANGE_AUDIO)DataRange;
144
145 if (Format->nSamplesPerSec >= AudioRange->MinimumSampleFrequency &&
146 Format->nSamplesPerSec <= AudioRange->MaximumSampleFrequency &&
147 Format->wBitsPerSample >= AudioRange->MinimumSampleFrequency &&
148 Format->wBitsPerSample <= AudioRange->MaximumBitsPerSample &&
149 Format->nChannels <= AudioRange->MaximumChannels)
150 {
151 // found match
152 //hr = S_OK;
153 break;
154 }
155 }
156 }
157 }
158 }
159
160 DataRange = (PKSDATARANGE)(((ULONG_PTR)DataRange + DataRange->FormatSize + 7) & ~7);
161 }
162 return S_OK;
163}
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA DataList
Definition: hidpi.h:333
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
#define S_OK
Definition: intsafe.h:52
#define GUID_NULL
Definition: ks.h:106
union KSDATAFORMAT * PKSDATARANGE
struct KSMULTIPLE_ITEM * PKSMULTIPLE_ITEM
struct _WAVEFORMATEX * LPWAVEFORMATEX
#define L(x)
Definition: ntvdm.h:50
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
int nChannels
Definition: imaadp32.c:63
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFCOLLECTION _In_ ULONG Index

◆ KsPrepareIoOperation()

HRESULT STDMETHODCALLTYPE CKsDataTypeHandler::KsPrepareIoOperation ( IN OUT IMediaSample Sample,
IN OUT PVOID  StreamHeader,
IN KSIOOPERATION  IoOperation 
)

Definition at line 167 of file datatype.cpp.

171{
172 return NOERROR;
173}

◆ KsQueryExtendedSize()

HRESULT STDMETHODCALLTYPE CKsDataTypeHandler::KsQueryExtendedSize ( OUT ULONG ExtendedSize)

Definition at line 177 of file datatype.cpp.

179{
180 /* no header extension required */
181 *ExtendedSize = 0;
182 return NOERROR;
183}

◆ KsSetMediaType()

HRESULT STDMETHODCALLTYPE CKsDataTypeHandler::KsSetMediaType ( IN const AM_MEDIA_TYPE AmMediaType)

Definition at line 187 of file datatype.cpp.

189{
190#ifdef KSPROXY_TRACE
191 OutputDebugString("CKsDataTypeHandler::KsSetMediaType\n");
192#endif
193
194 if (m_Type)
195 {
196 /* media type can only be set once */
197 return E_FAIL;
198 }
199
201 if (!m_Type)
202 return E_OUTOFMEMORY;
203
204 CopyMemory(m_Type, AmMediaType, sizeof(AM_MEDIA_TYPE));
205
206 if (m_Type->cbFormat)
207 {
208 m_Type->pbFormat = (BYTE*)CoTaskMemAlloc(m_Type->cbFormat);
209
210 if (!m_Type->pbFormat)
211 {
213 return E_OUTOFMEMORY;
214 }
215
216 CopyMemory(m_Type->pbFormat, AmMediaType->pbFormat, m_Type->cbFormat);
217 }
218
219 if (m_Type->pUnk)
220 m_Type->pUnk->AddRef();
221
222
223 return S_OK;
224}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_FAIL
Definition: ddrawi.h:102
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define CopyMemory
Definition: winbase.h:1710
#define OutputDebugString
Definition: winbase.h:3890
unsigned char BYTE
Definition: xxhash.c:193

◆ QueryInterface()

HRESULT STDMETHODCALLTYPE CKsDataTypeHandler::QueryInterface ( REFIID  InterfaceId,
PVOID Interface 
)

Definition at line 67 of file datatype.cpp.

70{
71 if (IsEqualGUID(refiid, IID_IUnknown) ||
72 IsEqualGUID(refiid, IID_IKsDataTypeHandler))
73 {
74 *Output = PVOID(this);
75 reinterpret_cast<IUnknown*>(*Output)->AddRef();
76 return NOERROR;
77 }
78 return E_NOINTERFACE;
79}
const GUID IID_IUnknown
Definition: datatype.cpp:12
ULONG AddRef()
@ Output
Definition: arc.h:85
void * PVOID
Definition: typedefs.h:50
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ STDMETHODIMP_() [1/2]

CKsDataTypeHandler::STDMETHODIMP_ ( ULONG  )
inline

Definition at line 20 of file datatype.cpp.

21 {
23 return m_Ref;
24 }
#define InterlockedIncrement
Definition: armddk.h:53

◆ STDMETHODIMP_() [2/2]

CKsDataTypeHandler::STDMETHODIMP_ ( ULONG  )
inline

Definition at line 25 of file datatype.cpp.

26 {
28
29 if (!m_Ref)
30 {
31 delete this;
32 return 0;
33 }
34 return m_Ref;
35 }
#define InterlockedDecrement
Definition: armddk.h:52

Member Data Documentation

◆ m_Ref

LONG CKsDataTypeHandler::m_Ref
protected

Definition at line 60 of file datatype.cpp.

Referenced by STDMETHODIMP_().

◆ m_Type

AM_MEDIA_TYPE* CKsDataTypeHandler::m_Type
protected

Definition at line 61 of file datatype.cpp.

Referenced by KsIsMediaTypeInRanges(), KsSetMediaType(), and ~CKsDataTypeHandler().


The documentation for this class was generated from the following file: