convert some printfs to mp_msg
[mplayer/glamo.git] / loader / dshow / inputpin.c
blob09d6b9eae4e39f2ab0cd91412beec34ec5ce21dd
1 /*
2 * Modified for use with MPlayer, detailed CVS changelog at
3 * http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
4 * $Id$
5 */
7 #include "inputpin.h"
8 #include "wine/winerror.h"
9 #include <string.h>
10 #include <stdio.h>
11 #include <stdlib.h>
13 static inline int unimplemented(const char* s, void* p)
15 Debug printf("%s(%p) called (UNIMPLEMENTED)", s, p);
16 return E_NOTIMPL;
19 /***********
20 * EnumPins
21 ***********/
23 typedef struct
25 IEnumPins_vt* vt;
26 DECLARE_IUNKNOWN();
27 IPin* pin1;
28 IPin* pin2;
29 int counter;
30 GUID interfaces[2];
31 } CEnumPins;
33 static long STDCALL CEnumPins_Next(IEnumPins* This,
34 /* [in] */ unsigned long cMediaTypes,
35 /* [size_is][out] */ IPin** ppMediaTypes,
36 /* [out] */ unsigned long* pcFetched)
38 CEnumPins* pin = (CEnumPins*)This;
40 Debug printf("CEnumPins_Next(%p) called\n", This);
41 if (!ppMediaTypes)
42 return E_INVALIDARG;
43 if (!pcFetched && (cMediaTypes!=1))
44 return E_INVALIDARG;
45 if (cMediaTypes<=0)
46 return 0;
48 //lcounter = ((CEnumPins*)This)->counter;
49 //lpin1 = ((CEnumPins*)This)->pin1;
50 //lpin2 = ((CEnumPins*)This)->pin2;
51 if (((pin->counter == 2) && pin->pin2)
52 || ((pin->counter == 1) && !pin->pin2))
54 if (pcFetched)
55 *pcFetched=0;
56 return 1;
59 if (pcFetched)
60 *pcFetched=1;
61 if (pin->counter==0)
63 *ppMediaTypes = pin->pin1;
64 pin->pin1->vt->AddRef((IUnknown*)pin->pin1);
66 else
68 *ppMediaTypes = pin->pin2;
69 pin->pin2->vt->AddRef((IUnknown*)pin->pin2);
71 pin->counter++;
72 if (cMediaTypes == 1)
73 return 0;
74 return 1;
77 static long STDCALL CEnumPins_Skip(IEnumPins* This,
78 /* [in] */ unsigned long cMediaTypes)
80 Debug unimplemented("CEnumPins_Skip", This);
81 return E_NOTIMPL;
84 static long STDCALL CEnumPins_Reset(IEnumPins* This)
86 Debug printf("CEnumPins_Reset(%p) called\n", This);
87 ((CEnumPins*)This)->counter = 0;
88 return 0;
91 static long STDCALL CEnumPins_Clone(IEnumPins* This,
92 /* [out] */ IEnumPins** ppEnum)
94 Debug unimplemented("CEnumPins_Clone", This);
95 return E_NOTIMPL;
98 static void CEnumPins_Destroy(CEnumPins* This)
100 free(This->vt);
101 free(This);
104 IMPLEMENT_IUNKNOWN(CEnumPins)
106 static CEnumPins* CEnumPinsCreate(IPin* p, IPin* pp)
108 CEnumPins* This = (CEnumPins*) malloc(sizeof(CEnumPins));
110 if (!This)
111 return NULL;
113 This->refcount = 1;
114 This->pin1 = p;
115 This->pin2 = pp;
116 This->counter = 0;
118 This->vt = (IEnumPins_vt*) malloc(sizeof(IEnumPins_vt));
119 if (!This->vt)
121 free(This);
122 return NULL;
124 This->vt->QueryInterface = CEnumPins_QueryInterface;
125 This->vt->AddRef = CEnumPins_AddRef;
126 This->vt->Release = CEnumPins_Release;
127 This->vt->Next = CEnumPins_Next;
128 This->vt->Skip = CEnumPins_Skip;
129 This->vt->Reset = CEnumPins_Reset;
130 This->vt->Clone = CEnumPins_Clone;
132 This->interfaces[0] = IID_IUnknown;
133 This->interfaces[1] = IID_IEnumPins;
135 return This;
140 /***********
141 * InputPin
142 ***********/
144 static long STDCALL CInputPin_Connect(IPin* This,
145 /* [in] */ IPin* pReceivePin,
146 /* [in] */ AM_MEDIA_TYPE* pmt)
148 Debug unimplemented("CInputPin_Connect", This);
149 return E_NOTIMPL;
152 static long STDCALL CInputPin_ReceiveConnection(IPin* This,
153 /* [in] */ IPin* pConnector,
154 /* [in] */ const AM_MEDIA_TYPE *pmt)
156 Debug unimplemented("CInputPin_ReceiveConnection", This);
157 return E_NOTIMPL;
160 static long STDCALL CInputPin_Disconnect(IPin* This)
162 Debug unimplemented("CInputPin_Disconnect", This);
163 return E_NOTIMPL;
166 static long STDCALL CInputPin_ConnectedTo(IPin* This,
167 /* [out] */ IPin** pPin)
169 Debug unimplemented("CInputPin_ConnectedTo", This);
170 return E_NOTIMPL;
173 static long STDCALL CInputPin_ConnectionMediaType(IPin* This,
174 /* [out] */ AM_MEDIA_TYPE *pmt)
176 Debug printf("CInputPin_ConnectionMediaType(%p) called\n", This);
177 if (!pmt)
178 return E_INVALIDARG;
179 *pmt=((CInputPin*)This)->type;
180 if (pmt->cbFormat > 0)
182 pmt->pbFormat=(char *)malloc(pmt->cbFormat);
183 memcpy(pmt->pbFormat, ((CInputPin*)This)->type.pbFormat, pmt->cbFormat);
185 return 0;
188 static long STDCALL CInputPin_QueryPinInfo(IPin* This,
189 /* [out] */ PIN_INFO *pInfo)
191 CBaseFilter* lparent=((CInputPin*)This)->parent;
192 Debug printf("CInputPin_QueryPinInfo(%p) called\n", This);
193 pInfo->dir = PINDIR_OUTPUT;
194 pInfo->pFilter = (IBaseFilter*) lparent;
195 lparent->vt->AddRef((IUnknown*)lparent);
196 pInfo->achName[0] = 0;
197 return 0;
200 static long STDCALL CInputPin_QueryDirection(IPin* This,
201 /* [out] */ PIN_DIRECTION *pPinDir)
203 *pPinDir = PINDIR_OUTPUT;
204 Debug printf("CInputPin_QueryDirection(%p) called\n", This);
205 return 0;
208 static long STDCALL CInputPin_QueryId(IPin* This,
209 /* [out] */ unsigned short* *Id)
211 Debug unimplemented("CInputPin_QueryId", This);
212 return E_NOTIMPL;
215 static long STDCALL CInputPin_QueryAccept(IPin* This,
216 /* [in] */ const AM_MEDIA_TYPE* pmt)
218 Debug unimplemented("CInputPin_QueryAccept", This);
219 return E_NOTIMPL;
222 static long STDCALL CInputPin_EnumMediaTypes(IPin* This,
223 /* [out] */ IEnumMediaTypes** ppEnum)
225 Debug unimplemented("CInputPin_EnumMediaTypes", This);
226 return E_NOTIMPL;
229 static long STDCALL CInputPin_QueryInternalConnections(IPin* This,
230 /* [out] */ IPin** apPin,
231 /* [out][in] */ unsigned long *nPin)
233 Debug unimplemented("CInputPin_QueryInternalConnections", This);
234 return E_NOTIMPL;
237 static long STDCALL CInputPin_EndOfStream(IPin * This)
239 Debug unimplemented("CInputPin_EndOfStream", This);
240 return E_NOTIMPL;
244 static long STDCALL CInputPin_BeginFlush(IPin * This)
246 Debug unimplemented("CInputPin_BeginFlush", This);
247 return E_NOTIMPL;
251 static long STDCALL CInputPin_EndFlush(IPin* This)
253 Debug unimplemented("CInputPin_EndFlush", This);
254 return E_NOTIMPL;
257 static long STDCALL CInputPin_NewSegment(IPin* This,
258 /* [in] */ REFERENCE_TIME tStart,
259 /* [in] */ REFERENCE_TIME tStop,
260 /* [in] */ double dRate)
262 Debug unimplemented("CInputPin_NewSegment", This);
263 return E_NOTIMPL;
266 static void CInputPin_Destroy(CInputPin* This)
268 free(This->vt);
269 free(This);
272 IMPLEMENT_IUNKNOWN(CInputPin)
274 CInputPin* CInputPinCreate(CBaseFilter* p, const AM_MEDIA_TYPE* amt)
276 CInputPin* This = (CInputPin*) malloc(sizeof(CInputPin));
278 if (!This)
279 return NULL;
281 This->refcount = 1;
282 This->parent = p;
283 This->type = *amt;
285 This->vt= (IPin_vt*) malloc(sizeof(IPin_vt));
287 if (!This->vt)
289 free(This);
290 return NULL;
293 This->vt->QueryInterface = CInputPin_QueryInterface;
294 This->vt->AddRef = CInputPin_AddRef;
295 This->vt->Release = CInputPin_Release;
296 This->vt->Connect = CInputPin_Connect;
297 This->vt->ReceiveConnection = CInputPin_ReceiveConnection;
298 This->vt->Disconnect = CInputPin_Disconnect;
299 This->vt->ConnectedTo = CInputPin_ConnectedTo;
300 This->vt->ConnectionMediaType = CInputPin_ConnectionMediaType;
301 This->vt->QueryPinInfo = CInputPin_QueryPinInfo;
302 This->vt->QueryDirection = CInputPin_QueryDirection;
303 This->vt->QueryId = CInputPin_QueryId;
304 This->vt->QueryAccept = CInputPin_QueryAccept;
305 This->vt->EnumMediaTypes = CInputPin_EnumMediaTypes;
306 This->vt->QueryInternalConnections = CInputPin_QueryInternalConnections;
307 This->vt->EndOfStream = CInputPin_EndOfStream;
308 This->vt->BeginFlush = CInputPin_BeginFlush;
309 This->vt->EndFlush = CInputPin_EndFlush;
310 This->vt->NewSegment = CInputPin_NewSegment;
312 This->interfaces[0]=IID_IUnknown;
314 return This;
318 /*************
319 * BaseFilter
320 *************/
322 static long STDCALL CBaseFilter_GetClassID(IBaseFilter * This,
323 /* [out] */ CLSID *pClassID)
325 Debug unimplemented("CBaseFilter_GetClassID", This);
326 return E_NOTIMPL;
329 static long STDCALL CBaseFilter_Stop(IBaseFilter* This)
331 Debug unimplemented("CBaseFilter_Stop", This);
332 return E_NOTIMPL;
335 static long STDCALL CBaseFilter_Pause(IBaseFilter* This)
337 Debug unimplemented("CBaseFilter_Pause", This);
338 return E_NOTIMPL;
341 static long STDCALL CBaseFilter_Run(IBaseFilter* This, REFERENCE_TIME tStart)
343 Debug unimplemented("CBaseFilter_Run", This);
344 return E_NOTIMPL;
347 static long STDCALL CBaseFilter_GetState(IBaseFilter* This,
348 /* [in] */ unsigned long dwMilliSecsTimeout,
349 // /* [out] */ FILTER_STATE *State)
350 void* State)
352 Debug unimplemented("CBaseFilter_GetState", This);
353 return E_NOTIMPL;
356 static long STDCALL CBaseFilter_SetSyncSource(IBaseFilter* This,
357 /* [in] */ IReferenceClock *pClock)
359 Debug unimplemented("CBaseFilter_SetSyncSource", This);
360 return E_NOTIMPL;
363 static long STDCALL CBaseFilter_GetSyncSource(IBaseFilter* This,
364 /* [out] */ IReferenceClock **pClock)
366 Debug unimplemented("CBaseFilter_GetSyncSource", This);
367 return E_NOTIMPL;
371 static long STDCALL CBaseFilter_EnumPins(IBaseFilter* This,
372 /* [out] */ IEnumPins **ppEnum)
374 Debug printf("CBaseFilter_EnumPins(%p) called\n", This);
375 *ppEnum = (IEnumPins*) CEnumPinsCreate(((CBaseFilter*)This)->pin, ((CBaseFilter*)This)->unused_pin);
376 return 0;
379 static long STDCALL CBaseFilter_FindPin(IBaseFilter* This,
380 /* [string][in] */ const unsigned short* Id,
381 /* [out] */ IPin **ppPin)
383 Debug unimplemented("CBaseFilter_FindPin\n", This);
384 return E_NOTIMPL;
387 static long STDCALL CBaseFilter_QueryFilterInfo(IBaseFilter* This,
388 // /* [out] */ FILTER_INFO *pInfo)
389 void* pInfo)
391 Debug unimplemented("CBaseFilter_QueryFilterInfo", This);
392 return E_NOTIMPL;
395 static long STDCALL CBaseFilter_JoinFilterGraph(IBaseFilter* This,
396 /* [in] */ IFilterGraph* pGraph,
397 /* [string][in] */ const unsigned short* pName)
399 Debug unimplemented("CBaseFilter_JoinFilterGraph", This);
400 return E_NOTIMPL;
403 static long STDCALL CBaseFilter_QueryVendorInfo(IBaseFilter* This,
404 /* [string][out] */ unsigned short** pVendorInfo)
406 Debug unimplemented("CBaseFilter_QueryVendorInfo", This);
407 return E_NOTIMPL;
410 static IPin* CBaseFilter_GetPin(CBaseFilter* This)
412 return This->pin;
415 static IPin* CBaseFilter_GetUnusedPin(CBaseFilter* This)
417 return This->unused_pin;
420 static void CBaseFilter_Destroy(CBaseFilter* This)
422 if (This->vt)
423 free(This->vt);
424 if (This->pin)
425 This->pin->vt->Release((IUnknown*)This->pin);
426 if (This->unused_pin)
427 This->unused_pin->vt->Release((IUnknown*)This->unused_pin);
428 free(This);
431 IMPLEMENT_IUNKNOWN(CBaseFilter)
433 CBaseFilter* CBaseFilterCreate(const AM_MEDIA_TYPE* type, CBaseFilter2* parent)
435 CBaseFilter* This = (CBaseFilter*) malloc(sizeof(CBaseFilter));
436 if (!This)
437 return NULL;
439 This->refcount = 1;
441 This->pin = (IPin*) CInputPinCreate(This, type);
442 This->unused_pin = (IPin*) CRemotePinCreate(This, parent->GetPin(parent));
444 This->vt = (IBaseFilter_vt*) malloc(sizeof(IBaseFilter_vt));
445 if (!This->vt || !This->pin || !This->unused_pin)
447 CBaseFilter_Destroy(This);
448 return NULL;
451 This->vt->QueryInterface = CBaseFilter_QueryInterface;
452 This->vt->AddRef = CBaseFilter_AddRef;
453 This->vt->Release = CBaseFilter_Release;
454 This->vt->GetClassID = CBaseFilter_GetClassID;
455 This->vt->Stop = CBaseFilter_Stop;
456 This->vt->Pause = CBaseFilter_Pause;
457 This->vt->Run = CBaseFilter_Run;
458 This->vt->GetState = CBaseFilter_GetState;
459 This->vt->SetSyncSource = CBaseFilter_SetSyncSource;
460 This->vt->GetSyncSource = CBaseFilter_GetSyncSource;
461 This->vt->EnumPins = CBaseFilter_EnumPins;
462 This->vt->FindPin = CBaseFilter_FindPin;
463 This->vt->QueryFilterInfo = CBaseFilter_QueryFilterInfo;
464 This->vt->JoinFilterGraph = CBaseFilter_JoinFilterGraph;
465 This->vt->QueryVendorInfo = CBaseFilter_QueryVendorInfo;
467 This->interfaces[0] = IID_IUnknown;
468 This->interfaces[1] = IID_IBaseFilter;
470 This->GetPin = CBaseFilter_GetPin;
471 This->GetUnusedPin = CBaseFilter_GetUnusedPin;
473 return This;
477 /**************
478 * BaseFilter2
479 **************/
482 static long STDCALL CBaseFilter2_GetClassID(IBaseFilter* This,
483 /* [out] */ CLSID* pClassID)
485 Debug unimplemented("CBaseFilter2_GetClassID", This);
486 return E_NOTIMPL;
489 static long STDCALL CBaseFilter2_Stop(IBaseFilter* This)
491 Debug unimplemented("CBaseFilter2_Stop", This);
492 return E_NOTIMPL;
495 static long STDCALL CBaseFilter2_Pause(IBaseFilter* This)
497 Debug unimplemented("CBaseFilter2_Pause", This);
498 return E_NOTIMPL;
501 static long STDCALL CBaseFilter2_Run(IBaseFilter* This, REFERENCE_TIME tStart)
503 Debug unimplemented("CBaseFilter2_Run", This);
504 return E_NOTIMPL;
508 static long STDCALL CBaseFilter2_GetState(IBaseFilter* This,
509 /* [in] */ unsigned long dwMilliSecsTimeout,
510 // /* [out] */ FILTER_STATE *State)
511 void* State)
513 Debug unimplemented("CBaseFilter2_GetState", This);
514 return E_NOTIMPL;
517 static long STDCALL CBaseFilter2_SetSyncSource(IBaseFilter* This,
518 /* [in] */ IReferenceClock* pClock)
520 Debug unimplemented("CBaseFilter2_SetSyncSource", This);
521 return E_NOTIMPL;
524 static long STDCALL CBaseFilter2_GetSyncSource(IBaseFilter* This,
525 /* [out] */ IReferenceClock** pClock)
527 Debug unimplemented("CBaseFilter2_GetSyncSource", This);
528 return E_NOTIMPL;
531 static long STDCALL CBaseFilter2_EnumPins(IBaseFilter* This,
532 /* [out] */ IEnumPins** ppEnum)
534 Debug printf("CBaseFilter2_EnumPins(%p) called\n", This);
535 *ppEnum = (IEnumPins*) CEnumPinsCreate(((CBaseFilter2*)This)->pin, 0);
536 return 0;
539 static long STDCALL CBaseFilter2_FindPin(IBaseFilter* This,
540 /* [string][in] */ const unsigned short* Id,
541 /* [out] */ IPin** ppPin)
543 Debug unimplemented("CBaseFilter2_FindPin", This);
544 return E_NOTIMPL;
547 static long STDCALL CBaseFilter2_QueryFilterInfo(IBaseFilter* This,
548 // /* [out] */ FILTER_INFO *pInfo)
549 void* pInfo)
551 Debug unimplemented("CBaseFilter2_QueryFilterInfo", This);
552 return E_NOTIMPL;
555 static long STDCALL CBaseFilter2_JoinFilterGraph(IBaseFilter* This,
556 /* [in] */ IFilterGraph* pGraph,
557 /* [string][in] */
558 const unsigned short* pName)
560 Debug unimplemented("CBaseFilter2_JoinFilterGraph", This);
561 return E_NOTIMPL;
564 static long STDCALL CBaseFilter2_QueryVendorInfo(IBaseFilter* This,
565 /* [string][out] */
566 unsigned short** pVendorInfo)
568 Debug unimplemented("CBaseFilter2_QueryVendorInfo", This);
569 return E_NOTIMPL;
572 static IPin* CBaseFilter2_GetPin(CBaseFilter2* This)
574 return This->pin;
577 static void CBaseFilter2_Destroy(CBaseFilter2* This)
579 Debug printf("CBaseFilter2_Destroy(%p) called\n", This);
580 if (This->pin)
581 This->pin->vt->Release((IUnknown*) This->pin);
582 if (This->vt)
583 free(This->vt);
584 free(This);
587 IMPLEMENT_IUNKNOWN(CBaseFilter2)
589 static GUID CBaseFilter2_interf1 =
590 {0x76c61a30, 0xebe1, 0x11cf, {0x89, 0xf9, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb}};
591 static GUID CBaseFilter2_interf2 =
592 {0xaae7e4e2, 0x6388, 0x11d1, {0x8d, 0x93, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2}};
593 static GUID CBaseFilter2_interf3 =
594 {0x02ef04dd, 0x7580, 0x11d1, {0xbe, 0xce, 0x00, 0xc0, 0x4f, 0xb6, 0xe9, 0x37}};
596 CBaseFilter2* CBaseFilter2Create()
598 CBaseFilter2* This = (CBaseFilter2*) malloc(sizeof(CBaseFilter2));
600 if (!This)
601 return NULL;
603 This->refcount = 1;
604 This->pin = (IPin*) CRemotePin2Create(This);
606 This->vt = (IBaseFilter_vt*) malloc(sizeof(IBaseFilter_vt));
608 if (!This->pin || !This->vt)
610 CBaseFilter2_Destroy(This);
611 return NULL;
614 memset(This->vt, 0, sizeof(IBaseFilter_vt));
615 This->vt->QueryInterface = CBaseFilter2_QueryInterface;
616 This->vt->AddRef = CBaseFilter2_AddRef;
617 This->vt->Release = CBaseFilter2_Release;
618 This->vt->GetClassID = CBaseFilter2_GetClassID;
619 This->vt->Stop = CBaseFilter2_Stop;
620 This->vt->Pause = CBaseFilter2_Pause;
621 This->vt->Run = CBaseFilter2_Run;
622 This->vt->GetState = CBaseFilter2_GetState;
623 This->vt->SetSyncSource = CBaseFilter2_SetSyncSource;
624 This->vt->GetSyncSource = CBaseFilter2_GetSyncSource;
625 This->vt->EnumPins = CBaseFilter2_EnumPins;
626 This->vt->FindPin = CBaseFilter2_FindPin;
627 This->vt->QueryFilterInfo = CBaseFilter2_QueryFilterInfo;
628 This->vt->JoinFilterGraph = CBaseFilter2_JoinFilterGraph;
629 This->vt->QueryVendorInfo = CBaseFilter2_QueryVendorInfo;
631 This->GetPin = CBaseFilter2_GetPin;
633 This->interfaces[0] = IID_IUnknown;
634 This->interfaces[1] = IID_IBaseFilter;
635 This->interfaces[2] = CBaseFilter2_interf1;
636 This->interfaces[3] = CBaseFilter2_interf2;
637 This->interfaces[4] = CBaseFilter2_interf3;
639 return This;
643 /*************
644 * CRemotePin
645 *************/
648 static long STDCALL CRemotePin_ConnectedTo(IPin* This, /* [out] */ IPin** pPin)
650 Debug printf("CRemotePin_ConnectedTo(%p) called\n", This);
651 if (!pPin)
652 return E_INVALIDARG;
653 *pPin = ((CRemotePin*)This)->remote_pin;
654 (*pPin)->vt->AddRef((IUnknown*)(*pPin));
655 return 0;
658 static long STDCALL CRemotePin_QueryDirection(IPin* This,
659 /* [out] */ PIN_DIRECTION* pPinDir)
661 Debug printf("CRemotePin_QueryDirection(%p) called\n", This);
662 if (!pPinDir)
663 return E_INVALIDARG;
664 *pPinDir=PINDIR_INPUT;
665 return 0;
668 static long STDCALL CRemotePin_ConnectionMediaType(IPin* This, /* [out] */ AM_MEDIA_TYPE* pmt)
670 Debug unimplemented("CRemotePin_ConnectionMediaType", This);
671 return E_NOTIMPL;
674 static long STDCALL CRemotePin_QueryPinInfo(IPin* This, /* [out] */ PIN_INFO* pInfo)
676 CBaseFilter* lparent = ((CRemotePin*)This)->parent;
677 Debug printf("CRemotePin_QueryPinInfo(%p) called\n", This);
678 pInfo->dir= PINDIR_INPUT;
679 pInfo->pFilter = (IBaseFilter*) lparent;
680 lparent->vt->AddRef((IUnknown*)lparent);
681 pInfo->achName[0]=0;
682 return 0;
685 static void CRemotePin_Destroy(CRemotePin* This)
687 Debug printf("CRemotePin_Destroy(%p) called\n", This);
688 free(This->vt);
689 free(This);
692 IMPLEMENT_IUNKNOWN(CRemotePin)
694 CRemotePin* CRemotePinCreate(CBaseFilter* pt, IPin* rpin)
696 CRemotePin* This = (CRemotePin*) malloc(sizeof(CRemotePin));
698 if (!This)
699 return NULL;
701 Debug printf("CRemotePinCreate() called -> %p\n", This);
703 This->parent = pt;
704 This->remote_pin = rpin;
705 This->refcount = 1;
707 This->vt = (IPin_vt*) malloc(sizeof(IPin_vt));
709 if (!This->vt)
711 free(This);
712 return NULL;
715 memset(This->vt, 0, sizeof(IPin_vt));
716 This->vt->QueryInterface = CRemotePin_QueryInterface;
717 This->vt->AddRef = CRemotePin_AddRef;
718 This->vt->Release = CRemotePin_Release;
719 This->vt->QueryDirection = CRemotePin_QueryDirection;
720 This->vt->ConnectedTo = CRemotePin_ConnectedTo;
721 This->vt->ConnectionMediaType = CRemotePin_ConnectionMediaType;
722 This->vt->QueryPinInfo = CRemotePin_QueryPinInfo;
724 This->interfaces[0] = IID_IUnknown;
726 return This;
730 /*************
731 * CRemotePin2
732 *************/
735 static long STDCALL CRemotePin2_QueryPinInfo(IPin* This,
736 /* [out] */ PIN_INFO* pInfo)
738 CBaseFilter2* lparent=((CRemotePin2*)This)->parent;
739 Debug printf("CRemotePin2_QueryPinInfo(%p) called\n", This);
740 pInfo->pFilter=(IBaseFilter*)lparent;
741 lparent->vt->AddRef((IUnknown*)lparent);
742 pInfo->dir=PINDIR_OUTPUT;
743 pInfo->achName[0]=0;
744 return 0;
747 // FIXME - not being released!
748 static void CRemotePin2_Destroy(CRemotePin2* This)
750 Debug printf("CRemotePin2_Destroy(%p) called\n", This);
751 free(This->vt);
752 free(This);
755 IMPLEMENT_IUNKNOWN(CRemotePin2)
757 CRemotePin2* CRemotePin2Create(CBaseFilter2* p)
759 CRemotePin2* This = (CRemotePin2*) malloc(sizeof(CRemotePin2));
761 if (!This)
762 return NULL;
764 Debug printf("CRemotePin2Create() called -> %p\n", This);
766 This->parent = p;
767 This->refcount = 1;
769 This->vt = (IPin_vt*) malloc(sizeof(IPin_vt));
771 if (!This->vt)
773 free(This);
774 return NULL;
777 memset(This->vt, 0, sizeof(IPin_vt));
778 This->vt->QueryInterface = CRemotePin2_QueryInterface;
779 This->vt->AddRef = CRemotePin2_AddRef;
780 This->vt->Release = CRemotePin2_Release;
781 This->vt->QueryPinInfo = CRemotePin2_QueryPinInfo;
783 This->interfaces[0] = IID_IUnknown;
785 return This;