Click here to Skip to main content
15,891,865 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
Why my code below does not work? It compiles fine, but when I execute it gives error "Could'nt run the graph 0x80070005"
C++
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
Updated 21-May-11 7:23am
v3
Comments
Christian Graus 21-May-11 12:12pm    
Tihs is a code snippet - do you have a question ?
Sandeep 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?
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?

1 solution

0x80070005 is ACCESS_DENIED

Sure it's just not something as simple as example.avi is RO?
 
Share this answer
 
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900