Microsoft DirectX 9.0

Async Filter Sample

Description

The Async Filter sample is a file reader filter that supports progressive download. This sample filter implements the IAsyncReader and IFileSourceFilter interfaces. It supports MPEG files, but not AVI files.

Path

Source: (SDK root)\Samples\C++\DirectShow\Filters\Async

User's Guide

This sample includes a small command-line application, Memfile.exe, that demonstrates the filter. The command-line arguments specify a media file and a bit rate, in kilobytes per second. The application reads the file into memory at the specified rate and plays the file. To do so, it creates an instance of the filter, adds the filter to the filter graph, and renders the filter's output pin.

At the command line, type:

Memfile Filename BitRate 

The Async sample filter does not support AVI files, because it cannot connect to the AVI Splitter filter. The Async filter's output pin proposes MEDIATYPE_Stream and MEDIASUBTYPE_NULL for the media type. The input pin on the AVI Splitter filter does not accept MEDIASUBTYPE_NULL, and does not propose any types of its own. Therefore, the pin connection fails. The Async filter could be enhanced to offer MEDIASUBTYPE_Avi when appropriate. For example, it could examine the file format, or use the file extension.