VLC 4.0.0-dev
Loading...
Searching...
No Matches
vlc_opengl_sampler.h File Reference

This file defines the public OpenGL sampler interface. More...

Include dependency graph for vlc_opengl_sampler.h:

Go to the source code of this file.

Data Structures

struct  vlc_gl_sampler_ops
struct  vlc_gl_sampler
 OpenGL sampler. More...

Macros

#define set_callback_opengl_sampler(open)

Typedefs

typedef int vlc_gl_sampler_open_fn(struct vlc_gl_sampler *sampler, bool expose_planes)
 Activation function for OpenGL sampler module implementations.

Functions

static void vlc_gl_sampler_FetchLocations (struct vlc_gl_sampler *sampler, uint32_t program)
 Callback to fetch locations of uniform or attribute variables.
static void vlc_gl_sampler_Load (struct vlc_gl_sampler *sampler)
 Callback to load sampler data.
static int vlc_gl_sampler_Update (struct vlc_gl_sampler *sampler, const struct vlc_gl_picture *picture)
 Update the input picture.
static void vlc_gl_sampler_SelectPlane (struct vlc_gl_sampler *sampler, unsigned plane)
 Select the plane to expose.

Detailed Description

This file defines the public OpenGL sampler interface.

The purpose of a sampler is to provide pixel values of a VLC input picture, stored in any format.

Concretely, a GLSL function:

vec4 vlc_texture(vec2 coords)

returns the RGBA values for the given coordinates.

Contrary to the standard GLSL function:

vec4 texture2D(sampler2D sampler, vec2 coords)

it does not take a sampler2D as parameter. The role of the sampler is to abstract the input picture from the filter, so the input picture is implicitly available.

Macro Definition Documentation

◆ set_callback_opengl_sampler

#define set_callback_opengl_sampler ( open)
Value:
{ \
vlc_gl_sampler_open_fn *fn = open; \
(void) fn; \
set_callback(fn); \
}
int vlc_gl_sampler_open_fn(struct vlc_gl_sampler *sampler, bool expose_planes)
Activation function for OpenGL sampler module implementations.
Definition vlc_opengl_sampler.h:245

Typedef Documentation

◆ vlc_gl_sampler_open_fn

typedef int vlc_gl_sampler_open_fn(struct vlc_gl_sampler *sampler, bool expose_planes)

Activation function for OpenGL sampler module implementations.

The input format is described by the public fields of the sampler object which are populated before the module is loaded.

Parameters
samplerthe sampler
expose_planesif set, vlc_texture() exposes a single plane at a time
Returns
VLC_SUCCESS when the module can be opened

Function Documentation

◆ vlc_gl_sampler_FetchLocations()

void vlc_gl_sampler_FetchLocations ( struct vlc_gl_sampler * sampler,
uint32_t program )
inlinestatic

Callback to fetch locations of uniform or attribute variables.

This function pointer cannot be NULL. This callback is called one time after the program is linked.

Parameters
samplerthe sampler
programthe linked GL program handle

References vlc_gl_sampler_ops::fetch_locations, and vlc_gl_sampler::ops.

◆ vlc_gl_sampler_Load()

void vlc_gl_sampler_Load ( struct vlc_gl_sampler * sampler)
inlinestatic

Callback to load sampler data.

This function pointer cannot be NULL. This callback can be used to specify values of uniform variables.

Parameters
samplerthe sampler

References vlc_gl_sampler_ops::load, and vlc_gl_sampler::ops.

◆ vlc_gl_sampler_SelectPlane()

void vlc_gl_sampler_SelectPlane ( struct vlc_gl_sampler * sampler,
unsigned plane )
inlinestatic

Select the plane to expose.

If the sampler exposes planes separately (for plane filters), select the plane to expose via the GLSL function vlc_texture().

Parameters
samplerthe sampler
planethe plane number

References vlc_gl_sampler::ops, and vlc_gl_sampler_ops::select_plane.

◆ vlc_gl_sampler_Update()

int vlc_gl_sampler_Update ( struct vlc_gl_sampler * sampler,
const struct vlc_gl_picture * picture )
inlinestatic

Update the input picture.

Parameters
samplerthe sampler
picturethe OpenGL picture
Returns
VLC_SUCCESS or a VLC error

References vlc_gl_sampler::ops, and vlc_gl_sampler_ops::update.