Everyone knows that Microsoft defines a type of media file, called ASF (Advanced Systems Format). The ASF is actually a file "container", which does not specify the compression format of the audio and video; in the ASF file, we can include compressed (including MPEG-4), or non-compressed data. In addition, Microsoft provides Windows Media Format SDK (hereinafter referred to as WMFS) other than the DirectX development environment, which is dedicated to supporting customer development ASF-related applications. So can we develop ASF applications in DirectShow?
The answer is yes. Because ASF is Microsoft's own media format, it will of course get special care. Microsoft provides a range of Filter. It's just that these Filter's version is more complicated, let's first finish it.
Earlinated from Windows Media Player (Microsoft Media Player, hereinafter referred to as WMP) 6.4, Microsoft used a Filter called Windows Media Source to support the playback of the ASF file. This source filter defaults to .asf, .wmv, .wma extension file association (ie, Filter Graph Manager automatically uses Windows Media Source Filter when calling IGRAPHBUILDER :: Renderfile or IgraphBuilder :: ADDSourceFilter to play the above-described extension). . Below is a typical Filter graph of the ASF file using Windows Media Source Filter:
Starting from DirectShow 8.0, Microsoft provides two other filters: WM ASF Reader and WM ASF Writer. And with the DirectShow version update, the version of these two Filter is constantly updated. (DirectShow 8.1 uses WMFS 7.0, DirectShow 9.0 uses WMFS 7.1.) However, despite this, in order to keep backward compatibility, Microsoft is also a Windows Media Source Filter as playing .asf, .wmv The default source filter of .wma file. The WM ASF Reader truly replaced Windows Media Source Filter completely replaced Windows Media Source Filter. Below is a Filter Graph, which is typical to play an ASF file, using WM ASF Reader.
Ren a clear version of the version, write a general ASF file application, there should be no problem. For additional special ASF files, such as DRM (Digital Rights Management) protected by DRM (Digital Rights Management), we also need to provide some special processing. (For more technical details, please refer to the PlayWndasf example in the SDK, here will not be described again.) Here we have to see how we want the ASF file.
The above has been mentioned that ASF is a file "container". The .asf extension is the "collectory" of this format file, and if we generate the Window Media file contains only audio, we generally use the .WMA extension, if only the video, or contain audio and video, we generally use .wmv extension name. With WM ASF Writer, there is an important concept to configure. By configuring, we can set the WM ASF Writer with several input Pins, generate the bit rate, compression quality, and so on. When WM ASF WRITER is created, a system default configuration is used. If this configuration does not meet our specific application, we can change the configuration via the iConfigasfwriter interface on the Filter. One thing to note is that before configuring the WM ASF Writer, we must first put it into the filter graph, but must wait until the configuration is completed, and all the input Pin of WM ASF Writer before running Filter Graph. Requires the connection, and the input data requirements on each INPUT PIN are all kinds of timestamps. There is also an important concept to remind, WMFS regulations, the ASF file must be played as a baseline. So, General WM ASF Writer always requires an audio INPUT PIN, even if this PIN is just entering some mute, low-code streams. Here are three common WM ASF Writer applications for reference: Tip: Building the above FILTER GRAPH, generally have two practical methods. One is one, one, add each filter, configure the WM ASF Writer (if the system default configuration does not meet the specific application), then complete the connection of the entire Filter link; another method is to use IgraphBuilder :: Render first build a source The play link of the file, then remove the Renderer Filter from the Filter Graph, add the WM ASF Writer, and complete the final connection after the necessary configuration.
In short, Microsoft's WM ASF Reader and WM ASF WRITER provide "natural" support for ASF in DirectShow. We can easily develop ASF applications in a DirectShow environment.