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

📄 csdn_文档中心_在中visual studio _net 2003利用directshow播放媒体文件(一).htm

📁 csdn10年中间经典帖子
💻 HTM
📖 第 1 页 / 共 4 页
字号:
            2003利用DirectShow播放媒体文件(一)</B>&nbsp;&nbsp;&nbsp;&nbsp;sunjin007(原作) 
          </TD></TR>
        <TR>
          <TD align=middle height=5></TD>
          <TD align=middle width=500></TD></TR>
        <TR>
          <TD align=middle bgColor=#003399><FONT color=#ffffff>关键字</FONT></TD>
          <TD width=500>&nbsp;&nbsp;&nbsp;&nbsp;DirectShow DirectX .NET 
        2003</TD></TR>
        <TR>
          <TD align=middle height=5></TD>
          <TD align=middle width=500></TD></TR></TBODY></TABLE><!--文章说明信息结束//-->
      <TABLE border=0 width=600>
        <TBODY>
        <TR>
          <TD align=left><BR>
            <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B 
            style="mso-bidi-font-weight: normal"><SPAN 
            lang=EN-US><?xml:namespace prefix = o ns = 
            "urn:schemas-microsoft-com:office:office" /><o:p><FONT 
            size=3>&nbsp;</P>
            <P class=MsoNormal 
            style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN 
            lang=EN-US><FONT 
            face="Times New Roman">DirectShow</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是微软公司提供的一套在</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Windows</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">平台上进行流媒体处理的开发包,与</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">DirectX</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">开发包一起发布。</SPAN><SPAN 
            lang=EN-US><FONT 
            face="Times New Roman">DirectShow</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为多媒体的捕捉和回放提供了强有力的支持。运用</SPAN><SPAN 
            lang=EN-US><FONT 
            face="Times New Roman">DirectShow</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我们可以很方便地从支持</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">WDM</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">驱动模型的采集卡上捕获数据,并且进行相应的后期处理乃至存储到文件中。它广泛地支持各种媒体格式,包括</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Asf</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Mpeg</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Avi</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Dv</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Mp3</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Wave</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等等,使得多媒体数据的回放变得轻而易举。另外,</SPAN><SPAN 
            lang=EN-US><FONT 
            face="Times New Roman">DirectShow</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">还集成了</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">DirectX</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其它部分(比如</SPAN><SPAN 
            lang=EN-US><FONT 
            face="Times New Roman">DirectDraw</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN 
            lang=EN-US><FONT 
            face="Times New Roman">DirectSound</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">)的技术,直接支持</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">DVD</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">播放,视频的非线性编辑,以及与数据摄像机的交换换。更值得一提的是,</SPAN><SPAN 
            lang=EN-US><FONT 
            face="Times New Roman">DirectShow</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">提供的是一种开放式的开发环境,我们可以根据自己的需要定制自己的组件。(引)</SPAN></P>
            <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN 
            lang=EN-US><o:p><FONT 
            face="Times New Roman">&nbsp;</FONT></o:p></SPAN></P>
            <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">入门</SPAN><SPAN 
            lang=EN-US><o:p></o:p></SPAN></P>
            <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN><FONT 
            face="Times New Roman"><SPAN 
            style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            </SPAN>DirectShow</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用一种叫做</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Filter 
            Graph</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的模型来管理整个数据流的处理过程,参与数据流处理的各个功能模块称做</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Filter</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,各个</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Filter</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Filter 
            Graph</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中按一定的顺序连成一条流水线协调工作,完成一些相对独立的功能,如</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Filter</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可以完成如下的一些功能:</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l1 level1 lfo1; tab-stops: list 42.0pt"><SPAN 
            lang=EN-US 
            style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN 
            style="mso-list: Ignore">l<SPAN 
            style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            </SPAN></SPAN></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">读文件</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l1 level1 lfo1; tab-stops: list 42.0pt"><SPAN 
            lang=EN-US 
            style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN 
            style="mso-list: Ignore">l<SPAN 
            style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            </SPAN></SPAN></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">从视频设备中获取视频</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l1 level1 lfo1; tab-stops: list 42.0pt"><SPAN 
            lang=EN-US 
            style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN 
            style="mso-list: Ignore">l<SPAN 
            style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            </SPAN></SPAN></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对视频流进行解码</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN: 0cm 0cm 0pt 42pt; TEXT-INDENT: -21pt; mso-list: l1 level1 lfo1; tab-stops: list 42.0pt"><SPAN 
            lang=EN-US 
            style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings"><SPAN 
            style="mso-list: Ignore">l<SPAN 
            style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
            </SPAN></SPAN></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将数据送往声卡或显卡</SPAN></P>
            <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt"><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">每个</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Filter</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">都有输入端和输出端,例如一个</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">MPEG-1</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">解码</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Filter</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">它的输入是</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">MPEG</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">编码的流数据,它的输出端是一解码过的流数据。</SPAN><SPAN 
            lang=EN-US><FONT 
            face="Times New Roman">DirectShow</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">正是通过将不同的</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Filter</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">连接在一起完成特定的功能的,我们将这些</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Filter</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的连接叫做</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Filter 
            Graph</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,如下图</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">A</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">给出是播放</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">AVI</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Filter 
            Graph</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">:</SPAN></P>
            <P align=center class=MsoNormal 
            style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-ALIGN: center"><SPAN 
            lang=EN-US><?xml:namespace prefix = v ns = 
            "urn:schemas-microsoft-com:vml" /><v:shapetype id=_x0000_t75 
            stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" 
            o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke 
            joinstyle="miter"></v:stroke><v:formulas><v:f 
            eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f 
            eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f 
            eqn="prod @2 1 2"></v:f><v:f 
            eqn="prod @3 21600 pixelWidth"></v:f><v:f 
            eqn="prod @3 21600 pixelHeight"></v:f><v:f 
            eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f 
            eqn="prod @7 21600 pixelWidth"></v:f><v:f 
            eqn="sum @8 21600 0"></v:f><v:f 
            eqn="prod @7 21600 pixelHeight"></v:f><v:f 
            eqn="sum @10 21600 0"></v:f></v:formulas><v:path 
            o:connecttype="rect" gradientshapeok="t" 
            o:extrusionok="f"></v:path><o:lock aspectratio="t" 
            v:ext="edit"></o:lock></v:shapetype><v:shape id=_x0000_i1025 
            style="HEIGHT: 84.75pt; WIDTH: 346.5pt" type="#_x0000_t75" 
            filled="t" fillcolor="silver" o:ole=""><IMG 
            src="CSDN_文档中心_在中Visual Studio _NET 2003利用DirectShow播放媒体文件(一).files/CSDN_Dev_Image_2004-4-102019480.emz" 
            o:title=""></v:shape></SPAN></P>
            <P align=center class=MsoNormal 
            style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-ALIGN: center"><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">图</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">A</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"> 播放</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">AVI</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件的</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Graph 
            Filter</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">图</SPAN></P>
            <P class=MsoNormal 
            style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">上图中每个模块分别代表了不同的</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Filter</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,媒体文件</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">Filter</FONT></SPAN><SPAN 
            style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">从硬盘读取</SPAN><SPAN 
            lang=EN-US><FONT face="Times New Roman">AVI</FONT></SPAN><SPAN 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -