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

Method JoinFilterGraph

common/baseclasses/amfilter.cpp:740–796  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

738/* Provide the filter with a filter graph */
739
740STDMETHODIMP
741CBaseFilter::JoinFilterGraph(__inout_opt IFilterGraph *pGraph, __in_opt LPCWSTR pName)
742{
743 CAutoLock cObjectLock(m_pLock);
744
745 // NOTE: we no longer hold references on the graph (m_pGraph, m_pSink)
746
747 m_pGraph = pGraph;
748 if (m_pGraph)
749 {
750 HRESULT hr = m_pGraph->QueryInterface(IID_IMediaEventSink, (void **)&m_pSink);
751 if (FAILED(hr))
752 {
753 ASSERT(m_pSink == NULL);
754 }
755 else
756 m_pSink->Release(); // we do NOT keep a reference on it.
757 }
758 else
759 {
760 // if graph pointer is null, then we should
761 // also release the IMediaEventSink on the same object - we don't
762 // refcount it, so just set it to null
763 m_pSink = NULL;
764 }
765
766 if (m_pName)
767 {
768 delete[] m_pName;
769 m_pName = NULL;
770 }
771
772 if (pName)
773 {
774 size_t namelen;
775 HRESULT hr = StringCchLengthW(pName, STRSAFE_MAX_CCH, &namelen);
776 if (FAILED(hr))
777 {
778 return hr;
779 }
780 m_pName = new WCHAR[namelen + 1];
781 if (m_pName)
782 {
783 (void)StringCchCopyW(m_pName, namelen + 1, pName);
784 }
785 else
786 {
787 return E_OUTOFMEMORY;
788 }
789 }
790
791#ifdef DXMPERF
792 PERFLOG_JOINGRAPH(m_pName ? m_pName : L"CBaseFilter", (IBaseFilter *)this, pGraph);
793#endif // DXMPERF
794
795 return NOERROR;
796}
797

Callers

nothing calls this directly

Calls 2

QueryInterfaceMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected