[vlc-devel] [PATCH 02/15] display: only pass the vout_display_priv_t to vout_display_start()
Thomas Guillem
thomas at gllm.fr
Thu Sep 3 10:06:33 CEST 2020
On Thu, Sep 3, 2020, at 07:52, Steve Lhomme wrote:
> All the fields we use in this function comes from this structure.
>
> Move the function after the vout_display_priv_t definition.
> ---
> src/video_output/display.c | 46 +++++++++++++++++++-------------------
> 1 file changed, 23 insertions(+), 23 deletions(-)
>
> diff --git a/src/video_output/display.c b/src/video_output/display.c
> index 58a524543ae..85a84ddba2d 100644
> --- a/src/video_output/display.c
> +++ b/src/video_output/display.c
> @@ -76,27 +76,6 @@ static int vout_display_Control(vout_display_t *vd,
> int query, ...)
> *
>
> *****************************************************************************/
>
> -static int vout_display_start(void *func, bool forced, va_list ap)
> -{
> - vout_display_open_cb activate = func;
> - vout_display_t *vd = va_arg(ap, vout_display_t *);
> - const vout_display_cfg_t *cfg = va_arg(ap, const vout_display_cfg_t *);
> - vlc_video_context *context = va_arg(ap, vlc_video_context *);
> -
> - /* Picture buffer does not have the concept of aspect ratio */
> - video_format_Copy(&vd->fmt, &vd->source);
> - vd->fmt.i_sar_num = 0;
> - vd->fmt.i_sar_den = 0;
> - vd->obj.force = forced; /* TODO: pass to activate() instead? */
> -
> - int ret = activate(vd, cfg, &vd->fmt, context);
> - if (ret != VLC_SUCCESS) {
> - video_format_Clean(&vd->fmt);
> - vlc_objres_clear(VLC_OBJECT(vd));
> - }
> - return ret;
> -}
> -
> /* */
> void vout_display_GetDefaultDisplaySize(unsigned *width, unsigned *height,
> const video_format_t *source,
> @@ -309,6 +288,28 @@ typedef struct {
> picture_pool_t *pool;
> } vout_display_priv_t;
>
> +static int vout_display_start(void *func, bool forced, va_list ap)
> +{
> + vout_display_open_cb activate = func;
> + vout_display_priv_t *osys = va_arg(ap, vout_display_priv_t *);
> + const vout_display_cfg_t *cfg = &osys->cfg;
> + vout_display_t *vd = &osys->display;
> + vlc_video_context *context = osys->src_vctx;
> +
> + /* Picture buffer does not have the concept of aspect ratio */
> + video_format_Copy(&vd->fmt, &vd->source);
> + vd->fmt.i_sar_num = 0;
> + vd->fmt.i_sar_den = 0;
> + vd->obj.force = forced; /* TODO: pass to activate() instead? */
> +
> + int ret = activate(vd, cfg, &vd->fmt, context);
> + if (ret != VLC_SUCCESS) {
> + video_format_Clean(&vd->fmt);
> + vlc_objres_clear(VLC_OBJECT(vd));
> + }
> + return ret;
> +}
Could you split the move for better readability?
> +
> static vlc_decoder_device * DisplayHoldDecoderDevice(vlc_object_t *o,
> void *sys)
> {
> VLC_UNUSED(o);
> @@ -748,8 +749,7 @@ vout_display_t *vout_display_New(vlc_object_t
> *parent,
> vd->sys = NULL;
>
> if (vlc_module_load(vd, "vout display", module, module && *module != '\0',
> - vout_display_start, vd, &osys->cfg,
> - osys->src_vctx) == NULL)
> + vout_display_start, osys) == NULL)
> goto error;
>
> #if defined(__OS2__)
> --
> 2.26.2
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list