[vlc-devel] [PATCH 00/27] Add support for OpenGL filters

Romain Vimont rom1v at videolabs.io
Thu Jun 25 14:22:47 CEST 2020


Add an API to execute OpenGL filters (loaded as VLC modules) in the OpenGL
vout (for now).

There are two types of filters:
 - blend filters just draw over the provided framebuffer (containing the result
   of the previous filter), without reading the input picture.
 - non-blend filters read their input picture and draw whatever they want to
   their own output framebuffer.

For example, a blend filter could be used to add a logo over the video, while
a non-blend filter could be used to deform the video.

This patchset adds several samples in doc/. To build and run them, see
doc/opengl_filters/README.md (patch "doc: prepare opengl filters samples").

In short:

    # build
    cd builddir
    ../configure --enable-opengl-filters-samples
    make  # build VLC as usual

    # run
    export VLC_PLUGIN_PATH=modules:doc
    ./vlc file.mkv --gl-filters=filter1:filter2:filter3

Four samples are provided to illustrate how the API works:
 - triangle: a blend filter drawing a triangle over the video
 - triangle_rotate: the same, but with a parameter to provide a rotation angle
 - triangle_clock: a triangle rotating according to the video timestamps
 - triangle_mask: a non-blend filter drawing the video in a triangle

You could for example test the following:

    export VLC_PLUGIN_PATH=modules:doc
    ./vlc file.mkv --gl-filters='triangle_clock:triangle_mask:triangle_rotate{angle=20}'

(sorry for your eyes)

This feature has been co-authored by Alexandre Janniaux.

MR: https://code.videolan.org/rom1v/vlc/-/merge_requests/12

Romain Vimont (27):
  opengl: introduce OpenGL filter API
  opengl: add filter private part
  opengl: add filters chain
  opengl: use modules for OpenGL filters
  opengl: store video format in sampler
  opengl: add "direct" sampler
  opengl: attach samplers to filters
  opengl: load filters from command-line arguments
  opengl: pass output size to filters
  opengl: add support for renderbuffers API
  opengl: create and bind filters framebuffers
  opengl: use default draw framebuffer
  opengl: add "draw" filter
  opengl: support "blend" filters
  opengl: lazy-load sampler
  opengl: apply viewport on filters
  opengl: pass picture PTS to filters
  opengl: add support for renderbuffers API
  opengl: init filters framebuffers in a second pass
  opengl: enable multisampling
  opengl: document filters implementation
  modules: use VLC_PLUGIN_PATH if it exists
  doc: prepare opengl filters samples
  doc: opengl filter: add triangle sample
  doc: opengl filter: add triangle_mask sample
  doc: opengl filter: add triangle_rotate sample
  doc: opengl filter: add triangle_clock sample

 Makefile.am                                |   2 +-
 bin/vlc.c                                  |   2 +-
 configure.ac                               |   7 +
 doc/Makefile.am                            |   2 +-
 doc/opengl_filters/Makefile.am             |  53 ++
 doc/opengl_filters/README.md               |  22 +
 doc/opengl_filters/triangle.c              | 197 ++++++++
 doc/opengl_filters/triangle_clock.c        | 221 +++++++++
 doc/opengl_filters/triangle_mask.c         | 190 +++++++
 doc/opengl_filters/triangle_rotate.c       | 237 +++++++++
 modules/video_output/caopengllayer.m       |  11 +-
 modules/video_output/ios.m                 |  14 +-
 modules/video_output/macosx.m              |  11 +-
 modules/video_output/opengl/Makefile.am    |   7 +
 modules/video_output/opengl/display.c      |  14 +-
 modules/video_output/opengl/filter.c       | 128 +++++
 modules/video_output/opengl/filter.h       | 115 +++++
 modules/video_output/opengl/filter_draw.c  | 181 +++++++
 modules/video_output/opengl/filter_draw.h  |  36 ++
 modules/video_output/opengl/filter_priv.h  |  83 ++++
 modules/video_output/opengl/filters.c      | 546 +++++++++++++++++++++
 modules/video_output/opengl/filters.h      | 109 ++++
 modules/video_output/opengl/gl_api.c       |  27 +
 modules/video_output/opengl/gl_api.h       |   3 +
 modules/video_output/opengl/gl_common.h    |  27 +
 modules/video_output/opengl/renderer.c     |  95 ++--
 modules/video_output/opengl/renderer.h     |  38 +-
 modules/video_output/opengl/sampler.c      | 108 +++-
 modules/video_output/opengl/sampler.h      |   2 +-
 modules/video_output/opengl/sampler_priv.h |  41 +-
 modules/video_output/opengl/vout_helper.c  | 110 ++++-
 modules/video_output/opengl/vout_helper.h  |   6 +-
 modules/video_output/win32/glwin32.c       |  11 +-
 33 files changed, 2547 insertions(+), 109 deletions(-)
 create mode 100644 doc/opengl_filters/Makefile.am
 create mode 100644 doc/opengl_filters/README.md
 create mode 100644 doc/opengl_filters/triangle.c
 create mode 100644 doc/opengl_filters/triangle_clock.c
 create mode 100644 doc/opengl_filters/triangle_mask.c
 create mode 100644 doc/opengl_filters/triangle_rotate.c
 create mode 100644 modules/video_output/opengl/filter.c
 create mode 100644 modules/video_output/opengl/filter.h
 create mode 100644 modules/video_output/opengl/filter_draw.c
 create mode 100644 modules/video_output/opengl/filter_draw.h
 create mode 100644 modules/video_output/opengl/filter_priv.h
 create mode 100644 modules/video_output/opengl/filters.c
 create mode 100644 modules/video_output/opengl/filters.h

-- 
2.27.0



More information about the vlc-devel mailing list