Index Topic Contents | |||
Previous Topic: Inftee Sample (Infinite-Pin Tee Filter) Next Topic: Cutlist Sample Applications |
Renderer Filters
This article describes sample renderer filters. The filters render video output, audio output, text output, and raw file output.
Contents of this article:
- Dump Sample (Dump Filter)
- SampVid Sample (Video Renderer Filter)
- Scope Sample (Oscilloscope Filter)
- TextOut Sample (Text Display Filter)
Dump Sample (Dump Filter)
The sample file dump filter, Dump, illustrates the use of the base filter class CBaseFilter and the rendered input pin class CRenderedInputPin. This sample also uses the IFileSinkFilter interface. The Dump filter demonstrates how to override the Receive method of the rendered input pin class to process actual media samples. The filter is also a "renderer" of its input stream. (That is, this filter doesn't fit the traditional definition of rendering audibly or visibly, although it is a "renderer filter.") The Dump filter delivers the EC_COMPLETE notification to the filter graph when it receives a call to CDumpInputPin::EndOfStream on its input pin.
This filter is a useful debugging tool. For example, you can verify, bit by bit, the results of a transform filter. You can build a graph manually by using the Filter Graph Editor, and connect the Dump filter to the output of a transform filter or any other output pin. You can also connect a tee filter and put the Dump filter on one leg of the tee filter and the typical output on another leg to monitor the results in a real-time scenario.
The Dump filter has a single input pin, which is dumped to a file. The filter prompts the user for a file name when it is instantiated and closes the file when it is freed.
This filter is installed with the DirectShow run time and is available through the Filter Graph Editor when you choose Insert Filters from the Graph menu, and select the DirectShow Filters category.
SampVid Sample (Video Renderer Filter)
The sample video renderer filter, SampVid, displays video inside a window. SampVid demonstrates the implementation of a special memory allocator, the CImageAllocator class, which uses buffers based on the Microsoft Win32® DIBSECTION structure. This sample shows use of the CBaseVideoRenderer class, which handles all the seeking, synchronization and quality management necessary for video renderers. Other base classes used include, among others:
- CBaseControlVideo
- CBaseControlWindow
- CDrawImage
- CImageAllocator
- CImageDisplay
- CImagePalette
- CMediaType
This sample also shows the use of the property page interface IQualProp, which addresses quality management.
This filter is installed with the DirectShow run time and is available through the Filter Graph Editor when you choose Insert Filters from the Graph menu, and select the DirectShow Filters category.
Scope Sample (Oscilloscope Filter)
The oscilloscope sample filter, Scope, illustrates the use of the base filter class CBaseFilter and the base input pin class CBaseInputPin.
Other than the video renderer sample, Scope is the only sample filter that has a constantly active window.
Note The Scope window is implemented as a dialog box, not as an actual window.
Developers creating control panels to alter filter parameters in real time might want to use a technique like this rather than property pages.
The Scope filter demonstrates setting up a separate thread to process data. In this case, the data is just copied to a separate buffer on the IMemInputPin::Receive method, and is then drawn on the Scope window on the separate thread.
The filter demonstrates how to apply DirectShow outside the rather narrow domain of multimedia playback. DirectShow has wide application in the diverse areas of:
- Process control
- Factory automation
- Image processing and analysis
- Virtual lab instrumentation
All of these areas have semi real-time requirements, but additionally emphasize user interaction and the display of gauges, monitors, signal generators, alarms, and other forms of graphical display of analyzed results.
The Scope filter also enables you to monitor audio output to determine if you are clipping, so you can adjust the gain.
This filter is installed with the DirectShow run time and is available through the Filter Graph Editor when you choose Insert Filters from the Graph menu, and select the DirectShow Filters category.
TextOut Sample (Text Display Filter)
The sample text renderer filter, TextOut, serves as an example of a renderer filter that is for a user-defined type. It can render text data found in an AVI file or other source. The TextOut filter demonstrates the use of the CBaseRenderer class, which handles all the synchronization and seeking although it doesn't have any quality management implementation. To get quality management, derive your classes from CBaseVideoRenderer instead. This sample also uses the CBaseWindow class.
This renderer creates and uses a simple window to display each piece of text it receives.
This filter is installed with the DirectShow run time and is available through the Filter Graph Editor when you choose Insert Filters from the Graph menu, and select the DirectShow Filters category.
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.