[vlc-devel] [PATCH] Language support acording to MKV-Spec
Maximilian Madlung
maxi.madlung at gmx.de
Tue Jul 29 00:38:22 CEST 2014
---
src/input/es_out.c | 42 +++++++++++++++++++++++++++++++++---------
1 file changed, 33 insertions(+), 9 deletions(-)
diff --git a/src/input/es_out.c b/src/input/es_out.c
index d5ac33b..cbf6ed2 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -2727,21 +2727,45 @@ 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( strchr( 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* buf;
+ char* psz_code_temp = strdup(psz_code);
+ char* psz_lang = strtok_r ( psz_code_temp, "-", &buf);
+
+ if( strlen( psz_lang ) == 2 )
+ {
+ pl = GetLang_1( psz_lang );
+ }
+ else if( strlen( psz_lang ) == 3 )
{
- pl = GetLang_2T( psz_code );
+ 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
More information about the vlc-devel
mailing list