brillcodec: add DXVA plug-in probe 48/28048/1
authorgunsoo83.kim <gunsoo83.kim@samsung.com>
Thu, 25 Sep 2014 03:54:53 +0000 (12:54 +0900)
committergunsoo83.kim <gunsoo83.kim@samsung.com>
Thu, 25 Sep 2014 03:54:53 +0000 (12:54 +0900)
- DXVA2 plug-in check capability in runtime.

Change-Id: Ib39e89b1dfb7b41f6e731a8c77cfc11776caedc1
Signed-off-by: gunsoo83.kim <gunsoo83.kim@samsung.com>
tizen/src/hw/pci/maru_dxva2_plugin.c

index 0a6f180..1edd267 100644 (file)
@@ -798,7 +798,7 @@ static void maru_dxva2_close(void)
     //free(dxva_ctx);
 }
 
-static int maru_dxva2_open(AVCodecContext *dec_ctx)
+static bool probe(void)
 {
     if (hd3d9_dll == NULL || hdxva2_dll == NULL) {
         hd3d9_dll = LoadLibrary(TEXT("D3D9.DLL"));
@@ -830,27 +830,22 @@ static int maru_dxva2_open(AVCodecContext *dec_ctx)
         }
     }
 
-    if (DxFindVideoServiceConversion(dec_ctx->codec_id)) {
-        ERR("DxFindVideoServiceConversion failed\n");
-        goto error;
-    }
-
-    dxva_ctx->thread_count = dec_ctx->thread_count;
-
-    return 0;
+    return true;
 
 error:
     maru_dxva2_close();
-    return -1;
+    return false;
 }
 
 static bool dxva_setup(AVCodecContext *dec_ctx, int width, int height)
 {
-    if(maru_dxva2_open(dec_ctx) < 0) {
-        ERR("DXVA initialization failed\n");
+    if (DxFindVideoServiceConversion(dec_ctx->codec_id)) {
+        ERR("DxFindVideoServiceConversion failed\n");
         return false;
     }
 
+    dxva_ctx->thread_count = dec_ctx->thread_count;
+
     //TODO: destroy surface and decoder at avcontext deinit()
     DxDestroyVideoDecoder();
 
@@ -993,7 +988,7 @@ CodecPlugin dxva_plugin = {
     .name = "DXVA2",
     .pix_fmt = PIX_FMT_DXVA2_VLD,
     .output_pix_fmt = PIX_FMT_YUV420P,
-    .probe = NULL;
+    .probe = probe,
     .setup = dxva_setup,
     .get_buffer = dxva_get_surface,
     .release_buffer = dxva_release_surface,