⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_43160.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:43160 发表者:周俊 发表日期:2003-06-08 22:24:01
<br>主题:奇怪得问题:(
<br>内容:最近开始接触DirectShow 写了一个入门级得视频捕捉程序。<BR>预览和捕捉AVI都没问题了,就是捕捉ASF不对,没有文件输出,也没有图像预览。<BR>这是什么原因造成得?<BR><BR>hr = pBuild-&gt;SetOutputFileName(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&amp;MEDIASUBTYPE_Avi,&nbsp;&nbsp;// 这里改成MEDIASUBTYPE_Asf就不行了!!!!!Specifies AVI for the target file.<BR>&nbsp;&nbsp;&nbsp;&nbsp;L"C:\\Example.avi", // File name.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&amp;pASFWriter,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Receives a pointer to the mux.<BR>&nbsp;&nbsp;&nbsp;&nbsp;NULL);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// (Optional) Receives a pointer to the file sink.<BR><BR> hr = pBuild-&gt;RenderStream(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&amp;PIN_CATEGORY_CAPTURE, // Pin category.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&amp;MEDIATYPE_Video,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Media type.<BR>&nbsp;&nbsp;&nbsp;&nbsp;pCap,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Capture filter.<BR>&nbsp;&nbsp;&nbsp;&nbsp;NULL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Intermediate filter (optional).<BR>&nbsp;&nbsp;&nbsp;&nbsp;pASFWriter);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Mux or file sink filter.<BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:Creator 回复日期:2003-06-09 08:15:52
<br>内容:Use the IConfigAsfWriter interface on the WM ASF Writer to set the Windows Media profile. <BR><BR><BR>You must do this before you connect any pins on the WM ASF Writer.<BR><BR>IConfigAsfWriter *pConfig = 0;<BR>hr = pASFWriter-&gt;QueryInterface(IID_IConfigAsfWriter, (void**)&amp;pConfig);<BR>if (SUCCEEDED(hr))<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp; // Configure the ASF Writer filter.<BR>&nbsp;&nbsp;&nbsp;&nbsp;pConfig-&gt;Release();<BR>}<BR><BR><BR>Each input pin on the WM ASF Writer filter corresponds to a stream in the Windows Media profile. You must connect every pin, so that the file content matches the profile.<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>
回复者:周俊 回复日期:2003-06-09 08:28:36
<br>内容:hr = pBuild-&gt;SetOutputFileName(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&amp;MEDIASUBTYPE_Avi,&nbsp;&nbsp;// Specifies AVI for the target file.<BR>&nbsp;&nbsp;&nbsp;&nbsp;L"C:\\Example.avi", // File name.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&amp;pASFWriter,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Receives a pointer to the mux.<BR>&nbsp;&nbsp;&nbsp;&nbsp;NULL);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// (Optional) Receives a pointer to the file sink.<BR><BR>IConfigAsfWriter *pConfig = 0;<BR>hr = pASFWriter-&gt;QueryInterface(IID_IConfigAsfWriter, (void**)&amp;pConfig);<BR>if (SUCCEEDED(hr))<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp; // Configure the ASF Writer filter.<BR>&nbsp;&nbsp;&nbsp;&nbsp;pConfig-&gt;ConfigureFilterUsingProfileGuid(WMProfile_V40_288VideoAudio);<BR>&nbsp;&nbsp; pConfig-&gt;Release();<BR>}<BR><BR><BR><BR>我就是这样写的,还是不对 :(<BR>是不是还必须要写声音流进去才对??<BR><BR> hr = pBuild-&gt;RenderStream(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&amp;PIN_CATEGORY_CAPTURE, // Pin category.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&amp;MEDIATYPE_Video,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Media type.<BR>&nbsp;&nbsp;&nbsp;&nbsp;pCap,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Capture filter.<BR>&nbsp;&nbsp;&nbsp;&nbsp;NULL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Intermediate filter (optional).<BR>&nbsp;&nbsp;&nbsp;&nbsp;pASFWriter);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Mux or file sink filter.<BR><BR><BR>hr = pGraph-&gt;QueryInterface(IID_IMediaControl, (void **)&amp;pControl);<BR>hr = pGraph-&gt;QueryInterface(IID_IMediaEvent, (void **)&amp;pEvent);<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>
<font color=red>答案被接受</font><br>回复者:Creator 回复日期:2003-06-09 17:11:29
<br>内容:你可以自己先用GraphEdit来调试,看看加与不加有什么不同!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:周俊 回复日期:2003-06-09 20:39:21
<br>内容:原来真得是这个原因。<BR>The DirectShow SDK documentation describes in detail how to create capture graphs, but there is one important point to remember when creating capture graphs using the WM ASF Writer: the WM ASF Writer will not run unless all of its pins are connected. If you configure the WM ASF Writer with the default system profile (not recommended), or any profile with audio and video streams, then it will create an input pin for each stream and each of those pins must be connected. If you do not intend to capture audio, for example, then be sure to configure the filter with a video-only profile so that no audio pin is created.<BR><BR>
<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 + -