[vlc-commits] dxva: move initialization from setup to open

Rémi Denis-Courmont git at videolan.org
Sun Sep 27 21:55:02 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Sep 27 16:07:23 2015 +0300| [a89197637e142563f0233ba35c10609a962f0435] | committer: Rémi Denis-Courmont

dxva: move initialization from setup to open

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

 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 0adc774..9ad378a 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 c91055c..dad28ac 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;



More information about the vlc-commits mailing list