Introduction
DirectShow is the media streaming architecture of Windows, in which a graph of
filters reads, decodes, transforms and renders a stream. A filter is a COM component,
and Microsoft’s documents describe how to implement a component as a
DLL, a PE
file. The documents consulted do not name the .ax extension; that
files of this kind carry it is taken from the extension list of the explorer, not
from a Microsoft page. DirectShow is a legacy feature, which Microsoft says has been superseded by
MediaPlayer, IMFMediaEngine and the capture functions of Media
Foundation, so most such files date from before them.
A file dropped on any page opens in the explorer, with its structure, resources and code, like any PE file.
What is particular: a COM server for filters
A DirectShow DLL must implement five functions so that it can be registered, unregistered and loaded. The first is its entry point; the other four are exports:
| Function | What it does |
|---|---|
DllMain | The entry point. DllMain is a placeholder name; the DirectShow implementation uses the name DllEntryPoint. It is the one function not exported. |
DllGetClassObject | Creates a class factory instance. Implemented by DirectShow. |
DllCanUnloadNow | Queries whether the DLL can safely be unloaded. Also implemented by DirectShow. |
DllRegisterServer | Creates the registry entries. The author must implement it; DirectShow provides AMovieDllRegisterServer2, which does the work, and it can be wrapped with the argument true. |
DllUnregisterServer | Removes them; likewise a wrap of AMovieDllRegisterServer2 with false. |
Microsoft’s example module-definition file exports all functions except the entry
point, and marks the four exports PRIVATE. If the DLL contains a
filter, Microsoft says some additional registration work might be needed
(the page “How to Register DirectShow Filters”, not covered here). The DLL can be
registered with the Regsvr32.exe utility.
The shared structure, the export directory and the entry point are described on the DLL and Exports pages. The same four exports are on the .ocx page, where the DLL is a control.
Not described
Known, not yet covered
- Reference: the filter registration data (pins and media types) and the filter categories.
Unknown
- Extension: no Microsoft page consulted names the
.axextension.
Links
Software
Reference
- DLL Functions – the functions a DirectShow DLL implements, and registration with Regsvr32.exe
- Building DirectShow Filters – the definition file and entry point of a filter DLL, and the legacy notice
- PE Format – Microsoft’s specification of PE32 and PE32+