]> granicus.if.org Git - handbrake/commitdiff
DXVA2: check if a compatible AVHWAccel exists for the input codec.
authorRodeo <tdskywalker@gmail.com>
Tue, 23 Jun 2015 22:01:18 +0000 (22:01 +0000)
committerRodeo <tdskywalker@gmail.com>
Tue, 23 Jun 2015 22:01:18 +0000 (22:01 +0000)
Otherwise, disable DXVA2 support for the title.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7311 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/vadxva2.c

index 7ca965d3c760d06c6642c62b66c895e3de6d3133..ff4a8151c974ab711abfb42c50166715eab0c232 100644 (file)
@@ -671,10 +671,23 @@ hb_va_dxva2_t * hb_va_create_dxva2( hb_va_dxva2_t *dxva2, int codec_id )
         goto error;
     }
 
-    dxva->do_job = HB_WORK_OK;
-    dxva->description = "DXVA2";
-
-    return dxva;
+    /*
+     * We may get a valid DXVA2 decoder later on, but we won't be able to
+     * use it if libavcodec is built without support for the appropriate
+     * AVHWaccel, so we need to check for it before declaring victory.
+     */
+    AVHWAccel *hwaccel = NULL;
+    for (hwaccel = av_hwaccel_next(NULL);
+         hwaccel != NULL;
+         hwaccel = av_hwaccel_next(hwaccel))
+    {
+        if (hwaccel->id == codec_id && hwaccel->pix_fmt == AV_PIX_FMT_DXVA2_VLD)
+        {
+            dxva->do_job = HB_WORK_OK;
+            dxva->description = "DXVA2";
+            return dxva;
+        }
+    }
 
 error:
     hb_va_close( dxva );