Skip to content

Extract OpenGL filter wrapper

Romain Vimont requested to merge rom1v/vlc:opengl_filter_wrapper into master

In order to implement several standalone video filters (with capability "video filter") using OpenGL filters (with capability "opengl filter"), define an helper to delegate the work to the opengl video filter.

Co-authored-by: vatsin1810 <suchak@sas.upenn.edu>


Context

The OpenGL filters API is separate from the video filter API, and is intended to be called from a video filter.

The easiest way to call a custom OpenGL filter is to use the opengl video filter and pass the OpenGL filter name as an argument:

vlc --video-filter=opengl --opengl-filter=my_opengl_filter video.mkv

However, it may be useful to wrap an OpenGL filter into a specific video filter (which will delegate the work to the opengl.c module). For example, the glblend (!73 (merged)) filter must be exposed as a "video filter" to be used as a deinterlace filter.

To avoid writing the same glue code again and again, expose a helper in the core API.

Previous work

This change is inspired from the work from vatsin: gsoc/gsoc2020/vatsin/vlc@f321f98b

Compared to this commit, the helper in this MR just delegates the work to the opengl module, but does not define the static function to call. This allows the caller to execute its own code in the wrapper (like glblend does), and avoids a layer of "magic macro".

The implementation also avoids the creation of a new filter chain (it just delegates the work to the unique opengl video filter). In the end, the existing code used in glblend is just moved to an helper.

Merge request reports