[vlc-devel] [PATCH 01/10] vout: define crop configuration as a type

Steve Lhomme robux4 at ycbcr.xyz
Mon Feb 8 07:59:16 UTC 2021


While you're at it you should make the crop ratio a vlc_rational_t.

On 2021-02-06 17:27, remi at remlab.net wrote:
> From: RĂ©mi Denis-Courmont <remi at remlab.net>
> 
> This creates a separate structure type for the crop configuration.
> No functional changes.
> ---
>   src/video_output/video_output.c  | 22 +---------------------
>   src/video_output/vout_internal.h | 23 +++++++++++++++++++++++
>   2 files changed, 24 insertions(+), 21 deletions(-)
> 
> diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
> index 323b40c084..d01bf880d6 100644
> --- a/src/video_output/video_output.c
> +++ b/src/video_output/video_output.c
> @@ -82,27 +82,7 @@ typedef struct vout_thread_sys_t
>       /* */
>       struct {
>           vlc_rational_t dar;
> -        struct {
> -            enum vout_crop_mode mode;
> -            union {
> -                struct {
> -                    unsigned num;
> -                    unsigned den;
> -                } ratio;
> -                struct {
> -                    unsigned x;
> -                    unsigned y;
> -                    unsigned width;
> -                    unsigned height;
> -                } window;
> -                struct {
> -                    unsigned left;
> -                    unsigned right;
> -                    unsigned top;
> -                    unsigned bottom;
> -                } border;
> -            };
> -        } crop;
> +        struct vout_crop crop;
>       } source;
>   
>       /* Snapshot interface */
> diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
> index ef92f1c889..a351106224 100644
> --- a/src/video_output/vout_internal.h
> +++ b/src/video_output/vout_internal.h
> @@ -103,6 +103,29 @@ 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,
>   };
> +
> +struct vout_crop {
> +    enum vout_crop_mode mode;
> +    union {
> +        struct {
> +            unsigned num;
> +            unsigned den;
> +        } ratio;
> +        struct {
> +            unsigned x;
> +            unsigned y;
> +            unsigned width;
> +            unsigned height;
> +        } window;
> +        struct {
> +            unsigned left;
> +            unsigned right;
> +            unsigned top;
> +            unsigned bottom;
> +        } border;
> +    };
> +};
> +
>   bool GetCropMode(const char *crop_str, enum vout_crop_mode *mode,
>                           unsigned *num, unsigned *den,
>                           unsigned *x, unsigned *y,
> -- 
> 2.30.0
> 
> _______________________________________________
> 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