| |
DirectShow
http://en.wikipedia.org/wiki/DirectShow
DirectShow
DirectShow (sometimes abbreviated as DS or DShow), codename Quartz, is a multimedia framework and API produced by Microsoft for software developers to perform various operations with media files or streams. It is the replacement for Microsoft's earlier Video for Windows technology. Based on the Microsoft Windows Component Object Model (COM) framework, DirectShow provides a common interface for media across many programming languages, and is an extensible, filter-based framework that can render or record media files on demand at the behest of the user or developer. The DirectShow development tools and documentation were originally distributed as part of the DirectX SDK, however, they are currently distributed as part of the Windows SDK (formerly known as the Platform SDK).
DirectShow's counterparts include Apple's QuickTime framework and gstreamer. Microsoft plans to replace DirectShow with Media Foundation in future Windows versions beginning with Windows Vista.
History
The Quartz team started with an existing project called Clockwork. Clockwork was a modular media processing framework in which semi-independent components worked together to process digital media streams, and had previously been used in several projects, including the Microsoft Interactive Television (MITV) project and another project named Tiger.
ActiveMovie was announced in March 1996, and released in May 1996, bundled with the beta version of Internet Explorer 3.0. In March 1997, Microsoft announced that ActiveMovie would become part of the DirectX 5 suite of technologies, and around July started referring to it as DirectShow, reflecting Microsoft's efforts at the time to consolidate technologies that worked directly with hardware under a common naming scheme. DirectShow became a standard component of all Windows operating systems starting with Windows 98. In DirectX version 8.0, DirectShow became part of the mainline distribution of the DirectX SDK and was placed alongside other DirectX APIs.
In October 2004, DirectShow was removed from the main DirectX distribution and relocated to the DirectX Extras download. In April of 2005, DirectShow was removed entirely from DirectX and moved to the Windows Server 2003 SP1 version of the Microsoft Platform SDK. The DirectX SDK was, however, still required to build some of the DirectShow samples.
Architecture
DirectShow divides a complex multimedia task (e.g. video playback) into a sequence of fundamental processing steps known as filters. [13] [14] Each filter — which represents one stage in the processing of the data — has input and/or output pins that may be used to connect the filter to other filters. The generic nature of this connection mechanism enables filters to be connected in various ways so as to implement different complex functions. [15] To implement a specific complex task, a developer must first build a filter graph by creating instances of the required filters, and then connecting the filters together.
GraphEdit is the GUI that can be used to visually build and test filter graphs. [17] During the rendering process, the filter graph searches the Windows Registry for registered filters and builds its graph of filters based on the locations provided. After this, it connects the filters together, and, at the developer's request, executes (i.e., plays, pauses, etc.) the created graph. DirectShow filter graphs are widely used in video playback (in which the filters implement functions such as file parsing, video and audio demultiplexing, decompressing and rendering) as well as for video and audio recording and editing. Interactive tasks such as DVD navigation may also be controlled by DirectShow.
In the above example, from left to right, the graph contains a source filter to read an MP3 file, stream splitter and decoder filters to parse and decode the audio, and a rendering filter to play the raw audio samples. Each filter has one or more pins that can be used to connect that filter to other filters. Every pin functions either as an output or input. Depending on the filter, data is either "pulled" from an input pin or "pushed" to an output pin in order to transfer data between filters.
Most filters are built using a set of C++ classes provided in the DirectShow SDK, called the DirectShow Base Classes. [18] These handle much of the creation, registration and connection logic for the filter. For the filter graph to use filters automatically, they need to be registered in a separate DirectShow registry entry as well as being registered with COM. This registration can be managed by the DirectShow Base Classes. However, if the application adds the filters manually, they do not need to be registered at all.
Unfortunately, it is difficult to modify a graph that is already running. It is usually easier to stop the graph and create a new graph from scratch. Starting with DirectShow 8.0 dynamic graph building, dynamic reconnection, and filter chains were introduced to help alter the graph while it was running. [19] However, many filter vendors ignore this feature, making graph modification problematic after a graph has begun processing.
Features
By default, DirectShow includes a limited number of filters for decoding some common media file formats such as MPEG-1, MP3, Windows Media Audio, Windows Media Video, MIDI, media containers such as AVI, ASF, WAV, some splitters/demultiplexers, multiplexers, source and sink filters and some static image filters.[20] Since the associated patented technologies are licensed in Windows, no license fees are required (e.g., to Fraunhofer, for MP3). Notably, support for popular and standard modern codecs such as MPEG-4 Advanced Simple Profile, AAC, H.264, Vorbis and containers Ogg, MOV, MP4 is absent. Incorporating support for additional codecs such as these involves paying the licensing fees to the involved codec technology developer or patent holder.
However, DirectShow's standard format repertoire can be easily expanded by means of a variety of commercial and open source filters. Such filters enable DirectShow to support virtually any container format and any audio or video codec. For example, filters have been developed for Ogg Vorbis[21], Musepack [22] and AC3 [23]. Finally, there are "bridge" filters that simultaneously support multiple formats, as well as functions like stream multiplexing, by exposing the functionality of underlying multimedia APIs such as VLC. [24]
The amount of work required to implement a filter graph depends on several factors. In the simplest case, DirectShow can create a filter graph automatically from a source such as a file or URL. [25] If this is not possible, the developer may be able to manually create a filter graph from a source file, possibly with the addition of a custom filter, and then let DirectShow complete the filter graph by connecting the filters together. At the next level, the developer must build the filter graph from scratch by manually adding and connecting each desired filter. Finally, in cases where an essential filter is unavailable, the developer must create a custom filter before a filter graph can be built.
Unlike the main C API of QuickTime where it is necessary to call MoviesTask in a loop to load a media file, DirectShow handles all of this in a transparent way. It creates several background threads that smoothly play the requested file or URL without much work required from the programmer. Also in contrast to QuickTime, nothing special is required for loading a URL instead of a local file on disk – DirectShow's filter graph abstracts these details from the programmer, although recent developments in QuickTime (including an ActiveX control) have lessened this.
Complexity
Commanding DirectShow to play a file is a relatively simple task. However, while programming more advanced customizations, such as commanding DirectShow to display certain windows messages from the video window or creating custom filters, many developers complain of difficulties. [34] [35] [36] It is often regarded as one of Microsoft's most complex development libraries/APIs.
Developers rarely create DirectShow filters from scratch, rather, they employ DirectShow Base Classes. The Base Classes can often simplify development, allowing the programmer to bypass certain tasks. However, the process may remain relatively complex; the code found in the Base Classes is nearly half the size of the entire MFC library. As a result, even with the Base Classes, the number of COM objects that DirectShow contains overwhelms many developers. In some cases, DirectShow's API deviates from traditional COM rules, particularly with regard to the parameters used for methods. To overcome their difficulties with DirectShow's unique COM rules, developers often turn to a higher level API that uses DirectShow, notably, Windows Media Player SDK. This API provides the developer with an ActiveX Control that has fewer COM interfaces to deal with.
Although DirectShow is capable of dynamically building a graph to render a given media type [19], it may become difficult for developers to rely on this functionality and they may need to resort to manually building filter graphs if the resulting filter graph is variable.[citation needed] It is possible for filter graphs to change over time as new filters are install on the computer.
| | |