[vlc-devel] [PATCH] libvlc: handle the report size callback in the wextern window module
Rémi Denis-Courmont
remi at remlab.net
Sun Jun 9 10:41:23 CEST 2019
Le perjantaina 7. kesäkuuta 2019, 11.15.44 EEST Steve Lhomme a écrit :
> This way it can work for all modules that render externally. And the code is
> generic. It also makes more sense to handle the window size in the window
> module.
> ---
> doc/libvlc/d3d11_player.cpp | 30 +++++------
> doc/libvlc/d3d9_player.c | 29 ++++++-----
> include/vlc/libvlc_media_player.h | 27 +++++++---
> lib/media_player.c | 3 ++
> modules/video_output/wextern.c | 66 +++++++++++++++++++++----
> modules/video_output/win32/direct3d11.c | 9 ----
> modules/video_output/win32/direct3d9.c | 3 --
> 7 files changed, 110 insertions(+), 57 deletions(-)
> diff --git a/include/vlc/libvlc_media_player.h
> b/include/vlc/libvlc_media_player.h index c1529fdecc..2920605ae4 100644
> --- a/include/vlc/libvlc_media_player.h
> +++ b/include/vlc/libvlc_media_player.h
> @@ -655,6 +647,23 @@ typedef bool( *libvlc_video_direct3d_device_setup_cb )(
> void **opaque, */
> typedef void( *libvlc_video_direct3d_device_cleanup_cb )( void *opaque );
>
> +/** Set the callback to call when the host app resizes the rendering area.
> + *
> + * This allows text rendering and aspect ratio to be handled properly when
> the host
> + * rendering size changes.
> + *
> + * It may be called before the \ref libvlc_video_direct3d_device_setup_cb
> callback.
> + *
> + * \param opaque private pointer set on the opaque parameter of @a
> libvlc_video_direct3d_device_setup_cb() [IN]
> + * \param report_size_change
> callback to use when the size changes. [IN]
> + * The callback is
> valid until another call to \ref libvlc_video_direct3d_set_resize_cb
> + *
> is done. This may be called from any thread.
> + * \param report_opaque private pointer to pass to the \ref
> report_size_change callback. [IN]
> + */
> +typedef void( *libvlc_video_direct3d_set_resize_cb )( void *opaque,
> + void
> (*report_size_change)(void *report_opaque, unsigned width, unsigned
> height), + void
> *report_opaque ); +
> typedef struct
> {
> unsigned width; /** rendering video width in
> pixel */
Passing a callback to a callback assumes that the host application only ever
wants to change the size when LibVLC wants to. I don't think we can generally
make that assumption.
AFAICT, we need a regular (not callback) LibVLC function that specifies the
window, the resolution - which means we need to be able to track window
instances.
Also, this assumes that changing the size can be done asynchronously. In
general, that's not true. For instance, X11 works that way. But Wayland needs
to wait until the size change has been seen by the display before it
acknowledges a size change. Some other backends may have even stronger
constraints.
--
レミ・デニ-クールモン
http://www.remlab.net/
More information about the vlc-devel
mailing list