[vlc-devel] [PATCH 2/4] libvlc: provide a callback to the host that it can call when its size changes

Rémi Denis-Courmont remi at remlab.net
Sun May 26 19:55:25 CEST 2019


Le perjantaina 24. toukokuuta 2019, 17.31.44 EEST Steve Lhomme a écrit :
> ---
>  include/vlc/libvlc_media_player.h       | 8 ++++++++
>  lib/media_player.c                      | 2 +-
>  modules/video_output/win32/direct3d11.c | 5 ++++-
>  modules/video_output/win32/direct3d9.c  | 5 ++++-
>  4 files changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/include/vlc/libvlc_media_player.h
> b/include/vlc/libvlc_media_player.h index 89b29b1afb..4c467b0658 100644
> --- a/include/vlc/libvlc_media_player.h
> +++ b/include/vlc/libvlc_media_player.h
> @@ -611,6 +611,14 @@ typedef enum libvlc_video_direct3d_engine_t {
>  typedef struct
>  {
>      bool hardware_decoding; /** set if D3D11_CREATE_DEVICE_VIDEO_SUPPORT is
> needed for D3D11 */ +
> +    /** Callback to call when the size of the host changes
> +     *
> +     * \note This may be called from any thread as long as it's not after
> +     *    \ref libvlc_video_direct3d_device_cleanup_cb has been called.
> +     */
> +    void (*repot_size_change)(void *report_opaque, unsigned width, unsigned
> height);

What does repot mean?

> +    void *report_opaque;
>  } libvlc_video_direct3d_device_cfg_t;
> 
>  typedef struct
> diff --git a/lib/media_player.c b/lib/media_player.c
> index fd085c3793..ab5b5d43c7 100644
> --- a/lib/media_player.c
> +++ b/lib/media_player.c
> @@ -1073,7 +1073,7 @@ bool
> libvlc_video_direct3d_set_callbacks(libvlc_media_player_t *mp,
> libvlc_video_direct3d_select_plane_cb select_plane_cb, void *opaque)
>  {
> -    var_SetString( mp, "window", "wdummy");
> +    var_SetString( mp, "window", "wextern");
> 
>      if ( engine == libvlc_video_direct3d_engine_d3d11 )
>      {
> diff --git a/modules/video_output/win32/direct3d11.c
> b/modules/video_output/win32/direct3d11.c index e057f20fbd..b0cd73f151
> 100644
> --- a/modules/video_output/win32/direct3d11.c
> +++ b/modules/video_output/win32/direct3d11.c
> @@ -1372,7 +1372,10 @@ static int Direct3D11Open(vout_display_t *vd,
> video_format_t *fmtp) HRESULT hr = E_FAIL;
> 
>      libvlc_video_direct3d_device_cfg_t cfg = {
> -        .hardware_decoding = is_d3d11_opaque( vd->source.i_chroma )
> +        .hardware_decoding = is_d3d11_opaque( vd->source.i_chroma ),
> +        /* bypass the size handling as the window doesn't handle the size
> */
> +        .repot_size_change = vd->cfg->window->ops->resize ? NULL:
> vout_window_ReportSize,
> +        .report_opaque     =
> vd->cfg->window->ops->resize ? NULL: vd->cfg->window, };

This seems to assume that window->ops is a constant (after the activation 
callback returned). Currently, there is no such constraint. It should be 
documented if it's added.

>      libvlc_video_direct3d_device_setup_t out;
>      ID3D11DeviceContext *d3d11_ctx = NULL;
> diff --git a/modules/video_output/win32/direct3d9.c
> b/modules/video_output/win32/direct3d9.c index 3f1381c3fe..d344534052
> 100644
> --- a/modules/video_output/win32/direct3d9.c
> +++ b/modules/video_output/win32/direct3d9.c
> @@ -1711,7 +1711,10 @@ static int Open(vout_display_t *vd, const
> vout_display_cfg_t *cfg, }
> 
>      libvlc_video_direct3d_device_cfg_t surface_cfg = {
> -        .hardware_decoding = is_d3d9_opaque( vd->source.i_chroma )
> +        .hardware_decoding = is_d3d9_opaque( vd->source.i_chroma ),
> +        /* bypass the size handling as the window doesn't handle the size
> */ +        .repot_size_change = vd->cfg->window->ops->resize ? NULL:
> vout_window_ReportSize, +        .report_opaque     =
> vd->cfg->window->ops->resize ? NULL: vd->cfg->window, };
>      libvlc_video_direct3d_device_setup_t device_setup;
>      IDirect3DDevice9 *d3d9_device = NULL;


-- 
雷米‧德尼-库尔蒙
http://www.remlab.net/





More information about the vlc-devel mailing list