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

Function FindIntefaceInGraph

common/DSUtilLite/DShowUtil.cpp:374–415  ·  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

372// refiid - guid of the interface to find
373// pUnknown - variable that'll receive the interface
374HRESULT FindIntefaceInGraph(IPin *pPin, REFIID refiid, void **pUnknown)
375{
376 PIN_DIRECTION dir;
377 pPin->QueryDirection(&dir);
378
379 IPin *pOtherPin = nullptr;
380 if (SUCCEEDED(pPin->ConnectedTo(&pOtherPin)) && pOtherPin)
381 {
382 IBaseFilter *pFilter = GetFilterFromPin(pOtherPin);
383 SafeRelease(&pOtherPin);
384
385 HRESULT hrFilter = pFilter->QueryInterface(refiid, pUnknown);
386 if (FAILED(hrFilter))
387 {
388 IEnumPins *pPinEnum = nullptr;
389 pFilter->EnumPins(&pPinEnum);
390
391 HRESULT hrPin = E_FAIL;
392 for (IPin *pOtherPin2 = nullptr; pPinEnum->Next(1, &pOtherPin2, 0) == S_OK; pOtherPin2 = nullptr)
393 {
394 PIN_DIRECTION pinDir;
395 pOtherPin2->QueryDirection(&pinDir);
396 if (dir == pinDir)
397 {
398 hrPin = FindIntefaceInGraph(pOtherPin2, refiid, pUnknown);
399 }
400 SafeRelease(&pOtherPin2);
401 if (SUCCEEDED(hrPin))
402 break;
403 }
404 hrFilter = hrPin;
405 SafeRelease(&pPinEnum);
406 }
407 SafeRelease(&pFilter);
408
409 if (SUCCEEDED(hrFilter))
410 {
411 return S_OK;
412 }
413 }
414 return E_NOINTERFACE;
415}
416
417// pPin - pin of our filter to start searching
418// refiid - guid of the interface to find

Callers 2

GetFileExtensionMethod · 0.85
StartStreamingMethod · 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