[vlc-devel] [PATCH] vmem: allow clients get and update additional format info
Rémi Denis-Courmont
remi at remlab.net
Mon Feb 1 11:25:03 CET 2016
Le 2016-01-30 18:21, Sergey Radionov a écrit :
> ---
> modules/video_output/vmem.c | 37
> +++++++++++++++++++++++++++++++------
> 1 file changed, 31 insertions(+), 6 deletions(-)
>
> diff --git a/modules/video_output/vmem.c
> b/modules/video_output/vmem.c
> index 5a6d869..ed640b8 100644
> --- a/modules/video_output/vmem.c
> +++ b/modules/video_output/vmem.c
> @@ -3,6 +3,7 @@
>
>
> *****************************************************************************
> * Copyright (C) 2008 VLC authors and VideoLAN
> * Copyrgiht (C) 2010 Rémi Denis-Courmont
> + * Copyrgiht (C) 2016 Sergey Radionov <rsatom at gmail.com>
> *
> * Authors: Sam Hocevar <sam at zoy.org>
> *
> @@ -168,6 +169,20 @@ static int Open(vlc_object_t *object)
> video_format_t fmt;
> video_format_ApplyRotation(&fmt, &vd->fmt);
>
> + enum {fmt_len, fmt_offset, fmt_visible_len, fmt_sar,
> fmt_update};
> + unsigned fmt_x[] = {
> + fmt.i_width,
> + fmt.i_x_offset,
> + fmt.i_visible_width,
> + vd->source.i_sar_num,
> + FALSE
> + };
> + unsigned fmt_y[] = {
> + fmt.i_height,
> + fmt.i_y_offset,
> + fmt.i_visible_height,
> + vd->source.i_sar_den,
> + FALSE };
Use self-consistent style please.
> if (setup != NULL) {
> char chroma[5];
>
> @@ -176,7 +191,7 @@ static int Open(vlc_object_t *object)
> memset(sys->pitches, 0, sizeof(sys->pitches));
> memset(sys->lines, 0, sizeof(sys->lines));
>
> - sys->count = setup(&sys->opaque, chroma, &fmt.i_width,
> &fmt.i_height,
> + sys->count = setup(&sys->opaque, chroma, fmt_x, fmt_y,
> sys->pitches, sys->lines);
> if (sys->count == 0) {
> msg_Err(vd, "video format setup failure (no pictures)");
> @@ -190,8 +205,8 @@ static int Open(vlc_object_t *object)
> fmt.i_chroma = vlc_fourcc_GetCodecFromString(VIDEO_ES,
> chroma);
> free(chroma);
>
> - fmt.i_width = var_InheritInteger(vd, "vmem-width");
> - fmt.i_height = var_InheritInteger(vd, "vmem-height");
> + fmt_x[fmt_len] = var_InheritInteger(vd, "vmem-width");
> + fmt_y[fmt_len] = var_InheritInteger(vd, "vmem-height");
> sys->pitches[0] = var_InheritInteger(vd, "vmem-pitch");
> sys->lines[0] = fmt.i_height;
> for (size_t i = 1; i < PICTURE_PLANE_MAX; i++)
> @@ -202,9 +217,19 @@ static int Open(vlc_object_t *object)
> sys->count = 1;
> sys->cleanup = NULL;
> }
> - fmt.i_x_offset = fmt.i_y_offset = 0;
> - fmt.i_visible_width = fmt.i_width;
> - fmt.i_visible_height = fmt.i_height;
> +
> + fmt.i_width = fmt_x[fmt_len];
> + fmt.i_height = fmt_y[fmt_len];
> + if (fmt_x[fmt_update] || fmt_y[fmt_update]) {
> + fmt.i_x_offset = fmt_x[fmt_offset];
> + fmt.i_y_offset = fmt_y[fmt_offset];
> + fmt.i_visible_width = fmt_x[fmt_visible_len];
> + fmt.i_visible_height = fmt_y[fmt_visible_len];
> + } else {
> + fmt.i_x_offset = fmt.i_y_offset = 0;
> + fmt.i_visible_width = fmt.i_width;
> + fmt.i_visible_height = fmt.i_height;
> + }
>
> if (!fmt.i_chroma) {
> msg_Err(vd, "vmem-chroma should be 4 characters long");
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list