Shows how to create a custom media source in Microsoft Media Foundation. The sample implements a media source that parses .wav audio files.
This sample is a relatively simple example of a media source:
- There is only one stream, so there is no code to implement stream selection.
- The media source does not implement rate control (that is, fast forward or reverse playback).
- All source and stream methods are implemented as synchronous methods.
- Because the data portion of a .wav file is a single block of uncompressed PCM audio, the media source does not need to read packet headers or otherwise parse the stream during playback, other than reading the initial WAVEFORMAT header.
For a more advanced example of a media source, see the MPEG1Source Sample.
This sample demonstrates the following Media Foundation interfaces:
The WavSource sample builds a DLL that is a COM server for both the media source and media source's byte-stream handler. Before using the media source, you must register the DLL.
To use the media source, you can run the BasicPlayback. The source resolver will automatically load the media source if you select a .wav file for playback. (If an error occurs, make sure that you successfully registered the WavSource DLL.)
You can also use the TopoEdit tool to build a playback topology that contains the media source. For more information about TopoEdit, see TopoEdit.
|Windows SDK||Windows Vista|
|Microsoft Windows||Windows Vista|
This sample is available in the following locations.
|Windows SDK||SDK Root\Samples\multimedia\mediafoundation\wavsource|
|MSDN Code Gallery||Download from MSDN Code Gallery|
- Media Foundation SDK Samples
- Media Sources
- MPEG1Source Sample
- Scheme Handlers and Byte-Stream Handlers
- Writing a Custom Media Source