CGraphBuilderCB.cpp
上传用户:hhs829
上传日期:2022-06-17
资源大小:586k
文件大小:2k
- //
- // CGraphBuilderCB.cpp
- //
- #include "stdafx.h"
- #include <streams.h>
- #include "CGraphBuilderCB.h"
- #include "CSupported.h"
- //////////////////////////////////////////////////////////////////////////////
- CGraphBuilderCB::CGraphBuilderCB() :
- CUnknown(NAME("Callbacker"), NULL)
- {
- mSupported = new CSupported();
- }
- CGraphBuilderCB::~CGraphBuilderCB()
- {
- if (mSupported)
- {
- delete mSupported;
- mSupported = NULL;
- }
- }
- STDMETHODIMP CGraphBuilderCB::NonDelegatingQueryInterface(REFIID riid, void** ppv)
- {
- if (riid == __uuidof(IAMGraphBuilderCallback))
- {
- return GetInterface((IAMGraphBuilderCallback*)this, ppv);
- }
- return CUnknown::NonDelegatingQueryInterface(riid,ppv);
- }
- //////////////////////////////////////////////////////////////////////////////
- //
- // IAMGraphBuilderCallback-overriden functions
- //////////////////////////////////////////////////////////////////////////////
- //----------------------------------------------------------------------------
- // SelectedFilter
- //
- //----------------------------------------------------------------------------
- STDMETHODIMP CGraphBuilderCB::SelectedFilter(IMoniker *pMon)
- {
- if (!pMon)
- {
- return E_POINTER;
- }
- IBindCtx * pBCtx = NULL;
- HRESULT hr = CreateBindCtx(0, (LPBC*)&pBCtx );
- if (!pBCtx || FAILED(hr))
- {
- return E_UNEXPECTED;
- }
- IBaseFilter * pBf = NULL;
- hr = pMon->BindToObject(pBCtx, NULL, __uuidof(IBaseFilter), (void**)&pBf);
- pBCtx->Release();
- if (FAILED(hr) || !pBf)
- {
- return E_UNEXPECTED;
- }
- // Get filter's CLSID
- IPersist * pPersist = NULL;
- hr = pBf->QueryInterface( __uuidof(IPersist), (void**)&pPersist);
- pBf->Release();
- if (SUCCEEDED(hr))
- {
- CLSID clsid = GUID_NULL;
- pPersist->GetClassID(&clsid);
- pPersist->Release();
- if (CSupported::IsGUIDSupported(clsid))
- {
- return S_OK;
- }
- }
- return E_FAIL;
- }
- //----------------------------------------------------------------------------
- // CreatedFilter
- //
- //----------------------------------------------------------------------------
- STDMETHODIMP CGraphBuilderCB::CreatedFilter(IBaseFilter *pBf)
- {
- return S_OK;
- }