[vlc-devel] [PATCH 5/7] video_output: read the user crop values before creating the display
Thomas Guillem
thomas at gllm.fr
Tue Sep 1 12:44:37 CEST 2020
On Tue, Sep 1, 2020, at 12:06, Steve Lhomme wrote:
> ---
> src/video_output/video_output.c | 28 ++++++++++++++++++++++++++++
> src/video_output/vout_internal.h | 4 ++++
> src/video_output/vout_intf.c | 2 +-
> 3 files changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/src/video_output/video_output.c
> b/src/video_output/video_output.c
> index 78e17cda742..383130a7287 100644
> --- a/src/video_output/video_output.c
> +++ b/src/video_output/video_output.c
> @@ -2216,6 +2216,34 @@ int vout_Request(const vout_configuration_t
> *cfg, vlc_video_context *vctx, input
> }
>
> vlc_mutex_lock(&sys->window_lock);
> + char *psz_crop = var_InheritString(&vout->obj, "crop");
> + if (psz_crop) {
> + unsigned num, den;
> + unsigned y, x;
> + unsigned width, height;
> + enum vout_crop_mode mode;
> +
> + if (GetCropMode(psz_crop, &mode, &num, &den,
> + &x, &y, &width, &height))
> + {
> + switch (mode)
> + {
> + case VOUT_CROP_RATIO:
> + ChangeCropRatio(sys, num, den);
> + break;
> + case VOUT_CROP_WINDOW:
> + ChangeCropWindow(sys, x, y, width, height);
> + break;
> + case VOUT_CROP_BORDER:
> + ChangeCropBorder(sys, x, y, width, height);
> + break;
> + case VOUT_CROP_NONE:
> + break;
> + }
> + }
> + free(psz_crop);
> + }
> +
Is it possible to put this initialisation into VoutGetDisplayCfg() like it is already done for other properties?
> if (EnableWindowLocked(vout, &original) != 0)
> {
> /* the window was not enabled, nor the display started */
> diff --git a/src/video_output/vout_internal.h
> b/src/video_output/vout_internal.h
> index ef6625c1eea..54eb4a7c0a0 100644
> --- a/src/video_output/vout_internal.h
> +++ b/src/video_output/vout_internal.h
> @@ -104,6 +104,10 @@ int vout_ChangeSource( vout_thread_t *p_vout,
> const video_format_t *fmt );
> enum vout_crop_mode {
> VOUT_CROP_NONE, VOUT_CROP_RATIO, VOUT_CROP_WINDOW,
> VOUT_CROP_BORDER,
> };
> +bool GetCropMode(const char *crop_str, enum vout_crop_mode *mode,
> + unsigned *num, unsigned *den,
> + unsigned *x, unsigned *y,
> + unsigned *width, unsigned *height );
>
> /* TODO to move them to vlc_vout.h */
> void vout_ChangeFullscreen(vout_thread_t *, const char *id);
> diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
> index 534f783a456..630961125b7 100644
> --- a/src/video_output/vout_intf.c
> +++ b/src/video_output/vout_intf.c
> @@ -450,7 +450,7 @@ exit:
> free( psz_path );
> }
>
> -static bool GetCropMode(const char *crop_str, enum vout_crop_mode *mode,
> +bool GetCropMode(const char *crop_str, enum vout_crop_mode *mode,
> unsigned *num, unsigned *den,
> unsigned *x, unsigned *y,
> unsigned *width, unsigned *height )
> --
> 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