MCPcopy Create free account
hub / github.com/Nevcairiel/LAVFilters / FindPinIntefaceInGraph

Function FindPinIntefaceInGraph

common/DSUtilLite/DShowUtil.cpp:420–463  ·  view source on GitHub ↗

pPin - pin of our filter to start searching refiid - guid of the interface to find pUnknown - variable that'll receive the interface

Source from the content-addressed store, hash-verified

418// refiid - guid of the interface to find
419// pUnknown - variable that'll receive the interface
420HRESULT FindPinIntefaceInGraph(IPin *pPin, REFIID refiid, void **pUnknown)
421{
422 PIN_DIRECTION dir;
423 pPin->QueryDirection(&dir);
424
425 IPin *pOtherPin = nullptr;
426 if (SUCCEEDED(pPin->ConnectedTo(&pOtherPin)) && pOtherPin)
427 {
428 IBaseFilter *pFilter = nullptr;
429 HRESULT hrFilter = pOtherPin->QueryInterface(refiid, pUnknown);
430
431 if (FAILED(hrFilter))
432 {
433 pFilter = GetFilterFromPin(pOtherPin);
434
435 IEnumPins *pPinEnum = nullptr;
436 pFilter->EnumPins(&pPinEnum);
437
438 HRESULT hrPin = E_FAIL;
439 for (IPin *pOtherPin2 = nullptr; pPinEnum->Next(1, &pOtherPin2, 0) == S_OK; pOtherPin2 = nullptr)
440 {
441 PIN_DIRECTION pinDir;
442 pOtherPin2->QueryDirection(&pinDir);
443 if (dir == pinDir)
444 {
445 hrPin = FindPinIntefaceInGraph(pOtherPin2, refiid, pUnknown);
446 }
447 SafeRelease(&pOtherPin2);
448 if (SUCCEEDED(hrPin))
449 break;
450 }
451 hrFilter = hrPin;
452 SafeRelease(&pPinEnum);
453 }
454 SafeRelease(&pFilter);
455 SafeRelease(&pOtherPin);
456
457 if (SUCCEEDED(hrFilter))
458 {
459 return S_OK;
460 }
461 }
462 return E_NOINTERFACE;
463}
464
465// pPin - pin of our filter to start searching
466// guid - guid of the filter to find

Callers 1

CreateDecoderMethod · 0.85

Calls 8

SUCCEEDEDFunction · 0.85
GetFilterFromPinFunction · 0.85
SafeReleaseFunction · 0.85
QueryDirectionMethod · 0.80
ConnectedToMethod · 0.80
EnumPinsMethod · 0.80
QueryInterfaceMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected