Mercurial > mplayer.hg
annotate loader/dshow/inputpin.c @ 29938:eb6c70e2cbea
Very preliminary code to allow selecting the OpenGL backend at runtime.
Works in the currently supported cases for only Win32 and only X11,
the mixed case is not working yet though.
But applied anyway since the code is slightly less messy than the current one.
author | reimar |
---|---|
date | Tue, 08 Dec 2009 06:42:46 +0000 |
parents | 0f1b5b68af32 |
children | 008338d7679f |
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 */ |
f5537cc95b02
Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents:
9964
diff
changeset
|
5 |
168 | 6 #include "inputpin.h" |
22305
3d1b23cf3d08
Moving duplicated (and sometimes wrong) AM_MEDIA_TYPE related code into separate file
voroshil
parents:
22028
diff
changeset
|
7 #include "mediatype.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 |
22028 | 33 /** |
34 * \brief IEnumPins:Next (retrives a specified number of pins ) | |
35 * | |
36 * \param[in] This pointer to CEnumPins object | |
37 * \param[in] cMediaTypes number of pins to retrive | |
38 * \param[out] ppMediaTypes array of IPin interface pointers of size cMediaTypes | |
39 * \param[out] pcFetched address of variables that receives number of returned pins | |
40 * | |
41 * \return S_OK - success | |
42 * \return S_FALSE - did not return as meny pins as requested | |
43 * \return E_INVALIDARG Invalid argument | |
44 * \return E_POINTER Null pointer | |
45 * \return VFW_E_ENUM_OUT_OF_SYNC - filter's state has changed and is now inconsistent with enumerator | |
46 * | |
47 */ | |
3056 | 48 static long STDCALL CEnumPins_Next(IEnumPins* This, |
49 /* [in] */ unsigned long cMediaTypes, | |
3130 | 50 /* [size_is][out] */ IPin** ppMediaTypes, |
51 /* [out] */ unsigned long* pcFetched) | |
168 | 52 { |
3056 | 53 CEnumPins* pin = (CEnumPins*)This; |
168 | 54 |
3056 | 55 Debug printf("CEnumPins_Next(%p) called\n", This); |
1545 | 56 if (!ppMediaTypes) |
57 return E_INVALIDARG; | |
58 if (!pcFetched && (cMediaTypes!=1)) | |
59 return E_INVALIDARG; | |
60 if (cMediaTypes<=0) | |
61 return 0; | |
62 | |
3056 | 63 //lcounter = ((CEnumPins*)This)->counter; |
64 //lpin1 = ((CEnumPins*)This)->pin1; | |
65 //lpin2 = ((CEnumPins*)This)->pin2; | |
66 if (((pin->counter == 2) && pin->pin2) | |
67 || ((pin->counter == 1) && !pin->pin2)) | |
168 | 68 { |
1545 | 69 if (pcFetched) |
70 *pcFetched=0; | |
168 | 71 return 1; |
72 } | |
1545 | 73 |
74 if (pcFetched) | |
75 *pcFetched=1; | |
3056 | 76 if (pin->counter==0) |
168 | 77 { |
3056 | 78 *ppMediaTypes = pin->pin1; |
79 pin->pin1->vt->AddRef((IUnknown*)pin->pin1); | |
168 | 80 } |
81 else | |
82 { | |
3056 | 83 *ppMediaTypes = pin->pin2; |
84 pin->pin2->vt->AddRef((IUnknown*)pin->pin2); | |
168 | 85 } |
3056 | 86 pin->counter++; |
1545 | 87 if (cMediaTypes == 1) |
88 return 0; | |
168 | 89 return 1; |
90 } | |
91 | |
22028 | 92 /** |
93 * \brief IEnumPins::Skip (skips over a specified number of pins) | |
94 * | |
95 * \param[in] This pointer to CEnumPinss object | |
96 * \param[in] cMediaTypes number of pins to skip | |
97 * | |
98 * \return S_OK - success | |
99 * \return S_FALSE - skipped past the end of the sequence | |
100 * \return VFW_E_ENUM_OUT_OF_SYNC - filter's state has changed and is now inconsistent with enumerator | |
101 * | |
102 */ | |
3056 | 103 static long STDCALL CEnumPins_Skip(IEnumPins* This, |
104 /* [in] */ unsigned long cMediaTypes) | |
168 | 105 { |
3056 | 106 Debug unimplemented("CEnumPins_Skip", This); |
168 | 107 return E_NOTIMPL; |
108 } | |
109 | |
22028 | 110 /** |
111 * \brief IEnumPins::Reset (resets enumeration sequence to beginning) | |
112 * | |
113 * \param[in] This pointer to CEnumPins object | |
114 * | |
115 * \return S_OK - success | |
116 * | |
117 */ | |
3056 | 118 static long STDCALL CEnumPins_Reset(IEnumPins* This) |
168 | 119 { |
3056 | 120 Debug printf("CEnumPins_Reset(%p) called\n", This); |
121 ((CEnumPins*)This)->counter = 0; | |
168 | 122 return 0; |
123 } | |
124 | |
22028 | 125 /** |
126 * \brief IEnumPins::Clone (makes a copy of enumerator, returned object | |
127 * starts at the same position as original) | |
128 * | |
129 * \param[in] This pointer to CEnumPins object | |
130 * \param[out] ppEnum address of variable that receives pointer to IEnumPins interface | |
131 * | |
132 * \return S_OK - success | |
133 * \return E_OUTOFMEMRY - Insufficient memory | |
134 * \return E_POINTER - Null pointer | |
135 * \return VFW_E_ENUM_OUT_OF_SYNC - filter's state has changed and is now inconsistent with enumerator | |
136 * | |
137 */ | |
3056 | 138 static long STDCALL CEnumPins_Clone(IEnumPins* This, |
139 /* [out] */ IEnumPins** ppEnum) | |
168 | 140 { |
3056 | 141 Debug unimplemented("CEnumPins_Clone", This); |
168 | 142 return E_NOTIMPL; |
143 } | |
1545 | 144 |
22028 | 145 /** |
146 * \brief CEnumPins destructor | |
147 * | |
148 * \param[in] This pointer to CEnumPins object | |
149 * | |
150 */ | |
3056 | 151 static void CEnumPins_Destroy(CEnumPins* This) |
168 | 152 { |
3056 | 153 free(This->vt); |
154 free(This); | |
168 | 155 } |
156 | |
3056 | 157 IMPLEMENT_IUNKNOWN(CEnumPins) |
158 | |
22028 | 159 /** |
160 * \brief CEnumPins constructor | |
161 * | |
162 * \param[in] p first pin for enumerator | |
163 * \param[in] pp second pin for enumerator | |
164 * | |
165 * \return pointer to CEnumPins object or NULL if error occured | |
166 * | |
167 */ | |
3056 | 168 static CEnumPins* CEnumPinsCreate(IPin* p, IPin* pp) |
168 | 169 { |
3056 | 170 CEnumPins* This = (CEnumPins*) malloc(sizeof(CEnumPins)); |
171 | |
3467 | 172 if (!This) |
173 return NULL; | |
174 | |
175 This->refcount = 1; | |
3056 | 176 This->pin1 = p; |
177 This->pin2 = pp; | |
178 This->counter = 0; | |
179 | |
180 This->vt = (IEnumPins_vt*) malloc(sizeof(IEnumPins_vt)); | |
3467 | 181 if (!This->vt) |
182 { | |
183 free(This); | |
184 return NULL; | |
185 } | |
3056 | 186 This->vt->QueryInterface = CEnumPins_QueryInterface; |
187 This->vt->AddRef = CEnumPins_AddRef; | |
188 This->vt->Release = CEnumPins_Release; | |
189 This->vt->Next = CEnumPins_Next; | |
190 This->vt->Skip = CEnumPins_Skip; | |
191 This->vt->Reset = CEnumPins_Reset; | |
192 This->vt->Clone = CEnumPins_Clone; | |
193 | |
194 This->interfaces[0] = IID_IUnknown; | |
195 This->interfaces[1] = IID_IEnumPins; | |
196 | |
197 return This; | |
198 } | |
199 | |
200 | |
201 | |
202 /*********** | |
203 * InputPin | |
22028 | 204 * |
205 * WARNING: | |
206 * This is implementation of OUTPUT pin in DirectShow's terms | |
207 * | |
3056 | 208 ***********/ |
209 | |
22028 | 210 /** |
211 * \brief IPin::Connect (connects pin to another pin) | |
212 * | |
213 * \param[in] This pointer to IPin interface | |
214 * \param[in] pReceivePin pointer to IPin interface of remote pin | |
215 * \param[in] pmt suggested media type for link. Can be NULL (any media type) | |
216 * | |
217 * \return S_OK - success. | |
218 * \return VFW_E_ALREADY_CONNECTED - pin already connected | |
219 * \return VFW_E_NOT_STOPPED - filter is active | |
220 * \return VFW_E_TYPE_NOT_ACCEPT - type is not acceptable | |
221 * \return Apropriate error code otherwise. | |
222 * | |
223 */ | |
3130 | 224 static long STDCALL CInputPin_Connect(IPin* This, |
225 /* [in] */ IPin* pReceivePin, | |
226 /* [in] */ AM_MEDIA_TYPE* pmt) | |
3056 | 227 { |
228 Debug unimplemented("CInputPin_Connect", This); | |
168 | 229 return E_NOTIMPL; |
230 } | |
231 | |
22028 | 232 /** |
233 * \brief IPin::ReceiveConnection (accepts a connection from another pin) | |
234 * | |
235 * \param[in] This pointer to IPin interface | |
236 * \param[in] pConnector connecting pin's IPin interface | |
237 * \param[in] pmt suggested media type for connection | |
238 * | |
239 * \return S_OK - success | |
240 * \return E_POINTER - Null pointer | |
241 * \return VFW_E_ALREADY_CONNECTED - pin already connected | |
242 * \return VFW_E_NOT_STOPPED - filter is active | |
243 * \return VFW_E_TYPE_NOT_ACCEPT - type is not acceptable | |
244 * | |
245 * \note | |
246 * When returning S_OK method should also do the following: | |
247 * - store media type and return the same type in IPin::ConnectionMediaType | |
248 * - store pConnector and return it in IPin::ConnectedTo | |
249 * | |
250 */ | |
3056 | 251 static long STDCALL CInputPin_ReceiveConnection(IPin* This, |
252 /* [in] */ IPin* pConnector, | |
253 /* [in] */ const AM_MEDIA_TYPE *pmt) | |
168 | 254 { |
3056 | 255 Debug unimplemented("CInputPin_ReceiveConnection", This); |
168 | 256 return E_NOTIMPL; |
257 } | |
1545 | 258 |
22028 | 259 /** |
260 * \brief IPin::Disconnect (accepts a connection from another pin) | |
261 * | |
262 * \param[in] This pointer to IPin interface | |
263 * | |
264 * \return S_OK - success | |
265 * \return S_FALSE - pin was not connected | |
266 * \return VFW_E_NOT_STOPPED - filter is active | |
267 * | |
268 * \note | |
269 * To break connection you have to also call Disconnect on other pin | |
270 */ | |
3056 | 271 static long STDCALL CInputPin_Disconnect(IPin* This) |
168 | 272 { |
3056 | 273 Debug unimplemented("CInputPin_Disconnect", This); |
168 | 274 return E_NOTIMPL; |
275 } | |
276 | |
22028 | 277 /** |
278 * \brief IPin::ConnectedTo (retrieves pointer to the connected pin, if such exist) | |
279 * | |
280 * \param[in] This pointer to IPin interface | |
281 * \param[out] pPin pointer to remote pin's IPin interface | |
282 * | |
283 * \return S_OK - success | |
284 * \return E_POINTER - Null pointer | |
285 * \return VFW_E_NOT_CONNECTED - pin is not connected | |
286 * | |
287 * \note | |
288 * Caller must call Release on received IPin, when done | |
289 */ | |
3056 | 290 static long STDCALL CInputPin_ConnectedTo(IPin* This, |
291 /* [out] */ IPin** pPin) | |
168 | 292 { |
3056 | 293 Debug unimplemented("CInputPin_ConnectedTo", This); |
168 | 294 return E_NOTIMPL; |
295 } | |
296 | |
22028 | 297 /** |
298 * \brief IPin::ConnectionMediaType (retrieves media type for connection, if such exist) | |
299 * | |
300 * \param[in] This pointer to IPin interface | |
301 * \param[out] pmt pointer to AM_MEDIA_TYPE, that receives connection media type | |
302 * | |
303 * \return S_OK - success | |
304 * \return E_POINTER - Null pointer | |
305 * \return VFW_E_NOT_CONNECTED - pin is not connected | |
306 * | |
307 */ | |
3056 | 308 static long STDCALL CInputPin_ConnectionMediaType(IPin* This, |
309 /* [out] */ AM_MEDIA_TYPE *pmt) | |
168 | 310 { |
3056 | 311 Debug printf("CInputPin_ConnectionMediaType(%p) called\n", This); |
312 if (!pmt) | |
313 return E_INVALIDARG; | |
22305
3d1b23cf3d08
Moving duplicated (and sometimes wrong) AM_MEDIA_TYPE related code into separate file
voroshil
parents:
22028
diff
changeset
|
314 CopyMediaType(pmt,&(((CInputPin*)This)->type)); |
168 | 315 return 0; |
316 } | |
317 | |
22028 | 318 /** |
319 * \brief IPin::QueryPinInfo (retrieves information about the pin) | |
320 * | |
321 * \param[in] This pointer to IPin interface | |
322 * \param[out] pInfo pointer to PIN_INFO structure, that receives pin info | |
323 * | |
324 * \return S_OK - success | |
325 * \return E_POINTER - Null pointer | |
326 * | |
327 * \note | |
328 * If pInfo->pFilter is not NULL, then caller must call Release on pInfo->pFilter when done | |
329 * | |
330 */ | |
3056 | 331 static long STDCALL CInputPin_QueryPinInfo(IPin* This, |
332 /* [out] */ PIN_INFO *pInfo) | |
168 | 333 { |
1545 | 334 CBaseFilter* lparent=((CInputPin*)This)->parent; |
3056 | 335 Debug printf("CInputPin_QueryPinInfo(%p) called\n", This); |
336 pInfo->dir = PINDIR_OUTPUT; | |
337 pInfo->pFilter = (IBaseFilter*) lparent; | |
1545 | 338 lparent->vt->AddRef((IUnknown*)lparent); |
3056 | 339 pInfo->achName[0] = 0; |
340 return 0; | |
341 } | |
342 | |
22028 | 343 /** |
344 * \brief IPin::QueryDirection (retrieves pin direction) | |
345 * | |
346 * \param[in] This pointer to IPin interface | |
347 * \param[out] pPinDir pointer to variable, that receives pin direction (PINDIR_INPUT,PINDIR_OUTPUT) | |
348 * | |
349 * \return S_OK - success | |
350 * \return E_POINTER - Null pointer | |
351 * | |
352 */ | |
3056 | 353 static long STDCALL CInputPin_QueryDirection(IPin* This, |
354 /* [out] */ PIN_DIRECTION *pPinDir) | |
355 { | |
356 *pPinDir = PINDIR_OUTPUT; | |
357 Debug printf("CInputPin_QueryDirection(%p) called\n", This); | |
168 | 358 return 0; |
359 } | |
360 | |
22028 | 361 /** |
362 * \brief IPin::QueryId (retrieves pin identificator) | |
363 * | |
364 * \param[in] This pointer to IPin interface | |
365 * \param[out] Id adress of variable, that receives string with pin's Id. | |
366 * | |
367 * \return S_OK - success | |
368 * \return E_OUTOFMEMORY - Insufficient memory | |
369 * \return E_POINTER - Null pointer | |
370 * | |
371 * \note | |
372 * Pin's Id is not the same as pin's name | |
373 * | |
374 */ | |
3056 | 375 static long STDCALL CInputPin_QueryId(IPin* This, |
376 /* [out] */ unsigned short* *Id) | |
168 | 377 { |
3056 | 378 Debug unimplemented("CInputPin_QueryId", This); |
379 return E_NOTIMPL; | |
168 | 380 } |
381 | |
22028 | 382 /** |
383 * \brief IPin::QueryAccept (determines can media type be accepted or not) | |
384 * | |
385 * \param[in] This pointer to IPin interface | |
386 * \param[in] pmt Media type to check | |
387 * | |
388 * \return S_OK - success | |
389 * \return S_FALSE - pin rejects media type | |
390 * | |
391 */ | |
3056 | 392 static long STDCALL CInputPin_QueryAccept(IPin* This, |
3130 | 393 /* [in] */ const AM_MEDIA_TYPE* pmt) |
168 | 394 { |
3056 | 395 Debug unimplemented("CInputPin_QueryAccept", This); |
168 | 396 return E_NOTIMPL; |
397 } | |
398 | |
22028 | 399 /** |
400 * \brief IPin::EnumMediaTypes (enumerates the pin's preferred media types) | |
401 * | |
402 * \param[in] This pointer to IPin interface | |
403 * \param[out] ppEnum adress of variable that receives pointer to IEnumMEdiaTypes interface | |
404 * | |
405 * \return S_OK - success | |
406 * \return E_OUTOFMEMORY - Insufficient memory | |
407 * \return E_POINTER - Null pointer | |
408 * | |
409 * \note | |
410 * Caller must call Release on received interface when done | |
411 * | |
412 */ | |
3056 | 413 static long STDCALL CInputPin_EnumMediaTypes(IPin* This, |
3130 | 414 /* [out] */ IEnumMediaTypes** ppEnum) |
168 | 415 { |
3056 | 416 Debug unimplemented("CInputPin_EnumMediaTypes", This); |
417 return E_NOTIMPL; | |
418 } | |
419 | |
22028 | 420 /** |
421 * \brief IPin::QueryInternalConnections (retries pin's internal connections) | |
422 * | |
423 * \param[in] This pointer to IPin interface | |
424 * \param[out] apPin Array that receives pins, internally connected to this | |
425 * \param[in,out] nPint Size of an array | |
426 * | |
427 * \return S_OK - success | |
428 * \return S_FALSE - pin rejects media type | |
429 * \return E_NOTIMPL - not implemented | |
430 * | |
431 */ | |
3056 | 432 static long STDCALL CInputPin_QueryInternalConnections(IPin* This, |
3130 | 433 /* [out] */ IPin** apPin, |
3056 | 434 /* [out][in] */ unsigned long *nPin) |
435 { | |
436 Debug unimplemented("CInputPin_QueryInternalConnections", This); | |
437 return E_NOTIMPL; | |
438 } | |
439 | |
22028 | 440 /** |
441 * \brief IPin::EndOfStream (notifies pin, that no data is expected, until new run command) | |
442 * | |
443 * \param[in] This pointer to IPin interface | |
444 * | |
445 * \return S_OK - success | |
446 * \return E_UNEXPECTED - The pin is output pin | |
447 * | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25849
diff
changeset
|
448 * \note |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25849
diff
changeset
|
449 * IMemoryInputPin::Receive,IMemoryInputPin::ReceiveMultiple, IMemoryInputPin::EndOfStream, |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25849
diff
changeset
|
450 * IMemAllocator::GetBuffer runs in different (streaming) thread then other |
22028 | 451 * methods (application thread). |
452 * IMemoryInputPin::NewSegment runs either in streaming or application thread. | |
453 * Developer must use critical sections for thread-safing work. | |
454 * | |
455 */ | |
3056 | 456 static long STDCALL CInputPin_EndOfStream(IPin * This) |
457 { | |
458 Debug unimplemented("CInputPin_EndOfStream", This); | |
168 | 459 return E_NOTIMPL; |
460 } | |
461 | |
462 | |
22028 | 463 /** |
464 * \brief IPin::BeginFlush (begins a flush operation) | |
465 * | |
466 * \param[in] This pointer to IPin interface | |
467 * | |
468 * \return S_OK - success | |
469 * \return E_UNEXPECTED - The pin is output pin | |
470 * | |
471 */ | |
3056 | 472 static long STDCALL CInputPin_BeginFlush(IPin * This) |
168 | 473 { |
3056 | 474 Debug unimplemented("CInputPin_BeginFlush", This); |
168 | 475 return E_NOTIMPL; |
476 } | |
477 | |
478 | |
22028 | 479 /** |
480 * \brief IPin::EndFlush (ends a flush operation) | |
481 * | |
482 * \param[in] This pointer to IPin interface | |
483 * | |
484 * \return S_OK - success | |
485 * \return E_UNEXPECTED - The pin is output pin | |
486 * | |
487 */ | |
3130 | 488 static long STDCALL CInputPin_EndFlush(IPin* This) |
168 | 489 { |
3056 | 490 Debug unimplemented("CInputPin_EndFlush", This); |
168 | 491 return E_NOTIMPL; |
492 } | |
493 | |
22028 | 494 /** |
495 * \brief IPin::NewSegment (media sample received after this call grouped as segment with common | |
496 * start,stop time and rate) | |
497 * | |
498 * \param[in] This pointer to IPin interface | |
499 * \param[in] tStart start time of new segment | |
500 * \param[in] tStop end time of new segment | |
501 * \param[in] dRate rate at wich segment should be processed | |
502 * | |
503 * \return S_OK - success | |
504 * \return E_UNEXPECTED - The pin is output pin | |
505 * | |
506 */ | |
3130 | 507 static long STDCALL CInputPin_NewSegment(IPin* This, |
3056 | 508 /* [in] */ REFERENCE_TIME tStart, |
509 /* [in] */ REFERENCE_TIME tStop, | |
510 /* [in] */ double dRate) | |
168 | 511 { |
3056 | 512 Debug unimplemented("CInputPin_NewSegment", This); |
168 | 513 return E_NOTIMPL; |
1545 | 514 } |
168 | 515 |
22028 | 516 /** |
517 * \brief CInputPin destructor | |
518 * | |
519 * \param[in] This pointer to CInputPin class | |
520 * | |
521 */ | |
3056 | 522 static void CInputPin_Destroy(CInputPin* This) |
168 | 523 { |
3056 | 524 free(This->vt); |
22305
3d1b23cf3d08
Moving duplicated (and sometimes wrong) AM_MEDIA_TYPE related code into separate file
voroshil
parents:
22028
diff
changeset
|
525 FreeMediaType(&(This->type)); |
3056 | 526 free(This); |
1545 | 527 } |
528 | |
3056 | 529 IMPLEMENT_IUNKNOWN(CInputPin) |
530 | |
22028 | 531 /** |
532 * \brief CInputPin constructor | |
533 * | |
534 * \param[in] amt media type for pin | |
535 * | |
536 * \return pointer to CInputPin if success | |
537 * \return NULL if error occured | |
538 * | |
539 */ | |
3056 | 540 CInputPin* CInputPinCreate(CBaseFilter* p, const AM_MEDIA_TYPE* amt) |
168 | 541 { |
3056 | 542 CInputPin* This = (CInputPin*) malloc(sizeof(CInputPin)); |
543 | |
3467 | 544 if (!This) |
545 return NULL; | |
546 | |
547 This->refcount = 1; | |
3056 | 548 This->parent = p; |
22305
3d1b23cf3d08
Moving duplicated (and sometimes wrong) AM_MEDIA_TYPE related code into separate file
voroshil
parents:
22028
diff
changeset
|
549 CopyMediaType(&(This->type),amt); |
3056 | 550 |
551 This->vt= (IPin_vt*) malloc(sizeof(IPin_vt)); | |
3467 | 552 |
553 if (!This->vt) | |
554 { | |
555 free(This); | |
556 return NULL; | |
557 } | |
558 | |
3056 | 559 This->vt->QueryInterface = CInputPin_QueryInterface; |
560 This->vt->AddRef = CInputPin_AddRef; | |
561 This->vt->Release = CInputPin_Release; | |
562 This->vt->Connect = CInputPin_Connect; | |
563 This->vt->ReceiveConnection = CInputPin_ReceiveConnection; | |
564 This->vt->Disconnect = CInputPin_Disconnect; | |
565 This->vt->ConnectedTo = CInputPin_ConnectedTo; | |
566 This->vt->ConnectionMediaType = CInputPin_ConnectionMediaType; | |
567 This->vt->QueryPinInfo = CInputPin_QueryPinInfo; | |
568 This->vt->QueryDirection = CInputPin_QueryDirection; | |
569 This->vt->QueryId = CInputPin_QueryId; | |
570 This->vt->QueryAccept = CInputPin_QueryAccept; | |
571 This->vt->EnumMediaTypes = CInputPin_EnumMediaTypes; | |
572 This->vt->QueryInternalConnections = CInputPin_QueryInternalConnections; | |
573 This->vt->EndOfStream = CInputPin_EndOfStream; | |
574 This->vt->BeginFlush = CInputPin_BeginFlush; | |
575 This->vt->EndFlush = CInputPin_EndFlush; | |
576 This->vt->NewSegment = CInputPin_NewSegment; | |
577 | |
578 This->interfaces[0]=IID_IUnknown; | |
579 | |
580 return This; | |
1545 | 581 } |
168 | 582 |
3056 | 583 |
584 /************* | |
585 * BaseFilter | |
586 *************/ | |
587 | |
588 static long STDCALL CBaseFilter_GetClassID(IBaseFilter * This, | |
589 /* [out] */ CLSID *pClassID) | |
168 | 590 { |
3056 | 591 Debug unimplemented("CBaseFilter_GetClassID", This); |
168 | 592 return E_NOTIMPL; |
1545 | 593 } |
168 | 594 |
22028 | 595 /** |
596 * \brief IMediaFilter::Stop (stops the filter) | |
597 * | |
598 * \param[in] This pointer to IBaseFilter interface | |
599 * | |
600 * \return S_OK success | |
601 * \return S_FALSE transition is not complete | |
602 * | |
603 * \remarks | |
604 * When filter is stopped it does onot deliver or process any samples and rejects any samples | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25849
diff
changeset
|
605 * from upstream filter. |
22028 | 606 * Transition may be asynchronous. In this case method should return S_FALSE. |
607 * Method always sets filter's state to State_Stopped even if error occured. | |
608 * | |
609 */ | |
3056 | 610 static long STDCALL CBaseFilter_Stop(IBaseFilter* This) |
168 | 611 { |
3056 | 612 Debug unimplemented("CBaseFilter_Stop", This); |
168 | 613 return E_NOTIMPL; |
1545 | 614 } |
168 | 615 |
22028 | 616 /** |
617 * \brief IMediaFilter::Pause (pauses filter) | |
618 * | |
619 * \param[in] This pointer to IBaseFilter interface | |
620 * | |
621 * \return S_OK success | |
622 * \return S_FALSE transition is not complete | |
623 * | |
624 * \remarks | |
625 * When filter is paused it can receive, process and deliver samples. | |
626 * Live source filters do not deliver any samples while paused. | |
627 * Transition may be asynchronous. In this case method should return S_FALSE. | |
628 * Method always sets filter's state to State_Stopped even if error occured. | |
629 * | |
630 */ | |
3056 | 631 static long STDCALL CBaseFilter_Pause(IBaseFilter* This) |
168 | 632 { |
3056 | 633 Debug unimplemented("CBaseFilter_Pause", This); |
634 return E_NOTIMPL; | |
635 } | |
636 | |
22028 | 637 /** |
638 * \brief IMediaFilter::Run (runs the filter) | |
639 * | |
640 * \param[in] This pointer to IBaseFilter interface | |
641 * \param[in] tStart Reference time corresponding to stream time 0. | |
642 * | |
643 * \return S_OK success | |
644 * \return S_FALSE transition is not complete | |
645 * | |
646 * \remarks | |
647 * When filter is running it can receive, process and deliver samples. Source filters | |
648 * generatesnew samples, and renderers renders them. | |
649 * Stream time is calculated as the current reference time minus tStart. | |
650 * Graph Manager sets tStart slightly in the future according to graph latency. | |
651 * | |
652 */ | |
3056 | 653 static long STDCALL CBaseFilter_Run(IBaseFilter* This, REFERENCE_TIME tStart) |
654 { | |
655 Debug unimplemented("CBaseFilter_Run", This); | |
168 | 656 return E_NOTIMPL; |
1545 | 657 } |
168 | 658 |
22028 | 659 /** |
660 * \brief IMediaFilter::GetState (retrieves the filter's state (running, stopped or paused)) | |
661 * | |
662 * \param[in] This pointer to IBaseFilter interface | |
663 * \param[in] dwMilliSecsTimeout Timeout interval in milliseconds. To block indifinitely pass | |
664 * INFINITE. | |
665 * \param[out] State pointer to variable that receives a member of FILTER_STATE enumeration. | |
666 * | |
667 * \return S_OK success | |
668 * \return E_POINTER Null pointer | |
669 * \return VFW_S_STATE_INTERMEDATE Intermediate state | |
670 * \return VFW_S_CANT_CUE The filter is active, but cannot deliver data. | |
671 * | |
672 */ | |
3056 | 673 static long STDCALL CBaseFilter_GetState(IBaseFilter* This, |
674 /* [in] */ unsigned long dwMilliSecsTimeout, | |
675 // /* [out] */ FILTER_STATE *State) | |
676 void* State) | |
168 | 677 { |
3056 | 678 Debug unimplemented("CBaseFilter_GetState", This); |
679 return E_NOTIMPL; | |
1545 | 680 } |
168 | 681 |
22028 | 682 /** |
683 * \brief IMediaFilter::SetSyncSource (sets the reference clock) | |
684 * | |
685 * \param[in] This pointer to IBaseFilter interface | |
686 * \param[in] pClock IReferenceClock interface of reference clock | |
687 * | |
688 * \return S_OK success | |
689 * \return apripriate error otherwise | |
690 * | |
691 */ | |
3056 | 692 static long STDCALL CBaseFilter_SetSyncSource(IBaseFilter* This, |
693 /* [in] */ IReferenceClock *pClock) | |
694 { | |
695 Debug unimplemented("CBaseFilter_SetSyncSource", This); | |
696 return E_NOTIMPL; | |
697 } | |
1545 | 698 |
22028 | 699 /** |
700 * \brief IMediafilter::GetSyncSource (gets current reference clock) | |
701 * | |
702 * \param[in] This pointer to IBaseFilter interface | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25849
diff
changeset
|
703 * \param[out] pClock address of variable that receives pointer to clock's |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25849
diff
changeset
|
704 * IReferenceClock interface |
22028 | 705 * |
706 * \return S_OK success | |
707 * \return E_POINTER Null pointer | |
708 * | |
709 */ | |
3056 | 710 static long STDCALL CBaseFilter_GetSyncSource(IBaseFilter* This, |
711 /* [out] */ IReferenceClock **pClock) | |
168 | 712 { |
3056 | 713 Debug unimplemented("CBaseFilter_GetSyncSource", This); |
168 | 714 return E_NOTIMPL; |
1545 | 715 } |
168 | 716 |
1545 | 717 |
22028 | 718 /** |
719 * \brief IBaseFilter::EnumPins (enumerates the pins of this filter) | |
720 * | |
721 * \param[in] This pointer to IBaseFilter interface | |
722 * \param[out] ppEnum address of variable that receives pointer to IEnumPins interface | |
723 * | |
724 * \return S_OK success | |
725 * \return E_OUTOFMEMORY Insufficient memory | |
726 * \return E_POINTER Null pointer | |
727 * | |
728 */ | |
3056 | 729 static long STDCALL CBaseFilter_EnumPins(IBaseFilter* This, |
730 /* [out] */ IEnumPins **ppEnum) | |
731 { | |
732 Debug printf("CBaseFilter_EnumPins(%p) called\n", This); | |
733 *ppEnum = (IEnumPins*) CEnumPinsCreate(((CBaseFilter*)This)->pin, ((CBaseFilter*)This)->unused_pin); | |
734 return 0; | |
735 } | |
736 | |
22028 | 737 /** |
738 * \brief IBaseFilter::FindPin (retrieves the pin with specified id) | |
739 * | |
740 * \param[in] This pointer to IBaseFilter interface | |
741 * \param[in] Id constant wide string, containing pin id | |
742 * \param[out] ppPin address of variable that receives pointer to pin's IPin interface | |
743 * | |
744 * \return S_OK success | |
745 * \return E_POINTER Null pointer | |
746 * \return VFW_E_NOT_FOUND Could not find a pin with specified id | |
747 * | |
748 * \note | |
749 * Be sure to release the interface after use. | |
750 * | |
751 */ | |
3056 | 752 static long STDCALL CBaseFilter_FindPin(IBaseFilter* This, |
753 /* [string][in] */ const unsigned short* Id, | |
754 /* [out] */ IPin **ppPin) | |
168 | 755 { |
3056 | 756 Debug unimplemented("CBaseFilter_FindPin\n", This); |
757 return E_NOTIMPL; | |
758 } | |
759 | |
22028 | 760 /** |
761 * \brief IBaseFilter::QueryFilterInfo (retrieves information aboud the filter) | |
762 * | |
763 * \param[in] This pointer to IBaseFilter interface | |
764 * \param[out] pInfo pointer to FILTER_INFO structure | |
765 * | |
766 * \return S_OK success | |
767 * \return E_POINTER Null pointer | |
768 * | |
769 * \note | |
770 * If pGraph member of FILTER_INFO is not NULL, be sure to release IFilterGraph interface after use. | |
771 * | |
772 */ | |
3130 | 773 static long STDCALL CBaseFilter_QueryFilterInfo(IBaseFilter* This, |
3056 | 774 // /* [out] */ FILTER_INFO *pInfo) |
775 void* pInfo) | |
776 { | |
777 Debug unimplemented("CBaseFilter_QueryFilterInfo", This); | |
778 return E_NOTIMPL; | |
779 } | |
780 | |
22028 | 781 /** |
782 * \brief IBaseFilter::JoinFilterGraph (notifies the filter that it has joined of left filter graph) | |
783 * | |
784 * \param[in] This pointer to IBaseFilter interface | |
785 * \param[in] pInfo pointer to graph's IFilterGraph interface or NULL if filter is leaving graph | |
786 * \param[in] pName pointer to wide character string that specifies a name for the filter | |
787 * | |
788 * \return S_OK success | |
789 * \return apropriate error code otherwise | |
790 * | |
791 * \remarks | |
792 * Filter should not call to graph's AddRef method. | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25849
diff
changeset
|
793 * The IFilterGraph is guaranteed to be valid until graph manager calls this method again with |
22028 | 794 * the value NULL. |
795 * | |
796 */ | |
3130 | 797 static long STDCALL CBaseFilter_JoinFilterGraph(IBaseFilter* This, |
798 /* [in] */ IFilterGraph* pGraph, | |
3056 | 799 /* [string][in] */ const unsigned short* pName) |
800 { | |
801 Debug unimplemented("CBaseFilter_JoinFilterGraph", This); | |
802 return E_NOTIMPL; | |
803 } | |
804 | |
22028 | 805 /** |
806 * \brief IBaseFilter::QueryVendorInfo (retrieves a string containing vendor info) | |
807 * | |
808 * \param[in] This pointer to IBaseFilter interface | |
809 * \param[out] address of variable that receives pointer to a string containing vendor info | |
810 * | |
811 * \return S_OK success | |
812 * \return E_POINTER Null pointer | |
813 * \return E_NOTIMPL Not implemented | |
814 * | |
815 * \remarks | |
816 * Call to CoTaskMemFree to free memory allocated for string | |
817 * | |
818 */ | |
3130 | 819 static long STDCALL CBaseFilter_QueryVendorInfo(IBaseFilter* This, |
820 /* [string][out] */ unsigned short** pVendorInfo) | |
3056 | 821 { |
822 Debug unimplemented("CBaseFilter_QueryVendorInfo", This); | |
168 | 823 return E_NOTIMPL; |
1545 | 824 } |
168 | 825 |
22028 | 826 /** |
827 * \brief CBaseFilter::GetPin (gets used pin) | |
828 * | |
829 * \param[in] This pointer to CBaseFilter object | |
830 * | |
831 * \return pointer to used pin's IPin interface | |
832 * | |
833 */ | |
3056 | 834 static IPin* CBaseFilter_GetPin(CBaseFilter* This) |
835 { | |
836 return This->pin; | |
837 } | |
1545 | 838 |
22028 | 839 /** |
840 * \brief CBaseFilter::GetUnusedPin (gets used pin) | |
841 * | |
842 * \param[in] This pointer to CBaseFilter object | |
843 * | |
844 * \return pointer to unused pin's IPin interface | |
845 * | |
846 */ | |
3056 | 847 static IPin* CBaseFilter_GetUnusedPin(CBaseFilter* This) |
168 | 848 { |
3056 | 849 return This->unused_pin; |
850 } | |
851 | |
22028 | 852 /** |
853 * \brief CBaseFilter destructor | |
854 * | |
855 * \param[in] This pointer to CBaseFilter object | |
856 * | |
857 */ | |
3056 | 858 static void CBaseFilter_Destroy(CBaseFilter* This) |
859 { | |
3467 | 860 if (This->vt) |
861 free(This->vt); | |
862 if (This->pin) | |
863 This->pin->vt->Release((IUnknown*)This->pin); | |
864 if (This->unused_pin) | |
865 This->unused_pin->vt->Release((IUnknown*)This->unused_pin); | |
3056 | 866 free(This); |
1545 | 867 } |
168 | 868 |
3056 | 869 IMPLEMENT_IUNKNOWN(CBaseFilter) |
1545 | 870 |
22028 | 871 /** |
872 * \brief CBaseFilter constructor | |
873 * | |
874 * \param[in] type Pointer to media type for connection | |
875 * \param[in] parent Pointer to parent CBaseFilter2 object | |
876 * | |
877 * \return pointer to CBaseFilter object or NULL if error occured | |
878 * | |
879 */ | |
3056 | 880 CBaseFilter* CBaseFilterCreate(const AM_MEDIA_TYPE* type, CBaseFilter2* parent) |
168 | 881 { |
3056 | 882 CBaseFilter* This = (CBaseFilter*) malloc(sizeof(CBaseFilter)); |
3467 | 883 if (!This) |
884 return NULL; | |
885 | |
3056 | 886 This->refcount = 1; |
887 | |
888 This->pin = (IPin*) CInputPinCreate(This, type); | |
889 This->unused_pin = (IPin*) CRemotePinCreate(This, parent->GetPin(parent)); | |
890 | |
891 This->vt = (IBaseFilter_vt*) malloc(sizeof(IBaseFilter_vt)); | |
3467 | 892 if (!This->vt || !This->pin || !This->unused_pin) |
893 { | |
894 CBaseFilter_Destroy(This); | |
895 return NULL; | |
896 } | |
897 | |
3056 | 898 This->vt->QueryInterface = CBaseFilter_QueryInterface; |
899 This->vt->AddRef = CBaseFilter_AddRef; | |
900 This->vt->Release = CBaseFilter_Release; | |
901 This->vt->GetClassID = CBaseFilter_GetClassID; | |
902 This->vt->Stop = CBaseFilter_Stop; | |
903 This->vt->Pause = CBaseFilter_Pause; | |
904 This->vt->Run = CBaseFilter_Run; | |
905 This->vt->GetState = CBaseFilter_GetState; | |
906 This->vt->SetSyncSource = CBaseFilter_SetSyncSource; | |
907 This->vt->GetSyncSource = CBaseFilter_GetSyncSource; | |
908 This->vt->EnumPins = CBaseFilter_EnumPins; | |
909 This->vt->FindPin = CBaseFilter_FindPin; | |
910 This->vt->QueryFilterInfo = CBaseFilter_QueryFilterInfo; | |
911 This->vt->JoinFilterGraph = CBaseFilter_JoinFilterGraph; | |
912 This->vt->QueryVendorInfo = CBaseFilter_QueryVendorInfo; | |
913 | |
914 This->interfaces[0] = IID_IUnknown; | |
915 This->interfaces[1] = IID_IBaseFilter; | |
916 | |
917 This->GetPin = CBaseFilter_GetPin; | |
918 This->GetUnusedPin = CBaseFilter_GetUnusedPin; | |
919 | |
920 return This; | |
1545 | 921 } |
168 | 922 |
923 | |
3056 | 924 /************** |
925 * BaseFilter2 | |
926 **************/ | |
168 | 927 |
928 | |
3130 | 929 static long STDCALL CBaseFilter2_GetClassID(IBaseFilter* This, |
930 /* [out] */ CLSID* pClassID) | |
168 | 931 { |
3056 | 932 Debug unimplemented("CBaseFilter2_GetClassID", This); |
168 | 933 return E_NOTIMPL; |
1545 | 934 } |
168 | 935 |
22028 | 936 /** |
937 * \brief IMediaFilter::Stop (stops the filter) | |
938 * | |
939 * \param[in] This pointer to IBaseFilter interface | |
940 * | |
941 * \return S_OK success | |
942 * \return S_FALSE transition is not complete | |
943 * | |
944 * \remarks | |
945 * When filter is stopped it does onot deliver or process any samples and rejects any samples | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25849
diff
changeset
|
946 * from upstream filter. |
22028 | 947 * Transition may be asynchronous. In this case method should return S_FALSE. |
948 * Method always sets filter's state to State_Stopped even if error occured. | |
949 * | |
950 */ | |
3130 | 951 static long STDCALL CBaseFilter2_Stop(IBaseFilter* This) |
168 | 952 { |
3056 | 953 Debug unimplemented("CBaseFilter2_Stop", This); |
168 | 954 return E_NOTIMPL; |
1545 | 955 } |
168 | 956 |
22028 | 957 /** |
958 * \brief IMediaFilter::Pause (pauses filter) | |
959 * | |
960 * \param[in] This pointer to IBaseFilter interface | |
961 * | |
962 * \return S_OK success | |
963 * \return S_FALSE transition is not complete | |
964 * | |
965 * \remarks | |
966 * When filter is paused it can receive, process and deliver samples. | |
967 * Live source filters do not deliver any samples while paused. | |
968 * Transition may be asynchronous. In this case method should return S_FALSE. | |
969 * Method always sets filter's state to State_Stopped even if error occured. | |
970 * | |
971 */ | |
3130 | 972 static long STDCALL CBaseFilter2_Pause(IBaseFilter* This) |
168 | 973 { |
3056 | 974 Debug unimplemented("CBaseFilter2_Pause", This); |
168 | 975 return E_NOTIMPL; |
1545 | 976 } |
977 | |
22028 | 978 /** |
979 * \brief IMediaFilter::Run (runs the filter) | |
980 * | |
981 * \param[in] This pointer to IBaseFilter interface | |
982 * \param[in] tStart Reference time corresponding to stream time 0. | |
983 * | |
984 * \return S_OK success | |
985 * \return S_FALSE transition is not complete | |
986 * | |
987 * \remarks | |
988 * When filter is running it can receive, process and deliver samples. Source filters | |
989 * generatesnew samples, and renderers renders them. | |
990 * Stream time is calculated as the current reference time minus tStart. | |
991 * Graph Manager sets tStart slightly in the future according to graph latency. | |
992 * | |
993 */ | |
3130 | 994 static long STDCALL CBaseFilter2_Run(IBaseFilter* This, REFERENCE_TIME tStart) |
168 | 995 { |
3056 | 996 Debug unimplemented("CBaseFilter2_Run", This); |
168 | 997 return E_NOTIMPL; |
1545 | 998 } |
168 | 999 |
1545 | 1000 |
22028 | 1001 /** |
1002 * \brief IMediaFilter::GetState (retrieves the filter's state (running, stopped or paused)) | |
1003 * | |
1004 * \param[in] This pointer to IBaseFilter interface | |
1005 * \param[in] dwMilliSecsTimeout Timeout interval in milliseconds. To block indifinitely pass | |
1006 * INFINITE. | |
1007 * \param[out] State pointer to variable that receives a member of FILTER_STATE enumeration. | |
1008 * | |
1009 * \return S_OK success | |
1010 * \return E_POINTER Null pointer | |
1011 * \return VFW_S_STATE_INTERMEDATE Intermediate state | |
1012 * \return VFW_S_CANT_CUE The filter is active, but cannot deliver data. | |
1013 * | |
1014 */ | |
3056 | 1015 static long STDCALL CBaseFilter2_GetState(IBaseFilter* This, |
1016 /* [in] */ unsigned long dwMilliSecsTimeout, | |
1017 // /* [out] */ FILTER_STATE *State) | |
1018 void* State) | |
1019 { | |
1020 Debug unimplemented("CBaseFilter2_GetState", This); | |
1021 return E_NOTIMPL; | |
1022 } | |
1023 | |
22028 | 1024 /** |
1025 * \brief IMediaFilter::SetSyncSource (sets the reference clock) | |
1026 * | |
1027 * \param[in] This pointer to IBaseFilter interface | |
1028 * \param[in] pClock IReferenceClock interface of reference clock | |
1029 * | |
1030 * \return S_OK success | |
1031 * \return apripriate error otherwise | |
1032 * | |
1033 */ | |
3056 | 1034 static long STDCALL CBaseFilter2_SetSyncSource(IBaseFilter* This, |
1035 /* [in] */ IReferenceClock* pClock) | |
1036 { | |
1037 Debug unimplemented("CBaseFilter2_SetSyncSource", This); | |
1038 return E_NOTIMPL; | |
1039 } | |
1040 | |
22028 | 1041 /** |
1042 * \brief IMediafilter::GetSyncSource (gets current reference clock) | |
1043 * | |
1044 * \param[in] This pointer to IBaseFilter interface | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25849
diff
changeset
|
1045 * \param[out] pClock address of variable that receives pointer to clock's |
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25849
diff
changeset
|
1046 * IReferenceClock interface |
22028 | 1047 * |
1048 * \return S_OK success | |
1049 * \return E_POINTER Null pointer | |
1050 * | |
1051 */ | |
3056 | 1052 static long STDCALL CBaseFilter2_GetSyncSource(IBaseFilter* This, |
1053 /* [out] */ IReferenceClock** pClock) | |
1054 { | |
1055 Debug unimplemented("CBaseFilter2_GetSyncSource", This); | |
1056 return E_NOTIMPL; | |
1057 } | |
1058 | |
22028 | 1059 /** |
1060 * \brief IBaseFilter::EnumPins (enumerates the pins of this filter) | |
1061 * | |
1062 * \param[in] This pointer to IBaseFilter interface | |
1063 * \param[out] ppEnum address of variable that receives pointer to IEnumPins interface | |
1064 * | |
1065 * \return S_OK success | |
1066 * \return E_OUTOFMEMORY Insufficient memory | |
1067 * \return E_POINTER Null pointer | |
1068 * | |
1069 */ | |
3056 | 1070 static long STDCALL CBaseFilter2_EnumPins(IBaseFilter* This, |
1071 /* [out] */ IEnumPins** ppEnum) | |
168 | 1072 { |
3056 | 1073 Debug printf("CBaseFilter2_EnumPins(%p) called\n", This); |
1074 *ppEnum = (IEnumPins*) CEnumPinsCreate(((CBaseFilter2*)This)->pin, 0); | |
1075 return 0; | |
1076 } | |
1077 | |
22028 | 1078 /** |
1079 * \brief IBaseFilter::FindPin (retrieves the pin with specified id) | |
1080 * | |
1081 * \param[in] This pointer to IBaseFilter interface | |
1082 * \param[in] Id constant wide string, containing pin id | |
1083 * \param[out] ppPin address of variable that receives pointer to pin's IPin interface | |
1084 * | |
1085 * \return S_OK success | |
1086 * \return E_POINTER Null pointer | |
1087 * \return VFW_E_NOT_FOUND Could not find a pin with specified id | |
1088 * | |
1089 * \note | |
1090 * Be sure to release the interface after use. | |
1091 * | |
1092 */ | |
3056 | 1093 static long STDCALL CBaseFilter2_FindPin(IBaseFilter* This, |
1094 /* [string][in] */ const unsigned short* Id, | |
1095 /* [out] */ IPin** ppPin) | |
1096 { | |
1097 Debug unimplemented("CBaseFilter2_FindPin", This); | |
1098 return E_NOTIMPL; | |
1099 } | |
1100 | |
22028 | 1101 /** |
1102 * \brief IBaseFilter::QueryFilterInfo (retrieves information aboud the filter) | |
1103 * | |
1104 * \param[in] This pointer to IBaseFilter interface | |
1105 * \param[out] pInfo pointer to FILTER_INFO structure | |
1106 * | |
1107 * \return S_OK success | |
1108 * \return E_POINTER Null pointer | |
1109 * | |
1110 * \note | |
1111 * If pGraph member of FILTER_INFO is not NULL, be sure to release IFilterGraph interface after use. | |
1112 * | |
1113 */ | |
3056 | 1114 static long STDCALL CBaseFilter2_QueryFilterInfo(IBaseFilter* This, |
1115 // /* [out] */ FILTER_INFO *pInfo) | |
1116 void* pInfo) | |
1117 { | |
1118 Debug unimplemented("CBaseFilter2_QueryFilterInfo", This); | |
1119 return E_NOTIMPL; | |
1120 } | |
1121 | |
22028 | 1122 /** |
1123 * \brief IBaseFilter::JoinFilterGraph (notifies the filter that it has joined of left filter graph) | |
1124 * | |
1125 * \param[in] This pointer to IBaseFilter interface | |
1126 * \param[in] pInfo pointer to graph's IFilterGraph interface or NULL if filter is leaving graph | |
1127 * \param[in] pName pointer to wide character string that specifies a name for the filter | |
1128 * | |
1129 * \return S_OK success | |
1130 * \return apropriate error code otherwise | |
1131 * | |
1132 * \remarks | |
1133 * Filter should not call to graph's AddRef method. | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
25849
diff
changeset
|
1134 * The IFilterGraph is guaranteed to be valid until graph manager calls this method again with |
22028 | 1135 * the value NULL. |
1136 * | |
1137 */ | |
3056 | 1138 static long STDCALL CBaseFilter2_JoinFilterGraph(IBaseFilter* This, |
1139 /* [in] */ IFilterGraph* pGraph, | |
1140 /* [string][in] */ | |
1141 const unsigned short* pName) | |
1142 { | |
1143 Debug unimplemented("CBaseFilter2_JoinFilterGraph", This); | |
168 | 1144 return E_NOTIMPL; |
1545 | 1145 } |
168 | 1146 |
22028 | 1147 /** |
1148 * \brief IBaseFilter::QueryVendorInfo (retrieves a string containing vendor info) | |
1149 * | |
1150 * \param[in] This pointer to IBaseFilter interface | |
1151 * \param[out] address of variable that receives pointer to a string containing vendor info | |
1152 * | |
1153 * \return S_OK success | |
1154 * \return E_POINTER Null pointer | |
1155 * \return E_NOTIMPL Not implemented | |
1156 * | |
1157 * \remarks | |
1158 * Call to CoTaskMemFree to free memory allocated for string | |
1159 * | |
1160 */ | |
3056 | 1161 static long STDCALL CBaseFilter2_QueryVendorInfo(IBaseFilter* This, |
1162 /* [string][out] */ | |
1163 unsigned short** pVendorInfo) | |
168 | 1164 { |
3056 | 1165 Debug unimplemented("CBaseFilter2_QueryVendorInfo", This); |
168 | 1166 return E_NOTIMPL; |
1545 | 1167 } |
168 | 1168 |
22028 | 1169 /** |
1170 * \brief CBaseFilter2::GetPin (gets used pin) | |
1171 * | |
1172 * \param[in] This pointer to CBaseFilter2 object | |
1173 * | |
1174 * \return pointer to used pin's IPin interface | |
1175 * | |
1176 */ | |
3056 | 1177 static IPin* CBaseFilter2_GetPin(CBaseFilter2* This) |
1178 { | |
1179 return This->pin; | |
1180 } | |
1545 | 1181 |
22028 | 1182 /** |
1183 * \brief CBaseFilter2 destructor | |
1184 * | |
1185 * \param[in] This pointer to CBaseFilter2 object | |
1186 * | |
1187 */ | |
3056 | 1188 static void CBaseFilter2_Destroy(CBaseFilter2* This) |
168 | 1189 { |
3130 | 1190 Debug printf("CBaseFilter2_Destroy(%p) called\n", This); |
3467 | 1191 if (This->pin) |
1192 This->pin->vt->Release((IUnknown*) This->pin); | |
1193 if (This->vt) | |
1194 free(This->vt); | |
3056 | 1195 free(This); |
1545 | 1196 } |
168 | 1197 |
3056 | 1198 IMPLEMENT_IUNKNOWN(CBaseFilter2) |
1545 | 1199 |
3056 | 1200 static GUID CBaseFilter2_interf1 = |
1201 {0x76c61a30, 0xebe1, 0x11cf, {0x89, 0xf9, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb}}; | |
22028 | 1202 /// IID_IAMNetShowPreroll |
3056 | 1203 static GUID CBaseFilter2_interf2 = |
1204 {0xaae7e4e2, 0x6388, 0x11d1, {0x8d, 0x93, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2}}; | |
22028 | 1205 /// IID_IAMRebuild |
3056 | 1206 static GUID CBaseFilter2_interf3 = |
1207 {0x02ef04dd, 0x7580, 0x11d1, {0xbe, 0xce, 0x00, 0xc0, 0x4f, 0xb6, 0xe9, 0x37}}; | |
1208 | |
22028 | 1209 /** |
1210 * \brief CBaseFilter2 constructor | |
1211 * | |
1212 * \return pointer to CBaseFilter2 object or NULL if error occured | |
1213 * | |
1214 */ | |
3056 | 1215 CBaseFilter2* CBaseFilter2Create() |
168 | 1216 { |
3056 | 1217 CBaseFilter2* This = (CBaseFilter2*) malloc(sizeof(CBaseFilter2)); |
1218 | |
3467 | 1219 if (!This) |
1220 return NULL; | |
1221 | |
3056 | 1222 This->refcount = 1; |
1223 This->pin = (IPin*) CRemotePin2Create(This); | |
1224 | |
1225 This->vt = (IBaseFilter_vt*) malloc(sizeof(IBaseFilter_vt)); | |
3467 | 1226 |
1227 if (!This->pin || !This->vt) | |
1228 { | |
1229 CBaseFilter2_Destroy(This); | |
1230 return NULL; | |
1231 } | |
1232 | |
3056 | 1233 memset(This->vt, 0, sizeof(IBaseFilter_vt)); |
1234 This->vt->QueryInterface = CBaseFilter2_QueryInterface; | |
1235 This->vt->AddRef = CBaseFilter2_AddRef; | |
1236 This->vt->Release = CBaseFilter2_Release; | |
1237 This->vt->GetClassID = CBaseFilter2_GetClassID; | |
1238 This->vt->Stop = CBaseFilter2_Stop; | |
1239 This->vt->Pause = CBaseFilter2_Pause; | |
1240 This->vt->Run = CBaseFilter2_Run; | |
1241 This->vt->GetState = CBaseFilter2_GetState; | |
1242 This->vt->SetSyncSource = CBaseFilter2_SetSyncSource; | |
1243 This->vt->GetSyncSource = CBaseFilter2_GetSyncSource; | |
1244 This->vt->EnumPins = CBaseFilter2_EnumPins; | |
1245 This->vt->FindPin = CBaseFilter2_FindPin; | |
1246 This->vt->QueryFilterInfo = CBaseFilter2_QueryFilterInfo; | |
1247 This->vt->JoinFilterGraph = CBaseFilter2_JoinFilterGraph; | |
1248 This->vt->QueryVendorInfo = CBaseFilter2_QueryVendorInfo; | |
1249 | |
1250 This->GetPin = CBaseFilter2_GetPin; | |
1251 | |
1252 This->interfaces[0] = IID_IUnknown; | |
1253 This->interfaces[1] = IID_IBaseFilter; | |
1254 This->interfaces[2] = CBaseFilter2_interf1; | |
1255 This->interfaces[3] = CBaseFilter2_interf2; | |
1256 This->interfaces[4] = CBaseFilter2_interf3; | |
1257 | |
1258 return This; | |
1545 | 1259 } |
168 | 1260 |
1545 | 1261 |
3056 | 1262 /************* |
1263 * CRemotePin | |
1264 *************/ | |
1545 | 1265 |
168 | 1266 |
22028 | 1267 /** |
1268 * \brief IPin::ConnectedTo (retrieves pointer to the connected pin, if such exist) | |
1269 * | |
1270 * \param[in] This pointer to IPin interface | |
1271 * \param[out] pPin pointer to remote pin's IPin interface | |
1272 * | |
1273 * \return S_OK - success | |
1274 * \return E_POINTER - Null pointer | |
1275 * \return VFW_E_NOT_CONNECTED - pin is not connected | |
1276 * | |
1277 * \note | |
1278 * Caller must call Release on received IPin, when done | |
1279 */ | |
3056 | 1280 static long STDCALL CRemotePin_ConnectedTo(IPin* This, /* [out] */ IPin** pPin) |
168 | 1281 { |
3056 | 1282 Debug printf("CRemotePin_ConnectedTo(%p) called\n", This); |
1545 | 1283 if (!pPin) |
1284 return E_INVALIDARG; | |
3056 | 1285 *pPin = ((CRemotePin*)This)->remote_pin; |
1545 | 1286 (*pPin)->vt->AddRef((IUnknown*)(*pPin)); |
1287 return 0; | |
1288 } | |
168 | 1289 |
22028 | 1290 /** |
1291 * \brief IPin::QueryDirection (retrieves pin direction) | |
1292 * | |
1293 * \param[in] This pointer to IPin interface | |
1294 * \param[out] pPinDir pointer to variable, that receives pin direction (PINDIR_INPUT,PINDIR_OUTPUT) | |
1295 * | |
1296 * \return S_OK - success | |
1297 * \return E_POINTER - Null pointer | |
1298 * | |
1299 */ | |
3056 | 1300 static long STDCALL CRemotePin_QueryDirection(IPin* This, |
3130 | 1301 /* [out] */ PIN_DIRECTION* pPinDir) |
1545 | 1302 { |
3056 | 1303 Debug printf("CRemotePin_QueryDirection(%p) called\n", This); |
1545 | 1304 if (!pPinDir) |
1305 return E_INVALIDARG; | |
1306 *pPinDir=PINDIR_INPUT; | |
1307 return 0; | |
1308 } | |
1309 | |
22028 | 1310 /** |
1311 * \brief IPin::ConnectionMediaType (retrieves media type for connection, if such exist) | |
1312 * | |
1313 * \param[in] This pointer to IPin interface | |
1314 * \param[out] pmt pointer to AM_MEDIA_TYPE, that receives connection media type | |
1315 * | |
1316 * \return S_OK - success | |
1317 * \return E_POINTER - Null pointer | |
1318 * \return VFW_E_NOT_CONNECTED - pin is not connected | |
1319 * | |
1320 */ | |
1545 | 1321 static long STDCALL CRemotePin_ConnectionMediaType(IPin* This, /* [out] */ AM_MEDIA_TYPE* pmt) |
168 | 1322 { |
3056 | 1323 Debug unimplemented("CRemotePin_ConnectionMediaType", This); |
168 | 1324 return E_NOTIMPL; |
1325 } | |
1326 | |
22028 | 1327 /** |
1328 * \brief IPin::QueryPinInfo (retrieves information about the pin) | |
1329 * | |
1330 * \param[in] This pointer to IPin interface | |
1331 * \param[out] pInfo pointer to PIN_INFO structure, that receives pin info | |
1332 * | |
1333 * \return S_OK - success | |
1334 * \return E_POINTER - Null pointer | |
1335 * | |
1336 * \note | |
1337 * If pInfo->pFilter is not NULL, then caller must call Release on pInfo->pFilter when done | |
1338 * | |
1339 */ | |
1545 | 1340 static long STDCALL CRemotePin_QueryPinInfo(IPin* This, /* [out] */ PIN_INFO* pInfo) |
168 | 1341 { |
1545 | 1342 CBaseFilter* lparent = ((CRemotePin*)This)->parent; |
3056 | 1343 Debug printf("CRemotePin_QueryPinInfo(%p) called\n", This); |
1344 pInfo->dir= PINDIR_INPUT; | |
1345 pInfo->pFilter = (IBaseFilter*) lparent; | |
1545 | 1346 lparent->vt->AddRef((IUnknown*)lparent); |
1347 pInfo->achName[0]=0; | |
1348 return 0; | |
1349 } | |
1350 | |
22028 | 1351 /** |
1352 * \brief CRemotePin destructor | |
1353 * | |
1354 * \param[in] This pointer to CRemotePin object | |
1355 * | |
1356 */ | |
3056 | 1357 static void CRemotePin_Destroy(CRemotePin* This) |
1358 { | |
1359 Debug printf("CRemotePin_Destroy(%p) called\n", This); | |
1360 free(This->vt); | |
1361 free(This); | |
1362 } | |
1363 | |
1364 IMPLEMENT_IUNKNOWN(CRemotePin) | |
1365 | |
22028 | 1366 /** |
1367 * \brief CRemotePin constructor | |
1368 * | |
1369 * \param[in] pt parent filter | |
1370 * \param[in] rpin remote pin | |
1371 * | |
1372 * \return pointer to CRemotePin or NULL if error occured | |
1373 * | |
1374 */ | |
3056 | 1375 CRemotePin* CRemotePinCreate(CBaseFilter* pt, IPin* rpin) |
1376 { | |
1377 CRemotePin* This = (CRemotePin*) malloc(sizeof(CRemotePin)); | |
3467 | 1378 |
1379 if (!This) | |
1380 return NULL; | |
1381 | |
3056 | 1382 Debug printf("CRemotePinCreate() called -> %p\n", This); |
1383 | |
1384 This->parent = pt; | |
1385 This->remote_pin = rpin; | |
1386 This->refcount = 1; | |
1387 | |
1388 This->vt = (IPin_vt*) malloc(sizeof(IPin_vt)); | |
3467 | 1389 |
1390 if (!This->vt) | |
1391 { | |
1392 free(This); | |
1393 return NULL; | |
1394 } | |
1395 | |
3056 | 1396 memset(This->vt, 0, sizeof(IPin_vt)); |
1397 This->vt->QueryInterface = CRemotePin_QueryInterface; | |
1398 This->vt->AddRef = CRemotePin_AddRef; | |
1399 This->vt->Release = CRemotePin_Release; | |
1400 This->vt->QueryDirection = CRemotePin_QueryDirection; | |
1401 This->vt->ConnectedTo = CRemotePin_ConnectedTo; | |
1402 This->vt->ConnectionMediaType = CRemotePin_ConnectionMediaType; | |
1403 This->vt->QueryPinInfo = CRemotePin_QueryPinInfo; | |
1404 | |
1405 This->interfaces[0] = IID_IUnknown; | |
1406 | |
1407 return This; | |
1408 } | |
1409 | |
1410 | |
1411 /************* | |
3130 | 1412 * CRemotePin2 |
3056 | 1413 *************/ |
1414 | |
1545 | 1415 |
22028 | 1416 /** |
1417 * \brief IPin::QueryPinInfo (retrieves information about the pin) | |
1418 * | |
1419 * \param[in] This pointer to IPin interface | |
1420 * \param[out] pInfo pointer to PIN_INFO structure, that receives pin info | |
1421 * | |
1422 * \return S_OK - success | |
1423 * \return E_POINTER - Null pointer | |
1424 * | |
1425 * \note | |
1426 * If pInfo->pFilter is not NULL, then caller must call Release on pInfo->pFilter when done | |
1427 * | |
1428 */ | |
3130 | 1429 static long STDCALL CRemotePin2_QueryPinInfo(IPin* This, |
1430 /* [out] */ PIN_INFO* pInfo) | |
1545 | 1431 { |
1432 CBaseFilter2* lparent=((CRemotePin2*)This)->parent; | |
3056 | 1433 Debug printf("CRemotePin2_QueryPinInfo(%p) called\n", This); |
1545 | 1434 pInfo->pFilter=(IBaseFilter*)lparent; |
1435 lparent->vt->AddRef((IUnknown*)lparent); | |
1436 pInfo->dir=PINDIR_OUTPUT; | |
168 | 1437 pInfo->achName[0]=0; |
1438 return 0; | |
1439 } | |
1545 | 1440 |
22028 | 1441 /** |
1442 * \brief CremotePin2 destructor | |
1443 * | |
1444 * \param This pointer to CRemotePin2 object | |
1445 * | |
1446 * FIXME - not being released! | |
1447 */ | |
3056 | 1448 static void CRemotePin2_Destroy(CRemotePin2* This) |
1545 | 1449 { |
3056 | 1450 Debug printf("CRemotePin2_Destroy(%p) called\n", This); |
1451 free(This->vt); | |
1452 free(This); | |
1545 | 1453 } |
1454 | |
3056 | 1455 IMPLEMENT_IUNKNOWN(CRemotePin2) |
1456 | |
22028 | 1457 /** |
1458 * \brief CRemotePin2 contructor | |
1459 * | |
1460 * \param[in] p pointer to parent CBaseFilter2 object | |
1461 * | |
1462 * \return pointer to CRemotePin2 object or NULL if error occured | |
1463 * | |
1464 */ | |
3056 | 1465 CRemotePin2* CRemotePin2Create(CBaseFilter2* p) |
1545 | 1466 { |
3056 | 1467 CRemotePin2* This = (CRemotePin2*) malloc(sizeof(CRemotePin2)); |
3467 | 1468 |
1469 if (!This) | |
1470 return NULL; | |
1471 | |
3056 | 1472 Debug printf("CRemotePin2Create() called -> %p\n", This); |
1473 | |
1474 This->parent = p; | |
1475 This->refcount = 1; | |
1476 | |
1477 This->vt = (IPin_vt*) malloc(sizeof(IPin_vt)); | |
3467 | 1478 |
1479 if (!This->vt) | |
1480 { | |
1481 free(This); | |
1482 return NULL; | |
1483 } | |
1484 | |
3056 | 1485 memset(This->vt, 0, sizeof(IPin_vt)); |
1486 This->vt->QueryInterface = CRemotePin2_QueryInterface; | |
1487 This->vt->AddRef = CRemotePin2_AddRef; | |
1488 This->vt->Release = CRemotePin2_Release; | |
1489 This->vt->QueryPinInfo = CRemotePin2_QueryPinInfo; | |
1490 | |
1491 This->interfaces[0] = IID_IUnknown; | |
1492 | |
1493 return This; | |
1545 | 1494 } |