[vlc-devel] [PATCH v2 03/21] opengl: expose software chroma in interop

Romain Vimont rom1v at videolabs.io
Tue Jan 7 12:41:39 CET 2020


Hardware decoders expose opaque format for chroma in interops. 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/interop.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 340672620b..1d5b455416 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->interop.fmt.p_palette);
+    tc->interop.sw_fmt = tc->interop.fmt;
+    tc->interop.sw_fmt.i_chroma = chroma;
+    tc->interop.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/interop.h b/modules/video_output/opengl/interop.h
index b13b94a698..402bcd2bcc 100644
--- a/modules/video_output/opengl/interop.h
+++ b/modules/video_output/opengl/interop.h
@@ -122,6 +122,9 @@ struct vlc_gl_interop {
     /* 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 a14b0451b3..25805780c5 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,
     interop->ops = NULL;
     interop->glexts = glexts;
     interop->fmt = *fmt;
+    /* this is the only allocated field, and we don't need it */
+    interop->fmt.p_palette = NULL;
 
     interop->gl = tc->gl;
     interop->vt = tc->vt;
-- 
2.25.0.rc0



More information about the vlc-devel mailing list