[vlc-commits] gl: use vlc_module_(un)load()

Rémi Denis-Courmont git at videolan.org
Thu Jan 31 18:59:59 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Jan 31 18:46:01 2019 +0200| [42ec469657e527e82d7f9ef1ae0ef4149ad91833] | committer: Rémi Denis-Courmont

gl: use vlc_module_(un)load()

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

 src/video_output/opengl.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/video_output/opengl.c b/src/video_output/opengl.c
index 5057b2b458..c8c43e6c7f 100644
--- a/src/video_output/opengl.c
+++ b/src/video_output/opengl.c
@@ -37,6 +37,22 @@ struct vlc_gl_priv_t
     vlc_atomic_rc_t rc;
 };
 
+static int vlc_gl_start(void *func, va_list ap)
+{
+    int (*activate)(vlc_object_t *) = func;
+    vlc_object_t *gl = va_arg(ap, vlc_object_t *);
+
+    return activate(gl);
+}
+
+static void vlc_gl_stop(void *func, va_list ap)
+{
+    void (*deactivate)(vlc_object_t *) = func;
+    vlc_object_t *gl = va_arg(ap, vlc_object_t *);
+
+    deactivate(gl);
+}
+
 /**
  * Creates an OpenGL context (and its underlying surface).
  *
@@ -72,7 +88,8 @@ vlc_gl_t *vlc_gl_Create(struct vout_window_t *wnd, unsigned flags,
 
     vlc_gl_t *gl = &glpriv->gl;
     gl->surface = wnd;
-    gl->module = module_need(gl, type, name, true);
+    gl->module = vlc_module_load(gl, type, name, true, vlc_gl_start,
+                                 VLC_OBJECT(gl));
     if (gl->module == NULL)
     {
         vlc_object_release(gl);
@@ -96,7 +113,8 @@ void vlc_gl_Release(vlc_gl_t *gl)
     struct vlc_gl_priv_t *glpriv = (struct vlc_gl_priv_t *)gl;
     if (!vlc_atomic_rc_dec(&glpriv->rc))
         return;
-    module_unneed(gl, gl->module);
+
+    vlc_module_unload(gl, gl->module, vlc_gl_stop, VLC_OBJECT(gl));
     vlc_object_release(gl);
 }
 



More information about the vlc-commits mailing list