vlc | branch: master | Romain Vimont <ro...@videolabs.io> | Fri Dec  6 14:55:38 
2019 +0100| [29cbdb5a6c05321c71e2ce55dbd8c1029c0bff34] | committer: Thomas 
Guillem

opengl: expose software chroma in interop

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.

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

 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 46aee2a3f4..2eed0eb02f 100644
--- a/modules/video_output/opengl/interop.h
+++ b/modules/video_output/opengl/interop.h
@@ -108,6 +108,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 875dfa58fe..0bac994067 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;

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to