想让一个程序先正常显示视频头捕捉到的数据,然后随时可以调用一个函数进行流保存到AVI文件!
第一步没有问题,但是第2不再次创建
pBuilder->SetOutputFileName(&MEDIASUBTYPE_Avi, L"C:\\Example.avi", &ppf, &pSink);
hr=pBuilder->RenderStream(
&PIN_CATEGORY_PREVIEW, // Pin category PIN_CATEGORY_CAPTURE
&MEDIATYPE_Video, // Media type
pSrc, // Capture filter
NULL, // Compression filter (optional)
NULL // Multiplexer or renderer filter
); //这里就失败了
不知道为什么,谁能解决啊?
如果能提供类似2个功能的代码,不胜感激!
第一步没有问题,但是第2不再次创建
pBuilder->SetOutputFileName(&MEDIASUBTYPE_Avi, L"C:\\Example.avi", &ppf, &pSink);
hr=pBuilder->RenderStream(
&PIN_CATEGORY_PREVIEW, // Pin category PIN_CATEGORY_CAPTURE
&MEDIATYPE_Video, // Media type
pSrc, // Capture filter
NULL, // Compression filter (optional)
NULL // Multiplexer or renderer filter
); //这里就失败了
不知道为什么,谁能解决啊?
如果能提供类似2个功能的代码,不胜感激!
解决方案 »
- 求一个播放mp3最简单的解决方案,不要太复杂的空间。
- 散分
- 怎么通过发送http请求来登陆动网的论坛
- 请问如何获得程序运行所在路径?
- 问个简单问题,我用INSTALLSHIELD5.5一个老版本,如何在UNINSTALL之前先让它调用我的一个程序?
- 讨论:VC中debug版和release版程序开发时应注意什么问题???
- 请教类的问题
- 分享+散分:自制简单的安装/卸载程序
- 求助:用CArchive将编辑框内容存入和读取至文件出错,但仅当编辑框内容为某些内容时。
- 我用MFC的框架做的ActiveX控件,需要在控件中读出系统当前的时间,怎么实现?
- 急!请问各位高手,怎样改变字符串的显示位置啊?
- 一个工具栏的问题
而在想保存AVI时,我从用了SetOutputFileName(),这个时候是不是一定要把以前的Graph对象销毁重新初始化啊?不懂,请指教
请问我如何才能把第一次初始化的Graph对象销毁掉啊,要不第2次保存AVI的Graph对象初始化就失败,就想你说的只能用一个Graph对象,我的函数如下
void CCaptureVideo::ClearGraphs()
{ // Destroy capture graph
if( m_pGB )
{
// have to wait for the graphs to stop first
//
CComQIPtr< IMediaControl, &IID_IMediaControl > pControl = m_pGB;
if( pControl )
pControl->Stop( ); // make the window go away before we release graph
// or we'll leak memory/resources
//
CComQIPtr< IVideoWindow, &IID_IVideoWindow > pWindow = m_pGB;
if( pWindow )
{
pWindow->put_Visible( OAFALSE );
pWindow->put_Owner( NULL );
}
/*
#ifdef REGISTER_FILTERGRAPH
// Remove filter graph from the running object table
if (g_dwGraphRegister)
RemoveGraphFromRot(g_dwGraphRegister);
#endif
*/
m_pGB->Release( );
m_pGrabber.Release( );
}
}可是好象没有完全销毁掉