Commit 7b38b41b authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

opengl: get gl value explicitly

(also fix unlikely ToCToU)
parent 2f952cf7
...@@ -799,7 +799,9 @@ static void ClearSurface(vout_display_t *vd) ...@@ -799,7 +799,9 @@ static void ClearSurface(vout_display_t *vd)
if (sys->p_window->b_opaque) if (sys->p_window->b_opaque)
{ {
/* Clear the surface to black with OpenGL ES 2 */ /* Clear the surface to black with OpenGL ES 2 */
vlc_gl_t *gl = vlc_gl_Create(sys->embed, VLC_OPENGL_ES2, "$gles2"); char *modlist = var_InheritString(sys->embed, "gles2");
vlc_gl_t *gl = vlc_gl_Create(sys->embed, VLC_OPENGL_ES2, modlist);
free(modlist);
if (gl == NULL) if (gl == NULL)
return; return;
......
...@@ -104,7 +104,7 @@ static int Open (vlc_object_t *obj) ...@@ -104,7 +104,7 @@ static int Open (vlc_object_t *obj)
goto error; goto error;
} }
const char *gl_name = "$" MODULE_VARNAME; char *gl_name = var_InheritString(surface, MODULE_VARNAME);
/* VDPAU GL interop works only with GLX. Override the "gl" option to force /* VDPAU GL interop works only with GLX. Override the "gl" option to force
* it. */ * it. */
...@@ -118,10 +118,8 @@ static int Open (vlc_object_t *obj) ...@@ -118,10 +118,8 @@ static int Open (vlc_object_t *obj)
case VLC_CODEC_VDPAU_VIDEO_420: case VLC_CODEC_VDPAU_VIDEO_420:
{ {
/* Force the option only if it was not previously set */ /* Force the option only if it was not previously set */
char *str = var_InheritString(surface, MODULE_VARNAME); if (gl_name == NULL)
if (str == NULL) gl_name = strdup("glx");
gl_name = "glx";
free(str);
break; break;
} }
default: default:
...@@ -131,6 +129,7 @@ static int Open (vlc_object_t *obj) ...@@ -131,6 +129,7 @@ static int Open (vlc_object_t *obj)
#endif #endif
sys->gl = vlc_gl_Create (surface, API, gl_name); sys->gl = vlc_gl_Create (surface, API, gl_name);
free(gl_name);
if (sys->gl == NULL) if (sys->gl == NULL)
goto error; goto error;
......
...@@ -128,7 +128,9 @@ static int Open(vlc_object_t *object) ...@@ -128,7 +128,9 @@ static int Open(vlc_object_t *object)
if (!surface) if (!surface)
goto error; goto error;
sys->gl = vlc_gl_Create (surface, VLC_OPENGL, "$gl"); char *modlist = var_InheritString(surface, "gl");
sys->gl = vlc_gl_Create (surface, VLC_OPENGL, modlist);
free(modlist);
if (!sys->gl) if (!sys->gl)
{ {
vlc_object_release(surface); vlc_object_release(surface);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment