[vlc-devel] [PATCH 03/18] opengl: expose software chroma in importer

Romain Vimont rom1v at videolabs.io
Fri Dec 20 15:48:45 CET 2019


Hardware decoders expose opaque format for chroma in importers. They
pass the actual format to opengl_fragment_shader_init(). Store it so
that everyone can access it.
---
 modules/video_output/opengl/fragment_shaders.c | 5 +++++
 modules/video_output/opengl/importer.h         | 3 +++
 modules/video_output/opengl/vout_helper.c      | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/modules/video_output/opengl/fragment_shaders.c b/modules/video_output/opengl/fragment_shaders.c
index 7bcb8f52ce..6b6ce7f01e 100644
--- a/modules/video_output/opengl/fragment_shaders.c
+++ b/modules/video_output/opengl/fragment_shaders.c
@@ -516,6 +516,11 @@ opengl_fragment_shader_init_impl(opengl_tex_converter_t *tc, GLenum tex_target,
     bool yuv_swap_uv = false;
     int ret;
 
+    assert(!tc->importer.fmt.p_palette);
+    tc->importer.sw_fmt = tc->importer.fmt;
+    tc->importer.sw_fmt.i_chroma = chroma;
+    tc->importer.sw_fmt.space = yuv_space;
+
     const vlc_chroma_description_t *desc = vlc_fourcc_GetChromaDescription(chroma);
     if (desc == NULL)
         return 0;
diff --git a/modules/video_output/opengl/importer.h b/modules/video_output/opengl/importer.h
index d59f425acc..22ca3b76d6 100644
--- a/modules/video_output/opengl/importer.h
+++ b/modules/video_output/opengl/importer.h
@@ -122,6 +122,9 @@ struct vlc_gl_importer {
     /* Can only be changed from the module open function */
     video_format_t fmt;
 
+    /* Software format (useful if fmt only exposes opaque chroma) */
+    video_format_t sw_fmt;
+
     /* Pointer to decoder video context, set by the caller (can be NULL) */
     vlc_video_context *vctx;
 
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index 533b554e6c..8b07577a41 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -556,6 +556,8 @@ opengl_init_program(vout_display_opengl_t *vgl, vlc_video_context *context,
     imp->ops = NULL;
     imp->glexts = glexts;
     imp->fmt = *fmt;
+    /* this is the only allocated field, and we don't need it */
+    imp->fmt.p_palette = NULL;
 
     imp->gl = tc->gl;
     imp->vt = tc->vt;
-- 
2.24.1



More information about the vlc-devel mailing list