|Microsoft DirectX 9.0|
This article answers many frequently asked questions about Microsoft® DirectShow®. It contains the following sections:
What operating systems does DirectShow support?
DirectShow supports Microsoft® Windows® 9x, Microsoft® Windows® 2000, Microsoft® Windows® Me, and Microsoft® Windows® XP.
How much COM knowledge do I need to program with DirectShow?
For application development, you need to understand the basics of working with COM objects: how to instantiate them, access the interfaces they expose, and manage reference counts on those interfaces. Filter development requires more COM knowledge.
What formats does DirectShow support?
See Supported Formats in DirectShow.
Is there a DirectShow Hardware Compatibility List (HCL)?
No. DirectShow uses Microsoft® DirectDraw® and Microsoft® DirectSound® hardware capabilities if they are available. When no special hardware is available, DirectShow uses GDI to draw video and the waveOut* multimedia APIs to play audio.
What languages can I use to write a DirectShow application?
DirectShow is designed primarily for C++ development. (You can also use C.) With Microsoft® Visual Basic®, you can access a only a small subset of the DirectShow API. DirectShow supports script-based DVD applications, using Microsoft® JScript® or Visual Basic Scripting Edition. It is also possible to write DirectShow applications using Borland Delphi; however, the SDK documentation does not address this topic.
For more information, see the following topics:
What compiler do I need for DirectShow development?
Any compiler capable of generating Component Object Model (COM) objects should work once the compiler's environment has been configured correctly.
How does DirectShow relate to Microsoft® Windows Media™?
See Windows Media Applications.
How does DirectShow relate to the other components in Microsoft® DirectX®?
Internally, DirectShow uses DirectSound and DirectDraw when the hardware supports it. The Video Renderer and Overlay Mixer filters use DirectDraw 3 and DirectDraw 5 surfaces. The Video Mixing Renderer 7 (Windows XP only) uses DirectDraw 7 surfaces. The Video Mixing Renderer 9 uses the latest Microsoft® Direct3D® APIs. You do not need to use the other DirectX APIs to write a DirectShow application, although it is possible to combine them. For an example, see the Texture3D Sample.
How does DirectShow relate to Microsoft® ActiveMovie®?
ActiveMovie was the original name for DirectShow. The term ActiveMovie is no longer used but some API names still retain the initials "AM", for example AM_MEDIA_TYPE and IAMVideoAccelerator.
Is DirectShow limited to multimedia applications?
The default components included with DirectShow are primarily designed for streaming audio and video data. However, the DirectShow architecture has been successfully used for many kinds of data-streaming solutions.
Is the source code to the GraphEdit utility available? Can GraphEdit be redistributed?
No, the source is not available, and Graphedt.exe is not redistributable.
Do DMOs replace DirectShow filters?
Microsoft® DirectX® Media Objects (DMOs) can be used in a DirectShow application. For encoders, decoders, and effects, you are encouraged to write a DMO instead of a DirectShow filter. For other purposes, a DirectShow filter might be more appropriate. For more information about DMOs, see the "DirectX Media Objects" node in the DirectX SDK documentation.
Where can I get more information about DirectShow?
The primary function of this list is to provide a forum where Developers and content creators using Microsoft's audio and streaming video technologies (DirectSound, DirectMusic, DirectShow) can exchange information and ideas. The list caters to all levels of DirectX expertise, from novice to advanced developer.
While it is expected that various members of the Microsoft DirectX development team will review and possibly comment on list topics, DirectXAV is not intended as a Microsoft support forum and there is no guarantee that Microsoft personnel will respond directly to inquiries. Often, your best source of help will be other members of the DirectXAV community who have faced similar issues themselves in the past.
Topics that are appropriate to this list include: compositional techniques using DirectMusic Producer; audio, music or streaming video programming techniques; sound design techniques; general issues or information about the relevant APIs; code snippets; suggestions; hints and tips; device driver quality; future feature requests; real-life experiences using the APIs, and so on.
To subscribe to DirectX DEV, send an e-mail to LISTSERV@discuss.microsoft.com with a message body of subscribe directxdev. To subscribe to DirectX A/V, send an e-mail to LISTSERV@discuss.microsoft.com with a message body of subscribe directxav.
I'm facing a difficult problem in developing my application/filter. Where can I get developer support?
You should contact DirectX SDK support for specific developer support issues:
Is there a book that explains DirectShow?
Currently, there is only one book devoted entirely to DirectShow:
DirectShow is discussed briefly in some existing DirectX books, including:
The July 2002 issue of MSDN Magazine contains a good introductory article about DirectShow and describes how to write a simply video effects filter.
I have some ideas on how Microsoft could improve DirectShow.
Microsoft welcomes suggestions, questions, and comments. Let us know what you think. What are we missing? What areas would you most like to see improved? What types of tutorials and samples would you most like to see? Your input will help us to prioritize future work. If you have questions or suggestions pertaining to the new DirectShow documentation, please send a message to email@example.com.
I'm playing an AVI format file with Windows Media Player. I can hear the audio, but there doesn't seem to be any videoinstead, I just see black. What's wrong?
Probably the file was encoded with a codec that is not present on your system. Although the AVI file format is common, AVI files can be created with many different codecs (coder/decoder). If you try to play an AVI file that uses an unsupported codec, you might hear the audio component, but the video will display as a black screen or the screen contents will remain unchanged.
Note The Windows Media Player often attempts to download and install a codec if it is not present on your system.
How do I know what codec a media file is using?
Do the following:
How do I build my application? What libraries and header files do I need?
See Setting Up the Build Environment.
GraphEdit displays a lot of filters that aren't documented. What are these filters?
GraphEdit enumerates all of the filters that are registered on your system in a filter category. This might include filters installed by third-party applications, or installed by other Microsoft technologies, such as Windows Media or NetMeeting. Also, some DirectShow filters act as wrappers for codecs or hardware devices, with each codec or device appearing as a distinct filter. The Microsoft H.263 Video Codec is used by NetMeeting and is no longer supported in DirectShow. For more information, see Enumerating Devices and Filters.
I'm having trouble building my custom graph programmatically.
First try building the filter graph with GraphEdit. This tool enables you to simulate lots of possibilities quickly. GraphEdit is always a great place to test out the graph before attempting to build it with source code.
For more information about graph building, see the following articles:
How can I detect whether DirectShow is installed on a given machine?
Call CoCreateInstance to create an instance of the Filter Graph Manager. If this call succeeds, DirectShow is installed on the machine. The following code shows how to do this:
IGraphBuilder *pGraph; HRESULT hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **) &pGraph);
How do I change a filter's settings without displaying the property page?
Most filters expose one or more interfaces for setting properties on the filter. Consult the reference page for the filter in question. (See DirectShow Filters.)
Why can't I use the ASF Writer and ASF Reader filters?
Prior to DirectX 9.0, it was necessary to provide a unique software certificate in order to use these filters in an application. Also, they were not available in GraphEdit. The unique certificate was a requirement of version 7.0 of the Windows Media™ Format SDK. In DirectX 9.0 both filters are based on version 7.1 of that SDK which does not require a unique certificate for reading or writing unprotected content. Therefore, for unprotected content both filters are now available to applications and in GraphEdit. If you are creating or reading files that have been protected with Digital Rights Management a unique certificate is still required.
When Windows Media™ Format 9 Series SDK is released, it will contain versions of these filters that supersede the version found in the DirectShow SDK.
Can DirectShow notify an application of its current playback position on a regular basis?
There is no callback notification of position. Use a timer and retrieve the current position by calling the IMediaSeeking::GetCurrentPosition method.
I wrote a filter. How do I install it?
See How to Register DirectShow Filters.
Can I test my filter with GraphEdit?
While you are developing a filter, GraphEdit can help you to visualize the connections between filters. It can also provide a quick test of a filter's functionality. However, it is not meant as a robust test platform.
How can I determine the number of pins on a filter?
See Enumerating Objects in a Filter Graph.
At what privilege ring do filters run?
Filters run at ring 3, although some filters control streaming devices that run at ring 0. For more information, see How Hardware Devices Participate in the Filter Graph.
Do I Need To Use A Kernel Debugger?
That depends on your specific project. Installing the DirectX debug runtime libraries means that you are installing debug drivers and other kernel mode components, and that if your application causes a debug assert in one of these components, your machine will automatically reboot unless you have a kernel debugger attached to your process.
How does the DEFINE_GUID macro work?
The DEFINE_GUID macro solves the problem of declaring
extern references to GUID values in your source code. For example, suppose that your project has three source files, Src1.cpp, Src2.cpp, and Src3.cpp, and all three files use a certain GUID value that you have defined. The GUID value must be defined exactly once in your project, and the other source files must declare
extern references to it. With the DEFINE_GUID macro, you can use the same header file for both purposes. In your header file, declare the GUID as follows:
DEFINE_GUID(CLSID_MyObject, 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
(Where this example has zeroes, put the actual GUID values.) You can use the Guidgen utility to create a new GUID and paste it into the header file in the DEFINE_GUID format. Include this header file in any source files that references the GUID. In exactly one of the source files, include the header file Initguid.h before your header file. For example:
// Src1.cpp #include <initguid.h> #include "MyGuids.h" // Src2.cpp #include "MyGuids.h" // Src3.cpp #include "MyGuids.h"
Wherever the Initguid.h header file is not included, the DEFINE_GUID macro creates an
extern reference to the GUID value. When the Initguid.h header file is included, it redefines the DEFINE_GUID macro so that DEFINE_GUID creates a defining declaration of the GUID.
If you do not include Initguid.h in any of the source files, you will get a link error "unresolved external symbol." If you include Initguid.h twice for the same GUID, you will get a compile error "redefinition; multiple initialization." To resolve these errors, make sure that Initguid.h is included exactly once. Also, do not include Initguid.h inside a precompiled header file, because the precompiled header in effect gets included in every source file.