ReactOS 0.4.15-dev-7906-g1b85a5f
input_pin.cpp
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS WDM Streaming ActiveMovie Proxy
4 * FILE: dll/directx/ksproxy/input_pin.cpp
5 * PURPOSE: InputPin of Proxy Filter
6 *
7 * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
8 */
9#include "precomp.h"
10
11const GUID IID_IKsPinPipe = {0xe539cd90, 0xa8b4, 0x11d1, {0x81, 0x89, 0x00, 0xa0, 0xc9, 0x06, 0x28, 0x02}};
12const GUID IID_IKsPinEx = {0x7bb38260L, 0xd19c, 0x11d2, {0xb3, 0x8a, 0x00, 0xa0, 0xc9, 0x5e, 0xc2, 0x2e}};
13
15{
18 0
19};
20
22{
25 0
26};
27
28class CInputPin : public IPin,
29 public IKsPropertySet,
30 public IKsControl,
31 public IKsObject,
32 public IKsPinEx,
33 public IMemInputPin,
34 public IKsPinPipe,
35 public IKsPinFactory,
36 public IStreamBuilder,
37 public IKsAggregateControl,
38 public IQualityControl,
40{
41public:
42 typedef std::vector<IUnknown *>ProxyPluginVector;
43
45
47 {
49 return m_Ref;
50 }
52 {
54 if (!m_Ref)
55 {
56 delete this;
57 return 0;
58 }
59 return m_Ref;
60 }
61
62 //IKsPinPipe
63 HRESULT STDMETHODCALLTYPE KsGetPinFramingCache(PKSALLOCATOR_FRAMING_EX *FramingEx, PFRAMING_PROP FramingProp, FRAMING_CACHE_OPS Option);
64 HRESULT STDMETHODCALLTYPE KsSetPinFramingCache(PKSALLOCATOR_FRAMING_EX FramingEx, PFRAMING_PROP FramingProp, FRAMING_CACHE_OPS Option);
66 IKsAllocatorEx* STDMETHODCALLTYPE KsGetPipe(KSPEEKOPERATION Operation);
67 HRESULT STDMETHODCALLTYPE KsSetPipe(IKsAllocatorEx *KsAllocator);
74
75 //IPin methods
76 HRESULT STDMETHODCALLTYPE Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt);
91
92 // ISpecifyPropertyPages
94
95 //IKsObject methods
97
98 //IKsPropertySet
99 HRESULT STDMETHODCALLTYPE Set(REFGUID guidPropSet, DWORD dwPropID, LPVOID pInstanceData, DWORD cbInstanceData, LPVOID pPropData, DWORD cbPropData);
100 HRESULT STDMETHODCALLTYPE Get(REFGUID guidPropSet, DWORD dwPropID, LPVOID pInstanceData, DWORD cbInstanceData, LPVOID pPropData, DWORD cbPropData, DWORD *pcbReturned);
101 HRESULT STDMETHODCALLTYPE QuerySupported(REFGUID guidPropSet, DWORD dwPropID, DWORD *pTypeSupport);
102
103 //IKsControl
107
108 //IKsPin
115 HRESULT STDMETHODCALLTYPE KsMediaSamplesCompleted(PKSSTREAM_SEGMENT StreamSegment);
122 // IKsPinEx
124
125 //IMemInputPin
130 HRESULT STDMETHODCALLTYPE ReceiveMultiple(IMediaSample **pSamples, long nSamples, long *nSamplesProcessed);
132
133 //IKsPinFactory
135
136 //IStreamBuilder
139
140 //IKsAggregateControl
143
144 //IQualityControl
147
148 //---------------------------------------------------------------
154 CInputPin(IBaseFilter * ParentFilter, LPCWSTR PinName, ULONG PinId, KSPIN_COMMUNICATION Communication);
155 virtual ~CInputPin(){};
156
157protected:
171 IKsInterfaceHandler * m_InterfaceHandler;
172 IKsAllocatorEx * m_KsAllocatorEx;
177 FRAMING_PROP m_FramingProp[4];
180};
181
183 IBaseFilter * ParentFilter,
184 LPCWSTR PinName,
185 ULONG PinId,
186 KSPIN_COMMUNICATION Communication) : m_Ref(0),
187 m_ParentFilter(ParentFilter),
188 m_PinName(PinName),
189 m_hPin(INVALID_HANDLE_VALUE),
190 m_PinId(PinId),
191 m_MemAllocator(0),
192 m_IoCount(0),
193 m_Communication(Communication),
194 m_Pin(0),
195 m_ReadOnly(0),
196 m_InterfaceHandler(0),
197 m_KsAllocatorEx(0),
198 m_PipeAllocatorFlag(0),
199 m_bPinBusCacheInitialized(0),
200 m_FilterName(0),
201 m_Plugins()
202{
205
206 HRESULT hr;
207 IKsObject * KsObjectParent;
208 HANDLE hFilter;
209
210 hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
211 assert(hr == S_OK);
212
213 hFilter = KsObjectParent->KsGetObjectHandle();
214 assert(hFilter);
215
216 KsObjectParent->Release();
217
218
220 hr = KsGetMediaType(0, &m_MediaFormat, hFilter, m_PinId);
221 assert(hr == S_OK);
222}
223
227 IN REFIID refiid,
229{
230 WCHAR Buffer[100];
231
232 *Output = NULL;
233
234 if (IsEqualGUID(refiid, IID_IUnknown) ||
235 IsEqualGUID(refiid, IID_IPin))
236 {
237 *Output = PVOID(this);
238 reinterpret_cast<IUnknown*>(*Output)->AddRef();
239 return NOERROR;
240 }
241 else if (IsEqualGUID(refiid, IID_IMemInputPin))
242 {
244 {
246 if (FAILED(hr))
247 return hr;
248 }
249
250 *Output = (IMemInputPin*)(this);
251 reinterpret_cast<IMemInputPin*>(*Output)->AddRef();
252 return NOERROR;
253 }
254 else if (IsEqualGUID(refiid, IID_IKsObject))
255 {
256 *Output = (IKsObject*)(this);
257 reinterpret_cast<IKsObject*>(*Output)->AddRef();
258 return NOERROR;
259 }
260 else if (IsEqualGUID(refiid, IID_IKsPropertySet))
261 {
263 {
265 if (FAILED(hr))
266 return hr;
267 }
268
269 *Output = (IKsPropertySet*)(this);
270 reinterpret_cast<IKsPropertySet*>(*Output)->AddRef();
271 return NOERROR;
272 }
273 else if (IsEqualGUID(refiid, IID_IKsControl))
274 {
275 *Output = (IKsControl*)(this);
276 reinterpret_cast<IKsControl*>(*Output)->AddRef();
277 return NOERROR;
278 }
279 else if (IsEqualGUID(refiid, IID_IKsPin) ||
280 IsEqualGUID(refiid, IID_IKsPinEx))
281 {
282 *Output = (IKsPinEx*)(this);
283 reinterpret_cast<IKsPinEx*>(*Output)->AddRef();
284 return NOERROR;
285 }
286 else if (IsEqualGUID(refiid, IID_IKsPinPipe))
287 {
288 *Output = (IKsPinPipe*)(this);
289 reinterpret_cast<IKsPinPipe*>(*Output)->AddRef();
290 return NOERROR;
291 }
292 else if (IsEqualGUID(refiid, IID_IKsPinFactory))
293 {
294 *Output = (IKsPinFactory*)(this);
295 reinterpret_cast<IKsPinFactory*>(*Output)->AddRef();
296 return NOERROR;
297 }
298#if 0
299 else if (IsEqualGUID(refiid, IID_IStreamBuilder))
300 {
301 *Output = (IStreamBuilder*)(this);
302 reinterpret_cast<IStreamBuilder*>(*Output)->AddRef();
303 return NOERROR;
304 }
305#endif
306 else if (IsEqualGUID(refiid, IID_IKsAggregateControl))
307 {
308 *Output = (IKsAggregateControl*)(this);
309 reinterpret_cast<IKsAggregateControl*>(*Output)->AddRef();
310 return NOERROR;
311 }
312 else if (IsEqualGUID(refiid, IID_IQualityControl))
313 {
314 *Output = (IQualityControl*)(this);
315 reinterpret_cast<IQualityControl*>(*Output)->AddRef();
316 return NOERROR;
317 }
318 else if (IsEqualGUID(refiid, IID_ISpecifyPropertyPages))
319 {
320 *Output = (ISpecifyPropertyPages*)(this);
321 reinterpret_cast<ISpecifyPropertyPages*>(*Output)->AddRef();
322 return NOERROR;
323 }
324
326 StringFromCLSID(refiid, &lpstr);
327 swprintf(Buffer, L"CInputPin::QueryInterface: NoInterface for %s\n", lpstr);
330
331 return E_NOINTERFACE;
332}
333//-------------------------------------------------------------------
334// IQualityControl interface
335//
339 IBaseFilter *pSelf,
340 Quality q)
341{
342#ifdef KSPROXY_TRACE
343 OutputDebugStringW(L"CInputPin::Notify NotImplemented\n");
344#endif
345
346 return E_NOTIMPL;
347}
348
352 IQualityControl *piqc)
353{
354#ifdef KSPROXY_TRACE
355 OutputDebugStringW(L"CInputPin::SetSink NotImplemented\n");
356#endif
357
358 return E_NOTIMPL;
359}
360
361
362//-------------------------------------------------------------------
363// IKsAggregateControl interface
364//
368 IN REFGUID AggregateClass)
369{
370#ifdef KSPROXY_TRACE
371 OutputDebugStringW(L"CInputPin::KsAddAggregate NotImplemented\n");
372#endif
373
374 return E_NOTIMPL;
375}
376
380 REFGUID AggregateClass)
381{
382#ifdef KSPROXY_TRACE
383 OutputDebugStringW(L"CInputPin::KsRemoveAggregate NotImplemented\n");
384#endif
385
386 return E_NOTIMPL;
387}
388
389//-------------------------------------------------------------------
390// IStreamBuilder
391//
392
396 IPin *ppinOut,
397 IGraphBuilder *pGraph)
398{
399 OutputDebugStringW(L"CInputPin::Render\n");
400 return S_OK;
401}
402
406 IPin *ppinOut,
407 IGraphBuilder *pGraph)
408{
409#ifdef KSPROXY_TRACE
410 OutputDebugStringW(L"CInputPin::Backout\n");
411#endif
412
413 return S_OK;
414}
415
416//-------------------------------------------------------------------
417// IKsPinFactory
418//
419
423 ULONG* PinFactory)
424{
425#ifdef KSPROXY_TRACE
426 OutputDebugStringW(L"CInputPin::KsPinFactory\n");
427#endif
428
429 *PinFactory = m_PinId;
430 return S_OK;
431}
432
433//-------------------------------------------------------------------
434// IKsPinPipe
435//
436
440 PKSALLOCATOR_FRAMING_EX *FramingEx,
441 PFRAMING_PROP FramingProp,
442 FRAMING_CACHE_OPS Option)
443{
444 if (Option > Framing_Cache_Write || Option < Framing_Cache_ReadLast)
445 {
446 // invalid argument
447 return E_INVALIDARG;
448 }
449
450 // get framing properties
451 *FramingProp = m_FramingProp[Option];
452 *FramingEx = m_FramingEx[Option];
453
454 return NOERROR;
455}
456
460 PKSALLOCATOR_FRAMING_EX FramingEx,
461 PFRAMING_PROP FramingProp,
462 FRAMING_CACHE_OPS Option)
463{
464 ULONG Index;
465 ULONG RefCount = 0;
466
467 if (m_FramingEx[Option])
468 {
469 for(Index = 1; Index < 4; Index++)
470 {
471 if (m_FramingEx[Index] == m_FramingEx[Option])
472 RefCount++;
473 }
474
475 if (RefCount == 1)
476 {
477 // existing framing is only used once
478 CoTaskMemFree(m_FramingEx[Option]);
479 }
480 }
481
482 // store framing
483 m_FramingEx[Option] = FramingEx;
484 m_FramingProp[Option] = *FramingProp;
485
486 return S_OK;
487}
488
489IPin*
492{
493 return m_Pin;
494}
495
496IKsAllocatorEx*
499 KSPEEKOPERATION Operation)
500{
501 if (Operation == KsPeekOperation_AddRef)
502 {
503 if (m_KsAllocatorEx)
504 m_KsAllocatorEx->AddRef();
505 }
506 return m_KsAllocatorEx;
507}
508
512 IKsAllocatorEx *KsAllocator)
513{
514 if (KsAllocator)
515 KsAllocator->AddRef();
516
517 if (m_KsAllocatorEx)
518 m_KsAllocatorEx->Release();
519
520 m_KsAllocatorEx = KsAllocator;
521 return NOERROR;
522}
523
524ULONG
527{
528 return m_PipeAllocatorFlag;
529}
530
531
535 ULONG Flag)
536{
538 return NOERROR;
539}
540
541GUID
544{
546 {
549 }
550
551 return m_PinBusCache;
552}
553
557 GUID Bus)
558{
559 CopyMemory(&m_PinBusCache, &Bus, sizeof(GUID));
560 return NOERROR;
561}
562
563PWCHAR
566{
567 return (PWCHAR)m_PinName;
568}
569
570
571PWCHAR
574{
575 return m_FilterName;
576}
577
578//-------------------------------------------------------------------
579// ISpecifyPropertyPages
580//
581
585{
586 if (!pPages)
587 return E_POINTER;
588
589 pPages->cElems = 0;
590 pPages->pElems = NULL;
591
592 return S_OK;
593}
594
595//-------------------------------------------------------------------
596// IMemInputPin
597//
598
599
603{
604#ifdef KSPROXY_TRACE
605 OutputDebugStringW(L"CInputPin::GetAllocator\n");
606#endif
607
608 return VFW_E_NO_ALLOCATOR;
609}
610
614{
615 HRESULT hr;
616 ALLOCATOR_PROPERTIES Properties;
617
618 hr = pAllocator->GetProperties(&Properties);
619
620#ifdef KSPROXY_TRACE
621 WCHAR Buffer[100];
622 swprintf(Buffer, L"CInputPin::NotifyAllocator hr %lx bReadOnly, %u cbAlign %u cbBuffer %u cbPrefix %u cBuffers %u\n", hr, bReadOnly, Properties.cbAlign, Properties.cbBuffer, Properties.cbPrefix, Properties.cBuffers);
624#endif
625
626 if (pAllocator)
627 {
628 pAllocator->AddRef();
629 }
630
631 if (m_MemAllocator)
632 {
634 }
635
636 m_MemAllocator = pAllocator;
637 m_ReadOnly = bReadOnly;
638 return NOERROR;
639}
640
644{
645 KSALLOCATOR_FRAMING Framing;
647 HRESULT hr;
649
653
654 hr = KsProperty(&Property, sizeof(KSPROPERTY), (PVOID)&Framing, sizeof(KSALLOCATOR_FRAMING), &BytesReturned);
655 if (SUCCEEDED(hr))
656 {
657 pProps->cBuffers = Framing.Frames;
658 pProps->cbBuffer = Framing.FrameSize;
659 pProps->cbAlign = Framing.FileAlignment;
660 pProps->cbPrefix = 0;
661 }
662 else
663 hr = E_NOTIMPL;
664
665#ifdef KSPROXY_TRACE
666 WCHAR Buffer[100];
667 swprintf(Buffer, L"CInputPin::GetAllocatorRequirements hr %lx m_hPin %p cBuffers %u cbBuffer %u cbAlign %u cbPrefix %u\n", hr, m_hPin, pProps->cBuffers, pProps->cbBuffer, pProps->cbAlign, pProps->cbPrefix);
669#endif
670
671 return hr;
672}
673
677{
678#ifdef KSPROXY_TRACE
679 OutputDebugStringW(L"CInputPin::Receive NotImplemented\n");
680#endif
681
682 return E_NOTIMPL;
683}
684
687CInputPin::ReceiveMultiple(IMediaSample **pSamples, long nSamples, long *nSamplesProcessed)
688{
689#ifdef KSPROXY_TRACE
690 OutputDebugStringW(L"CInputPin::ReceiveMultiple NotImplemented\n");
691#endif
692
693 return E_NOTIMPL;
694}
695
699{
700#ifdef KSPROXY_TRACE
701 OutputDebugStringW(L"CInputPin::ReceiveCanBlock NotImplemented\n");
702#endif
703
704 return S_FALSE;
705}
706
707//-------------------------------------------------------------------
708// IKsPin
709//
710
714 PKSMULTIPLE_ITEM* MediumList)
715{
716 HRESULT hr;
717 IKsObject * KsObjectParent;
718 HANDLE hFilter;
719
720 hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
721 if (FAILED(hr))
722 return hr;
723
724 hFilter = KsObjectParent->KsGetObjectHandle();
725
726 KsObjectParent->Release();
727
728 if (!hFilter)
729 return E_HANDLE;
730
732}
733
738{
739 HRESULT hr;
740 IKsObject * KsObjectParent;
741 HANDLE hFilter;
742
743 hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
744 if (FAILED(hr))
745 return hr;
746
747 hFilter = KsObjectParent->KsGetObjectHandle();
748
749 KsObjectParent->Release();
750
751 if (!hFilter)
752 return E_HANDLE;
753
755}
756
761 KSPIN_MEDIUM& Medium)
762{
763 return CreatePin(&m_MediaFormat);
764}
765
769 KSPIN_COMMUNICATION *Communication,
771 KSPIN_MEDIUM *Medium)
772{
773 if (Communication)
774 {
775 *Communication = m_Communication;
776 }
777
778 if (Interface)
779 {
780 if (!m_hPin)
781 return VFW_E_NOT_CONNECTED;
782
784 }
785
786 if (Medium)
787 {
788 if (!m_hPin)
789 return VFW_E_NOT_CONNECTED;
790
791 CopyMemory(Medium, &m_Medium, sizeof(KSPIN_MEDIUM));
792 }
793 return NOERROR;
794}
795
799{
803 HRESULT hr;
804
806
810
812
814
815 //TODO
816 //propagate to connected pin on the pipe
817
818 return hr;
819}
820
824 IMediaSample* Sample,
825 ULONG Flags)
826{
827 return E_FAIL;
828}
829
832CInputPin::KsMediaSamplesCompleted(PKSSTREAM_SEGMENT StreamSegment)
833{
834 return NOERROR;
835}
836
840{
841 if (Operation == KsPeekOperation_AddRef)
842 {
843 // add reference on allocator
845 }
846
847 return m_MemAllocator;
848}
849
853{
854
855 if (MemAllocator)
856 {
857 MemAllocator->AddRef();
858 }
859
860 if (m_MemAllocator)
861 {
863 }
864
865 m_MemAllocator = MemAllocator;
866 return NOERROR;
867}
868
872{
873 return E_FAIL;
874}
875
876LONG
879{
880 return InterlockedIncrement((volatile LONG*)&m_IoCount);
881}
882
883LONG
886{
887 return InterlockedDecrement((volatile LONG*)&m_IoCount);
888}
889
893 ULONG Proportion,
894 REFERENCE_TIME TimeDelta)
895{
896#ifdef KSPROXY_TRACE
897 OutputDebugStringW(L"CInputPin::KsQualityNotify NotImplemented\n");
898#endif
899
900 return E_NOTIMPL;
901}
902
903//-------------------------------------------------------------------
904// IKsPinEx
905//
906
907VOID
910 IMediaSample* Sample,
911 HRESULT hr)
912{
913#ifdef KSPROXY_TRACE
914 OutputDebugStringW(L"CInputPin::KsNotifyError NotImplemented\n");
915#endif
916}
917
918
919//-------------------------------------------------------------------
920// IKsControl
921//
926 ULONG PropertyLength,
930{
933}
934
938 PKSMETHOD Method,
939 ULONG MethodLength,
940 LPVOID MethodData,
943{
945 return KsSynchronousDeviceControl(m_hPin, IOCTL_KS_METHOD, (PVOID)Method, MethodLength, (PVOID)MethodData, DataLength, BytesReturned);
946}
947
952 ULONG EventLength,
953 LPVOID EventData,
956{
958
959 if (EventLength)
961 else
963}
964
965
966//-------------------------------------------------------------------
967// IKsPropertySet
968//
972 REFGUID guidPropSet,
973 DWORD dwPropID,
974 LPVOID pInstanceData,
975 DWORD cbInstanceData,
976 LPVOID pPropData,
977 DWORD cbPropData)
978{
980
981 if (cbInstanceData)
982 {
983 PKSPROPERTY Property = (PKSPROPERTY)CoTaskMemAlloc(sizeof(KSPROPERTY) + cbInstanceData);
984 if (!Property)
985 return E_OUTOFMEMORY;
986
987 Property->Set = guidPropSet;
988 Property->Id = dwPropID;
990
991 CopyMemory((Property+1), pInstanceData, cbInstanceData);
992
993 HRESULT hr = KsProperty(Property, sizeof(KSPROPERTY) + cbInstanceData, pPropData, cbPropData, &BytesReturned);
995 return hr;
996 }
997 else
998 {
1000
1001 Property.Set = guidPropSet;
1002 Property.Id = dwPropID;
1004
1005 HRESULT hr = KsProperty(&Property, sizeof(KSPROPERTY), pPropData, cbPropData, &BytesReturned);
1006 return hr;
1007 }
1008}
1009
1010HRESULT
1013 REFGUID guidPropSet,
1014 DWORD dwPropID,
1015 LPVOID pInstanceData,
1016 DWORD cbInstanceData,
1017 LPVOID pPropData,
1018 DWORD cbPropData,
1019 DWORD *pcbReturned)
1020{
1022
1023 if (cbInstanceData)
1024 {
1025 PKSPROPERTY Property = (PKSPROPERTY)CoTaskMemAlloc(sizeof(KSPROPERTY) + cbInstanceData);
1026 if (!Property)
1027 return E_OUTOFMEMORY;
1028
1029 Property->Set = guidPropSet;
1030 Property->Id = dwPropID;
1032
1033 CopyMemory((Property+1), pInstanceData, cbInstanceData);
1034
1035 HRESULT hr = KsProperty(Property, sizeof(KSPROPERTY) + cbInstanceData, pPropData, cbPropData, &BytesReturned);
1037 return hr;
1038 }
1039 else
1040 {
1042
1043 Property.Set = guidPropSet;
1044 Property.Id = dwPropID;
1046
1047 HRESULT hr = KsProperty(&Property, sizeof(KSPROPERTY), pPropData, cbPropData, &BytesReturned);
1048 return hr;
1049 }
1050}
1051
1052HRESULT
1055 REFGUID guidPropSet,
1056 DWORD dwPropID,
1057 DWORD *pTypeSupport)
1058{
1061
1062 Property.Set = guidPropSet;
1063 Property.Id = dwPropID;
1065
1066 return KsProperty(&Property, sizeof(KSPROPERTY), pTypeSupport, sizeof(DWORD), &BytesReturned);
1067}
1068
1069
1070//-------------------------------------------------------------------
1071// IKsObject
1072//
1073HANDLE
1076{
1077 assert(m_hPin);
1078 return m_hPin;
1079}
1080
1081//-------------------------------------------------------------------
1082// IPin interface
1083//
1084HRESULT
1086CInputPin::Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
1087{
1088#ifdef KSPROXY_TRACE
1089 OutputDebugStringW(L"CInputPin::Connect NotImplemented\n");
1090#endif
1091 return NOERROR;
1092}
1093
1094HRESULT
1097{
1098 HRESULT hr;
1099
1100 if (m_Pin)
1101 {
1102 // already connected
1104 }
1105
1106 // first check format
1107 hr = CheckFormat(pmt);
1108 if (FAILED(hr))
1109 {
1110 // format is not supported
1111 return hr;
1112 }
1113
1114 hr = CreatePin(pmt);
1115 if (FAILED(hr))
1116 {
1117 return hr;
1118 }
1119
1120 m_Pin = pConnector;
1121 m_Pin->AddRef();
1122
1123 return S_OK;
1124}
1125HRESULT
1128{
1129 if (!m_Pin)
1130 {
1131 // pin was not connected
1132 return S_FALSE;
1133 }
1134
1135 //FIXME
1136 //check if filter is active
1137
1138 m_Pin->Release();
1139 m_Pin = NULL;
1140
1141#ifdef KSPROXY_TRACE
1142 OutputDebugStringW(L"CInputPin::Disconnect\n");
1143#endif
1144
1145 return S_OK;
1146}
1147HRESULT
1150{
1151 if (!pPin)
1152 return E_POINTER;
1153
1154 if (m_Pin)
1155 {
1156 // increment reference count
1157 m_Pin->AddRef();
1158 *pPin = m_Pin;
1159 return S_OK;
1160 }
1161
1162 *pPin = NULL;
1163 return VFW_E_NOT_CONNECTED;
1164}
1165HRESULT
1168{
1169 if (!m_Pin)
1170 return VFW_E_NOT_CONNECTED;
1171
1172#ifdef KSPROXY_TRACE
1173 OutputDebugStringW(L"CInputPin::ConnectionMediaType NotImplemented\n");
1174#endif
1175
1176 return E_NOTIMPL;
1177}
1178HRESULT
1181{
1182 wcscpy(pInfo->achName, m_PinName);
1183 pInfo->dir = PINDIR_INPUT;
1184 pInfo->pFilter = m_ParentFilter;
1186
1187 return S_OK;
1188}
1189HRESULT
1192{
1193 if (pPinDir)
1194 {
1195 *pPinDir = PINDIR_INPUT;
1196 return S_OK;
1197 }
1198
1199 return E_POINTER;
1200}
1201HRESULT
1204{
1205 *Id = (LPWSTR)CoTaskMemAlloc((wcslen(m_PinName)+1)*sizeof(WCHAR));
1206 if (!*Id)
1207 return E_OUTOFMEMORY;
1208
1209 wcscpy(*Id, m_PinName);
1210 return S_OK;
1211}
1212
1213HRESULT
1216 const AM_MEDIA_TYPE *pmt)
1217{
1218 return CheckFormat(pmt);
1219}
1220HRESULT
1223{
1224 HRESULT hr;
1225 ULONG MediaTypeCount = 0, Index;
1226 AM_MEDIA_TYPE * MediaTypes;
1227 IKsObject * KsObjectParent;
1228 HANDLE hFilter;
1229
1230 hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
1231 if (FAILED(hr))
1232 return hr;
1233
1234 hFilter = KsObjectParent->KsGetObjectHandle();
1235
1236 KsObjectParent->Release();
1237
1238 if (!hFilter)
1239 return E_HANDLE;
1240
1241
1242 // query media type count
1243 hr = KsGetMediaTypeCount(hFilter, m_PinId, &MediaTypeCount);
1244 if (FAILED(hr) || !MediaTypeCount)
1245 return hr;
1246
1247 // allocate media types
1248 MediaTypes = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE) * MediaTypeCount);
1249 if (!MediaTypes)
1250 {
1251 // not enough memory
1252 return E_OUTOFMEMORY;
1253 }
1254
1255 // zero media types
1256 ZeroMemory(MediaTypes, sizeof(AM_MEDIA_TYPE) * MediaTypeCount);
1257
1258 for(Index = 0; Index < MediaTypeCount; Index++)
1259 {
1260 // get media type
1261 hr = KsGetMediaType(Index, &MediaTypes[Index], hFilter, m_PinId);
1262 if (FAILED(hr))
1263 {
1264 // failed
1265 CoTaskMemFree(MediaTypes);
1266 return hr;
1267 }
1268 }
1269
1270 return CEnumMediaTypes_fnConstructor(MediaTypeCount, MediaTypes, IID_IEnumMediaTypes, (void**)ppEnum);
1271}
1272
1273HRESULT
1276{
1277#ifdef KSPROXY_TRACE
1278 OutputDebugStringW(L"CInputPin::QueryInternalConnections NotImplemented\n");
1279#endif
1280 return E_NOTIMPL;
1281}
1282HRESULT
1285{
1286#ifdef KSPROXY_TRACE
1287 OutputDebugStringW(L"CInputPin::EndOfStream NotImplemented\n");
1288#endif
1289 return E_NOTIMPL;
1290}
1291HRESULT
1294{
1295#ifdef KSPROXY_TRACE
1296 OutputDebugStringW(L"CInputPin::BeginFlush NotImplemented\n");
1297#endif
1298 return E_NOTIMPL;
1299}
1300HRESULT
1303{
1304#ifdef KSPROXY_TRACE
1305 OutputDebugStringW(L"CInputPin::EndFlush NotImplemented\n");
1306#endif
1307 return E_NOTIMPL;
1308}
1309HRESULT
1312{
1313#ifdef KSPROXY_TRACE
1314 OutputDebugStringW(L"CInputPin::NewSegment NotImplemented\n");
1315#endif
1316 return E_NOTIMPL;
1317}
1318
1319
1320//-------------------------------------------------------------------
1321HRESULT
1324 const AM_MEDIA_TYPE *pmt)
1325{
1326 PKSMULTIPLE_ITEM MultipleItem;
1328 HRESULT hr;
1329 IKsObject * KsObjectParent;
1330 HANDLE hFilter;
1331
1332 if (!pmt)
1333 return E_POINTER;
1334
1335 hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
1336 if (FAILED(hr))
1337 return hr;
1338
1339 hFilter = KsObjectParent->KsGetObjectHandle();
1340
1341 KsObjectParent->Release();
1342
1343 if (!hFilter)
1344 return E_HANDLE;
1345
1346
1348 if (FAILED(hr))
1349 return S_FALSE;
1350
1351 DataFormat = (PKSDATAFORMAT)(MultipleItem + 1);
1352 for(ULONG Index = 0; Index < MultipleItem->Count; Index++)
1353 {
1354 if (IsEqualGUID(pmt->majortype, DataFormat->MajorFormat) &&
1355 IsEqualGUID(pmt->subtype, DataFormat->SubFormat) &&
1356 IsEqualGUID(pmt->formattype, DataFormat->Specifier))
1357 {
1358 // format is supported
1359 CoTaskMemFree(MultipleItem);
1360#ifdef KSPROXY_TRACE
1361 OutputDebugStringW(L"CInputPin::CheckFormat format OK\n");
1362#endif
1363 return S_OK;
1364 }
1366 }
1367 //format is not supported
1368 CoTaskMemFree(MultipleItem);
1369 return S_FALSE;
1370}
1371
1372HRESULT
1375 const AM_MEDIA_TYPE *pmt)
1376{
1377 PKSMULTIPLE_ITEM MediumList;
1379 PKSPIN_MEDIUM Medium;
1381 IKsInterfaceHandler * InterfaceHandler;
1382 HRESULT hr;
1383
1384 // query for pin medium
1385 hr = KsQueryMediums(&MediumList);
1386 if (FAILED(hr))
1387 return hr;
1388
1389 // query for pin interface
1391 if (FAILED(hr))
1392 {
1393 // failed
1394 CoTaskMemFree(MediumList);
1395 return hr;
1396 }
1397
1398 if (MediumList->Count)
1399 {
1400 //use first available medium
1401 Medium = (PKSPIN_MEDIUM)(MediumList + 1);
1402 }
1403 else
1404 {
1405 // default to standard medium
1406 Medium = &StandardPinMedium;
1407 }
1408
1409 if (InterfaceList->Count)
1410 {
1411 //use first available interface
1413 }
1414 else
1415 {
1416 // default to standard interface
1418 }
1419
1421 {
1422 if (!m_InterfaceHandler)
1423 {
1424 // now load the IKsInterfaceHandler plugin
1425 hr = CoCreateInstance(Interface->Set, NULL, CLSCTX_INPROC_SERVER, IID_IKsInterfaceHandler, (void**)&InterfaceHandler);
1426 if (FAILED(hr))
1427 {
1428 // failed to load interface handler plugin
1429#ifdef KSPROXY_TRACE
1430 OutputDebugStringW(L"CInputPin::CreatePin failed to load InterfaceHandlerPlugin\n");
1431#endif
1432 CoTaskMemFree(MediumList);
1434
1435 return hr;
1436 }
1437
1438 // now set the pin
1439 hr = InterfaceHandler->KsSetPin((IKsPin*)this);
1440 if (FAILED(hr))
1441 {
1442 // failed to load interface handler plugin
1443#ifdef KSPROXY_TRACE
1444 OutputDebugStringW(L"CInputPin::CreatePin failed to initialize InterfaceHandlerPlugin\n");
1445#endif
1446 InterfaceHandler->Release();
1447 CoTaskMemFree(MediumList);
1449 return hr;
1450 }
1451
1452 // store interface handler
1453 m_InterfaceHandler = InterfaceHandler;
1454 }
1455
1456 // now create pin
1457 hr = CreatePinHandle(Medium, Interface, pmt);
1458 if (FAILED(hr))
1459 {
1460 m_InterfaceHandler->Release();
1461 m_InterfaceHandler = InterfaceHandler;
1462 }
1463 }
1464 else
1465 {
1466#ifdef KSPROXY_TRACE
1467 WCHAR Buffer[100];
1468 swprintf(Buffer, L"CInputPin::CreatePin unexpected communication %u %s\n", m_Communication, m_PinName);
1470#endif
1471 hr = E_FAIL;
1472 }
1473
1474 // free medium / interface / dataformat
1475 CoTaskMemFree(MediumList);
1477
1478 return hr;
1479}
1480
1481HRESULT
1484 PKSPIN_MEDIUM Medium,
1486 const AM_MEDIA_TYPE *pmt)
1487{
1488 PKSPIN_CONNECT PinConnect;
1490 ULONG Length;
1491 HRESULT hr;
1492 IKsObject * KsObjectParent;
1493 HANDLE hFilter;
1494
1495 if (!pmt)
1496 return E_POINTER;
1497
1498 hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent);
1499 if (FAILED(hr))
1500 return hr;
1501
1502 hFilter = KsObjectParent->KsGetObjectHandle();
1503
1504 KsObjectParent->Release();
1505
1506 if (!hFilter)
1507 return E_HANDLE;
1508
1509
1511 {
1512 // pin already exists
1513 //CloseHandle(m_hPin);
1514 //m_hPin = INVALID_HANDLE_VALUE;
1515 return S_OK;
1516 }
1517
1518
1519 // calc format size
1520 Length = sizeof(KSPIN_CONNECT) + sizeof(KSDATAFORMAT) + pmt->cbFormat;
1521
1522 // allocate pin connect
1523 PinConnect = (PKSPIN_CONNECT)CoTaskMemAlloc(Length);
1524 if (!PinConnect)
1525 {
1526 // failed
1527 return E_OUTOFMEMORY;
1528 }
1529
1530 // setup request
1531 CopyMemory(&PinConnect->Interface, Interface, sizeof(KSPIN_INTERFACE));
1532 CopyMemory(&PinConnect->Medium, Medium, sizeof(KSPIN_MEDIUM));
1533 PinConnect->PinId = m_PinId;
1534 PinConnect->PinToHandle = NULL;
1537
1538 // get dataformat offset
1539 DataFormat = (PKSDATAFORMAT)(PinConnect + 1);
1540
1541 // copy data format
1542 DataFormat->FormatSize = sizeof(KSDATAFORMAT) + pmt->cbFormat;
1543 DataFormat->Flags = 0;
1544 DataFormat->SampleSize = pmt->lSampleSize;
1545 DataFormat->Reserved = 0;
1546 CopyMemory(&DataFormat->MajorFormat, &pmt->majortype, sizeof(GUID));
1547 CopyMemory(&DataFormat->SubFormat, &pmt->subtype, sizeof(GUID));
1548 CopyMemory(&DataFormat->Specifier, &pmt->formattype, sizeof(GUID));
1549
1550 if (pmt->cbFormat)
1551 {
1552 // copy extended format
1553 CopyMemory((DataFormat + 1), pmt->pbFormat, pmt->cbFormat);
1554 }
1555
1556 // create pin
1557 hr = KsCreatePin(hFilter, PinConnect, GENERIC_WRITE, &m_hPin);
1558
1559 if (SUCCEEDED(hr))
1560 {
1561 // store current interface / medium
1562 CopyMemory(&m_Medium, Medium, sizeof(KSPIN_MEDIUM));
1564 CopyMemory(&m_MediaFormat, pmt, sizeof(AM_MEDIA_TYPE));
1565
1566#ifdef KSPROXY_TRACE
1567 LPOLESTR pMajor, pSub, pFormat;
1568 StringFromIID(m_MediaFormat.majortype, &pMajor);
1569 StringFromIID(m_MediaFormat.subtype , &pSub);
1570 StringFromIID(m_MediaFormat.formattype, &pFormat);
1571
1572 WCHAR Buffer[200];
1573 swprintf(Buffer, L"CInputPin::CreatePinHandle Major %s SubType %s Format %s pbFormat %p cbFormat %u\n", pMajor, pSub, pFormat, pmt->pbFormat, pmt->cbFormat);
1574 CoTaskMemFree(pMajor);
1575 CoTaskMemFree(pSub);
1576 CoTaskMemFree(pFormat);
1578#endif
1579
1580 if (pmt->cbFormat)
1581 {
1582 m_MediaFormat.pbFormat = (BYTE*)CoTaskMemAlloc(pmt->cbFormat);
1583 if (!m_MediaFormat.pbFormat)
1584 {
1585 CoTaskMemFree(PinConnect);
1586 m_MediaFormat.pbFormat = NULL;
1587 m_MediaFormat.cbFormat = 0;
1588 return E_OUTOFMEMORY;
1589 }
1590 CopyMemory(m_MediaFormat.pbFormat, pmt->pbFormat, pmt->cbFormat);
1591 }
1592
1593 LPGUID pGuid;
1594 ULONG NumGuids = 0;
1595
1596 // get all supported sets
1597 hr = GetSupportedSets(&pGuid, &NumGuids);
1598 if (FAILED(hr))
1599 {
1600#ifdef KSPROXY_TRACE
1601 OutputDebugStringW(L"CInputPin::CreatePinHandle GetSupportedSets failed\n");
1602#endif
1603 return hr;
1604 }
1605
1606 // load all proxy plugins
1607 hr = LoadProxyPlugins(pGuid, NumGuids);
1608 if (FAILED(hr))
1609 {
1610#ifdef KSPROXY_TRACE
1611 OutputDebugStringW(L"CInputPin::CreatePinHandle LoadProxyPlugins failed\n");
1612#endif
1613 return hr;
1614 }
1615
1616 // free sets
1617 CoTaskMemFree(pGuid);
1618
1619
1620 //TODO
1621 // connect pin pipes
1622
1623 }
1624
1625 // free pin connect
1626 CoTaskMemFree(PinConnect);
1627
1628 return hr;
1629}
1630
1631HRESULT
1634 LPGUID * pOutGuid,
1635 PULONG NumGuids)
1636{
1638 LPGUID pGuid;
1639 ULONG NumProperty = 0;
1640 ULONG NumMethods = 0;
1641 ULONG NumEvents = 0;
1642 ULONG Length;
1644 HRESULT hr;
1645
1646 Property.Set = GUID_NULL;
1647 Property.Id = 0;
1649
1653
1654 Length = NumProperty + NumMethods + NumEvents;
1655
1656 assert(Length);
1657
1658 // allocate guid buffer
1659 pGuid = (LPGUID)CoTaskMemAlloc(Length);
1660 if (!pGuid)
1661 {
1662 // failed
1663 return E_OUTOFMEMORY;
1664 }
1665
1666 NumProperty /= sizeof(GUID);
1667 NumMethods /= sizeof(GUID);
1668 NumEvents /= sizeof(GUID);
1669
1670#ifdef KSPROXY_TRACE
1671 WCHAR Buffer[200];
1672 swprintf(Buffer, L"CInputPin::GetSupportedSets NumProperty %lu NumMethods %lu NumEvents %lu\n", NumProperty, NumMethods, NumEvents);
1674#endif
1675
1676 // get all properties
1678 if (FAILED(hr))
1679 {
1680 CoTaskMemFree(pGuid);
1681 return E_FAIL;
1682 }
1684
1685 // get all methods
1686 if (Length && NumMethods)
1687 {
1689 if (FAILED(hr))
1690 {
1691 CoTaskMemFree(pGuid);
1692 return E_FAIL;
1693 }
1695 }
1696
1697 // get all events
1698 if (Length && NumEvents)
1699 {
1701 if (FAILED(hr))
1702 {
1703 CoTaskMemFree(pGuid);
1704 return E_FAIL;
1705 }
1707 }
1708
1709 *pOutGuid = pGuid;
1710 *NumGuids = NumProperty+NumEvents+NumMethods;
1711 return S_OK;
1712}
1713
1714HRESULT
1717 LPGUID pGuids,
1718 ULONG NumGuids)
1719{
1720 ULONG Index;
1721 LPOLESTR pStr;
1722 HKEY hKey, hSubKey;
1723 HRESULT hr;
1725
1726 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\MediaInterfaces", 0, KEY_READ, &hKey) != ERROR_SUCCESS)
1727 {
1728 OutputDebugStringW(L"CInputPin::LoadProxyPlugins failed to open MediaInterfaces key\n");
1729 return E_FAIL;
1730 }
1731
1732 // enumerate all sets
1733 for(Index = 0; Index < NumGuids; Index++)
1734 {
1735 // convert to string
1736 hr = StringFromCLSID(pGuids[Index], &pStr);
1737 if (FAILED(hr))
1738 return E_FAIL;
1739
1740 // now try open class key
1741 if (RegOpenKeyExW(hKey, pStr, 0, KEY_READ, &hSubKey) != ERROR_SUCCESS)
1742 {
1743 // no plugin for that set exists
1744 CoTaskMemFree(pStr);
1745 continue;
1746 }
1747
1748 // try load plugin
1749 hr = CoCreateInstance(pGuids[Index], (IBaseFilter*)this, CLSCTX_INPROC_SERVER, IID_IUnknown, (void**)&pUnknown);
1750 if (SUCCEEDED(hr))
1751 {
1752 // store plugin
1753 m_Plugins.push_back(pUnknown);
1754 }
1755 // close key
1756 RegCloseKey(hSubKey);
1757 }
1758
1759 // close media interfaces key
1761 return S_OK;
1762}
1763
1764HRESULT
1765WINAPI
1767 IBaseFilter * ParentFilter,
1768 LPCWSTR PinName,
1769 HANDLE hFilter,
1770 ULONG PinId,
1771 KSPIN_COMMUNICATION Communication,
1772 REFIID riid,
1773 LPVOID * ppv)
1774{
1775 CInputPin * handler = new CInputPin(ParentFilter, PinName, PinId, Communication);
1776
1777 if (!handler)
1778 return E_OUTOFMEMORY;
1779
1780 if (FAILED(handler->QueryInterface(riid, ppv)))
1781 {
1782 /* not supported */
1783 delete handler;
1784 return E_NOINTERFACE;
1785 }
1786
1787 return S_OK;
1788}
DWORD Id
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
enum _PinDirection PIN_DIRECTION
@ PINDIR_INPUT
Definition: axcore.idl:41
#define STDMETHODIMP
Definition: basetyps.h:43
const GUID IID_IUnknown
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
#define RegCloseKey(hKey)
Definition: registry.h:49
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
Definition: cdrom.h:1444
Definition: bufpool.h:45
LPWSTR m_FilterName
Definition: input_pin.cpp:176
HRESULT STDMETHODCALLTYPE ReceiveCanBlock(void)
Definition: input_pin.cpp:698
HRESULT STDMETHODCALLTYPE ReceiveMultiple(IMediaSample **pSamples, long nSamples, long *nSamplesProcessed)
Definition: input_pin.cpp:687
FRAMING_PROP m_FramingProp[4]
Definition: input_pin.cpp:177
HRESULT STDMETHODCALLTYPE Render(IPin *ppinOut, IGraphBuilder *pGraph)
Definition: input_pin.cpp:395
ULONG STDMETHODCALLTYPE KsGetPipeAllocatorFlag()
Definition: input_pin.cpp:526
HRESULT STDMETHODCALLTYPE QueryPinInfo(PIN_INFO *pInfo)
Definition: input_pin.cpp:1180
STDMETHODIMP QueryInterface(REFIID InterfaceId, PVOID *Interface)
Definition: input_pin.cpp:226
PWCHAR STDMETHODCALLTYPE KsGetFilterName()
Definition: input_pin.cpp:573
ULONG m_PinId
Definition: input_pin.cpp:162
HRESULT STDMETHODCALLTYPE Disconnect()
Definition: input_pin.cpp:1127
HRESULT STDMETHODCALLTYPE Notify(IBaseFilter *pSelf, Quality q)
Definition: input_pin.cpp:338
HRESULT STDMETHODCALLTYPE KsQueryMediums(PKSMULTIPLE_ITEM *MediumList)
Definition: input_pin.cpp:713
std::vector< IUnknown * > ProxyPluginVector
Definition: input_pin.cpp:42
IPin *STDMETHODCALLTYPE KsGetConnectedPin()
Definition: input_pin.cpp:491
HRESULT STDMETHODCALLTYPE QueryInternalConnections(IPin **apPin, ULONG *nPin)
Definition: input_pin.cpp:1275
HRESULT STDMETHODCALLTYPE QueryAccept(const AM_MEDIA_TYPE *pmt)
Definition: input_pin.cpp:1215
HRESULT STDMETHODCALLTYPE QueryId(LPWSTR *Id)
Definition: input_pin.cpp:1203
HANDLE STDMETHODCALLTYPE KsGetObjectHandle()
Definition: input_pin.cpp:1075
HRESULT STDMETHODCALLTYPE SetSink(IQualityControl *piqc)
Definition: input_pin.cpp:351
IKsInterfaceHandler * m_InterfaceHandler
Definition: input_pin.cpp:171
VOID STDMETHODCALLTYPE KsNotifyError(IMediaSample *Sample, HRESULT hr)
Definition: input_pin.cpp:909
HRESULT STDMETHODCALLTYPE KsRenegotiateAllocator()
Definition: input_pin.cpp:871
HRESULT STDMETHODCALLTYPE CheckFormat(const AM_MEDIA_TYPE *pmt)
Definition: input_pin.cpp:1323
GUID STDMETHODCALLTYPE KsGetPinBusCache()
Definition: input_pin.cpp:543
HRESULT STDMETHODCALLTYPE Get(REFGUID guidPropSet, DWORD dwPropID, LPVOID pInstanceData, DWORD cbInstanceData, LPVOID pPropData, DWORD cbPropData, DWORD *pcbReturned)
Definition: input_pin.cpp:1012
HRESULT STDMETHODCALLTYPE EndOfStream()
Definition: input_pin.cpp:1284
HRESULT STDMETHODCALLTYPE QuerySupported(REFGUID guidPropSet, DWORD dwPropID, DWORD *pTypeSupport)
Definition: input_pin.cpp:1054
PWCHAR STDMETHODCALLTYPE KsGetPinName()
Definition: input_pin.cpp:565
HRESULT STDMETHODCALLTYPE KsPropagateAcquire()
Definition: input_pin.cpp:798
HRESULT STDMETHODCALLTYPE GetSupportedSets(LPGUID *pOutGuid, PULONG NumGuids)
Definition: input_pin.cpp:1633
HRESULT STDMETHODCALLTYPE EndFlush()
Definition: input_pin.cpp:1302
HRESULT STDMETHODCALLTYPE GetPages(CAUUID *pPages)
Definition: input_pin.cpp:584
HRESULT STDMETHODCALLTYPE KsDeliver(IMediaSample *Sample, ULONG Flags)
Definition: input_pin.cpp:823
HRESULT STDMETHODCALLTYPE EnumMediaTypes(IEnumMediaTypes **ppEnum)
Definition: input_pin.cpp:1222
KSPIN_INTERFACE m_Interface
Definition: input_pin.cpp:166
HRESULT STDMETHODCALLTYPE KsRemoveAggregate(REFGUID AggregateClass)
Definition: input_pin.cpp:379
IKsAllocatorEx *STDMETHODCALLTYPE KsGetPipe(KSPEEKOPERATION Operation)
Definition: input_pin.cpp:498
PKSALLOCATOR_FRAMING_EX m_FramingEx[4]
Definition: input_pin.cpp:178
HRESULT STDMETHODCALLTYPE ReceiveConnection(IPin *pConnector, const AM_MEDIA_TYPE *pmt)
Definition: input_pin.cpp:1096
STDMETHODIMP_(ULONG) AddRef()
Definition: input_pin.cpp:46
HRESULT STDMETHODCALLTYPE KsSetPinBusCache(GUID Bus)
Definition: input_pin.cpp:556
HRESULT STDMETHODCALLTYPE QueryDirection(PIN_DIRECTION *pPinDir)
Definition: input_pin.cpp:1191
HRESULT STDMETHODCALLTYPE KsGetPinFramingCache(PKSALLOCATOR_FRAMING_EX *FramingEx, PFRAMING_PROP FramingProp, FRAMING_CACHE_OPS Option)
Definition: input_pin.cpp:439
LONG m_IoCount
Definition: input_pin.cpp:164
AM_MEDIA_TYPE m_MediaFormat
Definition: input_pin.cpp:168
HRESULT STDMETHODCALLTYPE CreatePinHandle(PKSPIN_MEDIUM Medium, PKSPIN_INTERFACE Interface, const AM_MEDIA_TYPE *pmt)
Definition: input_pin.cpp:1483
HRESULT STDMETHODCALLTYPE KsAddAggregate(IN REFGUID AggregateClass)
Definition: input_pin.cpp:367
HRESULT STDMETHODCALLTYPE KsSetPipeAllocatorFlag(ULONG Flag)
Definition: input_pin.cpp:534
HRESULT STDMETHODCALLTYPE Set(REFGUID guidPropSet, DWORD dwPropID, LPVOID pInstanceData, DWORD cbInstanceData, LPVOID pPropData, DWORD cbPropData)
Definition: input_pin.cpp:971
LPCWSTR m_PinName
Definition: input_pin.cpp:160
LONG STDMETHODCALLTYPE KsIncrementPendingIoCount()
Definition: input_pin.cpp:878
HRESULT STDMETHODCALLTYPE KsSetPinFramingCache(PKSALLOCATOR_FRAMING_EX FramingEx, PFRAMING_PROP FramingProp, FRAMING_CACHE_OPS Option)
Definition: input_pin.cpp:459
HRESULT STDMETHODCALLTYPE KsPinFactory(ULONG *PinFactory)
Definition: input_pin.cpp:422
HRESULT STDMETHODCALLTYPE KsReceiveAllocator(IMemAllocator *MemAllocator)
Definition: input_pin.cpp:852
HRESULT STDMETHODCALLTYPE KsMediaSamplesCompleted(PKSSTREAM_SEGMENT StreamSegment)
Definition: input_pin.cpp:832
HRESULT STDMETHODCALLTYPE ConnectionMediaType(AM_MEDIA_TYPE *pmt)
Definition: input_pin.cpp:1167
HRESULT STDMETHODCALLTYPE GetAllocator(IMemAllocator **ppAllocator)
Definition: input_pin.cpp:602
HRESULT STDMETHODCALLTYPE CreatePin(const AM_MEDIA_TYPE *pmt)
Definition: input_pin.cpp:1374
IMemAllocator *STDMETHODCALLTYPE KsPeekAllocator(KSPEEKOPERATION Operation)
Definition: input_pin.cpp:839
HRESULT STDMETHODCALLTYPE NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
Definition: input_pin.cpp:1311
IKsAllocatorEx * m_KsAllocatorEx
Definition: input_pin.cpp:172
IMemAllocator * m_MemAllocator
Definition: input_pin.cpp:163
HRESULT STDMETHODCALLTYPE KsMethod(PKSMETHOD Method, ULONG MethodLength, LPVOID MethodData, ULONG DataLength, ULONG *BytesReturned)
Definition: input_pin.cpp:937
HRESULT STDMETHODCALLTYPE BeginFlush()
Definition: input_pin.cpp:1293
virtual ~CInputPin()
Definition: input_pin.cpp:155
ProxyPluginVector m_Plugins
Definition: input_pin.cpp:179
HRESULT STDMETHODCALLTYPE KsGetCurrentCommunication(KSPIN_COMMUNICATION *Communication, KSPIN_INTERFACE *Interface, KSPIN_MEDIUM *Medium)
Definition: input_pin.cpp:768
IPin * m_Pin
Definition: input_pin.cpp:169
HRESULT STDMETHODCALLTYPE KsSetPipe(IKsAllocatorEx *KsAllocator)
Definition: input_pin.cpp:511
KSPIN_COMMUNICATION m_Communication
Definition: input_pin.cpp:165
STDMETHODIMP_(ULONG) Release()
Definition: input_pin.cpp:51
IBaseFilter * m_ParentFilter
Definition: input_pin.cpp:159
BOOL m_bPinBusCacheInitialized
Definition: input_pin.cpp:174
ULONG m_PipeAllocatorFlag
Definition: input_pin.cpp:173
HRESULT STDMETHODCALLTYPE GetAllocatorRequirements(ALLOCATOR_PROPERTIES *pProps)
Definition: input_pin.cpp:643
BOOL m_ReadOnly
Definition: input_pin.cpp:170
HANDLE m_hPin
Definition: input_pin.cpp:161
LONG m_Ref
Definition: input_pin.cpp:158
GUID m_PinBusCache
Definition: input_pin.cpp:175
HRESULT STDMETHODCALLTYPE NotifyAllocator(IMemAllocator *pAllocator, BOOL bReadOnly)
Definition: input_pin.cpp:613
LONG STDMETHODCALLTYPE KsDecrementPendingIoCount()
Definition: input_pin.cpp:885
HRESULT STDMETHODCALLTYPE KsEvent(PKSEVENT Event, ULONG EventLength, LPVOID EventData, ULONG DataLength, ULONG *BytesReturned)
Definition: input_pin.cpp:950
HRESULT STDMETHODCALLTYPE Receive(IMediaSample *pSample)
Definition: input_pin.cpp:676
HRESULT STDMETHODCALLTYPE Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
Definition: input_pin.cpp:1086
HRESULT STDMETHODCALLTYPE KsQualityNotify(ULONG Proportion, REFERENCE_TIME TimeDelta)
Definition: input_pin.cpp:892
KSPIN_MEDIUM m_Medium
Definition: input_pin.cpp:167
HRESULT STDMETHODCALLTYPE KsProperty(PKSPROPERTY Property, ULONG PropertyLength, LPVOID PropertyData, ULONG DataLength, ULONG *BytesReturned)
Definition: input_pin.cpp:924
HRESULT STDMETHODCALLTYPE KsCreateSinkPinHandle(KSPIN_INTERFACE &Interface, KSPIN_MEDIUM &Medium)
Definition: input_pin.cpp:759
HRESULT STDMETHODCALLTYPE Backout(IPin *ppinOut, IGraphBuilder *pGraph)
Definition: input_pin.cpp:405
CInputPin(IBaseFilter *ParentFilter, LPCWSTR PinName, ULONG PinId, KSPIN_COMMUNICATION Communication)
Definition: input_pin.cpp:182
HRESULT STDMETHODCALLTYPE ConnectedTo(IPin **pPin)
Definition: input_pin.cpp:1149
HRESULT STDMETHODCALLTYPE LoadProxyPlugins(LPGUID pGuids, ULONG NumGuids)
Definition: input_pin.cpp:1716
HRESULT STDMETHODCALLTYPE KsQueryInterfaces(PKSMULTIPLE_ITEM *InterfaceList)
Definition: input_pin.cpp:736
const GUID IID_IKsPropertySet
Definition: controlnode.cpp:13
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define ERROR_SUCCESS
Definition: deptool.c:10
const GUID IID_IKsObject
KSDATAFORMAT * PKSDATAFORMAT
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
const GUID IID_IKsPinFactory
const GUID IID_IKsAggregateControl
Definition: proxy.cpp:16
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7482
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
#define swprintf
Definition: precomp.h:40
#define assert(x)
Definition: debug.h:53
LONGLONG REFERENCE_TIME
Definition: dmusicks.h:9
const GUID IID_IKsControl
Definition: filter.c:44
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
#define KSPROPERTY_TYPE_SETSUPPORT
Definition: dmksctrl.h:44
struct KSIDENTIFIER * PKSPROPERTY
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FP_OP Operation
Definition: fpcontrol.c:150
_In_ WDFDEVICE _In_ PWDF_DEVICE_INTERFACE_PROPERTY_DATA PropertyData
FxAutoRegKey hKey
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
Definition: ignoredbgout.c:23
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
KSPIN_MEDIUM StandardPinMedium
Definition: input_pin.cpp:21
HRESULT WINAPI CInputPin_Constructor(IBaseFilter *ParentFilter, LPCWSTR PinName, HANDLE hFilter, ULONG PinId, KSPIN_COMMUNICATION Communication, REFIID riid, LPVOID *ppv)
Definition: input_pin.cpp:1766
KSPIN_INTERFACE StandardPinInterface
Definition: input_pin.cpp:14
const GUID IID_IKsPinEx
Definition: input_pin.cpp:12
const GUID IID_IKsPinPipe
Definition: input_pin.cpp:11
HRESULT GetProperties([out] ALLOCATOR_PROPERTIES *pProps)
Definition: axcore.idl:92
struct ISpecifyPropertyPages::tagCAUUID CAUUID
ULONG AddRef()
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
ULONG Release()
nsrefcnt Release()
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define STATIC_KSINTERFACESETID_Standard
Definition: ks.h:277
#define KSPRIORITY_NORMAL
Definition: ks.h:1386
#define KSMEDIUM_TYPE_ANYINSTANCE
Definition: ks.h:301
#define GUID_NULL
Definition: ks.h:106
@ KSPROPERTY_CONNECTION_ALLOCATORFRAMING
Definition: ks.h:352
@ KSPROPERTY_CONNECTION_STATE
Definition: ks.h:349
#define IOCTL_KS_METHOD
Definition: ks.h:136
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
struct KSPIN_CONNECT * PKSPIN_CONNECT
#define STATIC_KSMEDIUMSETID_Standard
Definition: ks.h:303
@ KSPROPERTY_PIN_MEDIUMS
Definition: ks.h:631
@ KSPROPERTY_PIN_DATARANGES
Definition: ks.h:628
@ KSPROPERTY_PIN_INTERFACES
Definition: ks.h:630
KSSTATE
Definition: ks.h:1214
@ KSSTATE_ACQUIRE
Definition: ks.h:1216
#define KSPROPSETID_Connection
Definition: ks.h:346
KSPIN_COMMUNICATION
Definition: ks.h:1253
@ KSPIN_COMMUNICATION_BRIDGE
Definition: ks.h:1258
@ KSPIN_COMMUNICATION_NONE
Definition: ks.h:1254
KSIDENTIFIER * PKSPIN_INTERFACE
Definition: ks.h:243
_In_ PKSPIN_CONNECT Connect
Definition: ks.h:4536
KSIDENTIFIER * PKSPIN_MEDIUM
Definition: ks.h:244
@ KSINTERFACE_STANDARD_STREAMING
Definition: ks.h:283
#define IOCTL_KS_ENABLE_EVENT
Definition: ks.h:130
#define IOCTL_KS_DISABLE_EVENT
Definition: ks.h:133
HRESULT WINAPI CEnumMediaTypes_fnConstructor(ULONG MediaTypeCount, AM_MEDIA_TYPE *MediaTypes, REFIID riid, LPVOID *ppv)
KSDDKAPI HRESULT WINAPI KsGetMultiplePinFactoryItems(HANDLE FilterHandle, ULONG PinFactoryId, ULONG PropertyId, PVOID *Items)
Definition: ksproxy.cpp:154
KSDDKAPI HRESULT WINAPI KsGetMediaTypeCount(HANDLE FilterHandle, ULONG PinFactoryId, ULONG *MediaTypeCount)
Definition: ksproxy.cpp:216
KSDDKAPI HRESULT WINAPI KsGetMediaType(int Position, AM_MEDIA_TYPE *AmMediaType, HANDLE FilterHandle, ULONG PinFactoryId)
Definition: ksproxy.cpp:250
KSDDKAPI HRESULT WINAPI KsSynchronousDeviceControl(HANDLE Handle, ULONG IoControl, PVOID InBuffer, ULONG InLength, PVOID OutBuffer, ULONG OutLength, PULONG BytesReturned)
Definition: ksproxy.cpp:34
KSDDKAPI DWORD NTAPI KsCreatePin(HANDLE FilterHandle, PKSPIN_CONNECT Connect, ACCESS_MASK DesiredAccess, PHANDLE ConnectionHandle)
Definition: ksuser.c:192
static LPCSTR lpstr
Definition: font.c:51
@ NumMethods
Definition: actctx.c:1556
static LPOLESTR
Definition: stg_prop.c:27
#define KEY_READ
Definition: nt_native.h:1023
#define GENERIC_WRITE
Definition: nt_native.h:90
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define L(x)
Definition: ntvdm.h:50
_Check_return_ HRESULT WINAPI StringFromIID(_In_ REFIID rclsid, _Outptr_ LPOLESTR *lplpsz)
static BOOL Set
Definition: pageheap.c:10
long LONG
Definition: pedump.c:60
const GUID IID_IPin
Definition: pincontrol.cpp:15
const GUID IID_ISpecifyPropertyPages
Definition: proxy.cpp:12
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
GUID * LPGUID
Definition: guiddef.h:81
#define REFIID
Definition: guiddef.h:118
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
@ Output
Definition: arc.h:85
HRESULT hr
Definition: shlfolder.c:183
Definition: xml2sdb.h:80
PIN_DIRECTION dir
Definition: axcore.idl:96
WCHAR achName[MAX_PIN_NAME]
Definition: axcore.idl:97
IBaseFilter * pFilter
Definition: axcore.idl:95
ULONG Frames
Definition: ks.h:1670
ULONG FileAlignment
Definition: ks.h:1672
ULONG FrameSize
Definition: ks.h:1671
GUID Set
Definition: dmksctrl.h:76
ULONG Count
Definition: ks.h:1980
ULONG PinId
Definition: ks.h:2603
KSPIN_MEDIUM Medium
Definition: ks.h:2602
KSPRIORITY Priority
Definition: ks.h:2605
KSPIN_INTERFACE Interface
Definition: ks.h:2601
HANDLE PinToHandle
Definition: ks.h:2604
ULONG PriorityClass
Definition: ks.h:1391
ULONG PrioritySubClass
Definition: ks.h:1392
Definition: scsiwmi.h:51
uint32_t * PULONG
Definition: typedefs.h:59
void * PVOID
Definition: typedefs.h:50
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
_In_ PUSBD_INTERFACE_LIST_ENTRY InterfaceList
Definition: usbdlib.h:181
#define VFW_E_ALREADY_CONNECTED
Definition: vfwmsgs.h:43
#define VFW_E_NO_ALLOCATOR
Definition: vfwmsgs.h:49
#define VFW_E_NOT_CONNECTED
Definition: vfwmsgs.h:48
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_ ULONG _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesReturned
Definition: wdfiotarget.h:1052
#define ZeroMemory
Definition: winbase.h:1712
#define CopyMemory
Definition: winbase.h:1710
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:2357
#define E_NOINTERFACE
Definition: winerror.h:2364
#define E_HANDLE
Definition: winerror.h:2850
#define NOERROR
Definition: winerror.h:2354
#define E_POINTER
Definition: winerror.h:2365
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193