[vlc-commits] opengl: store video format in sampler
Romain Vimont
git at videolan.org
Thu Sep 10 15:41:41 CEST 2020
vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Tue Jul 7 12:33:48 2020 +0200| [4704f5ba8942d00ef196ab6f538fcb92f87fc042] | committer: Alexandre Janniaux
opengl: store video format in sampler
The sampler just referenced the interop format.
In order to support samplers without interop (when the input picture
comes from a previous OpenGL filter), store the input format in the
sampler.
Co-authored-by: Alexandre Janniaux <ajanni at videolabs.io>
Signed-off-by: Alexandre Janniaux <ajanni at videolabs.io>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4704f5ba8942d00ef196ab6f538fcb92f87fc042
---
modules/video_output/opengl/renderer.c | 14 +++++++-------
modules/video_output/opengl/sampler.c | 6 +++++-
modules/video_output/opengl/sampler.h | 2 +-
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/modules/video_output/opengl/renderer.c b/modules/video_output/opengl/renderer.c
index 29685d54f5..76f4e5378b 100644
--- a/modules/video_output/opengl/renderer.c
+++ b/modules/video_output/opengl/renderer.c
@@ -208,7 +208,7 @@ BuildVertexShader(struct vlc_gl_filter *filter)
if (renderer->dump_shaders)
msg_Dbg(filter, "\n=== Vertex shader for fourcc: %4.4s ===\n%s\n",
- (const char *) &renderer->sampler->fmt->i_chroma, code);
+ (const char *) &renderer->sampler->fmt.i_chroma, code);
return code;
}
@@ -238,8 +238,8 @@ BuildFragmentShader(struct vlc_gl_filter *filter)
if (renderer->dump_shaders)
msg_Dbg(filter, "\n=== Fragment shader for fourcc: %4.4s, colorspace: %d ===\n%s\n",
- (const char *) &sampler->fmt->i_chroma,
- sampler->fmt->space, code);
+ (const char *) &sampler->fmt.i_chroma,
+ sampler->fmt.space, code);
return code;
}
@@ -338,7 +338,7 @@ vlc_gl_renderer_Open(struct vlc_gl_filter *filter,
(void) config;
const opengl_vtable_t *vt = &filter->api->vt;
- const video_format_t *fmt = sampler->fmt;
+ const video_format_t *fmt = &sampler->fmt;
struct vlc_gl_renderer *renderer = calloc(1, sizeof(*renderer));
if (!renderer)
@@ -439,7 +439,7 @@ vlc_gl_renderer_SetViewpoint(struct vlc_gl_renderer *renderer,
UpdateFOVy(renderer);
UpdateZ(renderer);
}
- const video_format_t *fmt = renderer->sampler->fmt;
+ const video_format_t *fmt = &renderer->sampler->fmt;
getViewpointMatrixes(renderer, fmt->projection_mode);
return VLC_SUCCESS;
@@ -456,7 +456,7 @@ vlc_gl_renderer_SetWindowAspectRatio(struct vlc_gl_renderer *renderer,
UpdateFOVy(renderer);
UpdateZ(renderer);
- const video_format_t *fmt = renderer->sampler->fmt;
+ const video_format_t *fmt = &renderer->sampler->fmt;
getViewpointMatrixes(renderer, fmt->projection_mode);
}
@@ -697,7 +697,7 @@ static int BuildRectangle(GLfloat **vertexCoord, GLfloat **textureCoord, unsigne
static int SetupCoords(struct vlc_gl_renderer *renderer)
{
const opengl_vtable_t *vt = renderer->vt;
- const video_format_t *fmt = renderer->sampler->fmt;
+ const video_format_t *fmt = &renderer->sampler->fmt;
GLfloat *vertexCoord, *textureCoord;
GLushort *indices;
diff --git a/modules/video_output/opengl/sampler.c b/modules/video_output/opengl/sampler.c
index 4cfeada6ba..219cac3aec 100644
--- a/modules/video_output/opengl/sampler.c
+++ b/modules/video_output/opengl/sampler.c
@@ -953,7 +953,11 @@ vlc_gl_sampler_New(struct vlc_gl_interop *interop)
priv->gl = interop->gl;
priv->vt = interop->vt;
- sampler->fmt = &interop->fmt_out;
+ /* Formats with palette are not supported. This also allows to copy
+ * video_format_t without possibility of failure. */
+ assert(!sampler->fmt.p_palette);
+
+ sampler->fmt = interop->fmt_out;
sampler->shader.extensions = NULL;
sampler->shader.body = NULL;
diff --git a/modules/video_output/opengl/sampler.h b/modules/video_output/opengl/sampler.h
index b8439b004b..c3ddfd7204 100644
--- a/modules/video_output/opengl/sampler.h
+++ b/modules/video_output/opengl/sampler.h
@@ -51,7 +51,7 @@
*/
struct vlc_gl_sampler {
/* Input format */
- const video_format_t *fmt;
+ video_format_t fmt;
struct {
/**
More information about the vlc-commits
mailing list