[vlc-devel] [PATCH v2 2/2] es_format: display orientation with video format

"zhilizhao(赵志立)" quinkblack at foxmail.com
Mon Jan 25 10:53:37 UTC 2021



> On Jan 25, 2021, at 6:00 PM, Alexandre Janniaux <ajanni at videolabs.io> wrote:
> 
> ---
> src/misc/es_format.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/src/misc/es_format.c b/src/misc/es_format.c
> index 77c512a90a..9b752de355 100644
> --- a/src/misc/es_format.c
> +++ b/src/misc/es_format.c
> @@ -374,16 +374,31 @@ bool video_format_IsSimilar( const video_format_t *f1,
>     }
>     return true;
> }
> +
> +static const char *orient_to_string[ORIENT_MAX + 1] =
> +{
> +    [ORIENT_NORMAL]             = "normal",
> +    [ORIENT_TRANSPOSED]         = "transposed",
> +    [ORIENT_ANTI_TRANSPOSED]    = "antitransposed",
> +    [ORIENT_HFLIPPED]           = "hflip",
> +    [ORIENT_VFLIPPED]           = "vflip",
> +    [ORIENT_ROTATED_180]        = "80",
> +    [ORIENT_ROTATED_270]        = "270",
> +    [ORIENT_ROTATED_90]         = "90",
> +};
> +
> void video_format_Print( vlc_object_t *p_this,
>                          const char *psz_text, const video_format_t *fmt )
> {
> +    const char *orient = orient_to_string[fmt->orientation];

I thought ORIENT_MAX is introduced to prevent index-of-range error.
It’s less useful to specify the orient_to_string length, isn’t it?

>     msg_Dbg( p_this,
> -             "%s sz %ux%u, of (%u,%u), vsz %ux%u, 4cc %4.4s, sar %u:%u, msk r0x%" PRIx32 " g0x%" PRIx32 " b0x%" PRIx32,
> +             "%s sz %ux%u, of (%u,%u), vsz %ux%u, 4cc %4.4s, sar %u:%u, orient: %s, msk r0x%" PRIx32 " g0x%" PRIx32 " b0x%" PRIx32,
>              psz_text,
>              fmt->i_width, fmt->i_height, fmt->i_x_offset, fmt->i_y_offset,
>              fmt->i_visible_width, fmt->i_visible_height,
>              (char*)&fmt->i_chroma,
>              fmt->i_sar_num, fmt->i_sar_den,
> +             orient,
>              fmt->i_rmask, fmt->i_gmask, fmt->i_bmask );
> }
> 
> -- 
> 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