[vlc-devel] [PATCH 4/6] gl: pass the "decoder context" to glconv modules

Thomas Guillem thomas at gllm.fr
Sun Feb 24 12:27:06 CET 2019


This is a transitional commit. The vlc_decoder_context will be passed to "vout
display" modules from the future vlc_video_context struct.
---
 modules/video_output/opengl/converter.h   | 4 ++++
 modules/video_output/opengl/vout_helper.c | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/modules/video_output/opengl/converter.h b/modules/video_output/opengl/converter.h
index a1dd68c767..8670428852 100644
--- a/modules/video_output/opengl/converter.h
+++ b/modules/video_output/opengl/converter.h
@@ -23,6 +23,7 @@
 
 #include <vlc_plugin.h>
 #include <vlc_common.h>
+#include <vlc_codec.h>
 #include <vlc_picture_pool.h>
 #include <vlc_opengl.h>
 
@@ -258,6 +259,9 @@ struct opengl_tex_converter_t
     /* Pointer to object gl, set by the caller */
     vlc_gl_t *gl;
 
+    /* Pointer to decoder context, set by the caller (can be NULL) */
+    vlc_decoder_context *dec_context;
+
     /* libplacebo context, created by the caller (optional) */
     struct pl_context *pl_ctx;
 
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index adcc019d45..37f0f53c64 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -564,7 +564,11 @@ opengl_deinit_program(vout_display_opengl_t *vgl, struct prgm *prgm)
 {
     opengl_tex_converter_t *tc = prgm->tc;
     if (tc->p_module != NULL)
+    {
         module_unneed(tc, tc->p_module);
+        if (tc->dec_context)
+            vlc_decoder_context_Release(tc->dec_context);
+    }
     else if (tc->priv != NULL)
         opengl_tex_converter_generic_deinit(tc);
     if (prgm->id != 0)
@@ -646,7 +650,10 @@ opengl_init_program(vout_display_opengl_t *vgl, struct prgm *prgm,
         if (desc->plane_count == 0)
         {
             /* Opaque chroma: load a module to handle it */
+            tc->dec_context = vlc_decoder_context_Create(tc->gl->surface);
             tc->p_module = module_need_var(tc, "glconv", "glconv");
+            if (!tc->p_module && tc->dec_context)
+                vlc_decoder_context_Release(tc->dec_context);
         }
 
         if (tc->p_module != NULL)
-- 
2.20.1



More information about the vlc-devel mailing list