VLC 4.0.0-dev
Loading...
Searching...
No Matches
vlc_opengl_filter.h
Go to the documentation of this file.
1/*****************************************************************************
2 * vlc_opengl_filter.h
3 *****************************************************************************
4 * Copyright (C) 2020 VLC authors and VideoLAN
5 * Copyright (C) 2020-2023 Videolabs
6 *
7 * Authors: Alexandre Janniaux <ajanni@videolabs.io>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
23
24#ifndef VLC_OPENGL_FILTER_H
25#define VLC_OPENGL_FILTER_H
26
27#include <vlc_tick.h>
28#include <vlc_ancillary.h>
29#include <vlc_es.h>
30
31struct vlc_gl_filter;
32struct vlc_gl_picture;
33struct vlc_gl_format;
34
35#ifdef __cplusplus
36extern "C"
37{
38#endif
39
40struct vlc_gl_tex_size {
41 unsigned width;
42 unsigned height;
43};
44
45struct vlc_gl_input_meta {
52typedef int
55 const struct vlc_gl_format *glfmt,
56 struct vlc_gl_tex_size *size_out);
57
58#define set_callback_opengl_filter(open) \
59 { \
60 vlc_gl_filter_open_fn *fn = open; \
61 (void) fn; \
62 set_callback(fn); \
63 }
64
65struct vlc_gl_filter_ops {
66 /**
67 * Draw the result of the filter to the current framebuffer
68 */
69 int (*draw)(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic,
70 const struct vlc_gl_input_meta *meta);
71
72 /**
73 * Free filter resources
74 */
75 void (*close)(struct vlc_gl_filter *filter);
77 /**
78 * Request a (responsive) filter to adapt its output size (optional)
79 *
80 * A responsive filter is a filter for which the size of the produced
81 * pictures depends on the output (e.g. display) size rather than the
82 * input. This is for example the case for a renderer.
83 *
84 * A new output size is requested (size_out). The filter is authorized to
85 * change the size_out to enforce its own constraints.
86 *
87 * In addition, it may request to the previous filter (if any) an optimal
88 * size it wants to receive. If set to non-zero value, this previous filter
89 * will receive this size as its requested size (and so on).
90 *
91 * \retval true if the resize is accepted (possibly with a modified
92 * size_out)
93 * \retval false if the resize is rejected (included on error)
94 */
95 int (*request_output_size)(struct vlc_gl_filter *filter,
96 struct vlc_gl_tex_size *size_out,
97 struct vlc_gl_tex_size *optimal_in);
98
99 /**
100 * Callback to notify input size changes
101 *
102 * When a filter changes its output size as a result of
103 * request_output_size(), the next filter is notified by this callback.
104 */
105 void (*on_input_size_change)(struct vlc_gl_filter *filter,
106 const struct vlc_gl_tex_size *size);
107};
108
109/**
110 * OpenGL filter, in charge of a rendering pass.
111 */
112struct vlc_gl_filter {
114 module_t *module;
115
116 struct vlc_gl_t *gl;
117 const struct vlc_gl_api *api;
118 const struct vlc_gl_format *glfmt_in;
120 struct {
121 /**
122 * An OpenGL filter may either operate on the input RGBA picture, or on
123 * individual input planes (without chroma conversion) separately.
124 *
125 * In practice, this is useful for deinterlace filters.
126 *
127 * This flag must be set by the filter module (default is false).
128 */
129 bool filter_planes;
131 /**
132 * A blend filter draws over the input picture (without reading it).
133 *
134 * Meaningless if filter_planes is true.
135 *
136 * This flag must be set by the filter module (default is false).
137 */
138 bool blend;
140 /**
141 * Request MSAA level.
142 *
143 * This value must be set by the filter module (default is 0, which
144 * means disabled).
145 *
146 * Meaningless if filter_planes is true.
147 *
148 * The actual MSAA level may be overwritten to 0 if multisampling is
149 * not supported, or to a higher value if another filter rendering on
150 * the same framebuffer requested a higher MSAA level.
151 */
152 unsigned msaa_level;
155 const struct vlc_gl_filter_ops *ops;
156 void *sys;
158
159#ifdef __cplusplus
160}
161#endif
162
163#endif
static struct @13 config
Definition vlc_configuration.h:320
Internal module descriptor.
Definition modules.h:76
Definition vlc_opengl_filter.h:66
int(* draw)(struct vlc_gl_filter *filter, const struct vlc_gl_picture *pic, const struct vlc_gl_input_meta *meta)
Draw the result of the filter to the current framebuffer.
Definition vlc_opengl_filter.h:70
int(* request_output_size)(struct vlc_gl_filter *filter, struct vlc_gl_tex_size *size_out, struct vlc_gl_tex_size *optimal_in)
Request a (responsive) filter to adapt its output size (optional)
Definition vlc_opengl_filter.h:96
void(* on_input_size_change)(struct vlc_gl_filter *filter, const struct vlc_gl_tex_size *size)
Callback to notify input size changes.
Definition vlc_opengl_filter.h:106
void(* close)(struct vlc_gl_filter *filter)
Free filter resources.
Definition vlc_opengl_filter.h:76
OpenGL filter, in charge of a rendering pass.
Definition vlc_opengl_filter.h:113
vlc_object_t obj
Definition vlc_opengl_filter.h:114
const struct vlc_gl_filter_ops * ops
Definition vlc_opengl_filter.h:156
const struct vlc_gl_format * glfmt_in
Definition vlc_opengl_filter.h:119
struct vlc_gl_filter::@271 config
bool filter_planes
An OpenGL filter may either operate on the input RGBA picture, or on individual input planes (without...
Definition vlc_opengl_filter.h:130
unsigned msaa_level
Request MSAA level.
Definition vlc_opengl_filter.h:153
void * sys
Definition vlc_opengl_filter.h:157
module_t *struct vlc_gl_t * gl
Definition vlc_opengl_filter.h:117
bool blend
A blend filter draws over the input picture (without reading it).
Definition vlc_opengl_filter.h:139
const struct vlc_gl_api * api
Definition vlc_opengl_filter.h:118
Definition vlc_opengl_filter.h:46
video_orientation_t orientation
Definition vlc_opengl_filter.h:50
vlc_tick_t pts
Definition vlc_opengl_filter.h:47
unsigned plane
Definition vlc_opengl_filter.h:48
const vlc_video_dovi_metadata_t * dovi_rpu
Definition vlc_opengl_filter.h:49
Definition vlc_opengl.h:100
Definition vlc_opengl_filter.h:41
unsigned height
Definition vlc_opengl_filter.h:43
unsigned width
Definition vlc_opengl_filter.h:42
VLC object common members.
Definition vlc_objects.h:53
Definition vlc_ancillary.h:138
Ancillary definition and functions.
This file is a collection of common definitions and types.
This file defines the elementary streams format types.
video_orientation_t
Picture orientation.
Definition vlc_es.h:181
int vlc_gl_filter_open_fn(struct vlc_gl_filter *filter, const config_chain_t *config, const struct vlc_gl_format *glfmt, struct vlc_gl_tex_size *size_out)
Definition vlc_opengl_filter.h:54
int64_t vlc_tick_t
High precision date or time interval.
Definition vlc_tick.h:48