[vlc-devel] [PATCH] Adds additional language support according to specs and ticket. Implemented to serve this ticket: https://trac.videolan.org/vlc/ticket/11813#ticket and the MKV-Specifications http://www.matroska.org/technical/specs/index.html#languages

Rémi Denis-Courmont remi at remlab.net
Tue Jul 29 00:00:16 CEST 2014


Le lundi 28 juillet 2014, 19:24:12 Maximilian Madlung a écrit :
> ---
>  src/input/es_out.c |   42 ++++++++++++++++++++++++++++++++----------
>  1 file changed, 32 insertions(+), 10 deletions(-)

It should be somewhat obvious that the mail subject is excessively long.

The first line of a patch log should be only a summary (72 characterss 
maximum). Add paragraphs if you need/want to write more details.

Also...

> 
> diff --git a/src/input/es_out.c b/src/input/es_out.c
> index d5ac33b..53ae491 100644
> --- a/src/input/es_out.c
> +++ b/src/input/es_out.c
> @@ -2727,21 +2727,43 @@ static char *LanguageGetName( const char *psz_code )
> return strdup( "" );
>      }
> 
> -    if( strlen( psz_code ) == 2 )
> +    /* Check if the language code consists a - and only take the front
> +       part as language */
> +    if( strstr( psz_code, "-" ) != NULL)

strchr()

>      {
> -        pl = GetLang_1( psz_code );
> -    }
> -    else if( strlen( psz_code ) == 3 )
> -    {
> -        pl = GetLang_2B( psz_code );
> -        if( !strcmp( pl->psz_iso639_1, "??" ) )
> +	char * psz_lang = strtok ( ( char * ) psz_code, "-");

1) Not thread-safe. Refer to C documentation.
2) Illegal cast.

> +
> +	if( strlen( psz_lang ) == 2 )
>          {
> -            pl = GetLang_2T( psz_code );
> -        }
> +	    pl = GetLang_1( psz_lang );
> +	}
> +	if( strlen( psz_lang ) == 3 )
> +	{
> +	    pl = GetLang_2B( psz_lang );
> +	    if( !strcmp( pl->psz_iso639_1, "??" ) )
> +            {
> +                pl = GetLang_2T( psz_lang );
> +            }
> +	}
>      }
>      else
>      {
> -        return strdup( psz_code );
> +        if( strlen( psz_code ) == 2 )
> +        {
> +            pl = GetLang_1( psz_code );
> +        }
> +        else if( strlen( psz_code ) == 3 )
> +        {
> +            pl = GetLang_2B( psz_code );
> +            if( !strcmp( pl->psz_iso639_1, "??" ) )
> +            {
> +                pl = GetLang_2T( psz_code );
> +            }
> +        }
> +        else
> +        {
> +            return strdup( psz_code );
> +        }
>      }
> 
>      if( !strcmp( pl->psz_iso639_1, "??" ) )

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




More information about the vlc-devel mailing list