[PATCH 3/5] mfplat: Add a helper to trace video format name.

Nikolay Sivov nsivov at codeweavers.com
Wed Mar 18 08:57:36 CDT 2020


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/mfplat/buffer.c         |  2 +-
 dlls/mfplat/main.c           |  2 +-
 dlls/mfplat/mediatype.c      |  5 ++---
 dlls/mfplat/mfplat_private.h | 37 ++++++++++++++++++++++++++++++++++++
 4 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c
index 64ec436a1e..71bae4c42f 100644
--- a/dlls/mfplat/buffer.c
+++ b/dlls/mfplat/buffer.c
@@ -642,7 +642,7 @@ HRESULT WINAPI MFCreateAlignedMemoryBuffer(DWORD max_length, DWORD alignment, IM
 
 HRESULT WINAPI MFCreate2DMediaBuffer(DWORD width, DWORD height, DWORD fourcc, BOOL bottom_up, IMFMediaBuffer **buffer)
 {
-    TRACE("%u, %u, %#x, %d, %p.\n", width, height, fourcc, bottom_up, buffer);
+    TRACE("%u, %u, %s, %d, %p.\n", width, height, debugstr_fourcc(fourcc), bottom_up, buffer);
 
     return create_2d_buffer(width, height, fourcc, bottom_up, buffer);
 }
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index a5c954161d..ffe9e36d15 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -1510,7 +1510,7 @@ HRESULT WINAPI MFShutdown(void)
  */
 HRESULT WINAPI MFCopyImage(BYTE *dest, LONG deststride, const BYTE *src, LONG srcstride, DWORD width, DWORD lines)
 {
-    TRACE("(%p, %d, %p, %d, %u, %u)\n", dest, deststride, src, srcstride, width, lines);
+    TRACE("%p, %d, %p, %d, %u, %u.\n", dest, deststride, src, srcstride, width, lines);
 
     while (lines--)
     {
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c
index 8c4716e5e1..77753cc499 100644
--- a/dlls/mfplat/mediatype.c
+++ b/dlls/mfplat/mediatype.c
@@ -19,7 +19,6 @@
 #define COBJMACROS
 
 #include "mfplat_private.h"
-#include "d3d9types.h"
 
 #include "initguid.h"
 #include "ks.h"
@@ -1837,7 +1836,7 @@ HRESULT WINAPI MFGetStrideForBitmapInfoHeader(DWORD fourcc, DWORD width, LONG *s
     struct uncompressed_video_format *format;
     GUID subtype;
 
-    TRACE("%#x, %u, %p.\n", fourcc, width, stride);
+    TRACE("%s, %u, %p.\n", debugstr_fourcc(fourcc), width, stride);
 
     memcpy(&subtype, &MFVideoFormat_Base, sizeof(subtype));
     subtype.Data1 = fourcc;
@@ -1902,7 +1901,7 @@ HRESULT WINAPI MFGetPlaneSize(DWORD fourcc, DWORD width, DWORD height, DWORD *si
     unsigned int stride;
     GUID subtype;
 
-    TRACE("%#x, %u, %u, %p.\n", fourcc, width, height, size);
+    TRACE("%s, %u, %u, %p.\n", debugstr_fourcc(fourcc), width, height, size);
 
     memcpy(&subtype, &MFVideoFormat_Base, sizeof(subtype));
     subtype.Data1 = fourcc;
diff --git a/dlls/mfplat/mfplat_private.h b/dlls/mfplat/mfplat_private.h
index 0c374f116b..15d81a65b9 100644
--- a/dlls/mfplat/mfplat_private.h
+++ b/dlls/mfplat/mfplat_private.h
@@ -23,6 +23,7 @@
 #include "mfapi.h"
 #include "mfidl.h"
 #include "mferror.h"
+#include "d3d9types.h"
 
 #include "wine/heap.h"
 #include "wine/debug.h"
@@ -145,3 +146,39 @@ static inline const char *debugstr_propvar(const PROPVARIANT *v)
             return wine_dbg_sprintf("%p {vt %#x}", v, v->vt);
     }
 }
+
+static inline const char *debugstr_fourcc(DWORD format)
+{
+    static const struct format_name
+    {
+        unsigned int format;
+        const char *name;
+    } formats[] =
+    {
+        { D3DFMT_R8G8B8,        "R8G8B8" },
+        { D3DFMT_A8R8G8B8,      "A8R8G8B8" },
+        { D3DFMT_X8R8G8B8,      "X8R8G8B8" },
+        { D3DFMT_R5G6B5,        "R5G6B5" },
+        { D3DFMT_X1R5G5B5,      "X1R5G6B5" },
+        { D3DFMT_A2B10G10R10,   "A2B10G10R10" },
+        { D3DFMT_P8,            "P8" },
+        { D3DFMT_L8,            "L8" },
+        { D3DFMT_D16,           "D16" },
+        { D3DFMT_L16,           "L16" },
+        { D3DFMT_A16B16G16R16F, "A16B16G16R16F" },
+    };
+    int i;
+
+    if ((format & 0xff) == format)
+    {
+        for (i = 0; i < ARRAY_SIZE(formats); ++i)
+        {
+            if (formats[i].format == format)
+                return wine_dbg_sprintf("%s", wine_dbgstr_an(formats[i].name, -1));
+        }
+
+        return wine_dbg_sprintf("%#x", format);
+    }
+
+    return wine_dbgstr_an((char *)&format, 4);
+}
-- 
2.25.1




More information about the wine-devel mailing list