📄 subject_63574.htm
字号:
<p>
序号:63574 发表者:hhui 发表日期:2003-12-04 16:48:38
<br>主题:视频捕获和传送
<br>内容:从摄像头抓取视频,然后发送,里面的几个filter怎么生成,怎么连接?哪位高人能否指点一二(有源代码的更好)
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:莉莉 回复日期:2003-12-04 17:42:25
<br>内容:Capture啊,1: Create the filter graph manager and query for interfaces.<BR> hr = CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL, CLSCTX_INPROC_SERVER,<BR> IID_ICaptureGraphBuilder2, (void **)&pCaptureGraph);<BR><BR><BR>2:Use a method of the capture graph builder .To create an output path for the stream<BR> hr = pCaptureGraph->SetOutputFileName(&MEDIASUBTYPE_Asf, <BR> L"C:\\MyWebcam111111.asf", &pASFWriter, &pSink);<BR><BR>3:Now get the filter graph manager<BR><BR> hr = pCaptureGraph->GetFiltergraph(&pGraph);<BR><BR>4:Using QueryInterface on the graph builder<BR><BR> hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);<BR><BR>5:create the video input filter from the webcam,获得capture的设备(摄像头),得到指标,然后使用IFilterGraph::AddFilter把获得的指针加进the graph。<BR> <BR> hr = GetVideoInputFilter(&pVideoInputFilter, L"Logitech");<BR> if (SUCCEEDED(hr)) {<BR> hr = pGraph->AddFilter(pVideoInputFilter, L"Webcam Video Capture");<BR> }<BR> GetVideoInputFilter为自定义的函数,使用System Device Enumerator查找Capture Filter.见 Microsoft DirectX 9.0 中的Selecting a Capture Device。<BR><BR>6:然后使用RenderStream分别把preview和capture 的pin Render出来,........<BR><BR>7:再接着就可以run 这个graph拉,接下来就是等待结束。<BR><BR> if (SUCCEEDED(hr))<BR> {<BR> // Run the graph.<BR> hr = pControl->Run();<BR> if (SUCCEEDED(hr))<BR> { <BR> ....<BR> }<BR><BR> // And let's stop the filter graph<BR> hr = pControl->Stop();<BR> ......<BR> }
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:bird 回复日期:2003-12-05 08:53:17
<br>内容:How to Write a Capture Application!<BR><BR><BR>DirectShow sdk 里有!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -