//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"));
}
}
- 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();
.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,