[vlc-devel] [PATCH] lib: map the position enum to the correct subpicture alignment bitmasks

Tristan Matthews le.businessman at gmail.com
Fri May 23 18:43:28 CEST 2014


On Fri, May 23, 2014 at 12:38 PM, Mark Lee
<mark.lee at capricasoftware.co.uk> wrote:
> libvlc_media_player_set_video_title_display() was wrongly using the
> enum value directly, leading to the video title appearing in the wrong
> position for some values
> ---
>  lib/media_player.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/lib/media_player.c b/lib/media_player.c
> index 67bbde7..932cf53 100644
> --- a/lib/media_player.c
> +++ b/lib/media_player.c
> @@ -1445,12 +1445,30 @@ void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi )
>      }
>  }
>
> +/**
> + * Private lookup table to get subpicture alignment flag values corresponding
> + * to a libvlc_position_t enumerated value.
> + */
> +static int position_subpicture_alignment[] = {
> +    0,

Would it make sense to add
#define SUBPICTURE_ALIGN_CENTER 0x0
to vlc_subpicture.h?

> +    SUBPICTURE_ALIGN_LEFT,
> +    SUBPICTURE_ALIGN_RIGHT,
> +    SUBPICTURE_ALIGN_TOP,
> +    SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_LEFT,
> +    SUBPICTURE_ALIGN_TOP | SUBPICTURE_ALIGN_RIGHT,
> +    SUBPICTURE_ALIGN_BOTTOM,
> +    SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_LEFT,
> +    SUBPICTURE_ALIGN_BOTTOM | SUBPICTURE_ALIGN_RIGHT
> +};
> +
>  void libvlc_media_player_set_video_title_display( libvlc_media_player_t *p_mi, libvlc_position_t position, unsigned timeout )
>  {
> +    assert( position >= libvlc_position_disable && position <= libvlc_position_bottom_right );
> +
>      if ( position != libvlc_position_disable )
>      {
>          var_SetBool( p_mi, "video-title-show", true );
> -        var_SetInteger( p_mi, "video-title-position", position );
> +        var_SetInteger( p_mi, "video-title-position", position_subpicture_alignment[position] );
>          var_SetInteger( p_mi, "video-title-timeout", timeout );
>      }
>      else
> --
> 1.9.1
>
> _______________________________________________
> 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