From a89197637e142563f0233ba35c10609a962f0435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net> Date: Sun, 27 Sep 2015 16:07:23 +0300 Subject: [PATCH] dxva: move initialization from setup to open --- modules/codec/avcodec/d3d11va.c | 9 ++++++--- modules/codec/avcodec/dxva2.c | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c index 0adc774b131f..9ad378aaaf7a 100644 --- a/modules/codec/avcodec/d3d11va.c +++ b/modules/codec/avcodec/d3d11va.c @@ -147,10 +147,7 @@ static picture_t *DxAllocPicture(vlc_va_t *, const video_format_t *, unsigned in static int Setup(vlc_va_t *va, AVCodecContext *avctx, vlc_fourcc_t *chroma) { vlc_va_sys_t *sys = va->sys; - if (directx_va_Setup(va, &sys->dx_sys, avctx)!=VLC_SUCCESS) - return VLC_EGENERIC; - avctx->hwaccel_context = &sys->hw; *chroma = sys->filter == NULL ? VLC_CODEC_D3D11_OPAQUE : VLC_CODEC_YV12; return VLC_SUCCESS; @@ -361,6 +358,12 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt, goto error; } + err = directx_va_Setup(va, &sys->dx_sys, ctx); + if (err != VLC_SUCCESS) + goto error; + + ctx->hwaccel_context = &sys->hw; + /* TODO print the hardware name/vendor for debugging purposes */ va->description = DxDescribe(dx_sys); va->setup = Setup; diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c index c91055c6334a..dad28ac84616 100644 --- a/modules/codec/avcodec/dxva2.c +++ b/modules/codec/avcodec/dxva2.c @@ -207,10 +207,7 @@ static filter_t *CreateFilter( vlc_object_t *p_this, const es_format_t *p_fmt_in static int Setup(vlc_va_t *va, AVCodecContext *avctx, vlc_fourcc_t *chroma) { vlc_va_sys_t *sys = va->sys; - if (directx_va_Setup(va, &sys->dx_sys, avctx)!=VLC_SUCCESS) - return VLC_EGENERIC; - avctx->hwaccel_context = &sys->hw; *chroma = sys->filter == NULL ? VLC_CODEC_D3D9_OPAQUE : VLC_CODEC_YV12; return VLC_SUCCESS; @@ -368,6 +365,12 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt, goto error; } + err = directx_va_Setup(va, &sys->dx_sys, ctx); + if (err != VLC_SUCCESS) + goto error; + + ctx->hwaccel_context = &sys->hw; + /* TODO print the hardware name/vendor for debugging purposes */ va->description = DxDescribe(sys); va->setup = Setup; -- GitLab