ReactOS  0.4.14-dev-50-g13bb5e2
CKsInterfaceHandler Class Reference
Inheritance diagram for CKsInterfaceHandler:
Collaboration diagram for CKsInterfaceHandler:

Public Member Functions

STDMETHODIMP QueryInterface (REFIID InterfaceId, PVOID *Interface)
 
 STDMETHODIMP_ (ULONG) AddRef()
 
 STDMETHODIMP_ (ULONG) Release()
 
HRESULT STDMETHODCALLTYPE KsSetPin (IKsPin *KsPin)
 
HRESULT STDMETHODCALLTYPE KsProcessMediaSamples (IKsDataTypeHandler *KsDataTypeHandler, IMediaSample **SampleList, PLONG SampleCount, KSIOOPERATION IoOperation, PKSSTREAM_SEGMENT *StreamSegment)
 
HRESULT STDMETHODCALLTYPE KsCompleteIo (PKSSTREAM_SEGMENT StreamSegment)
 
 CKsInterfaceHandler ()
 
virtual ~CKsInterfaceHandler ()
 

Protected Attributes

LONG m_Ref
 
HANDLE m_Handle
 
IKsPinEx * m_Pin
 
WCHAR m_PinName [129]
 

Detailed Description

Definition at line 13 of file interface.cpp.

Constructor & Destructor Documentation

◆ CKsInterfaceHandler()

CKsInterfaceHandler::CKsInterfaceHandler ( )
inline

Definition at line 38 of file interface.cpp.

38 : m_Ref(0), m_Handle(NULL), m_Pin(0) {m_PinName[0] = L'\0';};
IKsPinEx * m_Pin
Definition: interface.cpp:44
WCHAR m_PinName[129]
Definition: interface.cpp:45
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR L[]
Definition: oid.c:1250

◆ ~CKsInterfaceHandler()

virtual CKsInterfaceHandler::~CKsInterfaceHandler ( )
inlinevirtual

Definition at line 39 of file interface.cpp.

39 {};

Member Function Documentation

◆ KsCompleteIo()

HRESULT STDMETHODCALLTYPE CKsInterfaceHandler::KsCompleteIo ( PKSSTREAM_SEGMENT  StreamSegment)

Definition at line 345 of file interface.cpp.

347 {
348  PKSSTREAM_SEGMENT_EXT StreamSegment;
349  PKSSTREAM_HEADER CurStreamHeader;
350  DWORD dwError = ERROR_SUCCESS, BytesReturned;
351  BOOL bOverlapped;
352  ULONG Index;
353  HRESULT hr;
354  IMediaSample2 * MediaSample;
355  AM_SAMPLE2_PROPERTIES Properties;
357 
358  // get private stream segment
359  StreamSegment = (PKSSTREAM_SEGMENT_EXT)InStreamSegment;
360 
361  // get result
362  bOverlapped = GetOverlappedResult(m_Handle, &StreamSegment->Overlapped, &BytesReturned, FALSE);
363  dwError = GetLastError();
364 
365  CurStreamHeader = StreamSegment->StreamHeader;
366 
367  //iterate through all stream headers
368  for(Index = 0; Index < StreamSegment->SampleCount; Index++)
369  {
370  if (!bOverlapped)
371  {
372  // operation failed
373  m_Pin->KsNotifyError(StreamSegment->MediaSample[Index], MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, dwError));
374  }
375 
376  // query IMediaSample2 interface
377  hr = StreamSegment->MediaSample[Index]->QueryInterface(IID_IMediaSample2, (void**)&MediaSample);
378  if (SUCCEEDED(hr))
379  {
380  // media sample properties
381  hr = MediaSample->GetProperties(sizeof(AM_SAMPLE2_PROPERTIES), (BYTE*)&Properties);
382  if (SUCCEEDED(hr))
383  {
384  //update media sample properties
385  Properties.dwTypeSpecificFlags = CurStreamHeader->TypeSpecificFlags;
386  Properties.dwSampleFlags |= (CurStreamHeader->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TIMEDISCONTINUITY);
387 
388  MediaSample->SetProperties(sizeof(AM_SAMPLE2_PROPERTIES), (BYTE*)&Properties);
389  }
390  // release IMediaSample2 interface
391  MediaSample->Release();
392  }
393 
394  // was an extended header used
395  if (StreamSegment->ExtendedSize)
396  {
397  // unprepare stream header extension
398  StreamSegment->StreamSegment.KsDataTypeHandler->KsCompleteIoOperation(StreamSegment->MediaSample[Index], (CurStreamHeader + 1), StreamSegment->StreamSegment.IoOperation, bOverlapped == FALSE);
399  }
400 
401  Start = 0;
402  Stop = 0;
403  if (bOverlapped && StreamSegment->StreamSegment.IoOperation == KsIoOperation_Read)
404  {
405  // update common media sample details
406  StreamSegment->MediaSample[Index]->SetSyncPoint((CurStreamHeader->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_SPLICEPOINT));
407  StreamSegment->MediaSample[Index]->SetPreroll((CurStreamHeader->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_PREROLL));
409 
410  if (CurStreamHeader->OptionsFlags & KSSTREAM_HEADER_OPTIONSF_TIMEVALID)
411  {
412  // use valid timestamp
413  Start = CurStreamHeader->PresentationTime.Time;
414 
416  {
417  Stop = CurStreamHeader->PresentationTime.Time + CurStreamHeader->Duration;
418  }
419  }
420  }
421 
422  // now set time
423  hr = StreamSegment->MediaSample[Index]->SetTime(&Start, &Stop);
424  if (FAILED(hr))
425  {
426  // use start time
427  StreamSegment->MediaSample[Index]->SetTime(&Start, &Start);
428  }
429 
430  // set valid data length
431  StreamSegment->MediaSample[Index]->SetActualDataLength(CurStreamHeader->DataUsed);
432 
433  if (StreamSegment->StreamSegment.IoOperation == KsIoOperation_Read)
434  {
435  if (bOverlapped)
436  {
437  // deliver sample
438  m_Pin->KsDeliver(StreamSegment->MediaSample[Index], CurStreamHeader->OptionsFlags);
439  }
440  }
441  else if (StreamSegment->StreamSegment.IoOperation == KsIoOperation_Write)
442  {
443  // release media sample reference
444  StreamSegment->MediaSample[Index]->Release();
445  }
446 
447  CurStreamHeader = (PKSSTREAM_HEADER)((ULONG_PTR)CurStreamHeader + CurStreamHeader->Size);
448  }
449 
450  // delete stream headers
451  CoTaskMemFree(StreamSegment->StreamHeader);
452 
453  if (StreamSegment->StreamSegment.KsDataTypeHandler)
454  {
455  // release reference
456  StreamSegment->StreamSegment.KsDataTypeHandler->Release();
457  }
458 
459  // decrement pending i/o count
460  m_Pin->KsDecrementPendingIoCount();
461 
462  //notify of completion
463  m_Pin->KsMediaSamplesCompleted(InStreamSegment);
464 
465  //destroy stream segment
466  CoTaskMemFree(StreamSegment);
467 
468  //release reference to ourselves
469  Release();
470 
471  // done
472  // Event handle is closed by caller
473  return S_OK;
474 }
LONGLONG Duration
Definition: ks.h:2739
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
#define ERROR_SUCCESS
Definition: deptool.c:10
struct KSSTREAM_SEGMENT_EXT * PKSSTREAM_SEGMENT_EXT
HRESULT hr
Definition: shlfolder.c:183
_In_ BOOLEAN Release
Definition: classpnp.h:929
BOOL WINAPI GetOverlappedResult(IN HANDLE hFile, IN LPOVERLAPPED lpOverlapped, OUT LPDWORD lpNumberOfBytesTransferred, IN BOOL bWait)
Definition: iocompl.c:204
#define KSSTREAM_HEADER_OPTIONSF_TIMEVALID
Definition: ks.h:2753
IKsPinEx * m_Pin
Definition: interface.cpp:44
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
KSTIME PresentationTime
Definition: ks.h:2738
struct KSSTREAM_HEADER * PKSSTREAM_HEADER
#define KSSTREAM_HEADER_OPTIONSF_TIMEDISCONTINUITY
Definition: ks.h:2754
_In_ PVOID _Out_ BOOLEAN * Stop
Definition: ldrtypes.h:241
uint32_t ULONG_PTR
Definition: typedefs.h:63
unsigned int BOOL
Definition: ntddk_ex.h:94
ULONG OptionsFlags
Definition: ks.h:2743
ULONG Release()
KSSTREAM_SEGMENT StreamSegment
Definition: interface.cpp:50
LONGLONG Time
Definition: ks.h:1834
OVERLAPPED Overlapped
Definition: interface.cpp:51
PKSSTREAM_HEADER StreamHeader
Definition: interface.cpp:56
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
HRESULT SetActualDataLength(LONG length)
LONGLONG REFERENCE_TIME
Definition: dmusicks.h:9
LONG HRESULT
Definition: typedefs.h:77
static const UCHAR Index[8]
Definition: usbohci.c:18
nsrefcnt Release()
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: partlist.h:33
#define SEVERITY_ERROR
Definition: winerror.h:65
HRESULT SetDiscontinuity(BOOL bDiscontinuity)
IMediaSample * MediaSample[64]
Definition: interface.cpp:52
unsigned char BYTE
Definition: mem.h:68
ULONG DataUsed
Definition: ks.h:2741
ULONG Size
Definition: ks.h:2736
#define FACILITY_WIN32
Definition: winerror.h:27
ULONG TypeSpecificFlags
Definition: ks.h:2737
#define S_OK
Definition: intsafe.h:59
#define KSSTREAM_HEADER_OPTIONSF_PREROLL
Definition: ks.h:2750
HRESULT SetTime([in] REFERENCE_TIME *pTimeStart, [in] REFERENCE_TIME *pTimeEnd)
_In_ FILTER_INFORMATION_CLASS _In_ ULONG _Out_ PULONG BytesReturned
Definition: fltkernel.h:1716
#define KSSTREAM_HEADER_OPTIONSF_DURATIONVALID
Definition: ks.h:2756
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
unsigned int ULONG
Definition: retypes.h:1
HRESULT SetSyncPoint(BOOL bIsSyncPoint)
HRESULT SetPreroll(BOOL bIsPreroll)
#define KSSTREAM_HEADER_OPTIONSF_DATADISCONTINUITY
Definition: ks.h:2751
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define KSSTREAM_HEADER_OPTIONSF_SPLICEPOINT
Definition: ks.h:2749

◆ KsProcessMediaSamples()

HRESULT STDMETHODCALLTYPE CKsInterfaceHandler::KsProcessMediaSamples ( IKsDataTypeHandler *  KsDataTypeHandler,
IMediaSample **  SampleList,
PLONG  SampleCount,
KSIOOPERATION  IoOperation,
PKSSTREAM_SEGMENT *  StreamSegment 
)

Definition at line 145 of file interface.cpp.

151 {
152  PKSSTREAM_SEGMENT_EXT StreamSegment;
153  ULONG ExtendedSize, Index, BytesReturned;
154  HRESULT hr = S_OK;
155 
156  // sanity check
157  assert(*SampleCount);
158 
159  if (*SampleCount == 0 || *SampleCount < 0)
160  return E_FAIL;
161 
162  // zero stream segment
163  *OutStreamSegment = NULL;
164 
165  // allocate stream segment
167  if (!StreamSegment)
168  return E_OUTOFMEMORY;
169 
170  // zero stream segment
171  ZeroMemory(StreamSegment, sizeof(KSSTREAM_SEGMENT_EXT));
172 
173  //allocate event
174  StreamSegment->StreamSegment.CompletionEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
175 
176  if (!StreamSegment->StreamSegment.CompletionEvent)
177  {
178  // failed to create event
179  CoTaskMemFree(StreamSegment);
181  }
182 
183  // increase our own reference count
184  AddRef();
185 
186  // setup stream segment
187  StreamSegment->StreamSegment.KsDataTypeHandler = KsDataTypeHandler;
188  StreamSegment->StreamSegment.KsInterfaceHandler = (IKsInterfaceHandler*)this;
189  StreamSegment->StreamSegment.IoOperation = IoOperation;
190  StreamSegment->Overlapped.hEvent = StreamSegment->StreamSegment.CompletionEvent;
191 
192 
193  // ge extension size
194  ExtendedSize = 0;
195  if (KsDataTypeHandler)
196  {
197  // query extension size
198  KsDataTypeHandler->KsQueryExtendedSize(&ExtendedSize);
199 
200  if (ExtendedSize)
201  {
202  // increment reference count
203  KsDataTypeHandler->AddRef();
204  }
205  else
206  {
207  // no need for the datatype handler
208  StreamSegment->StreamSegment.KsDataTypeHandler = NULL;
209  }
210  }
211 
212  StreamSegment->ExtendedSize = ExtendedSize;
213  StreamSegment->SampleCount = (ULONG)*SampleCount;
214 
215  // calculate stream header size count
216  ULONG StreamHeaderSize = StreamSegment->SampleCount * (sizeof(KSSTREAM_HEADER) + ExtendedSize);
217 
218  // allocate stream header
219  StreamSegment->StreamHeader = (PKSSTREAM_HEADER)CoTaskMemAlloc(StreamHeaderSize);
220  if (!StreamSegment->StreamHeader)
221  {
222  // not enough memory
223  CloseHandle(StreamSegment->StreamSegment.CompletionEvent);
224 
225  if (StreamSegment->StreamSegment.KsDataTypeHandler)
226  StreamSegment->StreamSegment.KsDataTypeHandler->Release();
227 
228  // free stream segment
229  CoTaskMemFree(StreamSegment);
230 
231  //release our reference count
232  Release();
233  return E_OUTOFMEMORY;
234  }
235 
236  // zero stream headers
237  ZeroMemory(StreamSegment->StreamHeader, StreamHeaderSize);
238 
239  PKSSTREAM_HEADER CurStreamHeader = StreamSegment->StreamHeader;
240 
241  // initialize all stream headers
242  for(Index = 0; Index < StreamSegment->SampleCount; Index++)
243  {
244  if (ExtendedSize)
245  {
246  // initialize extended size
247  hr = KsDataTypeHandler->KsPrepareIoOperation(SampleList[Index], (CurStreamHeader + 1), IoOperation);
248  // sanity check
249  assert(hr == NOERROR);
250  }
251 
252  // query for IMediaSample2 interface
253  IMediaSample2 * MediaSample;
254  AM_SAMPLE2_PROPERTIES Properties;
255  ZeroMemory(&Properties, sizeof(AM_SAMPLE2_PROPERTIES));
256 
257  hr = SampleList[Index]->QueryInterface(IID_IMediaSample2, (void**)&MediaSample);
258  if (SUCCEEDED(hr))
259  {
260  //get properties
261 
262  hr = MediaSample->GetProperties(sizeof(AM_SAMPLE2_PROPERTIES), (BYTE*)&Properties);
263 
264  //release IMediaSample2 interface
265  MediaSample->Release();
266  }
267  else
268  {
269  // get properties
270  hr = SampleList[Index]->GetPointer((BYTE**)&Properties.pbBuffer);
271  assert(hr == NOERROR);
272  hr = SampleList[Index]->GetTime(&Properties.tStart, &Properties.tStop);
273 
274  Properties.cbBuffer = SampleList[Index]->GetSize();
275  assert(Properties.cbBuffer);
276 
277  Properties.dwSampleFlags = 0;
278 
279  if (SampleList[Index]->IsDiscontinuity() == S_OK)
280  Properties.dwSampleFlags |= AM_SAMPLE_DATADISCONTINUITY;
281 
282  if (SampleList[Index]->IsPreroll() == S_OK)
283  Properties.dwSampleFlags |= AM_SAMPLE_PREROLL;
284 
285  if (SampleList[Index]->IsSyncPoint() == S_OK)
286  Properties.dwSampleFlags |= AM_SAMPLE_SPLICEPOINT;
287  }
288 #ifdef KSPROXY_TRACE
289  WCHAR Buffer[200];
290  swprintf(Buffer, L"CKsInterfaceHandler::KsProcessMediaSamples PinName %s BufferLength %lu Property Buffer %p ExtendedSize %u lActual %u dwSampleFlags %lx\n", m_PinName, Properties.cbBuffer, Properties.pbBuffer, ExtendedSize, Properties.lActual, Properties.dwSampleFlags);
292 #endif
293 
294  CurStreamHeader->Size = sizeof(KSSTREAM_HEADER) + ExtendedSize;
295  CurStreamHeader->PresentationTime.Denominator = 1;
296  CurStreamHeader->PresentationTime.Numerator = 1;
297  CurStreamHeader->FrameExtent = Properties.cbBuffer;
298  CurStreamHeader->Data = Properties.pbBuffer;
299 
300  if (IoOperation == KsIoOperation_Write)
301  {
302  // set flags
303  CurStreamHeader->OptionsFlags = Properties.dwSampleFlags;
304  CurStreamHeader->DataUsed = Properties.lActual;
305  // increment reference count
306  SampleList[Index]->AddRef();
307  }
308 
309  // store sample in stream segment
310  StreamSegment->MediaSample[Index] = SampleList[Index];
311 
312  // move to next header
313  CurStreamHeader = (PKSSTREAM_HEADER)((ULONG_PTR)CurStreamHeader + CurStreamHeader->Size);
314  }
315 
316  // submit to device
317  m_Pin->KsIncrementPendingIoCount();
318 
320  IoOperation == KsIoOperation_Write ? IOCTL_KS_WRITE_STREAM : IOCTL_KS_READ_STREAM,
321  NULL, 0,
322  StreamSegment->StreamHeader,
323  StreamHeaderSize,
324  &BytesReturned,
325  &StreamSegment->Overlapped))
326  {
327  // signal completion
328  SetEvent(StreamSegment->StreamSegment.CompletionEvent);
329  hr = S_OK;
330  *OutStreamSegment = (PKSSTREAM_SEGMENT)StreamSegment;
331  }
332  else
333  {
335  {
336  *OutStreamSegment = (PKSSTREAM_SEGMENT)StreamSegment;
337  hr = S_OK;
338  }
339  }
340  return hr;
341 }
#define CreateEvent
Definition: winbase.h:3565
#define IOCTL_KS_WRITE_STREAM
Definition: ks.h:139
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
struct KSSTREAM_SEGMENT_EXT * PKSSTREAM_SEGMENT_EXT
HRESULT hr
Definition: shlfolder.c:183
_In_ BOOLEAN Release
Definition: classpnp.h:929
#define NOERROR
Definition: winerror.h:2354
#define IOCTL_KS_READ_STREAM
Definition: ks.h:142
IKsPinEx * m_Pin
Definition: interface.cpp:44
long GetSize(void)
#define assert(x)
Definition: debug.h:53
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
KSTIME PresentationTime
Definition: ks.h:2738
WCHAR m_PinName[129]
Definition: interface.cpp:45
struct KSSTREAM_HEADER * PKSSTREAM_HEADER
#define ERROR_IO_PENDING
Definition: dderror.h:15
#define E_FAIL
Definition: ddrawi.h:102
HRESULT GetTime([out] REFERENCE_TIME *pTimeStart, [out] REFERENCE_TIME *pTimeEnd)
uint32_t ULONG_PTR
Definition: typedefs.h:63
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
ULONG OptionsFlags
Definition: ks.h:2743
KSSTREAM_SEGMENT StreamSegment
Definition: interface.cpp:50
HANDLE hEvent
Definition: winbase.h:792
OVERLAPPED Overlapped
Definition: interface.cpp:51
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
PKSSTREAM_HEADER StreamHeader
Definition: interface.cpp:56
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
ULONG Denominator
Definition: ks.h:1836
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define swprintf(buf, format,...)
Definition: sprintf.c:56
ULONG FrameExtent
Definition: ks.h:2740
static const UCHAR Index[8]
Definition: usbohci.c:18
nsrefcnt Release()
PVOID Data
Definition: ks.h:2742
#define SEVERITY_ERROR
Definition: winerror.h:65
ULONG AddRef()
static const WCHAR L[]
Definition: oid.c:1250
IMediaSample * MediaSample[64]
Definition: interface.cpp:52
unsigned char BYTE
Definition: mem.h:68
ULONG DataUsed
Definition: ks.h:2741
HRESULT GetPointer([out] BYTE **ppBuffer)
ULONG Size
Definition: ks.h:2736
#define FACILITY_WIN32
Definition: winerror.h:27
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
_In_ FILTER_INFORMATION_CLASS _In_ ULONG _Out_ PULONG BytesReturned
Definition: fltkernel.h:1716
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
ULONG Numerator
Definition: ks.h:1835
unsigned int ULONG
Definition: retypes.h:1
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ KsSetPin()

HRESULT STDMETHODCALLTYPE CKsInterfaceHandler::KsSetPin ( IKsPin *  KsPin)

Definition at line 78 of file interface.cpp.

80 {
81  HRESULT hr;
82  IKsObject * KsObject;
83  IKsPinEx * Pin;
84 
85  // get IKsPinEx interface
86  hr = KsPin->QueryInterface(IID_IKsPinEx, (void**)&Pin);
87  if (SUCCEEDED(hr))
88  {
89  // check if IKsObject is supported
90  hr = KsPin->QueryInterface(IID_IKsObject, (void**)&KsObject);
91 
92  if (SUCCEEDED(hr))
93  {
94  // get pin handle
95  m_Handle = KsObject->KsGetObjectHandle();
96 
97  // release IKsObject interface
98  KsObject->Release();
99 
100  if (!m_Handle)
101  {
102  // expected a file handle
103  hr = E_UNEXPECTED;
104  Pin->Release();
105  }
106  else
107  {
108  if (m_Pin)
109  {
110  // release old interface
111  m_Pin->Release();
112  }
113  m_Pin = Pin;
114  }
115  }
116  else
117  {
118  //release IKsPinEx interface
119  Pin->Release();
120  }
121  }
122 #if 1
123  //DBG code
124  PIN_INFO PinInfo;
125  IPin * pPin;
126  if (SUCCEEDED(KsPin->QueryInterface(IID_IPin, (void**)&pPin)))
127  {
128  if (SUCCEEDED(pPin->QueryPinInfo(&PinInfo)))
129  {
130  if (PinInfo.pFilter)
131  PinInfo.pFilter->Release();
132 
133  wcscpy(m_PinName, PinInfo.achName);
134  }
135  pPin->Release();
136  }
137 #endif
138 
139  // done
140  return hr;
141 }
HRESULT hr
Definition: shlfolder.c:183
IKsPinEx * m_Pin
Definition: interface.cpp:44
WCHAR m_PinName[129]
Definition: interface.cpp:45
const GUID IID_IKsPinEx
Definition: input_pin.cpp:12
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:415
LONG HRESULT
Definition: typedefs.h:77
nsrefcnt Release()
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
const GUID IID_IKsObject
Definition: interface.cpp:11
Definition: axcore.idl:91
#define E_UNEXPECTED
Definition: winerror.h:2456
const GUID IID_IPin
Definition: pincontrol.cpp:15
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ QueryInterface()

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

Definition at line 62 of file interface.cpp.

65 {
66  if (IsEqualGUID(refiid, IID_IUnknown) ||
67  IsEqualGUID(refiid, IID_IKsInterfaceHandler))
68  {
69  *Output = PVOID(this);
70  reinterpret_cast<IUnknown*>(*Output)->AddRef();
71  return NOERROR;
72  }
73  return E_NOINTERFACE;
74 }
#define E_NOINTERFACE
Definition: winerror.h:2364
#define NOERROR
Definition: winerror.h:2354
void * PVOID
Definition: retypes.h:9
const GUID IID_IUnknown
Definition: arc.h:85
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

◆ STDMETHODIMP_() [1/2]

CKsInterfaceHandler::STDMETHODIMP_ ( ULONG  )
inline

Definition at line 18 of file interface.cpp.

19  {
21  return m_Ref;
22  }
#define InterlockedIncrement
Definition: armddk.h:53

◆ STDMETHODIMP_() [2/2]

CKsInterfaceHandler::STDMETHODIMP_ ( ULONG  )
inline

Definition at line 23 of file interface.cpp.

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

Member Data Documentation

◆ m_Handle

HANDLE CKsInterfaceHandler::m_Handle
protected

Definition at line 43 of file interface.cpp.

Referenced by KsCompleteIo(), KsProcessMediaSamples(), and KsSetPin().

◆ m_Pin

IKsPinEx* CKsInterfaceHandler::m_Pin
protected

Definition at line 44 of file interface.cpp.

Referenced by KsCompleteIo(), KsProcessMediaSamples(), and KsSetPin().

◆ m_PinName

WCHAR CKsInterfaceHandler::m_PinName[129]
protected

Definition at line 45 of file interface.cpp.

Referenced by CKsInterfaceHandler(), KsProcessMediaSamples(), and KsSetPin().

◆ m_Ref

LONG CKsInterfaceHandler::m_Ref
protected

Definition at line 39 of file interface.cpp.

Referenced by STDMETHODIMP_().


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