From d5a69f4655e258e9172e0e34dbfb1910bc206b49 Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 31 Jan 2007 22:15:51 +0000 Subject: Avoid a static variable and instead use variable in context git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22095 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vd_lzo.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/vd_lzo.c b/libmpcodecs/vd_lzo.c index 59b64d84b2..379a557273 100644 --- a/libmpcodecs/vd_lzo.c +++ b/libmpcodecs/vd_lzo.c @@ -91,7 +91,6 @@ static void uninit(sh_video_t *sh) // decode a frame static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags) { - static int init_done = 0; int r; mp_image_t* mpi; int w; @@ -102,7 +101,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags) } - if (!init_done) { + if (priv->codec == -1) { lzo_byte *tmp = lzo_malloc(sh->bih->biSizeImage); // decompress one frame to see if its @@ -135,8 +134,10 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags) return NULL; } - if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,priv->codec)) return NULL; - init_done++; + if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,priv->codec)) { + priv->codec = -1; + return NULL; + } } mpi = mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0, -- cgit v1.2.3