From 359c111aa91dbbe9245a1bba2413692c63afdf73 Mon Sep 17 00:00:00 2001 From: kramm Date: Mon, 20 Sep 2004 16:15:59 +0000 Subject: [PATCH] added avifile_initialized flag. --- avi2swf/videoreader_vfw.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/avi2swf/videoreader_vfw.cc b/avi2swf/videoreader_vfw.cc index 2c2f809..2da5acd 100644 --- a/avi2swf/videoreader_vfw.cc +++ b/avi2swf/videoreader_vfw.cc @@ -223,13 +223,16 @@ void videoreader_vfw_close(videoreader_t* vr) AVIStreamRelease(i->as); i->vs = 0; } AVIFileRelease(i->avifile); i->avifile = 0; - AVIFileExit(); + + AVIFileExit(); avifile_initialized=0; free(vr->internal); vr->internal = 0; } void videoreader_vfw_setparameter(videoreader_t* vr, char*name, char*value) {} +static int avifile_initialized = 0; + int videoreader_vfw_open(videoreader_t* vr, char* filename) { memset(vr, 0, sizeof(videoreader_t)); @@ -248,7 +251,9 @@ int videoreader_vfw_open(videoreader_t* vr, char* filename) vr->close = videoreader_vfw_close; vr->setparameter = videoreader_vfw_setparameter; - AVIFileInit(); + if(!avifile_initialized) { + AVIFileInit(); + } if(AVIFileOpen(&i->avifile, filename, OF_SHARE_DENY_WRITE, 0)) { fprintf(stderr, "Couldn't open %s\n", filename); return -1; -- 1.7.10.4