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

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


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

vda: move initialization from setup to open

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

 modules/codec/avcodec/vda.c |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/modules/codec/avcodec/vda.c b/modules/codec/avcodec/vda.c
index defa759..48843d3 100644
--- a/modules/codec/avcodec/vda.c
+++ b/modules/codec/avcodec/vda.c
@@ -149,6 +149,15 @@ static int Open(vlc_va_t *va,
     sys->i_width = avctx->width;
     sys->i_height = avctx->height;
 
+    int i_ret = av_vda_default_init2(avctx, sys->vdactx);
+
+    msg_Dbg(va, "Creating VDA decoder %i", i_ret);
+
+    if (i_ret != 0) {
+        av_vda_default_free(avctx);
+        return VLC_EGENERIC;
+    }
+
     va->sys = sys;
     va->description = (char *)"VDA";
     va->setup = Setup;
@@ -167,16 +176,6 @@ static void Close( vlc_va_t *va, AVCodecContext *avctx )
 
 static int Setup( vlc_va_t *va, AVCodecContext *avctx, vlc_fourcc_t *pi_chroma )
 {
-
-    vlc_va_sys_t *sys = va->sys;
-
-    int i_ret = av_vda_default_init2(avctx, sys->vdactx);
-
-    msg_Dbg(va, "Creating VDA decoder %i", i_ret);
-
-    if (i_ret != 0)
-        return VLC_EGENERIC;
-
     *pi_chroma = VLC_CODEC_I420;
 
     return VLC_SUCCESS;



More information about the vlc-commits mailing list