[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:24:12 CEST 2014


---
 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 */
+    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 )
+	{
+	    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