Mercurial > mplayer.hg
annotate loader/dshow/inputpin.c @ 19995:9cd5e242121e
in case of errors after decoding quit the main decoding
loop before memmove() when sh_audio->in_buffer_len <= 0;
patch by Chandan Pitta chandan.pitta gmail com
author | nicodvb |
---|---|
date | Wed, 27 Sep 2006 21:45:15 +0000 |
parents | 3bf0d70b4c7f |
children | 24dc4ec0d08d |
rev | line source |
---|---|
15166
f5537cc95b02
Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents:
9964
diff
changeset
|
1 /* |
18783 | 2 * Modified for use with MPlayer, detailed changelog at |
3 * http://svn.mplayerhq.hu/mplayer/trunk/ | |
15166
f5537cc95b02
Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents:
9964
diff
changeset
|
4 * $Id$ |
f5537cc95b02
Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents:
9964
diff
changeset
|
5 */ |
f5537cc95b02
Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents:
9964
diff
changeset
|
6 |
168 | 7 #include "inputpin.h" |
2069 | 8 #include "wine/winerror.h" |
1545 | 9 #include <string.h> |
168 | 10 #include <stdio.h> |
11 #include <stdlib.h> | |
1545 | 12 |
7386 | 13 static inline int unimplemented(const char* s, void* p) |
1545 | 14 { |
3056 | 15 Debug printf("%s(%p) called (UNIMPLEMENTED)", s, p); |
16 return E_NOTIMPL; | |
17 } | |
1545 | 18 |
3056 | 19 /*********** |
20 * EnumPins | |
21 ***********/ | |
168 | 22 |
3056 | 23 typedef struct |
168 | 24 { |
3056 | 25 IEnumPins_vt* vt; |
3467 | 26 DECLARE_IUNKNOWN(); |
168 | 27 IPin* pin1; |
28 IPin* pin2; | |
29 int counter; | |
3056 | 30 GUID interfaces[2]; |
31 } CEnumPins; | |
1545 | 32 |
3056 | 33 static long STDCALL CEnumPins_Next(IEnumPins* This, |
34 /* [in] */ unsigned long cMediaTypes, | |
3130 | 35 /* [size_is][out] */ IPin** ppMediaTypes, |
36 /* [out] */ unsigned long* pcFetched) | |
168 | 37 { |
3056 | 38 CEnumPins* pin = (CEnumPins*)This; |
168 | 39 |
3056 | 40 Debug printf("CEnumPins_Next(%p) called\n", This); |
1545 | 41 if (!ppMediaTypes) |
42 return E_INVALIDARG; | |
43 if (!pcFetched && (cMediaTypes!=1)) | |
44 return E_INVALIDARG; | |
45 if (cMediaTypes<=0) | |
46 return 0; | |
47 | |
3056 | 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)) | |
168 | 53 { |
1545 | 54 if (pcFetched) |
55 *pcFetched=0; | |
168 | 56 return 1; |
57 } | |
1545 | 58 |
59 if (pcFetched) | |
60 *pcFetched=1; | |
3056 | 61 if (pin->counter==0) |
168 | 62 { |
3056 | 63 *ppMediaTypes = pin->pin1; |
64 pin->pin1->vt->AddRef((IUnknown*)pin->pin1); | |
168 | 65 } |
66 else | |
67 { | |
3056 | 68 *ppMediaTypes = pin->pin2; |
69 pin->pin2->vt->AddRef((IUnknown*)pin->pin2); | |
168 | 70 } |
3056 | 71 pin->counter++; |
1545 | 72 if (cMediaTypes == 1) |
73 return 0; | |
168 | 74 return 1; |
75 } | |
76 | |
3056 | 77 static long STDCALL CEnumPins_Skip(IEnumPins* This, |
78 /* [in] */ unsigned long cMediaTypes) | |
168 | 79 { |
3056 | 80 Debug unimplemented("CEnumPins_Skip", This); |
168 | 81 return E_NOTIMPL; |
82 } | |
83 | |
3056 | 84 static long STDCALL CEnumPins_Reset(IEnumPins* This) |
168 | 85 { |
3056 | 86 Debug printf("CEnumPins_Reset(%p) called\n", This); |
87 ((CEnumPins*)This)->counter = 0; | |
168 | 88 return 0; |
89 } | |
90 | |
3056 | 91 static long STDCALL CEnumPins_Clone(IEnumPins* This, |
92 /* [out] */ IEnumPins** ppEnum) | |
168 | 93 { |
3056 | 94 Debug unimplemented("CEnumPins_Clone", This); |
168 | 95 return E_NOTIMPL; |
96 } | |
1545 | 97 |
3056 | 98 static void CEnumPins_Destroy(CEnumPins* This) |
168 | 99 { |
3056 | 100 free(This->vt); |
101 free(This); | |
168 | 102 } |
103 | |
3056 | 104 IMPLEMENT_IUNKNOWN(CEnumPins) |
105 | |
106 static CEnumPins* CEnumPinsCreate(IPin* p, IPin* pp) | |
168 | 107 { |
3056 | 108 CEnumPins* This = (CEnumPins*) malloc(sizeof(CEnumPins)); |
109 | |
3467 | 110 if (!This) |
111 return NULL; | |
112 | |
113 This->refcount = 1; | |
3056 | 114 This->pin1 = p; |
115 This->pin2 = pp; | |
116 This->counter = 0; | |
117 | |
118 This->vt = (IEnumPins_vt*) malloc(sizeof(IEnumPins_vt)); | |
3467 | 119 if (!This->vt) |
120 { | |
121 free(This); | |
122 return NULL; | |
123 } | |
3056 | 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; | |
131 | |
132 This->interfaces[0] = IID_IUnknown; | |
133 This->interfaces[1] = IID_IEnumPins; | |
134 | |
135 return This; | |
136 } | |
137 | |
138 | |
139 | |
140 /*********** | |
141 * InputPin | |
142 ***********/ | |
143 | |
3130 | 144 static long STDCALL CInputPin_Connect(IPin* This, |
145 /* [in] */ IPin* pReceivePin, | |
146 /* [in] */ AM_MEDIA_TYPE* pmt) | |
3056 | 147 { |
148 Debug unimplemented("CInputPin_Connect", This); | |
168 | 149 return E_NOTIMPL; |
150 } | |
151 | |
3056 | 152 static long STDCALL CInputPin_ReceiveConnection(IPin* This, |
153 /* [in] */ IPin* pConnector, | |
154 /* [in] */ const AM_MEDIA_TYPE *pmt) | |
168 | 155 { |
3056 | 156 Debug unimplemented("CInputPin_ReceiveConnection", This); |
168 | 157 return E_NOTIMPL; |
158 } | |
1545 | 159 |
3056 | 160 static long STDCALL CInputPin_Disconnect(IPin* This) |
168 | 161 { |
3056 | 162 Debug unimplemented("CInputPin_Disconnect", This); |
168 | 163 return E_NOTIMPL; |
164 } | |
165 | |
3056 | 166 static long STDCALL CInputPin_ConnectedTo(IPin* This, |
167 /* [out] */ IPin** pPin) | |
168 | 168 { |
3056 | 169 Debug unimplemented("CInputPin_ConnectedTo", This); |
168 | 170 return E_NOTIMPL; |
171 } | |
172 | |
3056 | 173 static long STDCALL CInputPin_ConnectionMediaType(IPin* This, |
174 /* [out] */ AM_MEDIA_TYPE *pmt) | |
168 | 175 { |
3056 | 176 Debug printf("CInputPin_ConnectionMediaType(%p) called\n", This); |
177 if (!pmt) | |
178 return E_INVALIDARG; | |
168 | 179 *pmt=((CInputPin*)This)->type; |
3056 | 180 if (pmt->cbFormat > 0) |
168 | 181 { |
18878 | 182 pmt->pbFormat=malloc(pmt->cbFormat); |
168 | 183 memcpy(pmt->pbFormat, ((CInputPin*)This)->type.pbFormat, pmt->cbFormat); |
1545 | 184 } |
168 | 185 return 0; |
186 } | |
187 | |
3056 | 188 static long STDCALL CInputPin_QueryPinInfo(IPin* This, |
189 /* [out] */ PIN_INFO *pInfo) | |
168 | 190 { |
1545 | 191 CBaseFilter* lparent=((CInputPin*)This)->parent; |
3056 | 192 Debug printf("CInputPin_QueryPinInfo(%p) called\n", This); |
193 pInfo->dir = PINDIR_OUTPUT; | |
194 pInfo->pFilter = (IBaseFilter*) lparent; | |
1545 | 195 lparent->vt->AddRef((IUnknown*)lparent); |
3056 | 196 pInfo->achName[0] = 0; |
197 return 0; | |
198 } | |
199 | |
200 static long STDCALL CInputPin_QueryDirection(IPin* This, | |
201 /* [out] */ PIN_DIRECTION *pPinDir) | |
202 { | |
203 *pPinDir = PINDIR_OUTPUT; | |
204 Debug printf("CInputPin_QueryDirection(%p) called\n", This); | |
168 | 205 return 0; |
206 } | |
207 | |
3056 | 208 static long STDCALL CInputPin_QueryId(IPin* This, |
209 /* [out] */ unsigned short* *Id) | |
168 | 210 { |
3056 | 211 Debug unimplemented("CInputPin_QueryId", This); |
212 return E_NOTIMPL; | |
168 | 213 } |
214 | |
3056 | 215 static long STDCALL CInputPin_QueryAccept(IPin* This, |
3130 | 216 /* [in] */ const AM_MEDIA_TYPE* pmt) |
168 | 217 { |
3056 | 218 Debug unimplemented("CInputPin_QueryAccept", This); |
168 | 219 return E_NOTIMPL; |
220 } | |
221 | |
3056 | 222 static long STDCALL CInputPin_EnumMediaTypes(IPin* This, |
3130 | 223 /* [out] */ IEnumMediaTypes** ppEnum) |
168 | 224 { |
3056 | 225 Debug unimplemented("CInputPin_EnumMediaTypes", This); |
226 return E_NOTIMPL; | |
227 } | |
228 | |
229 static long STDCALL CInputPin_QueryInternalConnections(IPin* This, | |
3130 | 230 /* [out] */ IPin** apPin, |
3056 | 231 /* [out][in] */ unsigned long *nPin) |
232 { | |
233 Debug unimplemented("CInputPin_QueryInternalConnections", This); | |
234 return E_NOTIMPL; | |
235 } | |
236 | |
237 static long STDCALL CInputPin_EndOfStream(IPin * This) | |
238 { | |
239 Debug unimplemented("CInputPin_EndOfStream", This); | |
168 | 240 return E_NOTIMPL; |
241 } | |
242 | |
243 | |
3056 | 244 static long STDCALL CInputPin_BeginFlush(IPin * This) |
168 | 245 { |
3056 | 246 Debug unimplemented("CInputPin_BeginFlush", This); |
168 | 247 return E_NOTIMPL; |
248 } | |
249 | |
250 | |
3130 | 251 static long STDCALL CInputPin_EndFlush(IPin* This) |
168 | 252 { |
3056 | 253 Debug unimplemented("CInputPin_EndFlush", This); |
168 | 254 return E_NOTIMPL; |
255 } | |
256 | |
3130 | 257 static long STDCALL CInputPin_NewSegment(IPin* This, |
3056 | 258 /* [in] */ REFERENCE_TIME tStart, |
259 /* [in] */ REFERENCE_TIME tStop, | |
260 /* [in] */ double dRate) | |
168 | 261 { |
3056 | 262 Debug unimplemented("CInputPin_NewSegment", This); |
168 | 263 return E_NOTIMPL; |
1545 | 264 } |
168 | 265 |
3056 | 266 static void CInputPin_Destroy(CInputPin* This) |
168 | 267 { |
3056 | 268 free(This->vt); |
269 free(This); | |
1545 | 270 } |
271 | |
3056 | 272 IMPLEMENT_IUNKNOWN(CInputPin) |
273 | |
274 CInputPin* CInputPinCreate(CBaseFilter* p, const AM_MEDIA_TYPE* amt) | |
168 | 275 { |
3056 | 276 CInputPin* This = (CInputPin*) malloc(sizeof(CInputPin)); |
277 | |
3467 | 278 if (!This) |
279 return NULL; | |
280 | |
281 This->refcount = 1; | |
3056 | 282 This->parent = p; |
283 This->type = *amt; | |
284 | |
285 This->vt= (IPin_vt*) malloc(sizeof(IPin_vt)); | |
3467 | 286 |
287 if (!This->vt) | |
288 { | |
289 free(This); | |
290 return NULL; | |
291 } | |
292 | |
3056 | 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; | |
311 | |
312 This->interfaces[0]=IID_IUnknown; | |
313 | |
314 return This; | |
1545 | 315 } |
168 | 316 |
3056 | 317 |
318 /************* | |
319 * BaseFilter | |
320 *************/ | |
321 | |
322 static long STDCALL CBaseFilter_GetClassID(IBaseFilter * This, | |
323 /* [out] */ CLSID *pClassID) | |
168 | 324 { |
3056 | 325 Debug unimplemented("CBaseFilter_GetClassID", This); |
168 | 326 return E_NOTIMPL; |
1545 | 327 } |
168 | 328 |
3056 | 329 static long STDCALL CBaseFilter_Stop(IBaseFilter* This) |
168 | 330 { |
3056 | 331 Debug unimplemented("CBaseFilter_Stop", This); |
168 | 332 return E_NOTIMPL; |
1545 | 333 } |
168 | 334 |
3056 | 335 static long STDCALL CBaseFilter_Pause(IBaseFilter* This) |
168 | 336 { |
3056 | 337 Debug unimplemented("CBaseFilter_Pause", This); |
338 return E_NOTIMPL; | |
339 } | |
340 | |
341 static long STDCALL CBaseFilter_Run(IBaseFilter* This, REFERENCE_TIME tStart) | |
342 { | |
343 Debug unimplemented("CBaseFilter_Run", This); | |
168 | 344 return E_NOTIMPL; |
1545 | 345 } |
168 | 346 |
3056 | 347 static long STDCALL CBaseFilter_GetState(IBaseFilter* This, |
348 /* [in] */ unsigned long dwMilliSecsTimeout, | |
349 // /* [out] */ FILTER_STATE *State) | |
350 void* State) | |
168 | 351 { |
3056 | 352 Debug unimplemented("CBaseFilter_GetState", This); |
353 return E_NOTIMPL; | |
1545 | 354 } |
168 | 355 |
3056 | 356 static long STDCALL CBaseFilter_SetSyncSource(IBaseFilter* This, |
357 /* [in] */ IReferenceClock *pClock) | |
358 { | |
359 Debug unimplemented("CBaseFilter_SetSyncSource", This); | |
360 return E_NOTIMPL; | |
361 } | |
1545 | 362 |
3056 | 363 static long STDCALL CBaseFilter_GetSyncSource(IBaseFilter* This, |
364 /* [out] */ IReferenceClock **pClock) | |
168 | 365 { |
3056 | 366 Debug unimplemented("CBaseFilter_GetSyncSource", This); |
168 | 367 return E_NOTIMPL; |
1545 | 368 } |
168 | 369 |
1545 | 370 |
3056 | 371 static long STDCALL CBaseFilter_EnumPins(IBaseFilter* This, |
372 /* [out] */ IEnumPins **ppEnum) | |
373 { | |
374 Debug printf("CBaseFilter_EnumPins(%p) called\n", This); | |
375 *ppEnum = (IEnumPins*) CEnumPinsCreate(((CBaseFilter*)This)->pin, ((CBaseFilter*)This)->unused_pin); | |
376 return 0; | |
377 } | |
378 | |
379 static long STDCALL CBaseFilter_FindPin(IBaseFilter* This, | |
380 /* [string][in] */ const unsigned short* Id, | |
381 /* [out] */ IPin **ppPin) | |
168 | 382 { |
3056 | 383 Debug unimplemented("CBaseFilter_FindPin\n", This); |
384 return E_NOTIMPL; | |
385 } | |
386 | |
3130 | 387 static long STDCALL CBaseFilter_QueryFilterInfo(IBaseFilter* This, |
3056 | 388 // /* [out] */ FILTER_INFO *pInfo) |
389 void* pInfo) | |
390 { | |
391 Debug unimplemented("CBaseFilter_QueryFilterInfo", This); | |
392 return E_NOTIMPL; | |
393 } | |
394 | |
3130 | 395 static long STDCALL CBaseFilter_JoinFilterGraph(IBaseFilter* This, |
396 /* [in] */ IFilterGraph* pGraph, | |
3056 | 397 /* [string][in] */ const unsigned short* pName) |
398 { | |
399 Debug unimplemented("CBaseFilter_JoinFilterGraph", This); | |
400 return E_NOTIMPL; | |
401 } | |
402 | |
3130 | 403 static long STDCALL CBaseFilter_QueryVendorInfo(IBaseFilter* This, |
404 /* [string][out] */ unsigned short** pVendorInfo) | |
3056 | 405 { |
406 Debug unimplemented("CBaseFilter_QueryVendorInfo", This); | |
168 | 407 return E_NOTIMPL; |
1545 | 408 } |
168 | 409 |
3056 | 410 static IPin* CBaseFilter_GetPin(CBaseFilter* This) |
411 { | |
412 return This->pin; | |
413 } | |
1545 | 414 |
3056 | 415 static IPin* CBaseFilter_GetUnusedPin(CBaseFilter* This) |
168 | 416 { |
3056 | 417 return This->unused_pin; |
418 } | |
419 | |
420 static void CBaseFilter_Destroy(CBaseFilter* This) | |
421 { | |
3467 | 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); | |
3056 | 428 free(This); |
1545 | 429 } |
168 | 430 |
3056 | 431 IMPLEMENT_IUNKNOWN(CBaseFilter) |
1545 | 432 |
3056 | 433 CBaseFilter* CBaseFilterCreate(const AM_MEDIA_TYPE* type, CBaseFilter2* parent) |
168 | 434 { |
3056 | 435 CBaseFilter* This = (CBaseFilter*) malloc(sizeof(CBaseFilter)); |
3467 | 436 if (!This) |
437 return NULL; | |
438 | |
3056 | 439 This->refcount = 1; |
440 | |
441 This->pin = (IPin*) CInputPinCreate(This, type); | |
442 This->unused_pin = (IPin*) CRemotePinCreate(This, parent->GetPin(parent)); | |
443 | |
444 This->vt = (IBaseFilter_vt*) malloc(sizeof(IBaseFilter_vt)); | |
3467 | 445 if (!This->vt || !This->pin || !This->unused_pin) |
446 { | |
447 CBaseFilter_Destroy(This); | |
448 return NULL; | |
449 } | |
450 | |
3056 | 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; | |
466 | |
467 This->interfaces[0] = IID_IUnknown; | |
468 This->interfaces[1] = IID_IBaseFilter; | |
469 | |
470 This->GetPin = CBaseFilter_GetPin; | |
471 This->GetUnusedPin = CBaseFilter_GetUnusedPin; | |
472 | |
473 return This; | |
1545 | 474 } |
168 | 475 |
476 | |
3056 | 477 /************** |
478 * BaseFilter2 | |
479 **************/ | |
168 | 480 |
481 | |
3130 | 482 static long STDCALL CBaseFilter2_GetClassID(IBaseFilter* This, |
483 /* [out] */ CLSID* pClassID) | |
168 | 484 { |
3056 | 485 Debug unimplemented("CBaseFilter2_GetClassID", This); |
168 | 486 return E_NOTIMPL; |
1545 | 487 } |
168 | 488 |
3130 | 489 static long STDCALL CBaseFilter2_Stop(IBaseFilter* This) |
168 | 490 { |
3056 | 491 Debug unimplemented("CBaseFilter2_Stop", This); |
168 | 492 return E_NOTIMPL; |
1545 | 493 } |
168 | 494 |
3130 | 495 static long STDCALL CBaseFilter2_Pause(IBaseFilter* This) |
168 | 496 { |
3056 | 497 Debug unimplemented("CBaseFilter2_Pause", This); |
168 | 498 return E_NOTIMPL; |
1545 | 499 } |
500 | |
3130 | 501 static long STDCALL CBaseFilter2_Run(IBaseFilter* This, REFERENCE_TIME tStart) |
168 | 502 { |
3056 | 503 Debug unimplemented("CBaseFilter2_Run", This); |
168 | 504 return E_NOTIMPL; |
1545 | 505 } |
168 | 506 |
1545 | 507 |
3056 | 508 static long STDCALL CBaseFilter2_GetState(IBaseFilter* This, |
509 /* [in] */ unsigned long dwMilliSecsTimeout, | |
510 // /* [out] */ FILTER_STATE *State) | |
511 void* State) | |
512 { | |
513 Debug unimplemented("CBaseFilter2_GetState", This); | |
514 return E_NOTIMPL; | |
515 } | |
516 | |
517 static long STDCALL CBaseFilter2_SetSyncSource(IBaseFilter* This, | |
518 /* [in] */ IReferenceClock* pClock) | |
519 { | |
520 Debug unimplemented("CBaseFilter2_SetSyncSource", This); | |
521 return E_NOTIMPL; | |
522 } | |
523 | |
524 static long STDCALL CBaseFilter2_GetSyncSource(IBaseFilter* This, | |
525 /* [out] */ IReferenceClock** pClock) | |
526 { | |
527 Debug unimplemented("CBaseFilter2_GetSyncSource", This); | |
528 return E_NOTIMPL; | |
529 } | |
530 | |
531 static long STDCALL CBaseFilter2_EnumPins(IBaseFilter* This, | |
532 /* [out] */ IEnumPins** ppEnum) | |
168 | 533 { |
3056 | 534 Debug printf("CBaseFilter2_EnumPins(%p) called\n", This); |
535 *ppEnum = (IEnumPins*) CEnumPinsCreate(((CBaseFilter2*)This)->pin, 0); | |
536 return 0; | |
537 } | |
538 | |
539 static long STDCALL CBaseFilter2_FindPin(IBaseFilter* This, | |
540 /* [string][in] */ const unsigned short* Id, | |
541 /* [out] */ IPin** ppPin) | |
542 { | |
543 Debug unimplemented("CBaseFilter2_FindPin", This); | |
544 return E_NOTIMPL; | |
545 } | |
546 | |
547 static long STDCALL CBaseFilter2_QueryFilterInfo(IBaseFilter* This, | |
548 // /* [out] */ FILTER_INFO *pInfo) | |
549 void* pInfo) | |
550 { | |
551 Debug unimplemented("CBaseFilter2_QueryFilterInfo", This); | |
552 return E_NOTIMPL; | |
553 } | |
554 | |
555 static long STDCALL CBaseFilter2_JoinFilterGraph(IBaseFilter* This, | |
556 /* [in] */ IFilterGraph* pGraph, | |
557 /* [string][in] */ | |
558 const unsigned short* pName) | |
559 { | |
560 Debug unimplemented("CBaseFilter2_JoinFilterGraph", This); | |
168 | 561 return E_NOTIMPL; |
1545 | 562 } |
168 | 563 |
3056 | 564 static long STDCALL CBaseFilter2_QueryVendorInfo(IBaseFilter* This, |
565 /* [string][out] */ | |
566 unsigned short** pVendorInfo) | |
168 | 567 { |
3056 | 568 Debug unimplemented("CBaseFilter2_QueryVendorInfo", This); |
168 | 569 return E_NOTIMPL; |
1545 | 570 } |
168 | 571 |
3056 | 572 static IPin* CBaseFilter2_GetPin(CBaseFilter2* This) |
573 { | |
574 return This->pin; | |
575 } | |
1545 | 576 |
3056 | 577 static void CBaseFilter2_Destroy(CBaseFilter2* This) |
168 | 578 { |
3130 | 579 Debug printf("CBaseFilter2_Destroy(%p) called\n", This); |
3467 | 580 if (This->pin) |
581 This->pin->vt->Release((IUnknown*) This->pin); | |
582 if (This->vt) | |
583 free(This->vt); | |
3056 | 584 free(This); |
1545 | 585 } |
168 | 586 |
3056 | 587 IMPLEMENT_IUNKNOWN(CBaseFilter2) |
1545 | 588 |
3056 | 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}}; | |
595 | |
596 CBaseFilter2* CBaseFilter2Create() | |
168 | 597 { |
3056 | 598 CBaseFilter2* This = (CBaseFilter2*) malloc(sizeof(CBaseFilter2)); |
599 | |
3467 | 600 if (!This) |
601 return NULL; | |
602 | |
3056 | 603 This->refcount = 1; |
604 This->pin = (IPin*) CRemotePin2Create(This); | |
605 | |
606 This->vt = (IBaseFilter_vt*) malloc(sizeof(IBaseFilter_vt)); | |
3467 | 607 |
608 if (!This->pin || !This->vt) | |
609 { | |
610 CBaseFilter2_Destroy(This); | |
611 return NULL; | |
612 } | |
613 | |
3056 | 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; | |
630 | |
631 This->GetPin = CBaseFilter2_GetPin; | |
632 | |
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; | |
638 | |
639 return This; | |
1545 | 640 } |
168 | 641 |
1545 | 642 |
3056 | 643 /************* |
644 * CRemotePin | |
645 *************/ | |
1545 | 646 |
168 | 647 |
3056 | 648 static long STDCALL CRemotePin_ConnectedTo(IPin* This, /* [out] */ IPin** pPin) |
168 | 649 { |
3056 | 650 Debug printf("CRemotePin_ConnectedTo(%p) called\n", This); |
1545 | 651 if (!pPin) |
652 return E_INVALIDARG; | |
3056 | 653 *pPin = ((CRemotePin*)This)->remote_pin; |
1545 | 654 (*pPin)->vt->AddRef((IUnknown*)(*pPin)); |
655 return 0; | |
656 } | |
168 | 657 |
3056 | 658 static long STDCALL CRemotePin_QueryDirection(IPin* This, |
3130 | 659 /* [out] */ PIN_DIRECTION* pPinDir) |
1545 | 660 { |
3056 | 661 Debug printf("CRemotePin_QueryDirection(%p) called\n", This); |
1545 | 662 if (!pPinDir) |
663 return E_INVALIDARG; | |
664 *pPinDir=PINDIR_INPUT; | |
665 return 0; | |
666 } | |
667 | |
668 static long STDCALL CRemotePin_ConnectionMediaType(IPin* This, /* [out] */ AM_MEDIA_TYPE* pmt) | |
168 | 669 { |
3056 | 670 Debug unimplemented("CRemotePin_ConnectionMediaType", This); |
168 | 671 return E_NOTIMPL; |
672 } | |
673 | |
1545 | 674 static long STDCALL CRemotePin_QueryPinInfo(IPin* This, /* [out] */ PIN_INFO* pInfo) |
168 | 675 { |
1545 | 676 CBaseFilter* lparent = ((CRemotePin*)This)->parent; |
3056 | 677 Debug printf("CRemotePin_QueryPinInfo(%p) called\n", This); |
678 pInfo->dir= PINDIR_INPUT; | |
679 pInfo->pFilter = (IBaseFilter*) lparent; | |
1545 | 680 lparent->vt->AddRef((IUnknown*)lparent); |
681 pInfo->achName[0]=0; | |
682 return 0; | |
683 } | |
684 | |
3056 | 685 static void CRemotePin_Destroy(CRemotePin* This) |
686 { | |
687 Debug printf("CRemotePin_Destroy(%p) called\n", This); | |
688 free(This->vt); | |
689 free(This); | |
690 } | |
691 | |
692 IMPLEMENT_IUNKNOWN(CRemotePin) | |
693 | |
694 CRemotePin* CRemotePinCreate(CBaseFilter* pt, IPin* rpin) | |
695 { | |
696 CRemotePin* This = (CRemotePin*) malloc(sizeof(CRemotePin)); | |
3467 | 697 |
698 if (!This) | |
699 return NULL; | |
700 | |
3056 | 701 Debug printf("CRemotePinCreate() called -> %p\n", This); |
702 | |
703 This->parent = pt; | |
704 This->remote_pin = rpin; | |
705 This->refcount = 1; | |
706 | |
707 This->vt = (IPin_vt*) malloc(sizeof(IPin_vt)); | |
3467 | 708 |
709 if (!This->vt) | |
710 { | |
711 free(This); | |
712 return NULL; | |
713 } | |
714 | |
3056 | 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; | |
723 | |
724 This->interfaces[0] = IID_IUnknown; | |
725 | |
726 return This; | |
727 } | |
728 | |
729 | |
730 /************* | |
3130 | 731 * CRemotePin2 |
3056 | 732 *************/ |
733 | |
1545 | 734 |
3130 | 735 static long STDCALL CRemotePin2_QueryPinInfo(IPin* This, |
736 /* [out] */ PIN_INFO* pInfo) | |
1545 | 737 { |
738 CBaseFilter2* lparent=((CRemotePin2*)This)->parent; | |
3056 | 739 Debug printf("CRemotePin2_QueryPinInfo(%p) called\n", This); |
1545 | 740 pInfo->pFilter=(IBaseFilter*)lparent; |
741 lparent->vt->AddRef((IUnknown*)lparent); | |
742 pInfo->dir=PINDIR_OUTPUT; | |
168 | 743 pInfo->achName[0]=0; |
744 return 0; | |
745 } | |
1545 | 746 |
3130 | 747 // FIXME - not being released! |
3056 | 748 static void CRemotePin2_Destroy(CRemotePin2* This) |
1545 | 749 { |
3056 | 750 Debug printf("CRemotePin2_Destroy(%p) called\n", This); |
751 free(This->vt); | |
752 free(This); | |
1545 | 753 } |
754 | |
3056 | 755 IMPLEMENT_IUNKNOWN(CRemotePin2) |
756 | |
757 CRemotePin2* CRemotePin2Create(CBaseFilter2* p) | |
1545 | 758 { |
3056 | 759 CRemotePin2* This = (CRemotePin2*) malloc(sizeof(CRemotePin2)); |
3467 | 760 |
761 if (!This) | |
762 return NULL; | |
763 | |
3056 | 764 Debug printf("CRemotePin2Create() called -> %p\n", This); |
765 | |
766 This->parent = p; | |
767 This->refcount = 1; | |
768 | |
769 This->vt = (IPin_vt*) malloc(sizeof(IPin_vt)); | |
3467 | 770 |
771 if (!This->vt) | |
772 { | |
773 free(This); | |
774 return NULL; | |
775 } | |
776 | |
3056 | 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; | |
782 | |
783 This->interfaces[0] = IID_IUnknown; | |
784 | |
785 return This; | |
1545 | 786 } |