delaying video capture preview

M

Marcin

hello,

Anyone has an idea how can I delay the preview from my camera about 4
minutes? I want to delay capturing stream and then show it on screen.

I used Stream Buffer Engine but I can't lock the profile (LockProfile
function gives me an application error.

Help me please.

This is a piece of code.

All HRESULTs are ok but I cut it to clear the situation.

[cut]

hr = GetInterfaces();
// Attach the filter graph to the capture graph
hr = g_pCapture->SetFiltergraph(g_pGraph);

hr = FindCaptureDevice(&pSrcFilter);

// Add Capture filter to our graph.
hr = g_pGraph->AddFilter(pSrcFilter, L"Video Capture");

// Create the StreamBufferConfig object.
CComPtr<IStreamBufferConfigure> pConfig;
hr = pConfig.CoCreateInstance(CLSID_StreamBufferConfig);

// Create a new registry key to hold our settings.
HKEY hkey = 0;
long lRes = RegCreateKey(HKEY_LOCAL_MACHINE,
TEXT("SOFTWARE\\MyStreamBufferKey"), &hkey);

// Set the registry key.
CComPtr<IStreamBufferInitialize> pInit;
hr = pConfig.QueryInterface(&pInit);
hr = pInit->SetHKEY(hkey);
pInit.Release();

// Set the backing file directory.
hr = pConfig->SetDirectory(L"f:\\backing");



// Add the Stream Buffer Sink filter to the graph.
CComPtr<IStreamBufferSink> pSink;
hr = pSink.CoCreateInstance(CLSID_StreamBufferSink);

hr = pSink.QueryInterface(&pInit);
hr = pInit->SetHKEY(hkey);

pInit.Release();

CComQIPtr<IBaseFilter> pSinkFilter(pSink);
hr = g_pGraph->AddFilter(pSinkFilter, L"SBESink");

// Render the stream
hr = g_pCapture->RenderStream( &PIN_CATEGORY_CAPTURE,
&MEDIATYPE_Video,
pSrcFilter,
NULL, // Compressor filter
pSinkFilter);


hr = pSinkFilter->QueryInterface(IID_IStreamBufferSink,(LPVOID *)
&g_pSBSink);

hr = g_pSBSink->LockProfile(NULL);

[/cut]

the last function in this piece of code is the problem.
I don't know what I do wrong.

thx for help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top