Click here to Skip to main content
12,755,986 members (34,383 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C++ Video directshow
Why my code below does not work? It compiles fine, but when I execute it gives error "Could'nt run the graph 0x80070005"
<pre lang="CPP"">
IGraphBuilder * g_pGraph = NULL;
ICaptureGraphBuilder2 * g_pCapture = NULL;

IBaseFilter *pMux = NULL;
IFileSinkFilter *pSink = NULL;

///////////////////////////////////////////////////////////////////////////////////////

// Render the preview pin on the video capture filter
// Use this instead of g_pGraph->RenderFile

hr = g_pCapture->SetOutputFileName(&MEDIASUBTYPE_Avi,L"C:\\Example.avi", &pMux, NULL);
hr = g_pCapture->RenderStream (&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pSrcFilter, NULL, pMux);
if (FAILED(hr))
{
Msg(TEXT("Couldnt render the video capture stream. hr=0x%x\r\n")
TEXT("The capture device may already be in use by another application.\r\n\r\n")
TEXT("The sample will now close"), hr);
pSrcFilter->Release();
return hr;
}

hr = g_pCapture->RenderStream (&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video, pSrcFilter, NULL, NULL);

if (FAILED(hr))
{
Msg(TEXT("Couldnt render the video capture stream. hr=0x%x\r\n")
TEXT("The capture device may already be in use by another application.\r\n\r\n")
TEXT("The sample will now close"), hr);
pSrcFilter->Release();
return hr;
}
Posted 21-May-11 7:10am
Updated 21-May-11 8:23am
v3
Comments
Christian Graus 21-May-11 12:12pm
   
Tihs is a code snippet - do you have a question ?
WhizzMurtuza 21-May-11 12:17pm
   
Ideally as per MSDN it should have inserted smart tee and executed fine. But it does not work. What am I doing wrong?
S Mewara 21-May-11 13:24pm
   
OP said:
Ideally as per MSDN it should have inserted smart tee and executed fine. But it does not work. What am I doing wrong?

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

0x80070005 is ACCESS_DENIED

Sure it's just not something as simple as example.avi is RO?
  Permalink  
Comments
WhizzMurtuza 21-May-11 20:40pm
   
What do you mean by RO?
barneyman 21-May-11 20:42pm
   
read only
WhizzMurtuza 21-May-11 21:57pm
   
Example.avi is an output file if you notice.
barneyman 21-May-11 22:06pm
   
yes - i did notice

You got an access denied error, is there a chance that you either don't have access rights into c:\ or that there is already a c:\example.avi that is marked read only
Ashraf_Rash 11-Apr-12 9:58am
   
Change C:\ to D:\

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 21 May 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100