changeset 22077:40135eba142f

Avoid a static variable and instead use variable in context
author reimar
date Wed, 31 Jan 2007 22:15:51 +0000
parents e81065a87c2d
children 9fd2145ddb43
files libmpcodecs/vd_lzo.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_lzo.c	Wed Jan 31 18:14:47 2007 +0000
+++ b/libmpcodecs/vd_lzo.c	Wed Jan 31 22:15:51 2007 +0000
@@ -91,7 +91,6 @@
 // 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 @@
     }
     
 
-    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 @@
 	    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,