您的位置:首页 > 移动开发

DirectShow帮助文档学习总结

2008-09-01 16:30 375 查看
DirectShow帮助文档学习总结<?XML:NAMESPACE PREFIX = O />

      
       Interface、Class、Filter三者是相互关联的。Interface向应用程序提供Filter的入口,Class则实现了Interface的暴露函数,从而实现了Filter的功能。也可以说Interface和Class构成了Filter。在DirectShow提供的Interface、Class和Filter就是相互关联的。
       DirectShow的Interface很多来自DirectShow Objects,特别是那些常用的Interface。至于其他的Interface来自哪里还不清楚,谁知道请告诉我。
       DirectShow Objects提供了8个Objects,其中最重要的两个是Capture Graph Builder和Filter Graph Manager。Filter Graph Manager提供了很多常用的Interface。

 

DirectShow中提供的Interface大都继承自IUnknown,如ICaptureGraphBuilder2、IEnumFilters、IEnumMediaTypes、IEnumPins、IFilterChain、IFilterGraph、IGraphConfig、IMediaSeeking、IMediaSample、IMediaSample2、IMemAllocator、IMemInputPin、ISampleGrabber等等。
IGraphBuilder继承自IFilterGraph ,而IFilterGraph2继承自IGraphBuilder

DirectShow中提供的Interface有些继承自IDispatch,如IBasicAudio、IBasicVideo、IMediaControl、IMediaEvent、IMediaPosition等等,
IBasicVideo2继承自IBasicVideoIMediaEventEx继承自IMediaEvent
       DirectShow中提供的Interface继承自IPersist的是IMediaFilter,而IBaseFilter又继承自IMediaFilter
 

下面的内容直接摘自帮助文档,它们是相当重要的。

Filter Graph Manager

       The Filter Graph Manager builds and controls Filter graphs. This object is the central component in DirectShow. Applications use it to build and control Filter graphs. The Filter Graph Manager also handles synchronization, event notification, and other aspects of the controlling the Filter Graph. Create this object by calling CoCreateInstance.
 

DirectShow Filters

DirectShow provides a set of default filters that install automatically with Microsoft® Windows®. These filters support many data formats while providing a high degree of hardware independence. An application can also register and install custom filters on the target system.
The ACM Wrapper, AVI Decompressor and AVI Compressor filters work with the Audio and Video Compression Managers to enable various codecs to be used in a DirectShow Filter Graph.
All the filters supported by the DirectShow Software Development Kit (SDK) are listed here. If a Filter appears in GraphEdit but is not documented in this reference section, it means the Filter has either been installed by a third party or else is used internally by some other Microsoft technology such as Windows Media™ Player or TAPI. Such filters are not supported by the DirectShow SDK.
 

Interfaces

This topic contains reference information for the Microsoft® DirectShow® core interfaces. To provide broad support for various types of hardware, file formats, and stream operations, implements a large number of interfaces. Some are used by applications; others are used internally by filters and other DirectShow components.
 

Filter Categories

The following tables list the CLSIDs for the standard DirectShow Filter categories. To enumerate the filters in a given category, pass the corresponding CLSID to the ICreateDevEnum::CreateClassEnumerator method. These categories also appear in GraphEdit when you choose Insert Filters from the Graph menu.
 

DVD Event Notification Codes

Note   This introductory material applies only to C++ developers.
Microsoft® DirectShow® supports system-defined events, which filters in the Filter Graph pass to the Filter Graph manager. Filters pass these events to the Filter Graph manager by using the IMediaEventSink::Notify method, and the application retrieves them with the IMediaEvent::GetEvent method.
When you retrieve an event by calling GetEvent, the event can contain interface pointers or pointers to allocated memory. Code that uses GetEvent should, therefore, call IMediaEvent::FreeEventParams to free any resources associated with the event's parameters after it handles the event.
The DVD event notification codes are listed in Dvdevcod.h. See Event Notification Codes for non-DVD event notification codes. The following list shows the available DVD event notification codes in alphabetical order.
 

Event Notification Codes

This sections lists the DirectShow events that are not specific to DVD. For events specific to DVD, see DVD Event Notification Codes.
Filters send events to the Filter Graph Manager by calling the IMediaEventSink::Notify method. The Filter Graph Manager handles some events and queues others for the application. The application retrieves them by calling the IMediaEvent::GetEvent method.
In the sections that follow, each entry lists the event code, the meaning of the event parameters, and the Filter Graph Manager's default action for the event, if any. To override the default action, call IMediaEvent::CancelDefaultHandling. Event codes are defined in the header files Evcode.h and Audevcod.h. If there is no default action, the Filter Graph Manager automatically forwards the event to the application (through the event queue).
Custom Events
Filters can define custom events with event codes in the range EC_USER and higher. The Filter Graph Manager will place these directly in the event queue. However, the following caveats apply:
l         The Filter Graph Manager cannot free the event parameters using the normal IMediaEvent::FreeEventParams method. The application must free any memory or reference counts associated with the event parameters.
l         The Filter should only send the event from within an application that is prepared to handle the event. (Possibly the application can set a custom property on the Filter to indicate that it is safe to send the event.)
 

DirectShow Base Classes

The Microsoft® DirectShow® base classes are a set of C++ classes and utility functions designed for implementing DirectShow filters. Several of the helper classes are also useful for application developers.
This section describes the base classes. It contains the following sections:
l         Introduction to the Filter Base Classes
l         Base Class Reference
l         Utility Functions
l         Debugging Utilities 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息