[vlc-commits] dxva2: simplify the device logging

Steve Lhomme git at videolan.org
Thu Jun 13 15:24:06 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jun 13 14:45:47 2019 +0200| [7490353445fd0e7d7de58d021a2e8b23df1780cd] | committer: Steve Lhomme

dxva2: simplify the device logging

No need to allocate a string anymore.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7490353445fd0e7d7de58d021a2e8b23df1780cd
---

 modules/codec/avcodec/dxva2.c | 30 ++++++------------------------
 1 file changed, 6 insertions(+), 24 deletions(-)

diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 194e5ca895..da029b5a18 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -138,7 +138,6 @@ struct vlc_va_sys_t
 /* */
 static int D3dCreateDevice(vlc_va_t *, const video_format_t *);
 static void D3dDestroyDevice(vlc_va_t *);
-static char *DxDescribe(vlc_va_sys_t *);
 
 static int D3dCreateDeviceManager(vlc_va_t *);
 static void D3dDestroyDeviceManager(vlc_va_t *);
@@ -326,11 +325,12 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
     if (err != VLC_SUCCESS)
         goto error;
 
-    /* TODO print the hardware name/vendor for debugging purposes */
-    char *desc = DxDescribe(sys);
-    if (desc != NULL) {
-        msg_Info(va, "Using %s", desc);
-        free(desc);
+    D3DADAPTER_IDENTIFIER9 d3dai;
+    if (SUCCEEDED(IDirect3D9_GetAdapterIdentifier(sys->hd3d.obj,
+                                               sys->d3d_dev.adapterId, 0, &d3dai))) {
+        msg_Info(va, "Using DXVA2 (%.*s, vendor %s(%lx), device %lx, revision %lx)",
+                    (int)sizeof(d3dai.Description), d3dai.Description,
+                    DxgiVendorStr(d3dai.VendorId), d3dai.VendorId, d3dai.DeviceId, d3dai.Revision);
     }
 
     ctx->hwaccel_context = &sys->hw;
@@ -375,24 +375,6 @@ static void D3dDestroyDevice(vlc_va_t *va)
     D3D9_ReleaseDevice(&sys->d3d_dev);
     D3D9_Destroy( &sys->hd3d );
 }
-/**
- * It describes our Direct3D object
- */
-static char *DxDescribe(vlc_va_sys_t *sys)
-{
-    D3DADAPTER_IDENTIFIER9 d3dai;
-    if (FAILED(IDirect3D9_GetAdapterIdentifier(sys->hd3d.obj,
-                                               sys->d3d_dev.adapterId, 0, &d3dai))) {
-        return NULL;
-    }
-
-    char *description;
-    if (asprintf(&description, "DXVA2 (%.*s, vendor %s(%lx), device %lx, revision %lx)",
-                 (int)sizeof(d3dai.Description), d3dai.Description,
-                 DxgiVendorStr(d3dai.VendorId), d3dai.VendorId, d3dai.DeviceId, d3dai.Revision) < 0)
-        return NULL;
-    return description;
-}
 
 /**
  * It creates a Direct3D device manager



More information about the vlc-commits mailing list