[vlc-devel] commit: opengl: Rewrite crazy code. ( Should fix a crash reported by Apple-bugreport). (Pierre d'Herbemont )

git version control git at videolan.org
Sat Sep 20 03:30:42 CEST 2008


vlc | branch: 0.9-bugfix | Pierre d'Herbemont <pdherbemont at videolan.org> | Sat Sep 20 03:30:40 2008 +0200| [b910801079a3a5c3459e0f6eaf21e1543eb3d96d] | committer: Pierre d'Herbemont 

opengl: Rewrite crazy code. (Should fix a crash reported by Apple-bugreport).

Given the (non) quality of this code and the use of the feature I am all thefor removing everything around OPENGL_MORE_EFFECT.
(cherry picked from commit fb7c9b784eb444811ec8bd344ab0167575126f01)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b910801079a3a5c3459e0f6eaf21e1543eb3d96d
---

 modules/video_output/opengl.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c
index 32d56e2..a72a0df 100644
--- a/modules/video_output/opengl.c
+++ b/modules/video_output/opengl.c
@@ -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 "




More information about the vlc-devel mailing list