[vlc-devel] [PATCH 01/14] es_out: use string id for "cat-track-id" options

Thomas Guillem thomas at gllm.fr
Mon Feb 24 10:16:56 CET 2020



On Sat, Feb 22, 2020, at 08:46, Rémi Denis-Courmont wrote:
> Le perjantaina 21. helmikuuta 2020, 17.59.32 EET Thomas Guillem a écrit :
> > We can keep the same variable name since the integers can still be treated
> > as a string.
> > 
> > Using an integer on these reworked variables won't work to identify any
> > track and will cause VLC to disable the used category.
> > ---
> >  src/input/es_out.c  | 9 +++++----
> >  src/input/var.c     | 6 +++---
> >  src/libvlc-module.c | 7 +++----
> >  3 files changed, 11 insertions(+), 11 deletions(-)
> > 
> > diff --git a/src/input/es_out.c b/src/input/es_out.c
> > index bd73c78cbd2..f782eb61079 100644
> > --- a/src/input/es_out.c
> > +++ b/src/input/es_out.c
> > @@ -162,7 +162,7 @@ typedef struct
> > 
> >      /* Parameters used for es selection */
> >      bool        b_autoselect; /* if we want to select an es when no user
> > prefs */ -    int         i_id;       /* es id as set by es fmt.id */
> > +    char        *str_id;       /* String id generated by EsOutCreateStrId()
> > */ int         i_demux_id; /* same as previous, demuxer set default value
> > */ int         i_channel;  /* es number in creation order */
> >      char        **ppsz_language;
> > @@ -439,6 +439,7 @@ static es_out_es_props_t * GetPropsByCat( es_out_sys_t
> > *p_sys, int i_cat )
> > 
> >  static void EsOutPropsCleanup( es_out_es_props_t *p_props )
> >  {
> > +    free( p_props->str_id );
> >      if( p_props->ppsz_language )
> >      {
> >          for( int i = 0; p_props->ppsz_language[i]; i++ )
> > @@ -459,7 +460,7 @@ static void EsOutPropsInit( es_out_es_props_t *p_props,
> >      p_props->e_policy = e_default_policy;
> >      p_props->i_count = 0;
> >      p_props->b_autoselect = autoselect;
> > -    p_props->i_id = (psz_trackidvar) ? var_GetInteger( p_input,
> > psz_trackidvar ): -1; +    p_props->str_id = (psz_trackidvar) ?
> > var_GetNonEmptyString( p_input, psz_trackidvar ): -1; p_props->i_channel =
> > (psz_trackvar) ? var_GetInteger( p_input, psz_trackvar ): -1;
> 
> Assigning -1 to a pointer, will crash in later use.

Good catch, it should be NULL here.

> 
> > p_props->i_demux_id = -1;
> >      p_props->p_main_es = NULL;
> > @@ -2491,9 +2492,9 @@ static void EsOutSelect( es_out_t *out, es_out_id_t
> > *es, bool b_force ) return;
> > 
> >          /* user designated by ID ES have higher prio than everything */
> > -        if ( p_esprops->i_id >= 0 )
> > +        if ( p_esprops->str_id )
> >          {
> > -            if( es->fmt.i_id == p_esprops->i_id )
> > +            if( strcmp( p_esprops->str_id, es->id.str_id ) == 0 )
> >                  wanted_es = es;
> >          }
> >          /* then per pos */
> > diff --git a/src/input/var.c b/src/input/var.c
> > index 9f119a838d4..b5de58afb63 100644
> > --- a/src/input/var.c
> > +++ b/src/input/var.c
> > @@ -58,11 +58,11 @@ void input_ConfigVarInit ( input_thread_t *p_input )
> >                      VLC_VAR_STRING|VLC_VAR_DOINHERIT );
> > 
> >          var_Create( p_input, "video-track-id",
> > -                    VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
> > +                    VLC_VAR_STRING|VLC_VAR_DOINHERIT );
> >          var_Create( p_input, "audio-track-id",
> > -                    VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
> > +                    VLC_VAR_STRING|VLC_VAR_DOINHERIT );
> >          var_Create( p_input, "sub-track-id",
> > -                    VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
> > +                    VLC_VAR_STRING|VLC_VAR_DOINHERIT );
> > 
> >          var_Create( p_input, "sub-file", VLC_VAR_STRING | VLC_VAR_DOINHERIT
> > ); var_Create( p_input, "sub-autodetect-file", VLC_VAR_BOOL | diff --git
> > a/src/libvlc-module.c b/src/libvlc-module.c
> > index d82ad097f3c..1da7fa6e793 100644
> > --- a/src/libvlc-module.c
> > +++ b/src/libvlc-module.c
> > @@ -631,7 +631,6 @@ static const char *const ppsz_clock_descriptions[] =
> >      "Language of the menus you want to use with DVD/BluRay " \
> >      "(comma separated, two or three letters country code, you may use 'any'
> > as a fallback).")
> > 
> > -/// \todo Document how to find it
> >  #define INPUT_VIDEOTRACK_ID_TEXT N_("Video track ID")
> >  #define INPUT_VIDEOTRACK_ID_LONGTEXT N_( \
> >      "Stream ID of the video track to use.")
> > @@ -1848,13 +1847,13 @@ vlc_module_begin ()
> >                   INPUT_MENUTRACK_LANG_TEXT, INPUT_MENUTRACK_LANG_LONGTEXT,
> >                    false )
> >          change_safe ()
> > -    add_integer( "video-track-id", -1, INPUT_VIDEOTRACK_ID_TEXT,
> > +    add_string( "video-track-id", NULL, INPUT_VIDEOTRACK_ID_TEXT,
> >                   INPUT_VIDEOTRACK_ID_LONGTEXT, true )
> >          change_safe ()
> > -    add_integer( "audio-track-id", -1, INPUT_AUDIOTRACK_ID_TEXT,
> > +    add_string( "audio-track-id", NULL, INPUT_AUDIOTRACK_ID_TEXT,
> >                   INPUT_AUDIOTRACK_ID_LONGTEXT, true )
> >          change_safe ()
> > -    add_integer( "sub-track-id", -1,
> > +    add_string( "sub-track-id", NULL,
> >                   INPUT_SUBTRACK_ID_TEXT, INPUT_SUBTRACK_ID_LONGTEXT, true )
> > change_safe ()
> >      add_integer( "captions", 608,
> 
> 
> -- 
> 雷米‧德尼-库尔蒙
> http://www.remlab.net/
> 
> 
> 
> _______________________________________________
> 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