[vlc-devel] [PATCH 7/7] d3d11va: better logging of decoder configuration

Steve Lhomme robux4 at videolabs.io
Thu Oct 15 19:05:02 CEST 2015


---
 modules/codec/avcodec/d3d11va.c    |  9 +++++++--
 modules/codec/avcodec/directx_va.c | 19 ++++++++++---------
 modules/codec/avcodec/directx_va.h |  1 +
 3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 677387e..8998b15 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -638,16 +638,18 @@ static int DxSetupOutput(vlc_va_t *va, const GUID *input)
     processorInput[idx++] = DXGI_FORMAT_NV12;
     processorInput[idx++] = DXGI_FORMAT_UNKNOWN;
 
+    char *psz_decoder_name = directx_va_GetDecoderName(input);
+
     /* */
     for (idx = 0; processorInput[idx] != DXGI_FORMAT_UNKNOWN; ++idx)
     {
         BOOL is_supported = false;
         hr = ID3D11VideoDevice_CheckVideoDecoderFormat((ID3D11VideoDevice*) dx_sys->d3ddec, input, processorInput[idx], &is_supported);
         if (SUCCEEDED(hr) && is_supported)
-            msg_Dbg(va, "%s is supported for output", DxgiFormatToStr(processorInput[idx]));
+            msg_Dbg(va, "%s output is supported for decoder %s.", DxgiFormatToStr(processorInput[idx]), psz_decoder_name);
         else
         {
-            msg_Dbg(va, "Can't get a decoder for output format %s.", DxgiFormatToStr(processorInput[idx]));
+            msg_Dbg(va, "Can't get a decoder output format %s for decoder %s.", DxgiFormatToStr(processorInput[idx]), psz_decoder_name);
             continue;
         }
 
@@ -664,10 +666,13 @@ static int DxSetupOutput(vlc_va_t *va, const GUID *input)
 
         if ( !b_needsProcessor )
         {
+            msg_Dbg(va, "Using output format %s for decoder %s", DxgiFormatToStr(processorInput[idx]), psz_decoder_name);
             va->sys->render = processorInput[idx];
+            free(psz_decoder_name);
             return VLC_SUCCESS;
         }
     }
+    free(psz_decoder_name);
 
     msg_Dbg(va, "Output format from picture source not supported.");
     return VLC_EGENERIC;
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index c8df0ec..2f617f0 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -242,13 +242,17 @@ static void DestroyVideoService(vlc_va_t *, directx_sys_t *);
 static void DestroyDeviceManager(vlc_va_t *, directx_sys_t *);
 static void DestroyDevice(vlc_va_t *, directx_sys_t *);
 
-static const directx_va_mode_t *FindDxvaMode(const GUID *guid)
+char *directx_va_GetDecoderName(const GUID *guid)
 {
     for (unsigned i = 0; DXVA_MODES[i].name; i++) {
         if (IsEqualGUID(DXVA_MODES[i].guid, guid))
-            return &DXVA_MODES[i];
+            return strdup(DXVA_MODES[i].name);
     }
-    return NULL;
+
+    char *psz_name = malloc(36);
+    if (likely(psz_name))
+        asprintf(&psz_name, "Unknown decoder " GUID_FMT, GUID_PRINT(*guid));
+    return psz_name;
 }
 
 /* */
@@ -517,12 +521,9 @@ static int FindVideoServiceConversion(vlc_va_t *va, directx_sys_t *dx_sys, const
     /* Retreive supported modes from the decoder service */
     for (unsigned i = 0; i < p_list.count; i++) {
         const GUID *g = &p_list.list[i];
-        const directx_va_mode_t *mode = FindDxvaMode(g);
-        if (mode) {
-            msg_Dbg(va, "- '%s' is supported by hardware", mode->name);
-        } else {
-            msg_Warn(va, "- Unknown GUID = " GUID_FMT, GUID_PRINT( *g ) );
-        }
+        char *psz_decoder_name = directx_va_GetDecoderName(g);
+        msg_Dbg(va, "- '%s' is supported by hardware", psz_decoder_name);
+        free(psz_decoder_name);
     }
 
     /* Try all supported mode by our priority */
diff --git a/modules/codec/avcodec/directx_va.h b/modules/codec/avcodec/directx_va.h
index c3718a3..905ae0d 100644
--- a/modules/codec/avcodec/directx_va.h
+++ b/modules/codec/avcodec/directx_va.h
@@ -139,5 +139,6 @@ void directx_va_Close(vlc_va_t *, directx_sys_t *);
 int directx_va_Setup(vlc_va_t *, directx_sys_t *, AVCodecContext *avctx);
 int directx_va_Get(vlc_va_t *, directx_sys_t *, picture_t *pic, uint8_t **data);
 void directx_va_Release(void *opaque, uint8_t *data);
+char *directx_va_GetDecoderName(const GUID *guid);
 
 #endif /* AVCODEC_DIRECTX_VA_H */
-- 
2.6.0



More information about the vlc-devel mailing list