Thanks but I would like to something done in VC+ +, here is a part of my project:
The problem in this code, and when I try to connect the pin of the mux to sink, an error occurs!!
// initialize COM library
hr = CoInitialize(NULL);
if(FAILED(hr))
{
return hr;
}
// Create the filter graph
hr = CoCreateInstance (CLSID_FilterGraph, NULL, CLSCTX_INPROC,
IID_IGraphBuilder, (void **) &g_pGraph);
if (FAILED(hr))
return hr;
// Create the capture graph builder
hr = CoCreateInstance (CLSID_CaptureGraphBuilder2 , NULL, CLSCTX_INPROC,
IID_ICaptureGraphBuilder2, (void **) &g_pCapture);
if (FAILED(hr))
return hr;
// Obtain interfaces for media control and Video Window
hr = g_pGraph->QueryInterface(IID_IMediaControl,(LPVOID *) &g_pMC);
if (FAILED(hr))
return hr;
hr = g_pGraph->QueryInterface(IID_IVideoWindow, (LPVOID *) &g_pVW);
if (FAILED(hr))
return hr;
hr = g_pGraph->QueryInterface(IID_IMediaEvent, (LPVOID *) &g_pME);
if (FAILED(hr))
return hr;
//hr = CoCreateInstance(CLSID_LMNetMux, 0, CLSCTX_INPROC_SERVER,
//IID_ILMNetMux,(void**)&Mux);
//pMux =Mux;
//pLNDp = pMux;
//g_pGraph->QueryInterface(IID_ILMNetMux, (void**) &Mux);
// hr = g_pGraph->AddFilter(pLNDp, L"LMNetMux");
//___________________________________
hr = CoCreateInstance(CLSID_LMNetSnk, 0, CLSCTX_INPROC_SERVER,
IID_ILMNetSnk,(void**)&Sink);
if (FAILED(hr))
return hr;
pLNSk =Sink;
hr = g_pGraph->AddFilter(pLNSk, L"LMNetSnk");
//=============Conects==============
HRESULT Conectamux()
{
HRESULT hr;
// Conectar LMNetMux
IPin * pOut = GetOutPin( pSrcFilter, 0 );// ponteiro Video Capture
IPin * pIn = GetInPin( iLmn, 0 );// ponteiro LMNetMux
hr = g_pGraph->Connect( pOut, pIn);// conecta, os pinos
return hr;
}
HRESULT ConectaSink()
{
HRESULT hr;
// Conectar LMNetSnk
IPin *pOut = GetOutPin(iLmn, 0 );// ponteiro LMNetMux
IPin * pIn = GetInPin( pLNSk, 0 );// ponteiro LMNetSnk
hr = g_pGraph->Connect( pOut, pIn);// conecta, os pinos
return hr;
}