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

Sean McGovern gseanmcg at gmail.com
Mon Jul 28 23:55:53 CEST 2014


Please, please, PLEASE.. fix your patch title as per previous reviews.

Thanks,
Sean McG.
-----Original Message-----
From: Maximilian Madlung <maxi.madlung at gmx.de>
Sender: "vlc-devel" <vlc-devel-bounces at videolan.org>Date: Mon, 28 Jul 2014 23:52:55 
To: <vlc-devel at videolan.org>
Reply-To: Mailing list for VLC media player developers <vlc-devel at videolan.org>
Subject: [vlc-devel] [PATCH] Adds language support acording to this ticket
	https://trac.videolan.org/vlc/ticket/11813#ticket and the
	MKV-Specifications
	http://www.matroska.org/technical/specs/index.html#languages

Change: Tab-Fix, Minor code fix
---
 src/input/es_out.c |   40 +++++++++++++++++++++++++++++++---------
 1 file changed, 31 insertions(+), 9 deletions(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index d5ac33b..95da724 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 );
+        }
+        else 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

_______________________________________________
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