[PATCH 2/2] include: Add debug utilities for Media Foundation modules

Andrew Eikum aeikum at codeweavers.com
Mon Feb 7 08:49:52 CST 2022


Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
---
 dlls/evr/mixer.c                  |   3 +-
 dlls/mf/copier.c                  |   3 +-
 dlls/winegstreamer/audioconvert.c |   3 +-
 dlls/winegstreamer/mfplat.c       |   3 +-
 dlls/winegstreamer/wma_decoder.c  |   3 +-
 include/wine/mfdebug.h            | 178 ++++++++++++++++++++++++++++++
 6 files changed, 188 insertions(+), 5 deletions(-)
 create mode 100644 include/wine/mfdebug.h

diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c
index 0b957e7b6bd..e8488d6cf1a 100644
--- a/dlls/evr/mixer.c
+++ b/dlls/evr/mixer.c
@@ -32,6 +32,7 @@
 #include "evcode.h"
 
 #include "wine/debug.h"
+#include "wine/mfdebug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(evr);
 
@@ -853,7 +854,7 @@ static HRESULT WINAPI video_mixer_transform_SetInputType(IMFTransform *iface, DW
     unsigned int count;
     GUID *guids;
 
-    TRACE("%p, %lu, %p, %#lx.\n", iface, id, media_type, flags);
+    TRACE("%p, %lu, %p %s, %#lx.\n", iface, id, media_type, wine_dbgstr_mfmediatype(media_type), flags);
 
     EnterCriticalSection(&mixer->cs);
 
diff --git a/dlls/mf/copier.c b/dlls/mf/copier.c
index 4972c9f9c44..857de34cb91 100644
--- a/dlls/mf/copier.c
+++ b/dlls/mf/copier.c
@@ -23,6 +23,7 @@
 #include "mf_private.h"
 
 #include "wine/debug.h"
+#include "wine/mfdebug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
 
@@ -326,7 +327,7 @@ static HRESULT WINAPI sample_copier_transform_SetInputType(IMFTransform *iface,
 {
     struct sample_copier *transform = impl_from_IMFTransform(iface);
 
-    TRACE("%p, %u, %p, %#x.\n", iface, id, type, flags);
+    TRACE("%p, %u, %p %s, %#x.\n", iface, id, type, wine_dbgstr_mfmediatype(type), flags);
 
     return sample_copier_set_media_type(transform, TRUE, id, type, flags);
 }
diff --git a/dlls/winegstreamer/audioconvert.c b/dlls/winegstreamer/audioconvert.c
index d5723cdf58f..0d812af6500 100644
--- a/dlls/winegstreamer/audioconvert.c
+++ b/dlls/winegstreamer/audioconvert.c
@@ -25,6 +25,7 @@
 #include "ksmedia.h"
 
 #include "wine/debug.h"
+#include "wine/mfdebug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
 
@@ -277,7 +278,7 @@ static HRESULT WINAPI audio_converter_SetInputType(IMFTransform *iface, DWORD id
 
     struct audio_converter *converter = impl_audio_converter_from_IMFTransform(iface);
 
-    TRACE("%p, %lu, %p, %#lx.\n", iface, id, type, flags);
+    TRACE("%p, %lu, %p %s, %#lx.\n", iface, id, type, wine_dbgstr_mfmediatype(type), flags);
 
     if (id != 0)
         return MF_E_INVALIDSTREAMNUMBER;
diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c
index a111bbe196d..cf4fbd5b04a 100644
--- a/dlls/winegstreamer/mfplat.c
+++ b/dlls/winegstreamer/mfplat.c
@@ -26,6 +26,7 @@
 #include "mfapi.h"
 
 #include "wine/debug.h"
+#include "wine/mfdebug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
 
@@ -186,7 +187,7 @@ static HRESULT WINAPI video_processor_GetOutputAvailableType(IMFTransform *iface
 
 static HRESULT WINAPI video_processor_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags)
 {
-    FIXME("%p, %lu, %p, %#lx.\n", iface, id, type, flags);
+    FIXME("%p, %lu, %p %s, %#lx.\n", iface, id, type, wine_dbgstr_mfmediatype(type), flags);
 
     return E_NOTIMPL;
 }
diff --git a/dlls/winegstreamer/wma_decoder.c b/dlls/winegstreamer/wma_decoder.c
index 78316059052..aca9c50953d 100644
--- a/dlls/winegstreamer/wma_decoder.c
+++ b/dlls/winegstreamer/wma_decoder.c
@@ -26,6 +26,7 @@
 #include "wmcodecdsp.h"
 
 #include "wine/debug.h"
+#include "wine/mfdebug.h"
 #include "wine/heap.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(wmadec);
@@ -330,7 +331,7 @@ static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFM
     HRESULT hr;
     ULONG i;
 
-    TRACE("iface %p, id %lu, type %p, flags %#lx.\n", iface, id, type, flags);
+    TRACE("iface %p, id %lu, type %p %s, flags %#lx.\n", iface, id, type, wine_dbgstr_mfmediatype(type), flags);
 
     if (FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_MAJOR_TYPE, &major)) ||
         FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_SUBTYPE, &subtype)))
diff --git a/include/wine/mfdebug.h b/include/wine/mfdebug.h
new file mode 100644
index 00000000000..503d89dc9a8
--- /dev/null
+++ b/include/wine/mfdebug.h
@@ -0,0 +1,178 @@
+/*
+ * Copyright 2022 Andrew Eikum for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINE_WINE_MFDEBUG_H
+#define __WINE_WINE_MFDEBUG_H
+
+static const char *wine_dbgstr_mfmediatype_guid( const GUID *guid )
+{
+#define X(x) if (IsEqualGUID( guid, &x )) return #x;
+    X(MFMediaType_Audio)
+    X(MFMediaType_Video)
+
+    X(MFVideoFormat_Base)
+    X(MFVideoFormat_RGB8)
+    X(MFVideoFormat_RGB555)
+    X(MFVideoFormat_RGB565)
+    X(MFVideoFormat_RGB24)
+    X(MFVideoFormat_RGB32)
+    X(MFVideoFormat_ARGB32)
+    X(MFVideoFormat_A2R10G10B10)
+    X(MFVideoFormat_A16B16G16R16F)
+    X(MFVideoFormat_L8)
+    X(MFVideoFormat_L16)
+    X(MFVideoFormat_D16)
+
+    X(MFVideoFormat_420O)
+    X(MFVideoFormat_DVSL)
+    X(MFVideoFormat_DVSD)
+    X(MFVideoFormat_DVHD)
+    X(MFVideoFormat_DV25)
+    X(MFVideoFormat_DV50)
+    X(MFVideoFormat_DVH1)
+    X(MFVideoFormat_DVC)
+    X(MFVideoFormat_v210)
+    X(MFVideoFormat_v216)
+    X(MFVideoFormat_v410)
+    X(MFVideoFormat_AI44)
+    X(MFVideoFormat_AV1)
+    X(MFVideoFormat_AYUV)
+    X(MFVideoFormat_H263)
+    X(MFVideoFormat_H264)
+    X(MFVideoFormat_H265)
+    X(MFVideoFormat_HEVC)
+    X(MFVideoFormat_HEVC_ES)
+    X(MFVideoFormat_I420)
+    X(MFVideoFormat_IYUV)
+    X(MFVideoFormat_M4S2)
+    X(MFVideoFormat_MJPG)
+    X(MFVideoFormat_MP43)
+    X(MFVideoFormat_MP4S)
+    X(MFVideoFormat_MP4V)
+    X(MFVideoFormat_MPG1)
+    X(MFVideoFormat_MSS1)
+    X(MFVideoFormat_MSS2)
+    X(MFVideoFormat_NV11)
+    X(MFVideoFormat_NV12)
+    X(MFVideoFormat_ORAW)
+    X(MFVideoFormat_P010)
+    X(MFVideoFormat_P016)
+    X(MFVideoFormat_P210)
+    X(MFVideoFormat_P216)
+    X(MFVideoFormat_UYVY)
+    X(MFVideoFormat_VP10)
+    X(MFVideoFormat_VP80)
+    X(MFVideoFormat_VP90)
+    X(MFVideoFormat_Y210)
+    X(MFVideoFormat_Y216)
+    X(MFVideoFormat_Y410)
+    X(MFVideoFormat_Y416)
+    X(MFVideoFormat_Y41P)
+    X(MFVideoFormat_Y41T)
+    X(MFVideoFormat_Y42T)
+    X(MFVideoFormat_YUY2)
+    X(MFVideoFormat_YV12)
+    X(MFVideoFormat_YVYU)
+    X(MFVideoFormat_YVU9)
+    X(MFVideoFormat_WMV1)
+    X(MFVideoFormat_WMV2)
+    X(MFVideoFormat_WMV3)
+    X(MFVideoFormat_WVC1)
+
+    X(MFVideoFormat_Base_HDCP)
+    X(MFVideoFormat_H264_ES)
+    X(MFVideoFormat_H264_HDCP)
+    X(MFVideoFormat_HEVC_HDCP)
+    X(MFVideoFormat_MPEG2)
+
+    X(MFAudioFormat_Base)
+    X(MFAudioFormat_AAC)
+    X(MFAudioFormat_ADTS)
+    X(MFAudioFormat_ALAC)
+    X(MFAudioFormat_AMR_NB)
+    X(MFAudioFormat_AMR_WB)
+    X(MFAudioFormat_AMR_WP)
+    X(MFAudioFormat_Dolby_AC3_SPDIF)
+    X(MFAudioFormat_DRM)
+    X(MFAudioFormat_DTS)
+    X(MFAudioFormat_Float)
+    X(MFAudioFormat_FLAC)
+    X(MFAudioFormat_MP3)
+    X(MFAudioFormat_MPEG)
+    X(MFAudioFormat_MSP1)
+    X(MFAudioFormat_Opus)
+    X(MFAudioFormat_PCM)
+    X(MFAudioFormat_WMAudioV8)
+    X(MFAudioFormat_WMAudioV9)
+    X(MFAudioFormat_WMAudio_Lossless)
+    X(MFAudioFormat_WMASPDIF)
+
+    X(MFAudioFormat_AAC_HDCP)
+    X(MFAudioFormat_ADTS_HDCP)
+    X(MFAudioFormat_Base_HDCP)
+    X(MFAudioFormat_Dolby_AC3)
+    X(MFAudioFormat_Dolby_AC3_HDCP)
+    X(MFAudioFormat_Dolby_DDPlus)
+    X(MFAudioFormat_Float_SpatialObjects)
+    X(MFAudioFormat_LPCM)
+    X(MFAudioFormat_PCM_HDCP)
+    X(MFAudioFormat_Vorbis)
+
+    X(MFMediaType_Binary)
+    X(MFMediaType_Default)
+    X(MFMediaType_FileTransfer)
+    X(MFMediaType_HTML)
+    X(MFMediaType_Image)
+    X(MFMediaType_MultiplexedFrames)
+    X(MFMediaType_Perception)
+    X(MFMediaType_Protected)
+    X(MFMediaType_SAMI)
+    X(MFMediaType_Script)
+    X(MFMediaType_Stream)
+    X(MFMediaType_Subtitle)
+#undef X
+    return NULL;
+}
+
+static const char *wine_dbgstr_mfmediatype( IMFMediaType *type )
+{
+    GUID major, minor;
+    const char *major_s = "none", *minor_s = "none";
+
+    if (!type) return "{null}";
+
+    if (SUCCEEDED( IMFMediaType_GetMajorType( type, &major ) ))
+    {
+        major_s = wine_dbgstr_mfmediatype_guid( &major );
+
+        if (!major_s)
+            major_s = wine_dbgstr_guid( &major );
+    }
+
+    if (SUCCEEDED( IMFMediaType_GetGUID( type, &MF_MT_SUBTYPE, &minor ) ))
+    {
+        minor_s = wine_dbgstr_mfmediatype_guid( &minor );
+
+        if (!minor_s)
+            minor_s = wine_dbgstr_guid( &minor );
+    }
+
+    return wine_dbg_sprintf( "{%s, %s}", major_s, minor_s );
+}
+
+#endif  /* __WINE_WINE_MFDEBUG_H */
-- 
2.35.1




More information about the wine-devel mailing list