#include "StdAfx.h"
#include "process.h"
process::process(void)
{
}
process::~process(void)
{
}
HRESULT process::InitCaptureGraphBuilder(IGraphBuilder **ppGraph,ICaptureGraphBuilder2 **ppBuilder)
{
if (!ppGraph||!ppBuilder)
{
return E_POINTER;
}
IGraphBuilder *pGraph=NULL;
ICaptureGraphBuilder2 *pBuilder=NULL;
HRESULT hr=CoCreateInstance(CLSID_CaptureGraphBuilder2,NULL,CLSCTX_INPROC_SERVER,IID_ICaptureGraphBuilder2,(void**)&pBuilder);
if (SUCCEEDED(hr))
{
hr=CoCreateInstance(CLSID_FilterGraph,0,CLSCTX_INPROC_SERVER,IID_IGraphBuilder,(void**)&pGraph);
if (SUCCEEDED(hr))
{
pBuilder->SetFiltergraph(pGraph);
*ppBuilder=pBuilder;
*ppGraph=pGraph;
return S_OK;
}
else
{
pGraph->Release();
}
}
return hr;
}
#include "process.h"
process::process(void)
{
}
process::~process(void)
{
}
HRESULT process::InitCaptureGraphBuilder(IGraphBuilder **ppGraph,ICaptureGraphBuilder2 **ppBuilder)
{
if (!ppGraph||!ppBuilder)
{
return E_POINTER;
}
IGraphBuilder *pGraph=NULL;
ICaptureGraphBuilder2 *pBuilder=NULL;
HRESULT hr=CoCreateInstance(CLSID_CaptureGraphBuilder2,NULL,CLSCTX_INPROC_SERVER,IID_ICaptureGraphBuilder2,(void**)&pBuilder);
if (SUCCEEDED(hr))
{
hr=CoCreateInstance(CLSID_FilterGraph,0,CLSCTX_INPROC_SERVER,IID_IGraphBuilder,(void**)&pGraph);
if (SUCCEEDED(hr))
{
pBuilder->SetFiltergraph(pGraph);
*ppBuilder=pBuilder;
*ppGraph=pGraph;
return S_OK;
}
else
{
pGraph->Release();
}
}
return hr;
}