DirectShow, as you might have guessed, is a COM based multimedia framework that makes the task of capturing, playing back, and manipulating media streams easier(DirectShow是一个基于组件对象模块(COM)的多媒体框架,可以让捕捉、播放以及操作媒体流变的更容易). It was formerly known as ActiveMovie, until it became known as DirectShow. DirectShow might internally use DirectSound and DirectDraw when playing a media, provided there is support from the hardware; otherwise, it might use the traditional Wave APIs and GDI APIs(DirectShow在硬件支持的情况下,可能内部会使用DirectSound以及DirectDraw来播放媒体。否则的话,它就可能会使用传统的Wave  APIs和GDI APIs).
 
Filters: Technically, Filters are just C++ classes complying(遵从) with the COM interface, which take input in some form, process the data, and produce some output in the same/or different form(Filters是遵循COM接口的C++类,以一些方式获取输入,处理数据,并且以同样/或不同的方式产生输出). A Filter represents each stage in the processing of a media type.
 
Pins: A Pin is an interface in itself, and every Filter must implement at least one Pin(Pin自身是一个接口,并且每个Filter必须实现至少一个Pin). Pins are a way for Filters to talk to other Filters(Pins是Filters之间互相联系的一种方式). Typically, a Filter might have an input pin and an output pin(典型地,一个Filter可能有一个输入pin和一个输出pin). During the processing of the media, a Filter takes input through its input pin, processes the data, and passes the output to another filter through its output pin(在处理媒体时,Filter从输入pin获取输入,处理数据,并且通过输出pin将输出传递给另一个Filter). The other filter, as is obvious, receives the processed data through its input pin. So, basically, the output pin of one filter is connected with the input pin of another filter, and that is how they talk(所以,本质上,一个Filter的输出pin是与另一个Filter的输入pin相连接的,这就是它们之间互相联系的方式).
 
Filter Graph and Filter Graph Manager: A Filter Graph is a sequence of connected filters(Filter Graph是一系列相连接的Filters). The processing of any type of media involves a Filter Graph with a specific set of filters most suitable for that media type(处理任何类型的媒体都涉及到一个Filter Graph,它由一组特定的最适合该媒体类型的Filters组成). The Filter Graph Manager is the divine power that lets you create these Filter Graphs, add Filters to a Filter Graph, connect the Pins of the appropriate Filters, and finally, run the graph which accomplishes our objective, which is, if you remember, playing the media(Filter Graph Manager允许你创建Filter Graphs,添加Filters到Filter Graph,将合适的Filters的Pins相连接,并且最终运行Graph来播放媒体).
 
Source Filter takes the input from a file or a URL or a capture device, and processes the data in a form which can be consumed by other filters(Source Filter从一个文件或URL或捕获设备中获取输入,并且处理生成可供其他Filters使用的数据). A characteristic of a source filter is that it has no input pins and only one output pin(Source Filter的一个特性是它没有输入pins,只有一个输出pin). Note: Pins are a secret between filters only. A Renderer Filter takes the input from the previous filter, and renders it to a sound device or a display device or a file, in case of capture(Renderer Filter从先前的Filter获取输入,并且将数据以捕获的方式渲染到一个音频设备,或一个显示设备,或一个文件). Remember, this might use DirectSound or DirectDraw internally. A characteristic of a renderer filter is that it has one input pin and no output pins(Render Filter的一个特性是它由一个输入pin,却没有输出pins). Everything in between a source filter and a renderer filter is called a Transform Filter. A transform filter might have one or more input pins and one or more output pins.
 
Any application that wants to use DirectShow must follow these steps:
1. Create the Filter Graph Manager
2. Create the Filter Graph using the Filter Graph Manager
3. Run the Filter Graph (to play the media)
4. Release the resources
 
There are three ways in which you can create a filter graph: Automatic Graph Creation, Manual Graph Creation, and Semi-Automatic Graph Creation.
Automatic Graph Creation: This is the easiest of all methods, but doesn't give your application much flexibility in choosing filters. Here, you just call the RenderFile method on the IGraphBuilder interface, passing in the filename or any other source(你只需要调用IGraphBuilder接口的RenderFile函数,传入文件名或任何其他源). The graph manager will take all the pains(麻烦的事) to create an appropriate graph for you. The graph builder has its own algorithm to select various filters and then connect their pins to complete the graph(Graph Builder有它自己的算法来选择不同的Filters,并且把它们的pins连接起来以完成Graph). For example, if you pass the filename "love.mp3", the graph builder will identify the file format and then choose the appropriate filters to build a graph suitable for MP3 media.
Manual Graph Creation: This method is the most painful, but provides you with super flexibility in choosing the filters. I won't go into the details of this, but in the most abstract terms, first, you have to create the instances of the individual filters that you need(首先,你必须创建你所需要的独立的Filter实例). Then, you add each of these filters to the graph(接着,你将这些Filters添加到Graph中). At this point, the filters just lie in the graph like beans on a table(此时,这些Filters就像散落在桌子上的豆). The next step is to connect the pins of these filters(接着要做的就是将这些Filters的pins连接起来); this is again painful as it involves enumerating the pins of the filters and selecting the output pin of one and the input pin of another and then connecting the two together(这又是一件麻烦事儿,因为需要枚举Filters的pins,然后选定一个Filter的输出pin以及另一个Filter的输入pin,并将它们连接起来). Once you have connected all the pins, the graph is complete and ready to be run, assuming you haven't messed up the pins.
Semi-Automatic Graph Creation: This method provides you the flexibility while also trying to reduce the amount of pain. Here, you just choose a few priority filters (that you most surely want present in the graph) and then add them to the graph(你只需要选择一些主要的Filters(那些你肯定想要它们出现在Graph中的),然后把它们添加到Graph中). These filters lie in the graph just like beans on a table. Then, you ask the graph manager to complete the graph(你请求Graph Manager来完成Graph). The graph manager will add the missing pieces (filters) and build a graph for you(Graph Manager会添加缺漏的Filters,并且为你构建Graph). One thing to note here is that the graph manager will try its ever best to include your priority filters in the final graph, so this way, you have the control to override some of the default filters which the graph manager would have otherwise chosen(要注意的是Graph Manager会尽最大可能在最终的Graph中包含你选择的重要的Filters,这样的话,你就能够有权替换一些Graph Manager本来会选用的默认的Filters).

DirectShow学习笔记的更多相关文章

  1. DirectShow学习笔记总结

    DirectShow是微软公司在ActiveMovie和Video for Windows的基础上推出的新一代基于COM(Component Object Model)的流媒体处理的开发包,9.0之前 ...

  2. 我的Android进阶之旅------>Android中编解码学习笔记

    编解码学习笔记(一):基本概念 媒体业务是网络的主要业务之间.尤其移动互联网业务的兴起,在运营商和应用开发商中,媒体业务份量极重,其中媒体的编解码服务涉及需求分析.应用开发.释放license收费等等 ...

  3. js学习笔记:webpack基础入门(一)

    之前听说过webpack,今天想正式的接触一下,先跟着webpack的官方用户指南走: 在这里有: 如何安装webpack 如何使用webpack 如何使用loader 如何使用webpack的开发者 ...

  4. PHP-自定义模板-学习笔记

    1.  开始 这几天,看了李炎恢老师的<PHP第二季度视频>中的“章节7:创建TPL自定义模板”,做一个学习笔记,通过绘制架构图.UML类图和思维导图,来对加深理解. 2.  整体架构图 ...

  5. PHP-会员登录与注册例子解析-学习笔记

    1.开始 最近开始学习李炎恢老师的<PHP第二季度视频>中的“章节5:使用OOP注册会员”,做一个学习笔记,通过绘制基本页面流程和UML类图,来对加深理解. 2.基本页面流程 3.通过UM ...

  6. 2014年暑假c#学习笔记目录

    2014年暑假c#学习笔记 一.C#编程基础 1. c#编程基础之枚举 2. c#编程基础之函数可变参数 3. c#编程基础之字符串基础 4. c#编程基础之字符串函数 5.c#编程基础之ref.ou ...

  7. JAVA GUI编程学习笔记目录

    2014年暑假JAVA GUI编程学习笔记目录 1.JAVA之GUI编程概述 2.JAVA之GUI编程布局 3.JAVA之GUI编程Frame窗口 4.JAVA之GUI编程事件监听机制 5.JAVA之 ...

  8. seaJs学习笔记2 – seaJs组建库的使用

    原文地址:seaJs学习笔记2 – seaJs组建库的使用 我觉得学习新东西并不是会使用它就够了的,会使用仅仅代表你看懂了,理解了,二不代表你深入了,彻悟了它的精髓. 所以不断的学习将是源源不断. 最 ...

  9. CSS学习笔记

    CSS学习笔记 2016年12月15日整理 CSS基础 Chapter1 在console输入escape("宋体") ENTER 就会出现unicode编码 显示"%u ...

随机推荐

  1. 第二十章 数据访问(In .net4.5) 之 使用LINQ

    1. 概述 .net3.5中新添加给C#的LINQ查询,提供了直观便捷的数据查询方式.并且支持多种数据源的查询. 本章介绍标准的LINQ操作,如何用最优的方式使用LINQ 以及 LINQ to XML ...

  2. Server Tomcat v7.0 Server at localhost failed to start解决办法

    今晚搞了下tomcat,在调试的时候发现报了这样一个错误Server Tomcat v7.0 Server at localhost failed to start 首先,确认了端口号8080是不是被 ...

  3. 3.css中的颜色

    css中颜色的设置形式主要有三种方式:颜色名称.十六进制代码和十进制代码. 在古老的 HTML4 时,颜色名称只有 16 种. 颜色名称 十六进制代码 十进制代码 含义  black  #000000 ...

  4. Python学习教程(learning Python)--2.2.2 Python全局和局部变量

    Python的变量也有全局和局部变量之分. 1. 局部变量 用在子函数里的变量称之为局部变量,其生命周期为该函数执行周期,即函数执行完后变量即不存在.由于局部变量和某个函数直接相关,故不同子函数里可以 ...

  5. Python学习教程(learning Python)--2 Python简单函数设计

    本节讨论Python程序设计时为何引入函数? 为何大家都反对用一堆堆的单个函数语句完成一项程序的设计任务呢? 用一条条的语句去完成某项程序设计时,冗长.不宜理解,不宜复用,而采用按功能模块划分成函数, ...

  6. Windows上搭建android开发环境

    在搭建android开发环境时需要四部分内容,框架如下 其中Java SDK和Eclipse在java4android中有过介绍,重点介绍ADT和Android SDK的安装. 安装Android S ...

  7. zip解压缩

    package com.green.project.compress; import java.io.File;import java.io.FileInputStream;import java.i ...

  8. MongoDB牛刀小试

    MongoDB基本操作 1.MongoDB的启动 首先创建一个目录作为MongoDB的工作目录: 进入MongoDB的bin目录: 执行mongod命令,使用参数--dbpath指定MongoDB的工 ...

  9. base64和图片的互转(HTML5的File实现)

    <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="C ...

  10. How to write a windows service

    how to write a windows services susport microsoft This aritcle describe the detail step to setup a w ...