[vlc-devel] [PATCH 5/5] libvlc: provide the source video dimensions when updating the surface dimensions

Rémi Denis-Courmont remi at remlab.net
Mon May 27 17:39:11 CEST 2019


Le maanantaina 27. toukokuuta 2019, 17.37.04 EEST Steve Lhomme a écrit :
> The host may decide to match the source video but it cannot do so if the
> resize callback settled the window size (which is also the rendering
> dimension) for good.
> ---
>  include/vlc/libvlc_media_player.h       |  3 +++
>  modules/video_output/win32/direct3d11.c | 10 ++++++++++
>  modules/video_output/win32/direct3d9.c  | 10 ++++++++++
>  3 files changed, 23 insertions(+)
> 
> diff --git a/include/vlc/libvlc_media_player.h
> b/include/vlc/libvlc_media_player.h index 472818c18a..1a6a0938a7 100644
> --- a/include/vlc/libvlc_media_player.h
> +++ b/include/vlc/libvlc_media_player.h
> @@ -664,6 +664,9 @@ typedef struct
>      libvlc_video_color_space_t colorspace;              /** video color
> space */ libvlc_video_color_primaries_t primaries;       /** video color
> primaries */ libvlc_video_transfer_func_t transfer;        /** video
> transfer function */ +
> +    unsigned source_width;                    /** original width of the
> video */ +    unsigned source_height;                  /** original height
> of the video */ } libvlc_video_direct3d_cfg_t;
> 
>  typedef struct
> diff --git a/modules/video_output/win32/direct3d11.c
> b/modules/video_output/win32/direct3d11.c index 49d487ef1c..37a98096c8
> 100644
> --- a/modules/video_output/win32/direct3d11.c
> +++ b/modules/video_output/win32/direct3d11.c
> @@ -268,6 +268,16 @@ static int QueryDisplayFormat(vout_display_t *vd, const
> video_format_t *fmt)
> 
>      cfg.width  = sys->area.vdcfg.display.width;
>      cfg.height = sys->area.vdcfg.display.height;
> +    if (fmt->i_sar_den && fmt->i_sar_num)
> +    {
> +        cfg.source_width  = fmt->i_visible_width  * fmt->i_sar_num /
> fmt->i_sar_den;
> +        cfg.source_height = fmt->i_visible_height *
> fmt->i_sar_num / fmt->i_sar_den;

I don't think SAR works that way.

> +    }
> +    else
> +    {
> +        cfg.source_width  = fmt->i_visible_width;
> +        cfg.source_height = fmt->i_visible_height;
> +    }
> 
>      switch (fmt->i_chroma)
>      {
> diff --git a/modules/video_output/win32/direct3d9.c
> b/modules/video_output/win32/direct3d9.c index 69a4665e3e..8384c8406b
> 100644
> --- a/modules/video_output/win32/direct3d9.c
> +++ b/modules/video_output/win32/direct3d9.c
> @@ -579,6 +579,16 @@ static int UpdateOutput(vout_display_t *vd, const
> video_format_t *fmt) libvlc_video_direct3d_cfg_t cfg;
>      cfg.width  = sys->area.vdcfg.display.width;
>      cfg.height = sys->area.vdcfg.display.height;
> +    if (fmt->i_sar_den && fmt->i_sar_num)
> +    {
> +        cfg.source_width  = fmt->i_visible_width  * fmt->i_sar_num /
> fmt->i_sar_den; +        cfg.source_height = fmt->i_visible_height *
> fmt->i_sar_num / fmt->i_sar_den; +    }
> +    else
> +    {
> +        cfg.source_width  = fmt->i_visible_width;
> +        cfg.source_height = fmt->i_visible_height;
> +    }
> 
>      switch (fmt->i_chroma)
>      {


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





More information about the vlc-devel mailing list