哪些工具或代码结构(如定义)是应该在这个领域使用的工具或如何让它们工作?作为媒体基金会的新人,在问我这里的问题之前应该做些什么来避免简单的错误吗?
问题不是"你最喜欢的工具是什么,让我们争论谁是对的"但简单地说,就这个媒体基础框架而言,哪些选项根据您在该领域的专业知识值得考虑调试以及如何使用它们?
在stackoverflow上查看似乎在不知道如何正确调试Media Foundation应用程序的情况下询问了一些问题。在某些情况下,某个特定问题会得到一个答案,表明OP应该使用MFTrace 1,2。我也相信我之前的问题可以通过使用适当的调试工具或特定于媒体基础的跟踪来帮助。
我自己甚至无法让MFTrace或Event Viewer工作,这两种工具都在official media foundation blog中提及。
缺少如何获取MFTrace的文档,它是否仅在.NET 4.0上的旧win 7 SDK中提供,它被称为here?或者可以使用更新的SDK吗?安装旧版win 7 SDK涉及Windows 10上的一些难点(first change regedit values,how to do that,new error -> SO suggest to look at the log and maybe uninstall any existing Visual C++ 2010 redistrubutable。) 很高兴知道这是否是你必须经历的事情,在这种情况下我会,或者如果MFTrace可以在其他地方找到。
我没有从Event Viewer获取任何日志。但也许人们应该完全跳过这个工具并且只使用MFTrace,因为官方博客说了以下内容?
然而,MFTrace比事件查看器更强大,并且收集更多信息。 source
除了工具,还有没有?
#define MF_TRACE_LEVEL 15
在this ms blog post中,他们提到了EventWriteString
和一些TRACE_LEVEL
定义。这是在MFTrace之外有用的东西吗?
答案 0 :(得分:2)
通常我使用以下内容:
正在运行MFTRACE:
MFTrace并不漂亮,但它在被弄清楚之后并不会变得很难。最后引用的MS博客条目帮助很大,文本分析工具也是如此。
我使用这些.bat脚本来运行MFTRACE(记住:使用ADMIN命令提示符!)
<强> MFTRACEPATH.BAT:强>
@echo off
Echo MFTracePath.bat adds MFTrace to path
SET _NT_SYMBOL_PATH=C:\Users\sschi\AppData\Local\Temp\SymbolCache;%QTDIR%\bin
SET PATH=%PATH%;%PROGRAMFILES(x86)%\Windows Kits\10\bin\x86
cd {your Binary Folder}
echo run MFTraceCaller CapstoneDebug next
<强> MFTRACECALLER.BAT 强>
@echo off
SET exFile=MYEXECUTABLEFILENAME
if '%%1' == '' goto start
set exFile=%1
:START
echo Starting MFTRACE using %exFile%, saving output to %exFile%.txt
@echo on
mftrace -es -k all -l 4 -o %exFile%.txt %exFile%.exe %2 %3 %4 %5
@echo off
echo.
echo Trace completed - output is in %exFile.Txt%
echo.
echo Post Processing is available using
echo MFTraceParseTimeStamps.bat
echo MFTraceParseTopologies.bat
echo a) Open %exfile%.txt in TextAnalysisTool
echo b) Load TextAnalysisToolDebugFilters.tat
文本分析工具有助于过滤大量的输出。使用“文件”,“加载过滤器”根据需要加载过滤器您可以打开和关闭各个过滤器,以帮助您了解自己正在做的事情。此外,较高的过滤器会覆盖较低的过滤器,因此,例如,行中的文本“错误”将覆盖其下方的所有内容。此外,打开文件中的任何“OutputDebugString”日志记录,它将出现在跟踪输出中。
下面是我的'厨房水槽'过滤器文件。关闭所有内容,但红色错误跟踪开始。
<强> FILTERS.TAT:强>
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<TextAnalysisTool.NET version="2016-06-16" showOnlyFilteredLines="False">
<filters>
<filter enabled="y" excluding="n" description="" foreColor="ff0000" type="matches_text" case_sensitive="n" regex="n" text="Error" />
<filter enabled="y" excluding="n" description="" foreColor="000000" backColor="ffa500" type="matches_text" case_sensitive="n" regex="n" text="Warning" />
<filter enabled="n" excluding="n" description="" backColor="ffa500" type="matches_text" case_sensitive="n" regex="n" text="Process Frame" />
<filter enabled="y" excluding="n" description="" backColor="90ee90" type="matches_text" case_sensitive="n" regex="n" text="MESessionStart" />
<filter enabled="y" excluding="n" description="" backColor="90ee90" type="matches_text" case_sensitive="n" regex="n" text="MESessionStopped" />
<filter enabled="y" excluding="n" description="" backColor="90ee90" type="matches_text" case_sensitive="n" regex="n" text="MESessionPaused" />
<filter enabled="y" excluding="n" description="" backColor="90ee90" type="matches_text" case_sensitive="n" regex="n" text="UpdatePendingCommands" />
<filter enabled="y" excluding="n" description="" backColor="90ee90" type="matches_text" case_sensitive="n" regex="n" text="SetPositionInternal" />
<filter enabled="n" excluding="n" description="" foreColor="008000" backColor="add8e6" type="matches_text" case_sensitive="n" regex="n" text="Scrub" />
<filter enabled="y" excluding="n" description="" foreColor="008000" backColor="d3d3d3" type="matches_text" case_sensitive="n" regex="n" text="<<<<<< " />
<filter enabled="y" excluding="n" description="" foreColor="008080" backColor="f0e68c" type="matches_text" case_sensitive="n" regex="n" text="RequestSample" />
<filter enabled="y" excluding="n" description="" foreColor="006400" type="matches_text" case_sensitive="n" regex="n" text="MESession" />
<filter enabled="y" excluding="n" description="" foreColor="008000" type="matches_text" case_sensitive="n" regex="n" text="MFStartup" />
<filter enabled="y" excluding="n" description="" foreColor="008000" type="matches_text" case_sensitive="n" regex="n" text="MFShutdown" />
<filter enabled="y" excluding="n" description="" foreColor="800080" type="matches_text" case_sensitive="n" regex="n" text="Grabber" />
<filter enabled="y" excluding="n" description="" foreColor="800080" type="matches_text" case_sensitive="n" regex="n" text="Seek" />
<filter enabled="y" excluding="n" description="" foreColor="d2691e" type="matches_text" case_sensitive="n" regex="n" text="GraphBuilder" />
<filter enabled="y" excluding="n" description="" foreColor="2e8b57" type="matches_text" case_sensitive="n" regex="n" text="MF_TOPOLOGY" />
<filter enabled="y" excluding="n" description="" foreColor="2e8b57" type="matches_text" case_sensitive="n" regex="n" text="MF_TOPONODE" />
<filter enabled="y" excluding="n" description="" foreColor="2e8b57" type="matches_text" case_sensitive="n" regex="n" text="MF_TRANSFORM" />
<filter enabled="y" excluding="n" description="" foreColor="5f9ea0" type="matches_text" case_sensitive="n" regex="n" text="CurrentPosition" />
<filter enabled="y" excluding="n" description="" foreColor="5f9ea0" type="matches_text" case_sensitive="n" regex="n" text="CMFMediaSession" />
<filter enabled="y" excluding="n" description="" foreColor="0000ff" type="matches_text" case_sensitive="n" regex="n" text="OutputDebugString" />
<filter enabled="n" excluding="n" description="" foreColor="b22222" type="matches_text" case_sensitive="n" regex="n" text="MF_SOURCE_READER" />
<filter enabled="n" excluding="n" description="" foreColor="008080" type="matches_text" case_sensitive="n" regex="n" text="CoCreateInstance" />
<filter enabled="y" excluding="n" description="" foreColor="008b8b" type="matches_text" case_sensitive="n" regex="n" text="MeStream" />
<filter enabled="y" excluding="n" description="" foreColor="008b8b" type="matches_text" case_sensitive="n" regex="n" text="MESource" />
<filter enabled="y" excluding="n" description="" foreColor="008b8b" type="matches_text" case_sensitive="n" regex="n" text="MFT_MESSAGE" />
<filter enabled="y" excluding="n" description="" foreColor="008080" type="matches_text" case_sensitive="n" regex="n" text="MF_MT_SUBTYPE" />
<filter enabled="y" excluding="n" description="" foreColor="008b8b" type="matches_text" case_sensitive="n" regex="n" text="Sample" />
<filter enabled="y" excluding="n" description="" foreColor="008b8b" type="matches_text" case_sensitive="n" regex="n" text="ProcessInput" />
<filter enabled="y" excluding="n" description="" foreColor="008b8b" type="matches_text" case_sensitive="n" regex="n" text="ProcessOutput" />
<filter enabled="y" excluding="n" description="" foreColor="008000" type="matches_text" case_sensitive="n" regex="n" text="OnClock" />
<filter enabled="y" excluding="n" description="" foreColor="b22222" type="matches_text" case_sensitive="n" regex="n" text="Met=" />
</filters>
</TextAnalysisTool.NET>
其他参考资料