[vlc-devel] commit: Default to any for --audio-language. (Laurent Aimar )

git version control git at videolan.org
Sun Feb 14 16:32:48 CET 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Feb 14 15:03:58 2010 +0100| [cdc9281c4841e62f066328e7bdd56398755a3077] | committer: Laurent Aimar 

Default to any for --audio-language.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cdc9281c4841e62f066328e7bdd56398755a3077
---

 src/input/es_out.c  |   18 ++++++++++++------
 src/libvlc-module.c |    4 ++--
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index 9bf2803..3062d8e 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -190,7 +190,7 @@ static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced );
 
 static char *LanguageGetName( const char *psz_code );
 static char *LanguageGetCode( const char *psz_lang );
-static char **LanguageSplit( const char *psz_langs );
+static char **LanguageSplit( const char *psz_langs, bool b_default_any );
 static int LanguageArrayIndex( char **ppsz_langs, char *psz_lang );
 
 static char *EsOutProgramGetMetaName( es_out_pgrm_t *p_pgrm );
@@ -269,7 +269,7 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate )
         char *psz_string;
 
         psz_string = var_GetString( p_input, "audio-language" );
-        p_sys->ppsz_audio_language = LanguageSplit( psz_string );
+        p_sys->ppsz_audio_language = LanguageSplit( psz_string, true );
         if( p_sys->ppsz_audio_language )
         {
             for( int i = 0; p_sys->ppsz_audio_language[i]; i++ )
@@ -279,7 +279,7 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate )
         free( psz_string );
 
         psz_string = var_GetString( p_input, "sub-language" );
-        p_sys->ppsz_sub_language = LanguageSplit( psz_string );
+        p_sys->ppsz_sub_language = LanguageSplit( psz_string, false );
         if( p_sys->ppsz_sub_language )
         {
             for( int i = 0; p_sys->ppsz_sub_language[i]; i++ )
@@ -2728,7 +2728,7 @@ static char *LanguageGetCode( const char *psz_lang )
     return strdup("??");
 }
 
-static char **LanguageSplit( const char *psz_langs )
+static char **LanguageSplit( const char *psz_langs, bool b_default_any )
 {
     char *psz_dup;
     char *psz_parser;
@@ -2751,6 +2751,10 @@ static char **LanguageSplit( const char *psz_langs )
         {
             TAB_APPEND( i_psz, ppsz, strdup("any") );
         }
+        else if( !strcmp( psz_parser, "none" ) )
+        {
+            TAB_APPEND( i_psz, ppsz, strdup("none") );
+        }
         else
         {
             psz_code = LanguageGetCode( psz_parser );
@@ -2769,6 +2773,8 @@ static char **LanguageSplit( const char *psz_langs )
 
     if( i_psz )
     {
+        if( b_default_any && strcmp( ppsz[i_psz - 1], "none" ) )
+            TAB_APPEND( i_psz, ppsz, strdup("any") );
         TAB_APPEND( i_psz, ppsz, NULL );
     }
 
@@ -2786,9 +2792,9 @@ static int LanguageArrayIndex( char **ppsz_langs, char *psz_lang )
     {
         if( !strcasecmp( ppsz_langs[i], psz_lang ) ||
             !strcasecmp( ppsz_langs[i], "any" ) )
-        {
             return i;
-        }
+        if( !strcasecmp( ppsz_langs[i], "none" ) )
+            break;
     }
 
     return -1;
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 95b60bc..b021a0d 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -701,12 +701,12 @@ static const char *const ppsz_clock_descriptions[] =
 #define INPUT_AUDIOTRACK_LANG_TEXT N_("Audio language")
 #define INPUT_AUDIOTRACK_LANG_LONGTEXT N_( \
     "Language of the audio track you want to use " \
-    "(comma separated, two or three letter country code).")
+    "(comma separated, two or three letter country code, you may use 'none' to avoid a fallback to another language).")
 
 #define INPUT_SUBTRACK_LANG_TEXT N_("Subtitle language")
 #define INPUT_SUBTRACK_LANG_LONGTEXT N_( \
     "Language of the subtitle track you want to use " \
-    "(comma separated, two or three letters country code).")
+    "(comma separated, two or three letters country code, you may use 'any' as a fallback).")
 
 /// \todo Document how to find it
 #define INPUT_AUDIOTRACK_ID_TEXT N_("Audio track ID")




More information about the vlc-devel mailing list