168
|
1 #include "inputpin.h"
|
2069
|
2 #include "wine/winerror.h"
|
1545
|
3 #include <string.h>
|
168
|
4 #include <stdio.h>
|
|
5 #include <stdlib.h>
|
1545
|
6
|
7386
|
7 static inline int unimplemented(const char* s, void* p)
|
1545
|
8 {
|
3056
|
9 Debug printf("%s(%p) called (UNIMPLEMENTED)", s, p);
|
|
10 return E_NOTIMPL;
|
|
11 }
|
1545
|
12
|
3056
|
13 /***********
|
|
14 * EnumPins
|
|
15 ***********/
|
168
|
16
|
3056
|
17 typedef struct
|
168
|
18 {
|
3056
|
19 IEnumPins_vt* vt;
|
3467
|
20 DECLARE_IUNKNOWN();
|
168
|
21 IPin* pin1;
|
|
22 IPin* pin2;
|
|
23 int counter;
|
3056
|
24 GUID interfaces[2];
|
|
25 } CEnumPins;
|
1545
|
26
|
3056
|
27 static long STDCALL CEnumPins_Next(IEnumPins* This,
|
|
28 /* [in] */ unsigned long cMediaTypes,
|
3130
|
29 /* [size_is][out] */ IPin** ppMediaTypes,
|
|
30 /* [out] */ unsigned long* pcFetched)
|
168
|
31 {
|
3056
|
32 CEnumPins* pin = (CEnumPins*)This;
|
168
|
33
|
3056
|
34 Debug printf("CEnumPins_Next(%p) called\n", This);
|
1545
|
35 if (!ppMediaTypes)
|
|
36 return E_INVALIDARG;
|
|
37 if (!pcFetched && (cMediaTypes!=1))
|
|
38 return E_INVALIDARG;
|
|
39 if (cMediaTypes<=0)
|
|
40 return 0;
|
|
41
|
3056
|
42 //lcounter = ((CEnumPins*)This)->counter;
|
|
43 //lpin1 = ((CEnumPins*)This)->pin1;
|
|
44 //lpin2 = ((CEnumPins*)This)->pin2;
|
|
45 if (((pin->counter == 2) && pin->pin2)
|
|
46 || ((pin->counter == 1) && !pin->pin2))
|
168
|
47 {
|
1545
|
48 if (pcFetched)
|
|
49 *pcFetched=0;
|
168
|
50 return 1;
|
|
51 }
|
1545
|
52
|
|
53 if (pcFetched)
|
|
54 *pcFetched=1;
|
3056
|
55 if (pin->counter==0)
|
168
|
56 {
|
3056
|
57 *ppMediaTypes = pin->pin1;
|
|
58 pin->pin1->vt->AddRef((IUnknown*)pin->pin1);
|
168
|
59 }
|
|
60 else
|
|
61 {
|
3056
|
62 *ppMediaTypes = pin->pin2;
|
|
63 pin->pin2->vt->AddRef((IUnknown*)pin->pin2);
|
168
|
64 }
|
3056
|
65 pin->counter++;
|
1545
|
66 if (cMediaTypes == 1)
|
|
67 return 0;
|
168
|
68 return 1;
|
|
69 }
|
|
70
|
3056
|
71 static long STDCALL CEnumPins_Skip(IEnumPins* This,
|
|
72 /* [in] */ unsigned long cMediaTypes)
|
168
|
73 {
|
3056
|
74 Debug unimplemented("CEnumPins_Skip", This);
|
168
|
75 return E_NOTIMPL;
|
|
76 }
|
|
77
|
3056
|
78 static long STDCALL CEnumPins_Reset(IEnumPins* This)
|
168
|
79 {
|
3056
|
80 Debug printf("CEnumPins_Reset(%p) called\n", This);
|
|
81 ((CEnumPins*)This)->counter = 0;
|
168
|
82 return 0;
|
|
83 }
|
|
84
|
3056
|
85 static long STDCALL CEnumPins_Clone(IEnumPins* This,
|
|
86 /* [out] */ IEnumPins** ppEnum)
|
168
|
87 {
|
3056
|
88 Debug unimplemented("CEnumPins_Clone", This);
|
168
|
89 return E_NOTIMPL;
|
|
90 }
|
1545
|
91
|
3056
|
92 static void CEnumPins_Destroy(CEnumPins* This)
|
168
|
93 {
|
3056
|
94 free(This->vt);
|
|
95 free(This);
|
168
|
96 }
|
|
97
|
3056
|
98 IMPLEMENT_IUNKNOWN(CEnumPins)
|
|
99
|
|
100 static CEnumPins* CEnumPinsCreate(IPin* p, IPin* pp)
|
168
|
101 {
|
3056
|
102 CEnumPins* This = (CEnumPins*) malloc(sizeof(CEnumPins));
|
|
103
|
3467
|
104 if (!This)
|
|
105 return NULL;
|
|
106
|
|
107 This->refcount = 1;
|
3056
|
108 This->pin1 = p;
|
|
109 This->pin2 = pp;
|
|
110 This->counter = 0;
|
|
111
|
|
112 This->vt = (IEnumPins_vt*) malloc(sizeof(IEnumPins_vt));
|
3467
|
113 if (!This->vt)
|
|
114 {
|
|
115 free(This);
|
|
116 return NULL;
|
|
117 }
|
3056
|
118 This->vt->QueryInterface = CEnumPins_QueryInterface;
|
|
119 This->vt->AddRef = CEnumPins_AddRef;
|
|
120 This->vt->Release = CEnumPins_Release;
|
|
121 This->vt->Next = CEnumPins_Next;
|
|
122 This->vt->Skip = CEnumPins_Skip;
|
|
123 This->vt->Reset = CEnumPins_Reset;
|
|
124 This->vt->Clone = CEnumPins_Clone;
|
|
125
|
|
126 This->interfaces[0] = IID_IUnknown;
|
|
127 This->interfaces[1] = IID_IEnumPins;
|
|
128
|
|
129 return This;
|
|
130 }
|
|
131
|
|
132
|
|
133
|
|
134 /***********
|
|
135 * InputPin
|
|
136 ***********/
|
|
137
|
3130
|
138 static long STDCALL CInputPin_Connect(IPin* This,
|
|
139 /* [in] */ IPin* pReceivePin,
|
|
140 /* [in] */ AM_MEDIA_TYPE* pmt)
|
3056
|
141 {
|
|
142 Debug unimplemented("CInputPin_Connect", This);
|
168
|
143 return E_NOTIMPL;
|
|
144 }
|
|
145
|
3056
|
146 static long STDCALL CInputPin_ReceiveConnection(IPin* This,
|
|
147 /* [in] */ IPin* pConnector,
|
|
148 /* [in] */ const AM_MEDIA_TYPE *pmt)
|
168
|
149 {
|
3056
|
150 Debug unimplemented("CInputPin_ReceiveConnection", This);
|
168
|
151 return E_NOTIMPL;
|
|
152 }
|
1545
|
153
|
3056
|
154 static long STDCALL CInputPin_Disconnect(IPin* This)
|
168
|
155 {
|
3056
|
156 Debug unimplemented("CInputPin_Disconnect", This);
|
168
|
157 return E_NOTIMPL;
|
|
158 }
|
|
159
|
3056
|
160 static long STDCALL CInputPin_ConnectedTo(IPin* This,
|
|
161 /* [out] */ IPin** pPin)
|
168
|
162 {
|
3056
|
163 Debug unimplemented("CInputPin_ConnectedTo", This);
|
168
|
164 return E_NOTIMPL;
|
|
165 }
|
|
166
|
3056
|
167 static long STDCALL CInputPin_ConnectionMediaType(IPin* This,
|
|
168 /* [out] */ AM_MEDIA_TYPE *pmt)
|
168
|
169 {
|
3056
|
170 Debug printf("CInputPin_ConnectionMediaType(%p) called\n", This);
|
|
171 if (!pmt)
|
|
172 return E_INVALIDARG;
|
168
|
173 *pmt=((CInputPin*)This)->type;
|
3056
|
174 if (pmt->cbFormat > 0)
|
168
|
175 {
|
9964
|
176 pmt->pbFormat=(char *)malloc(pmt->cbFormat);
|
168
|
177 memcpy(pmt->pbFormat, ((CInputPin*)This)->type.pbFormat, pmt->cbFormat);
|
1545
|
178 }
|
168
|
179 return 0;
|
|
180 }
|
|
181
|
3056
|
182 static long STDCALL CInputPin_QueryPinInfo(IPin* This,
|
|
183 /* [out] */ PIN_INFO *pInfo)
|
168
|
184 {
|
1545
|
185 CBaseFilter* lparent=((CInputPin*)This)->parent;
|
3056
|
186 Debug printf("CInputPin_QueryPinInfo(%p) called\n", This);
|
|
187 pInfo->dir = PINDIR_OUTPUT;
|
|
188 pInfo->pFilter = (IBaseFilter*) lparent;
|
1545
|
189 lparent->vt->AddRef((IUnknown*)lparent);
|
3056
|
190 pInfo->achName[0] = 0;
|
|
191 return 0;
|
|
192 }
|
|
193
|
|
194 static long STDCALL CInputPin_QueryDirection(IPin* This,
|
|
195 /* [out] */ PIN_DIRECTION *pPinDir)
|
|
196 {
|
|
197 *pPinDir = PINDIR_OUTPUT;
|
|
198 Debug printf("CInputPin_QueryDirection(%p) called\n", This);
|
168
|
199 return 0;
|
|
200 }
|
|
201
|
3056
|
202 static long STDCALL CInputPin_QueryId(IPin* This,
|
|
203 /* [out] */ unsigned short* *Id)
|
168
|
204 {
|
3056
|
205 Debug unimplemented("CInputPin_QueryId", This);
|
|
206 return E_NOTIMPL;
|
168
|
207 }
|
|
208
|
3056
|
209 static long STDCALL CInputPin_QueryAccept(IPin* This,
|
3130
|
210 /* [in] */ const AM_MEDIA_TYPE* pmt)
|
168
|
211 {
|
3056
|
212 Debug unimplemented("CInputPin_QueryAccept", This);
|
168
|
213 return E_NOTIMPL;
|
|
214 }
|
|
215
|
3056
|
216 static long STDCALL CInputPin_EnumMediaTypes(IPin* This,
|
3130
|
217 /* [out] */ IEnumMediaTypes** ppEnum)
|
168
|
218 {
|
3056
|
219 Debug unimplemented("CInputPin_EnumMediaTypes", This);
|
|
220 return E_NOTIMPL;
|
|
221 }
|
|
222
|
|
223 static long STDCALL CInputPin_QueryInternalConnections(IPin* This,
|
3130
|
224 /* [out] */ IPin** apPin,
|
3056
|
225 /* [out][in] */ unsigned long *nPin)
|
|
226 {
|
|
227 Debug unimplemented("CInputPin_QueryInternalConnections", This);
|
|
228 return E_NOTIMPL;
|
|
229 }
|
|
230
|
|
231 static long STDCALL CInputPin_EndOfStream(IPin * This)
|
|
232 {
|
|
233 Debug unimplemented("CInputPin_EndOfStream", This);
|
168
|
234 return E_NOTIMPL;
|
|
235 }
|
|
236
|
|
237
|
3056
|
238 static long STDCALL CInputPin_BeginFlush(IPin * This)
|
168
|
239 {
|
3056
|
240 Debug unimplemented("CInputPin_BeginFlush", This);
|
168
|
241 return E_NOTIMPL;
|
|
242 }
|
|
243
|
|
244
|
3130
|
245 static long STDCALL CInputPin_EndFlush(IPin* This)
|
168
|
246 {
|
3056
|
247 Debug unimplemented("CInputPin_EndFlush", This);
|
168
|
248 return E_NOTIMPL;
|
|
249 }
|
|
250
|
3130
|
251 static long STDCALL CInputPin_NewSegment(IPin* This,
|
3056
|
252 /* [in] */ REFERENCE_TIME tStart,
|
|
253 /* [in] */ REFERENCE_TIME tStop,
|
|
254 /* [in] */ double dRate)
|
168
|
255 {
|
3056
|
256 Debug unimplemented("CInputPin_NewSegment", This);
|
168
|
257 return E_NOTIMPL;
|
1545
|
258 }
|
168
|
259
|
3056
|
260 static void CInputPin_Destroy(CInputPin* This)
|
168
|
261 {
|
3056
|
262 free(This->vt);
|
|
263 free(This);
|
1545
|
264 }
|
|
265
|
3056
|
266 IMPLEMENT_IUNKNOWN(CInputPin)
|
|
267
|
|
268 CInputPin* CInputPinCreate(CBaseFilter* p, const AM_MEDIA_TYPE* amt)
|
168
|
269 {
|
3056
|
270 CInputPin* This = (CInputPin*) malloc(sizeof(CInputPin));
|
|
271
|
3467
|
272 if (!This)
|
|
273 return NULL;
|
|
274
|
|
275 This->refcount = 1;
|
3056
|
276 This->parent = p;
|
|
277 This->type = *amt;
|
|
278
|
|
279 This->vt= (IPin_vt*) malloc(sizeof(IPin_vt));
|
3467
|
280
|
|
281 if (!This->vt)
|
|
282 {
|
|
283 free(This);
|
|
284 return NULL;
|
|
285 }
|
|
286
|
3056
|
287 This->vt->QueryInterface = CInputPin_QueryInterface;
|
|
288 This->vt->AddRef = CInputPin_AddRef;
|
|
289 This->vt->Release = CInputPin_Release;
|
|
290 This->vt->Connect = CInputPin_Connect;
|
|
291 This->vt->ReceiveConnection = CInputPin_ReceiveConnection;
|
|
292 This->vt->Disconnect = CInputPin_Disconnect;
|
|
293 This->vt->ConnectedTo = CInputPin_ConnectedTo;
|
|
294 This->vt->ConnectionMediaType = CInputPin_ConnectionMediaType;
|
|
295 This->vt->QueryPinInfo = CInputPin_QueryPinInfo;
|
|
296 This->vt->QueryDirection = CInputPin_QueryDirection;
|
|
297 This->vt->QueryId = CInputPin_QueryId;
|
|
298 This->vt->QueryAccept = CInputPin_QueryAccept;
|
|
299 This->vt->EnumMediaTypes = CInputPin_EnumMediaTypes;
|
|
300 This->vt->QueryInternalConnections = CInputPin_QueryInternalConnections;
|
|
301 This->vt->EndOfStream = CInputPin_EndOfStream;
|
|
302 This->vt->BeginFlush = CInputPin_BeginFlush;
|
|
303 This->vt->EndFlush = CInputPin_EndFlush;
|
|
304 This->vt->NewSegment = CInputPin_NewSegment;
|
|
305
|
|
306 This->interfaces[0]=IID_IUnknown;
|
|
307
|
|
308 return This;
|
1545
|
309 }
|
168
|
310
|
3056
|
311
|
|
312 /*************
|
|
313 * BaseFilter
|
|
314 *************/
|
|
315
|
|
316 static long STDCALL CBaseFilter_GetClassID(IBaseFilter * This,
|
|
317 /* [out] */ CLSID *pClassID)
|
168
|
318 {
|
3056
|
319 Debug unimplemented("CBaseFilter_GetClassID", This);
|
168
|
320 return E_NOTIMPL;
|
1545
|
321 }
|
168
|
322
|
3056
|
323 static long STDCALL CBaseFilter_Stop(IBaseFilter* This)
|
168
|
324 {
|
3056
|
325 Debug unimplemented("CBaseFilter_Stop", This);
|
168
|
326 return E_NOTIMPL;
|
1545
|
327 }
|
168
|
328
|
3056
|
329 static long STDCALL CBaseFilter_Pause(IBaseFilter* This)
|
168
|
330 {
|
3056
|
331 Debug unimplemented("CBaseFilter_Pause", This);
|
|
332 return E_NOTIMPL;
|
|
333 }
|
|
334
|
|
335 static long STDCALL CBaseFilter_Run(IBaseFilter* This, REFERENCE_TIME tStart)
|
|
336 {
|
|
337 Debug unimplemented("CBaseFilter_Run", This);
|
168
|
338 return E_NOTIMPL;
|
1545
|
339 }
|
168
|
340
|
3056
|
341 static long STDCALL CBaseFilter_GetState(IBaseFilter* This,
|
|
342 /* [in] */ unsigned long dwMilliSecsTimeout,
|
|
343 // /* [out] */ FILTER_STATE *State)
|
|
344 void* State)
|
168
|
345 {
|
3056
|
346 Debug unimplemented("CBaseFilter_GetState", This);
|
|
347 return E_NOTIMPL;
|
1545
|
348 }
|
168
|
349
|
3056
|
350 static long STDCALL CBaseFilter_SetSyncSource(IBaseFilter* This,
|
|
351 /* [in] */ IReferenceClock *pClock)
|
|
352 {
|
|
353 Debug unimplemented("CBaseFilter_SetSyncSource", This);
|
|
354 return E_NOTIMPL;
|
|
355 }
|
1545
|
356
|
3056
|
357 static long STDCALL CBaseFilter_GetSyncSource(IBaseFilter* This,
|
|
358 /* [out] */ IReferenceClock **pClock)
|
168
|
359 {
|
3056
|
360 Debug unimplemented("CBaseFilter_GetSyncSource", This);
|
168
|
361 return E_NOTIMPL;
|
1545
|
362 }
|
168
|
363
|
1545
|
364
|
3056
|
365 static long STDCALL CBaseFilter_EnumPins(IBaseFilter* This,
|
|
366 /* [out] */ IEnumPins **ppEnum)
|
|
367 {
|
|
368 Debug printf("CBaseFilter_EnumPins(%p) called\n", This);
|
|
369 *ppEnum = (IEnumPins*) CEnumPinsCreate(((CBaseFilter*)This)->pin, ((CBaseFilter*)This)->unused_pin);
|
|
370 return 0;
|
|
371 }
|
|
372
|
|
373 static long STDCALL CBaseFilter_FindPin(IBaseFilter* This,
|
|
374 /* [string][in] */ const unsigned short* Id,
|
|
375 /* [out] */ IPin **ppPin)
|
168
|
376 {
|
3056
|
377 Debug unimplemented("CBaseFilter_FindPin\n", This);
|
|
378 return E_NOTIMPL;
|
|
379 }
|
|
380
|
3130
|
381 static long STDCALL CBaseFilter_QueryFilterInfo(IBaseFilter* This,
|
3056
|
382 // /* [out] */ FILTER_INFO *pInfo)
|
|
383 void* pInfo)
|
|
384 {
|
|
385 Debug unimplemented("CBaseFilter_QueryFilterInfo", This);
|
|
386 return E_NOTIMPL;
|
|
387 }
|
|
388
|
3130
|
389 static long STDCALL CBaseFilter_JoinFilterGraph(IBaseFilter* This,
|
|
390 /* [in] */ IFilterGraph* pGraph,
|
3056
|
391 /* [string][in] */ const unsigned short* pName)
|
|
392 {
|
|
393 Debug unimplemented("CBaseFilter_JoinFilterGraph", This);
|
|
394 return E_NOTIMPL;
|
|
395 }
|
|
396
|
3130
|
397 static long STDCALL CBaseFilter_QueryVendorInfo(IBaseFilter* This,
|
|
398 /* [string][out] */ unsigned short** pVendorInfo)
|
3056
|
399 {
|
|
400 Debug unimplemented("CBaseFilter_QueryVendorInfo", This);
|
168
|
401 return E_NOTIMPL;
|
1545
|
402 }
|
168
|
403
|
3056
|
404 static IPin* CBaseFilter_GetPin(CBaseFilter* This)
|
|
405 {
|
|
406 return This->pin;
|
|
407 }
|
1545
|
408
|
3056
|
409 static IPin* CBaseFilter_GetUnusedPin(CBaseFilter* This)
|
168
|
410 {
|
3056
|
411 return This->unused_pin;
|
|
412 }
|
|
413
|
|
414 static void CBaseFilter_Destroy(CBaseFilter* This)
|
|
415 {
|
3467
|
416 if (This->vt)
|
|
417 free(This->vt);
|
|
418 if (This->pin)
|
|
419 This->pin->vt->Release((IUnknown*)This->pin);
|
|
420 if (This->unused_pin)
|
|
421 This->unused_pin->vt->Release((IUnknown*)This->unused_pin);
|
3056
|
422 free(This);
|
1545
|
423 }
|
168
|
424
|
3056
|
425 IMPLEMENT_IUNKNOWN(CBaseFilter)
|
1545
|
426
|
3056
|
427 CBaseFilter* CBaseFilterCreate(const AM_MEDIA_TYPE* type, CBaseFilter2* parent)
|
168
|
428 {
|
3056
|
429 CBaseFilter* This = (CBaseFilter*) malloc(sizeof(CBaseFilter));
|
3467
|
430 if (!This)
|
|
431 return NULL;
|
|
432
|
3056
|
433 This->refcount = 1;
|
|
434
|
|
435 This->pin = (IPin*) CInputPinCreate(This, type);
|
|
436 This->unused_pin = (IPin*) CRemotePinCreate(This, parent->GetPin(parent));
|
|
437
|
|
438 This->vt = (IBaseFilter_vt*) malloc(sizeof(IBaseFilter_vt));
|
3467
|
439 if (!This->vt || !This->pin || !This->unused_pin)
|
|
440 {
|
|
441 CBaseFilter_Destroy(This);
|
|
442 return NULL;
|
|
443 }
|
|
444
|
3056
|
445 This->vt->QueryInterface = CBaseFilter_QueryInterface;
|
|
446 This->vt->AddRef = CBaseFilter_AddRef;
|
|
447 This->vt->Release = CBaseFilter_Release;
|
|
448 This->vt->GetClassID = CBaseFilter_GetClassID;
|
|
449 This->vt->Stop = CBaseFilter_Stop;
|
|
450 This->vt->Pause = CBaseFilter_Pause;
|
|
451 This->vt->Run = CBaseFilter_Run;
|
|
452 This->vt->GetState = CBaseFilter_GetState;
|
|
453 This->vt->SetSyncSource = CBaseFilter_SetSyncSource;
|
|
454 This->vt->GetSyncSource = CBaseFilter_GetSyncSource;
|
|
455 This->vt->EnumPins = CBaseFilter_EnumPins;
|
|
456 This->vt->FindPin = CBaseFilter_FindPin;
|
|
457 This->vt->QueryFilterInfo = CBaseFilter_QueryFilterInfo;
|
|
458 This->vt->JoinFilterGraph = CBaseFilter_JoinFilterGraph;
|
|
459 This->vt->QueryVendorInfo = CBaseFilter_QueryVendorInfo;
|
|
460
|
|
461 This->interfaces[0] = IID_IUnknown;
|
|
462 This->interfaces[1] = IID_IBaseFilter;
|
|
463
|
|
464 This->GetPin = CBaseFilter_GetPin;
|
|
465 This->GetUnusedPin = CBaseFilter_GetUnusedPin;
|
|
466
|
|
467 return This;
|
1545
|
468 }
|
168
|
469
|
|
470
|
3056
|
471 /**************
|
|
472 * BaseFilter2
|
|
473 **************/
|
168
|
474
|
|
475
|
3130
|
476 static long STDCALL CBaseFilter2_GetClassID(IBaseFilter* This,
|
|
477 /* [out] */ CLSID* pClassID)
|
168
|
478 {
|
3056
|
479 Debug unimplemented("CBaseFilter2_GetClassID", This);
|
168
|
480 return E_NOTIMPL;
|
1545
|
481 }
|
168
|
482
|
3130
|
483 static long STDCALL CBaseFilter2_Stop(IBaseFilter* This)
|
168
|
484 {
|
3056
|
485 Debug unimplemented("CBaseFilter2_Stop", This);
|
168
|
486 return E_NOTIMPL;
|
1545
|
487 }
|
168
|
488
|
3130
|
489 static long STDCALL CBaseFilter2_Pause(IBaseFilter* This)
|
168
|
490 {
|
3056
|
491 Debug unimplemented("CBaseFilter2_Pause", This);
|
168
|
492 return E_NOTIMPL;
|
1545
|
493 }
|
|
494
|
3130
|
495 static long STDCALL CBaseFilter2_Run(IBaseFilter* This, REFERENCE_TIME tStart)
|
168
|
496 {
|
3056
|
497 Debug unimplemented("CBaseFilter2_Run", This);
|
168
|
498 return E_NOTIMPL;
|
1545
|
499 }
|
168
|
500
|
1545
|
501
|
3056
|
502 static long STDCALL CBaseFilter2_GetState(IBaseFilter* This,
|
|
503 /* [in] */ unsigned long dwMilliSecsTimeout,
|
|
504 // /* [out] */ FILTER_STATE *State)
|
|
505 void* State)
|
|
506 {
|
|
507 Debug unimplemented("CBaseFilter2_GetState", This);
|
|
508 return E_NOTIMPL;
|
|
509 }
|
|
510
|
|
511 static long STDCALL CBaseFilter2_SetSyncSource(IBaseFilter* This,
|
|
512 /* [in] */ IReferenceClock* pClock)
|
|
513 {
|
|
514 Debug unimplemented("CBaseFilter2_SetSyncSource", This);
|
|
515 return E_NOTIMPL;
|
|
516 }
|
|
517
|
|
518 static long STDCALL CBaseFilter2_GetSyncSource(IBaseFilter* This,
|
|
519 /* [out] */ IReferenceClock** pClock)
|
|
520 {
|
|
521 Debug unimplemented("CBaseFilter2_GetSyncSource", This);
|
|
522 return E_NOTIMPL;
|
|
523 }
|
|
524
|
|
525 static long STDCALL CBaseFilter2_EnumPins(IBaseFilter* This,
|
|
526 /* [out] */ IEnumPins** ppEnum)
|
168
|
527 {
|
3056
|
528 Debug printf("CBaseFilter2_EnumPins(%p) called\n", This);
|
|
529 *ppEnum = (IEnumPins*) CEnumPinsCreate(((CBaseFilter2*)This)->pin, 0);
|
|
530 return 0;
|
|
531 }
|
|
532
|
|
533 static long STDCALL CBaseFilter2_FindPin(IBaseFilter* This,
|
|
534 /* [string][in] */ const unsigned short* Id,
|
|
535 /* [out] */ IPin** ppPin)
|
|
536 {
|
|
537 Debug unimplemented("CBaseFilter2_FindPin", This);
|
|
538 return E_NOTIMPL;
|
|
539 }
|
|
540
|
|
541 static long STDCALL CBaseFilter2_QueryFilterInfo(IBaseFilter* This,
|
|
542 // /* [out] */ FILTER_INFO *pInfo)
|
|
543 void* pInfo)
|
|
544 {
|
|
545 Debug unimplemented("CBaseFilter2_QueryFilterInfo", This);
|
|
546 return E_NOTIMPL;
|
|
547 }
|
|
548
|
|
549 static long STDCALL CBaseFilter2_JoinFilterGraph(IBaseFilter* This,
|
|
550 /* [in] */ IFilterGraph* pGraph,
|
|
551 /* [string][in] */
|
|
552 const unsigned short* pName)
|
|
553 {
|
|
554 Debug unimplemented("CBaseFilter2_JoinFilterGraph", This);
|
168
|
555 return E_NOTIMPL;
|
1545
|
556 }
|
168
|
557
|
3056
|
558 static long STDCALL CBaseFilter2_QueryVendorInfo(IBaseFilter* This,
|
|
559 /* [string][out] */
|
|
560 unsigned short** pVendorInfo)
|
168
|
561 {
|
3056
|
562 Debug unimplemented("CBaseFilter2_QueryVendorInfo", This);
|
168
|
563 return E_NOTIMPL;
|
1545
|
564 }
|
168
|
565
|
3056
|
566 static IPin* CBaseFilter2_GetPin(CBaseFilter2* This)
|
|
567 {
|
|
568 return This->pin;
|
|
569 }
|
1545
|
570
|
3056
|
571 static void CBaseFilter2_Destroy(CBaseFilter2* This)
|
168
|
572 {
|
3130
|
573 Debug printf("CBaseFilter2_Destroy(%p) called\n", This);
|
3467
|
574 if (This->pin)
|
|
575 This->pin->vt->Release((IUnknown*) This->pin);
|
|
576 if (This->vt)
|
|
577 free(This->vt);
|
3056
|
578 free(This);
|
1545
|
579 }
|
168
|
580
|
3056
|
581 IMPLEMENT_IUNKNOWN(CBaseFilter2)
|
1545
|
582
|
3056
|
583 static GUID CBaseFilter2_interf1 =
|
|
584 {0x76c61a30, 0xebe1, 0x11cf, {0x89, 0xf9, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb}};
|
|
585 static GUID CBaseFilter2_interf2 =
|
|
586 {0xaae7e4e2, 0x6388, 0x11d1, {0x8d, 0x93, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2}};
|
|
587 static GUID CBaseFilter2_interf3 =
|
|
588 {0x02ef04dd, 0x7580, 0x11d1, {0xbe, 0xce, 0x00, 0xc0, 0x4f, 0xb6, 0xe9, 0x37}};
|
|
589
|
|
590 CBaseFilter2* CBaseFilter2Create()
|
168
|
591 {
|
3056
|
592 CBaseFilter2* This = (CBaseFilter2*) malloc(sizeof(CBaseFilter2));
|
|
593
|
3467
|
594 if (!This)
|
|
595 return NULL;
|
|
596
|
3056
|
597 This->refcount = 1;
|
|
598 This->pin = (IPin*) CRemotePin2Create(This);
|
|
599
|
|
600 This->vt = (IBaseFilter_vt*) malloc(sizeof(IBaseFilter_vt));
|
3467
|
601
|
|
602 if (!This->pin || !This->vt)
|
|
603 {
|
|
604 CBaseFilter2_Destroy(This);
|
|
605 return NULL;
|
|
606 }
|
|
607
|
3056
|
608 memset(This->vt, 0, sizeof(IBaseFilter_vt));
|
|
609 This->vt->QueryInterface = CBaseFilter2_QueryInterface;
|
|
610 This->vt->AddRef = CBaseFilter2_AddRef;
|
|
611 This->vt->Release = CBaseFilter2_Release;
|
|
612 This->vt->GetClassID = CBaseFilter2_GetClassID;
|
|
613 This->vt->Stop = CBaseFilter2_Stop;
|
|
614 This->vt->Pause = CBaseFilter2_Pause;
|
|
615 This->vt->Run = CBaseFilter2_Run;
|
|
616 This->vt->GetState = CBaseFilter2_GetState;
|
|
617 This->vt->SetSyncSource = CBaseFilter2_SetSyncSource;
|
|
618 This->vt->GetSyncSource = CBaseFilter2_GetSyncSource;
|
|
619 This->vt->EnumPins = CBaseFilter2_EnumPins;
|
|
620 This->vt->FindPin = CBaseFilter2_FindPin;
|
|
621 This->vt->QueryFilterInfo = CBaseFilter2_QueryFilterInfo;
|
|
622 This->vt->JoinFilterGraph = CBaseFilter2_JoinFilterGraph;
|
|
623 This->vt->QueryVendorInfo = CBaseFilter2_QueryVendorInfo;
|
|
624
|
|
625 This->GetPin = CBaseFilter2_GetPin;
|
|
626
|
|
627 This->interfaces[0] = IID_IUnknown;
|
|
628 This->interfaces[1] = IID_IBaseFilter;
|
|
629 This->interfaces[2] = CBaseFilter2_interf1;
|
|
630 This->interfaces[3] = CBaseFilter2_interf2;
|
|
631 This->interfaces[4] = CBaseFilter2_interf3;
|
|
632
|
|
633 return This;
|
1545
|
634 }
|
168
|
635
|
1545
|
636
|
3056
|
637 /*************
|
|
638 * CRemotePin
|
|
639 *************/
|
1545
|
640
|
168
|
641
|
3056
|
642 static long STDCALL CRemotePin_ConnectedTo(IPin* This, /* [out] */ IPin** pPin)
|
168
|
643 {
|
3056
|
644 Debug printf("CRemotePin_ConnectedTo(%p) called\n", This);
|
1545
|
645 if (!pPin)
|
|
646 return E_INVALIDARG;
|
3056
|
647 *pPin = ((CRemotePin*)This)->remote_pin;
|
1545
|
648 (*pPin)->vt->AddRef((IUnknown*)(*pPin));
|
|
649 return 0;
|
|
650 }
|
168
|
651
|
3056
|
652 static long STDCALL CRemotePin_QueryDirection(IPin* This,
|
3130
|
653 /* [out] */ PIN_DIRECTION* pPinDir)
|
1545
|
654 {
|
3056
|
655 Debug printf("CRemotePin_QueryDirection(%p) called\n", This);
|
1545
|
656 if (!pPinDir)
|
|
657 return E_INVALIDARG;
|
|
658 *pPinDir=PINDIR_INPUT;
|
|
659 return 0;
|
|
660 }
|
|
661
|
|
662 static long STDCALL CRemotePin_ConnectionMediaType(IPin* This, /* [out] */ AM_MEDIA_TYPE* pmt)
|
168
|
663 {
|
3056
|
664 Debug unimplemented("CRemotePin_ConnectionMediaType", This);
|
168
|
665 return E_NOTIMPL;
|
|
666 }
|
|
667
|
1545
|
668 static long STDCALL CRemotePin_QueryPinInfo(IPin* This, /* [out] */ PIN_INFO* pInfo)
|
168
|
669 {
|
1545
|
670 CBaseFilter* lparent = ((CRemotePin*)This)->parent;
|
3056
|
671 Debug printf("CRemotePin_QueryPinInfo(%p) called\n", This);
|
|
672 pInfo->dir= PINDIR_INPUT;
|
|
673 pInfo->pFilter = (IBaseFilter*) lparent;
|
1545
|
674 lparent->vt->AddRef((IUnknown*)lparent);
|
|
675 pInfo->achName[0]=0;
|
|
676 return 0;
|
|
677 }
|
|
678
|
3056
|
679 static void CRemotePin_Destroy(CRemotePin* This)
|
|
680 {
|
|
681 Debug printf("CRemotePin_Destroy(%p) called\n", This);
|
|
682 free(This->vt);
|
|
683 free(This);
|
|
684 }
|
|
685
|
|
686 IMPLEMENT_IUNKNOWN(CRemotePin)
|
|
687
|
|
688 CRemotePin* CRemotePinCreate(CBaseFilter* pt, IPin* rpin)
|
|
689 {
|
|
690 CRemotePin* This = (CRemotePin*) malloc(sizeof(CRemotePin));
|
3467
|
691
|
|
692 if (!This)
|
|
693 return NULL;
|
|
694
|
3056
|
695 Debug printf("CRemotePinCreate() called -> %p\n", This);
|
|
696
|
|
697 This->parent = pt;
|
|
698 This->remote_pin = rpin;
|
|
699 This->refcount = 1;
|
|
700
|
|
701 This->vt = (IPin_vt*) malloc(sizeof(IPin_vt));
|
3467
|
702
|
|
703 if (!This->vt)
|
|
704 {
|
|
705 free(This);
|
|
706 return NULL;
|
|
707 }
|
|
708
|
3056
|
709 memset(This->vt, 0, sizeof(IPin_vt));
|
|
710 This->vt->QueryInterface = CRemotePin_QueryInterface;
|
|
711 This->vt->AddRef = CRemotePin_AddRef;
|
|
712 This->vt->Release = CRemotePin_Release;
|
|
713 This->vt->QueryDirection = CRemotePin_QueryDirection;
|
|
714 This->vt->ConnectedTo = CRemotePin_ConnectedTo;
|
|
715 This->vt->ConnectionMediaType = CRemotePin_ConnectionMediaType;
|
|
716 This->vt->QueryPinInfo = CRemotePin_QueryPinInfo;
|
|
717
|
|
718 This->interfaces[0] = IID_IUnknown;
|
|
719
|
|
720 return This;
|
|
721 }
|
|
722
|
|
723
|
|
724 /*************
|
3130
|
725 * CRemotePin2
|
3056
|
726 *************/
|
|
727
|
1545
|
728
|
3130
|
729 static long STDCALL CRemotePin2_QueryPinInfo(IPin* This,
|
|
730 /* [out] */ PIN_INFO* pInfo)
|
1545
|
731 {
|
|
732 CBaseFilter2* lparent=((CRemotePin2*)This)->parent;
|
3056
|
733 Debug printf("CRemotePin2_QueryPinInfo(%p) called\n", This);
|
1545
|
734 pInfo->pFilter=(IBaseFilter*)lparent;
|
|
735 lparent->vt->AddRef((IUnknown*)lparent);
|
|
736 pInfo->dir=PINDIR_OUTPUT;
|
168
|
737 pInfo->achName[0]=0;
|
|
738 return 0;
|
|
739 }
|
1545
|
740
|
3130
|
741 // FIXME - not being released!
|
3056
|
742 static void CRemotePin2_Destroy(CRemotePin2* This)
|
1545
|
743 {
|
3056
|
744 Debug printf("CRemotePin2_Destroy(%p) called\n", This);
|
|
745 free(This->vt);
|
|
746 free(This);
|
1545
|
747 }
|
|
748
|
3056
|
749 IMPLEMENT_IUNKNOWN(CRemotePin2)
|
|
750
|
|
751 CRemotePin2* CRemotePin2Create(CBaseFilter2* p)
|
1545
|
752 {
|
3056
|
753 CRemotePin2* This = (CRemotePin2*) malloc(sizeof(CRemotePin2));
|
3467
|
754
|
|
755 if (!This)
|
|
756 return NULL;
|
|
757
|
3056
|
758 Debug printf("CRemotePin2Create() called -> %p\n", This);
|
|
759
|
|
760 This->parent = p;
|
|
761 This->refcount = 1;
|
|
762
|
|
763 This->vt = (IPin_vt*) malloc(sizeof(IPin_vt));
|
3467
|
764
|
|
765 if (!This->vt)
|
|
766 {
|
|
767 free(This);
|
|
768 return NULL;
|
|
769 }
|
|
770
|
3056
|
771 memset(This->vt, 0, sizeof(IPin_vt));
|
|
772 This->vt->QueryInterface = CRemotePin2_QueryInterface;
|
|
773 This->vt->AddRef = CRemotePin2_AddRef;
|
|
774 This->vt->Release = CRemotePin2_Release;
|
|
775 This->vt->QueryPinInfo = CRemotePin2_QueryPinInfo;
|
|
776
|
|
777 This->interfaces[0] = IID_IUnknown;
|
|
778
|
|
779 return This;
|
1545
|
780 }
|