[vlc-devel] [PATCH] Fix track selection according to user preference.

Denis Charmet typx at dinauz.org
Fri Jul 12 10:06:09 CEST 2013


Hi,

Le vendredi 12 juillet 2013 à 09:52:00, Rafaël Carré a écrit :
> > +                if( idx1 < 0 || /* this track isn't in the language list */
> > +                    ( idx2 >= 0 &&
> > +                      ( idx2 < idx1 || /* it's less prioritar from the user
> 
> prioritary?
> or something like:
> "its user priority is lower than the already selected one" ?
>
Yeah my bad.
 
> I think it'd look better this way:
> 
> if (idx1 < 0) /* xxx */
>     return;
> if (idx2 >= 0 && idx2 <= idx1) /* xxx */
>     return;
> ..
> 

I like to factorize but fair enough, it will gain in readability

> > +            else if( idx1 >= 0 || !strcmp( es->psz_language_code, "??" ) ||
> > +                     !p_sys->ppsz_audio_language )
> > +                i_wanted = es->i_channel;
> 
> Cosmetic change?
> 
Yes. Since I was refactoring this part I wanted to homogenize with the
SPU part.

> > -    if( psz_langs == NULL ) return NULL;
> > +    if( psz_langs == NULL || !*psz_langs )
> > +    {
> > +        if ( b_default_any )
> > +        {
> > +            TAB_APPEND( i_psz, ppsz, strdup("any") );
> > +            TAB_APPEND( i_psz, ppsz, NULL );
> > +        }
> > +        return ppsz;
> > +    }
> 
> Is this change related?

It is. If there isn't any user pref, it use ppsz = {"any", NULL} instead of
NULL. This allow to check the idx1. I can remove that and replace it
with if( idx1 < 0 && !p_sys->ppsz_audio_language ) { /* check container priority
*/ ... }

Regards,

-- 
Denis Charmet - TypX
Le mauvais esprit est un art de vivre



More information about the vlc-devel mailing list