diff utils.c @ 303:9a931fd8d06c libavcodec

multiple init bugfix (patch by Alex Beregszaszi <alex@naxine.org>)
author michaelni
date Mon, 01 Apr 2002 13:24:47 +0000
parents e10840e4f773
children 764aeec1320e
line wrap: on
line diff
--- a/utils.c	Sat Mar 30 21:33:14 2002 +0000
+++ b/utils.c	Mon Apr 01 13:24:47 2002 +0000
@@ -385,12 +385,24 @@
 /* must be called before any other functions */
 void avcodec_init(void)
 {
+    static int inited = 0;
+
+    if (inited != 0)
+	return;
+    inited = 1;
+
     dsputil_init();
 }
 
 /* simple call to use all the codecs */
 void avcodec_register_all(void)
 {
+    static int inited = 0;
+    
+    if (inited != 0)
+	return;
+    inited = 1;
+
     /* encoders */
 #ifdef CONFIG_ENCODERS
     register_avcodec(&ac3_encoder);