[vlc-devel] [PATCH 22/48] video_output: add vout_ChangeSource to set a new source for the display

Rémi Denis-Courmont remi at remlab.net
Sat Oct 12 15:09:32 CEST 2019


Le perjantaina 11. lokakuuta 2019, 16.33.36 EEST Steve Lhomme a écrit :
> It may not work, in which case a new display/thread should be created to
> handle the new format.

As noted earlier, I don't think this extra function should exist. We have to 
be able to reuse the window across stop/start so it's very unclear what the 
benefit is ??

> 
> No functional changes.
> ---
>  src/video_output/video_output.c  | 31 ++++++++++++++++++++++---------
>  src/video_output/vout_internal.h |  8 ++++++++
>  2 files changed, 30 insertions(+), 9 deletions(-)
> 
> diff --git a/src/video_output/video_output.c
> b/src/video_output/video_output.c index 13866dddd0d..1f3f3f9ef70 100644
> --- a/src/video_output/video_output.c
> +++ b/src/video_output/video_output.c
> @@ -1943,6 +1943,24 @@ vout_thread_t *vout_Hold(vout_thread_t *vout)
>      return vout;
>  }
> 
> +int vout_ChangeSource( vout_thread_t *vout, const video_format_t *original,
> unsigned dpb_size ) +{
> +    vout_thread_sys_t *sys = vout->p;
> +
> +     /* TODO: If dimensions are equal or slightly smaller, update the
> aspect +     * ratio and crop settings, instead of recreating a display.
> +     */
> +    if (video_format_IsSimilar(original, &sys->original)) {
> +        if (dpb_size <= sys->dpb_size) {
> +            /* It is assumed that the SPU input matches input already. */
> +            return 0;
> +        }
> +        msg_Warn(vout, "DPB need to be increased");
> +    }
> +
> +    return -1;
> +}
> +
>  static int vout_EnableWindow(const vout_configuration_t *cfg, const
> video_format_t *original, vlc_decoder_device **pp_dec_device)
>  {
> @@ -2001,15 +2019,10 @@ int vout_Request(const vout_configuration_t *cfg,
> vlc_decoder_device *dec_dev, i video_format_t original;
>      VoutFixFormat(&original, cfg->fmt);
> 
> -    /* TODO: If dimensions are equal or slightly smaller, update the aspect
> -     * ratio and crop settings, instead of recreating a display.
> -     */
> -    if (video_format_IsSimilar(&original, &sys->original)) {
> -        if (cfg->dpb_size <= sys->dpb_size) {
> -            video_format_Clean(&original);
> -            return 0;
> -        }
> -        msg_Warn(vout, "DPB need to be increased");
> +    if (vout_ChangeSource(vout, &original, cfg->dpb_size) == 0)
> +    {
> +        video_format_Clean(&original);
> +        return 0;
>      }
> 
>      if (vout_EnableWindow(cfg, &original, NULL) != 0)
> diff --git a/src/video_output/vout_internal.h
> b/src/video_output/vout_internal.h index 713751c26d7..747f8934f71 100644
> --- a/src/video_output/vout_internal.h
> +++ b/src/video_output/vout_internal.h
> @@ -242,6 +242,14 @@ void vout_StopDisplay(vout_thread_t *);
>   */
>  void vout_Close( vout_thread_t *p_vout );
> 
> +/**
> + * Set the new source format for a started vout
> + *
> + * \retval 0 on success
> + * \retval -1 on error, the vout needs to be restarted to handle the format
> + */
> +int vout_ChangeSource( vout_thread_t *p_vout, const video_format_t *fmt,
> unsigned dpb_size ); +
>  /* TODO to move them to vlc_vout.h */
>  void vout_ChangeFullscreen(vout_thread_t *, const char *id);
>  void vout_ChangeWindowed(vout_thread_t *);


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





More information about the vlc-devel mailing list