[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

Maximilian Madlung maxi.madlung at gmx.de
Mon Jul 28 19:43:37 CEST 2014


Hi Tristan,

thanks for your review. I will change those things. This may give me the 
chance to get the spaces right - I think I have still some tabs left :-X

Can I send a patch directly as answer to this thread?

Ciao
Max

On 28/07/14 19:36, Tristan Matthews wrote:
> Hi,
>
> On Mon, Jul 28, 2014 at 1:24 PM, Maximilian Madlung <maxi.madlung at gmx.de> wrote:
>> ---
>>   src/input/es_out.c |   42 ++++++++++++++++++++++++++++++++----------
>>   1 file changed, 32 insertions(+), 10 deletions(-)
>>
>> 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 */
> I think you mean "code contains a - ..."
>
>> +    if( strstr( psz_code, "-" ) != NULL)
>>       {
>> -        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, "-");
>> +
>> +       if( strlen( psz_lang ) == 2 )
>>           {
>> -            pl = GetLang_2T( psz_code );
>> -        }
>> +           pl = GetLang_1( psz_lang );
>> +       }
>> +       if( strlen( psz_lang ) == 3 )
>> +       {
> Since these conditions (strlen == 2 and strlen == 3) are mutually exclusive,
> you should use else if.
>
>> +           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, "??" ) )
>> --
>> 1.7.9.5
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> Also, the commit message first line should probably just be something
> like "input: Add additional language support" and then the body of the
> message something like "Fixes #11813"
>
> More info on git send email usage:
> https://wiki.videolan.org/Git#Submitting_patches_to_the_vlc-devel
>
> Best,
> Tristan
> _______________________________________________
> 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