Directshow预览并保存到avi文件 [英] Directshow preview and save to avi file

查看:200
本文介绍了Directshow预览并保存到avi文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我下面的代码不起作用?它可以很好地编译,但是当我执行它时会给出错误无法运行图0x80070005"

Why my code below does not work? It compiles fine, but when I execute it gives error "Could''nt run the graph 0x80070005"

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;
    }

推荐答案

0x80070005 ACCESS_DENIED

当然,它不像example.avi那样简单.avi是RO吗?
0x80070005 is ACCESS_DENIED

Sure it''s just not something as simple as example.avi is RO?


这篇关于Directshow预览并保存到avi文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆