[vlc-devel] [PATCH 00/21 v2] Merge OpenGL and Direct3D libvlc callbacks

Steve Lhomme robux4 at ycbcr.xyz
Wed Feb 5 16:13:08 CET 2020


The 2 API's are very similar. Apart from distinct namings and some extra 
features in Direct3D they work the same. First a "device" is setup, the texture
were libvlc is going to render is resized, then there's rendering and a swap 
(in between a "make current enter/leave").

The OpenGL API had a GetProcessAddress that is not used in D3D.

The Direct3D API had support for reporting host size change so that VLC can
resize the (fake) window and provide more appropriate text rendering or
reposition the rendering area. This API is now available to OpenGL hosts.

The Direct3D API allowed the host to use a different opaque after the Setup
callback is called. That allows allocating the graphics resources during the
setup, including multiple playback in the same host. This API is now available 
to OpenGL hosts.

The Direct3D11 engine has support for HDR and tone mapping between what VLC 
provides and what the host reports it is going to handle with that source.
To do that we need to tell the host what the source is like and the host needs
to tell what it will use. In OpenGL this API currently doesn't support any
tone mapping.

The Direct3D11 engine supports rendering the texture planes separately. This
API is not used by the OpenGL API. The callback is ignored, just like with D3D9.

The HDR10 metadata are also passed to the host with each frame so it could
theoretically send them over HDMI (since we're not the ones rendering to the 
display).

Changes since the previous v1:
 - use a separate callback to set the HRD10 metadata, with a typed pointer
 - reorder some patches to do the _direct3d renaming before using the callbacks
   in the OpenGL API
  - use a union for the received device setup data as the fields are exclusive
  - fix some comments about the opaque that is returned from the device setup

This patchset can be found on this branch:
https://code.videolan.org/robUx4/vlc/tree/callbacks/23

Steve Lhomme (21):
  libvlc: add a callback to pass frame metadata before rendering
  libvlc: rename libvlc_video_direct3d_hdr10_metadata_t to a more
    generic name
  libvlc: merge direct3d_start_end_rendering_cb and makeCurrent_cb
  libvlc: make the OpenGL host tell the rendering colorimetry it's using
  libvlc: pass the OpenGL rendering configuration update as a structure
  libvlc: merge libvlc_video_render_cfg_t and
    libvlc_video_direct3d_cfg_t
  libvlc: let the OpenGL host refuse a source format if it can't handle
    it
  libvlc: merge direct3d_update_output_cb update into update_output_cb
  libvlc: fix the libvlc_video_cleanup_cb comment
  libvlc: use a union for exclusive video_direct3d_device_setup_t values
  libvlc: rename the OpenGL callbacks cleanup callback type
  libvlc: let the OpenGL host app change the opaque data used for the
    session
  libvlc: rename libvlc_video_direct3d_device_cfg_t /
    libvlc_video_setup_device_info_t
  libvlc: merge libvlc_video_setup_cb and
    libvlc_video_direct3d_device_setup_cb
  libvlc: rename libvlc_video_setup_cb to a less generic name
  libvlc: merge libvlc_video_direct3d_device_cleanup_cb and
    libvlc_video_output_cleanup_cb
  libvlc: rename libvlc_video_direct3d_set_resize_cb to a more generic
    name
  libvlc: let the OpenGL host app tell libvlc its rendering area changed
  libvlc: rename the select_plane callback to something more generic
  libvlc: pass the select_plane/frame_metadata callback to OpenGL as
    well
  libvlc: merge libvlc_video_direct3d_set_callbacks into
    libvlc_video_set_output_callbacks

 doc/libvlc/QtGL/qtvlcwidget.cpp              |  36 +-
 doc/libvlc/d3d11_player.cpp                  |  13 +-
 doc/libvlc/d3d9_player.c                     |  13 +-
 doc/libvlc/sdl_opengl_player.cpp             |  32 +-
 include/vlc/libvlc_media_player.h            | 331 ++++++++-----------
 lib/libvlc.sym                               |   1 -
 lib/media_player.c                           |  41 +--
 modules/hw/d3d11/d3d11_device.c              |  10 +-
 modules/hw/d3d9/d3d9_device.c                |  10 +-
 modules/video_output/vgl.c                   |  29 +-
 modules/video_output/wextern.c               |   4 +-
 modules/video_output/win32/d3d11_swapchain.c |  51 +--
 modules/video_output/win32/d3d11_swapchain.h |   5 +-
 modules/video_output/win32/direct3d11.c      |  50 +--
 modules/video_output/win32/direct3d9.c       |  12 +-
 15 files changed, 306 insertions(+), 332 deletions(-)

-- 
2.17.1



More information about the vlc-devel mailing list