Microsoft DirectX 8.1 (C++) |
The Microsoft® DirectShow® base classes provide several macros for displaying debugging information.
Requirements
Header: Declared in Wxdebug.h; include Streams.h.
Library: Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).
Function | Description |
DbgCheckModuleLevel | Checks whether logging is enabled for the given message types and level. |
DbgDumpObjectRegister | Displays information about active objects. |
DbgInitialise | Initializes the debug library. |
DbgLog | Sends a string to the debug output location, if logging is enabled for the specified type and level. |
DbgOutString | Sends a string to the debug output location. |
DbgSetModuleLevel | Sets the logging level for one or more message types. |
DbgTerminate | Cleans up the debug library. |
DisplayType | Sends information about a media type to the debug output location. |
DumpGraph | Sends information about a filter graph to the debug output location. |
NAME | Generates a debug-only string. |
NOTE | Sends a string to the debug output location. |
REMIND | Generates a reminder at compile time. |
Remarks
The debugging facilities in DirectShow can be fine-tuned to display specific types of debug information, while ignoring others. With this feature, you can pinpoint problems in particular areas of your code. DirectShow defines several message types, shown in the following table.
Value | Description |
LOG_ERROR | Error notification. |
LOG_LOCKING | Locking and unlocking of critical sections. |
LOG_MEMORY | Memory allocation, and object creation and destruction. |
LOG_TIMING | Timing and performance measurements. |
LOG_TRACE | General call tracing. |
Every module can set its own debugging level for each message type. (A module is a DLL or executable that can be loaded using the Microsoft® Win32® LoadLibrary function.) A module's logging level for a given message type appears in the registry under the following key:
\HKEY_LOCAL_MACHINE\SOFTWARE\Debug\<Module Name>\<Message Type>
<Message Type> is the message type minus the initial "LOG_"; for example, LOCKING for LOG_LOCKING messages.
When a module is loaded, the debug library looks up the module's logging levels in the registry. If the registry keys do not exist, the debug library creates them. Global logging levels for a message type can be specified in the following key:
\HKEY_LOCAL_MACHINE\SOFTWARE\Debug\GLOBAL\<Message Type>
The debug library uses whichever level is greater. A module can also set its own levels at run time, using the DbgSetModuleLevel function. To send a message to the debug output, call the DbgLog macro. The following example creates a level 3 message of type LOG_TRACE:
DbgLog((LOG_TRACE, 3, TEXT("This is a debug message.")));
In debug builds, if the current logging level for LOG_TRACE messages is 3 or higher, the message is sent to the debug output. Otherwise, it is ignored. Debug builds must define the preprocessor symbol DEBUG before including the base-class header file, Streams.h.
The debug output location is determined by another registry key:
\HKEY_LOCAL_MACHINE\SOFTWARE\Debug\<Module Name>\LogToFile
If the value is Console, the output goes to the console window. If the value is Deb, Debug, Debugger, or an empty string, the output goes to the debugger window. Otherwise, the output is written to a file specified by the registry key.
Before an executable uses the DirectShow debug library, it must call the DbgInitialise function. Afterward, it must call the DbgTerminate function. DLLs do not need to call these functions.