]> git.sesse.net Git - vlc/commitdiff
opengl: Rewrite crazy code. (Should fix a crash reported by Apple-bugreport).
authorPierre d'Herbemont <pdherbemont@videolan.org>
Sat, 20 Sep 2008 01:30:40 +0000 (03:30 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Sat, 20 Sep 2008 01:33:26 +0000 (03:33 +0200)
Given the (non) quality of this code and the use of the feature I am all thefor removing everything around OPENGL_MORE_EFFECT.

modules/video_output/opengl.c

index 32d56e256f6af68184698eb381855b16bbc7e196..a72a0dfe55570839bbeebcecf5c01a2db033fa0f 100644 (file)
@@ -469,18 +469,22 @@ static int Init( vout_thread_t *p_vout )
     else
     {
 #ifdef OPENGL_MORE_EFFECT
-        p_sys->i_effect = 3;
-        while (( strcmp( val.psz_string, ppsz_effects[p_sys->i_effect]) ) && (pow(2,p_sys->i_effect) < INIFILE))
+        long i, size = sizeof(ppsz_effects)/sizeof(*ppsz_effects);
+        p_sys->i_effect = OPENGL_EFFECT_NONE;
+
+        for(i = 3; i < size; i++)
         {
-            p_sys->i_effect ++;
+            if(!strcmp( val.psz_string, ppsz_effects[i]))
+            {
+                p_sys->i_effect = 1 << i;
+                break;
+            }
         }
-        if (pow(2,p_sys->i_effect) < INIFILE)
-            p_sys->i_effect = pow(2,p_sys->i_effect);
-        else if ( strcmp( val.psz_string, ppsz_effects[p_sys->i_effect]))
+
+        if( p_sys->i_effect == OPENGL_EFFECT_NONE )
         {
             msg_Warn( p_vout, "no valid opengl effect provided, using "
                       "\"none\"" );
-            p_sys->i_effect = OPENGL_EFFECT_NONE;
         }
 #else
         msg_Warn( p_vout, "no valid opengl effect provided, using "