[vlc-devel] [RFC 0/8] libvlc common API to render to outside surface

Steve Lhomme robux4 at ycbcr.xyz
Tue Nov 20 16:42:34 CET 2018


Here is a first draft of an API to render to outside surfaces. It works with
the OpenGL video display and D3D11/D3D9 with patches I will send later.

Some additions to the current OpenGL are needed to have something more generic.
Especially passing the outside GPU device context to the API. D3D doesn't have
the notion of "make current" context. Each call has to be done on the right
object. Maybe an OpenGL context might be used instead of "make current" but I
don't know enough.

Because of this device, there has to be a way to share the resource. So we tell
the host app when we're about to use it and when we're done.

The update_output API will probably evolve to include the requested bit depth,
the transfer function (PQ or HLG), chroma, full/studio scale, etc. There should
also be a way to return the actual format in use (not all combinations might be
available on the screen/texture/host) so the vout can adapt the rendering (HDR
to SDR for example). For now only basic RGBA is supported (just like in OpenGL).

With these changes in the vouts, they become code to render to a texture that is
either the screen in our window or some other texture (that may be the screen).
It could be used to do more processing inside the GPU like HDR to SDR conversion
360 to 2D conversion, chroma, resizing, cropping, SPU blending, etc. The code in
the OpenGL, Direct3D11 vout could be adapted to output a picture_t using another
set of callbacks than the ones currently in use.

Steve Lhomme (8):
  libvlc: add a bool return value to the resize callback
  libvlc: rename libvlc_gl_resize_cb to libvlc_update_output_cb
  libvlc: rename libvlc_video_set_opengl_callbacks() to
    libvlc_video_set_output_callbacks()
  libvlc: remove the _gl_ from the video output callbacks API
  libvlc: pass the video output callbacks using a structure
  libvlc: add a callback to notify the host when the rendering
    starts/ends
  libvlc: add an engine context pointer to the callbacks structure
  libvlc: return an false if setting the callback fails

 doc/libvlc/sdl_opengl_player.cpp  |  23 ++++--
 include/vlc/libvlc_media_player.h | 131 ++++++++++++++++++++++--------
 lib/libvlc.sym                    |   4 +-
 lib/media_player.c                |  72 +++++++++-------
 modules/video_output/vgl.c        |  25 +++---
 5 files changed, 172 insertions(+), 83 deletions(-)

-- 
2.17.1



More information about the vlc-devel mailing list