[vlc-devel] [PATCH v4 16/20] opengl: pass picture date to filters
Romain Vimont
rom1v at videolabs.io
Tue Jul 7 12:33:59 CEST 2020
Expose the date of the input picture_t to the OpenGL filter.
As the date is directly coming from the input picture without
modification, its value and semantic is defined by the previous layer
forwarding the picture to the OpenGL filters.
Co-authored-by: Alexandre Janniaux <ajanni at videolabs.io>
---
modules/video_output/opengl/filter.h | 9 ++++++++-
modules/video_output/opengl/filter_draw.c | 4 +++-
modules/video_output/opengl/filters.c | 16 ++++++++++++++--
modules/video_output/opengl/filters.h | 1 +
modules/video_output/opengl/renderer.c | 6 ++++--
5 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/modules/video_output/opengl/filter.h b/modules/video_output/opengl/filter.h
index 94c9fc3320..88b4f572b0 100644
--- a/modules/video_output/opengl/filter.h
+++ b/modules/video_output/opengl/filter.h
@@ -22,6 +22,8 @@
#ifndef VLC_GL_FILTER_H
#define VLC_GL_FILTER_H
+#include <vlc_tick.h>
+
#include "sampler.h"
struct vlc_gl_filter;
@@ -31,6 +33,10 @@ struct vlc_gl_tex_size {
unsigned height;
};
+struct vlc_gl_input_meta {
+ vlc_tick_t pts;
+};
+
typedef int
vlc_gl_filter_open_fn(struct vlc_gl_filter *filter,
const config_chain_t *config,
@@ -40,7 +46,8 @@ struct vlc_gl_filter_ops {
/**
* Draw the result of the filter to the current framebuffer
*/
- int (*draw)(struct vlc_gl_filter *filter);
+ int (*draw)(struct vlc_gl_filter *filter,
+ const struct vlc_gl_input_meta *meta);
/**
* Free filter resources
diff --git a/modules/video_output/opengl/filter_draw.c b/modules/video_output/opengl/filter_draw.c
index d5b969e24b..885ae957b3 100644
--- a/modules/video_output/opengl/filter_draw.c
+++ b/modules/video_output/opengl/filter_draw.c
@@ -46,8 +46,10 @@ struct sys {
};
static int
-Draw(struct vlc_gl_filter *filter)
+Draw(struct vlc_gl_filter *filter, const struct vlc_gl_input_meta *meta)
{
+ (void) meta;
+
struct sys *sys = filter->sys;
const opengl_vtable_t *vt = &filter->api->vt;
diff --git a/modules/video_output/opengl/filters.c b/modules/video_output/opengl/filters.c
index a8724e474b..41a023eb20 100644
--- a/modules/video_output/opengl/filters.c
+++ b/modules/video_output/opengl/filters.c
@@ -50,6 +50,11 @@ struct vlc_gl_filters {
unsigned width;
unsigned height;
} viewport;
+
+ struct {
+ /** Last updated picture PTS */
+ vlc_tick_t pts;
+ } pic;
};
struct vlc_gl_filters *
@@ -66,6 +71,7 @@ vlc_gl_filters_New(struct vlc_gl_t *gl, const struct vlc_gl_api *api,
vlc_list_init(&filters->list);
memset(&filters->viewport, 0, sizeof(filters->viewport));
+ filters->pic.pts = VLC_TICK_INVALID;
return filters;
}
@@ -274,6 +280,8 @@ vlc_gl_filters_UpdatePicture(struct vlc_gl_filters *filters,
assert(first_filter);
+ filters->pic.pts = picture->date;
+
return vlc_gl_sampler_UpdatePicture(first_filter->sampler, picture);
}
@@ -286,6 +294,10 @@ vlc_gl_filters_Draw(struct vlc_gl_filters *filters)
vt->GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &value);
GLuint draw_framebuffer = value; /* as GLuint */
+ struct vlc_gl_input_meta meta = {
+ .pts = filters->pic.pts,
+ };
+
struct vlc_gl_filter_priv *priv;
vlc_list_foreach(priv, &filters->list, node)
{
@@ -321,7 +333,7 @@ vlc_gl_filters_Draw(struct vlc_gl_filters *filters)
vt->Viewport(0, 0, priv->size_out.width, priv->size_out.height);
struct vlc_gl_filter *filter = &priv->filter;
- int ret = filter->ops->draw(filter);
+ int ret = filter->ops->draw(filter, &meta);
if (ret != VLC_SUCCESS)
return ret;
@@ -334,7 +346,7 @@ vlc_gl_filters_Draw(struct vlc_gl_filters *filters)
vt->BindFramebuffer(GL_DRAW_FRAMEBUFFER, draw_fb);
struct vlc_gl_filter *subfilter = &subfilter_priv->filter;
- ret = subfilter->ops->draw(subfilter);
+ ret = subfilter->ops->draw(subfilter, &meta);
if (ret != VLC_SUCCESS)
return ret;
}
diff --git a/modules/video_output/opengl/filters.h b/modules/video_output/opengl/filters.h
index 3541bf0076..c7b8ec3942 100644
--- a/modules/video_output/opengl/filters.h
+++ b/modules/video_output/opengl/filters.h
@@ -25,6 +25,7 @@
#include <vlc_common.h>
#include <vlc_list.h>
#include <vlc_opengl.h>
+#include <vlc_tick.h>
#include "filter.h"
#include "gl_api.h"
diff --git a/modules/video_output/opengl/renderer.c b/modules/video_output/opengl/renderer.c
index 10b79e7742..74bafcd6ef 100644
--- a/modules/video_output/opengl/renderer.c
+++ b/modules/video_output/opengl/renderer.c
@@ -328,7 +328,7 @@ Close(struct vlc_gl_filter *filter)
static int SetupCoords(struct vlc_gl_renderer *renderer);
static int
-Draw(struct vlc_gl_filter *filter);
+Draw(struct vlc_gl_filter *filter, const struct vlc_gl_input_meta *meta);
int
vlc_gl_renderer_Open(struct vlc_gl_filter *filter,
@@ -756,8 +756,10 @@ static int SetupCoords(struct vlc_gl_renderer *renderer)
}
static int
-Draw(struct vlc_gl_filter *filter)
+Draw(struct vlc_gl_filter *filter, const struct vlc_gl_input_meta *meta)
{
+ (void) meta;
+
struct vlc_gl_renderer *renderer = filter->sys;
const opengl_vtable_t *vt = renderer->vt;
--
2.27.0
More information about the vlc-devel
mailing list