如何调试 c++ DirectShow过滤器

发布于 2024-09-05 01:19:57 字数 164 浏览 2 评论 0原文

directshow 过滤器有哪些调试工具可用?目前,我有一个项目编译并注册视频源过滤器,然后在 GraphEdit 中设置图形。我在 Visual Studio 2008 中使用 C++。是否可以以任何方式将调试器附加到过滤器,以便设置断点、检查变量等?除此之外,有没有办法将诊断信息记录在我可以实时查看的地方?

What debugging tools are available for directshow filters? Presently, I have a project that compiles and registers a video source filter that I then setup a graph in GraphEdit. I am using c++ in visual studio 2008. Is it possible to get a debugger attached to the filter in any way where I could set break points, inspect variables, etc? Barring that is there a way to log diagnostic information somewhere that I can view in real time?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

太傻旳人生 2024-09-12 01:19:57

连接调试器应该没有问题。将 graphedt.exe 设置为过滤器的 Visual Studio 项目中的调试目标,您应该能够在代码中设置断点。如果您在这方面遇到困难,可能是因为某些解码器中的反调试逻辑 - 您必须避免使用它们。

您还可以通过记录交付及其时间戳和延迟来获取有用的调试信息。我发现做到这一点的最好方法是使用直通滤波器。 www.gdcl.co.uk/mobile(win32 和 win mobile)提供了一个类似的示例监视器过滤器,以源代码和二进制形式提供。

G

There should be no problem with attaching a debugger. Set graphedt.exe as the debug target in your filter's Visual Studio project and you should be able to set breakpoints in your code. If you're having difficulty with this, it might be because of the anti-debugging logic in some decoders — you'll have to avoid using those.

You can also get useful debug information by logging the deliveries and their timestamps and latency. The best way I find to do ths is to use a pass-through filter. There is an example monitor filter like this available in source and binary form from www.gdcl.co.uk/mobile (win32 and win mobile).

G

深海少女心 2024-09-12 01:19:57

在调试版本中,DirectShow 基类已经包含由注册表项控制的灵活日志记录机制。基类本身使用这种机制来记录它们自己的操作。如果需要,应该可以修改基类,以便在诊断版本构建中可以使用日志记录。

一个简单的示例:

DbgLog(( LOG_TIMING, 1, TEXT(__FUNCTION__ " : Frame:%d, Stream Time:%dms, Sample Time:%dms"), 
(int)currentFrame, (int)currentTime, (int)sampleTime ));

如果“TIMING”类别的日志记录级别设置为 >=1,则会生成以调用函数名称为前缀的日志输出。每个类别的日志记录级别在注册表中的以下项下配置。有一个“GLOBAL”子键用于所有过滤器的最低日志记录级别,还有一个子键用于按过滤器文件名进行额外日志记录。

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\Debug
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DirectShow\Debug(x64 Windows 上的 32 位代码)。

编辑每个过滤器的“LogToFile”键以指定日志记录目标。默认为“调试”(调试器输出),但也可以是“控制台”以记录到控制台窗口,或用于记录到的文件名。也可以添加其他类型的日志记录。

控制台选项对于无需调试器的实时监控特别方便。在我的系统上,如果控制台窗口尚未打开,基类将无法打开控制台窗口,因此我在 wxdebug.cpp 中添加了以下调整,以便在请求控制台输出时无条件打开控制台。

   if (!lstrcmpi(szFile, TEXT("Console"))) {
      AllocConsole ();      // modification - always allocate console if using Console output

有关详细信息,请参阅 DirectShow 调试输出函数信息。

In a debug build, the DirectShow base classes already include a flexible logging mechanism controlled by registry keys. The base classes themselves use this mechanism to log their own operation. If required it should be possible to modify the base classes so that logging is available in a diagnostic release build.

A simple example:

DbgLog(( LOG_TIMING, 1, TEXT(__FUNCTION__ " : Frame:%d, Stream Time:%dms, Sample Time:%dms"), 
(int)currentFrame, (int)currentTime, (int)sampleTime ));

This produces log output prefixed by the name of the calling function if the logging level for the 'TIMING' category is set to >=1. Logging levels for each category are configured in the registry under the key below. There is a 'GLOBAL' sub-key for the minimum logging level for all filters and sub-keys for extra logging by filter file name.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DirectShow\Debug
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DirectShow\Debug (32bit code on x64 Windows).

Edit the 'LogToFile' key for each filter to specify a logging destination. This defaults to 'Debug' (debugger output) but can also be 'Console' to log to a console window, or a file name to log to. Other types of logging could be added too.

The console option is particularly convenient for live monitoring without a debugger. On my system the base classes fail to open a console window if not already open so I added the following tweak in wxdebug.cpp to open a console unconditionally if console output is requested.

   if (!lstrcmpi(szFile, TEXT("Console"))) {
      AllocConsole ();      // modification - always allocate console if using Console output

See DirectShow Debug Output Functions for further information.

够钟 2024-09-12 01:19:57

用于分析过滤器之间的数据流的一些工具:

开源图形编辑器 GraphStudioNext 分析器过滤器(和分析器文件编写器)插入到两个感兴趣的过滤器之间时,将向您显示活动的可视日志。您现在需要自己构建它才能获得此功能。

Geraint Davie 的监视器过滤器 会将活动日志文件写入磁盘。

Some tools for analyzing data flow between filters:

Open source graph editor GraphStudioNext analyzer filter (and analyzer file writer) will show you a visual log of activity when inserted between two filters of interest. You'll need to build it yourself to get this feature for now.

Geraint Davie's monitor filter will write a log file of activity to disk.

我早已燃尽 2024-09-12 01:19:57

调试实时应用程序的最佳方法是生成日志文件。如果你想实时查看日志信息,只需创建一个基于客户端服务器套接字的日志记录即可。例如,您的应用程序可以开始侦听端口。外部查看器应用程序(客户端)可以连接到该端口并开始实时接收日志信息。

The best way to debug real time apps is generating log files. If you want to view the log information in real time, just create a client server socket based logging. For example, your app can start listening to a port. An external viewer app (client) could connect to that port and starts receiving the log information in real time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文