[vlc-devel] [PATCH] libvlc: replace existing title menu bool with int bit mask

Rémi Denis-Courmont remi at remlab.net
Wed Dec 2 23:21:30 CET 2015


On Wednesday 02 December 2015 15:35:17 Felix Paul Kühne wrote:
> ---
>  include/vlc/libvlc_media_player.h | 9 ++++++++-
>  lib/media_player.c                | 2 +-
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/include/vlc/libvlc_media_player.h
> b/include/vlc/libvlc_media_player.h index 6614340..c69b8cb 100644
> --- a/include/vlc/libvlc_media_player.h
> +++ b/include/vlc/libvlc_media_player.h
> @@ -57,11 +57,18 @@ typedef struct libvlc_track_description_t
>  /**
>   * Description for titles
>   */
> +typedef enum libvlc_title_style_options_t {
> +    libvlc_title_plain         = 0x0000,
> +    libvlc_title_menu          = 0x0001,
> +    libvlc_title_interactive   = 0x0002

Enumeration is only warranted the range of char out of the box. Four hex 
digits is confusing/confused.

> +} libvlc_title_style_options_t;
> +
>  typedef struct libvlc_title_description_t
>  {
>      int64_t i_duration; /**< duration in milliseconds */
>      char *psz_name; /**< title name */
> -    bool b_menu; /**< info if item was recognized as a menu by the demuxer
> */ +    libvlc_title_style_options_t i_style; /**< info if item was
> recognized as a menu, interactive or plain content by the demuxer
> +        
>                                   * an int bit mask specified by combining
> the options described in libvlc_title_style_options_t */ }

Bit mask for an enumeration sounds like case for a ISO C "common warning".

> libvlc_title_description_t;
> 
>  /**
> diff --git a/lib/media_player.c b/lib/media_player.c
> index 2dee2d7..483d6f5 100644
> --- a/lib/media_player.c
> +++ b/lib/media_player.c
> @@ -1476,7 +1476,7 @@ int libvlc_media_player_get_full_title_descriptions(
> libvlc_media_player_t *p_mi
> 
>          /* we want to return milliseconds to match the rest of the API */
>          title->i_duration = p_input_title[i]->i_length / 1000;
> -        title->b_menu = p_input_title[i]->i_flags & INPUT_TITLE_MENU;
> +        title->i_style = p_input_title[i]->i_flags;
>          if( p_input_title[i]->psz_name )
>              title->psz_name = strdup( p_input_title[i]->psz_name );
>          else

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list