Commit cdc9281c authored by Laurent Aimar's avatar Laurent Aimar

Default to any for --audio-language.

parent 4396c68b
...@@ -190,7 +190,7 @@ static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced ); ...@@ -190,7 +190,7 @@ static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced );
static char *LanguageGetName( const char *psz_code ); static char *LanguageGetName( const char *psz_code );
static char *LanguageGetCode( const char *psz_lang ); 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 int LanguageArrayIndex( char **ppsz_langs, char *psz_lang );
static char *EsOutProgramGetMetaName( es_out_pgrm_t *p_pgrm ); 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 ) ...@@ -269,7 +269,7 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate )
char *psz_string; char *psz_string;
psz_string = var_GetString( p_input, "audio-language" ); 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 ) if( p_sys->ppsz_audio_language )
{ {
for( int i = 0; p_sys->ppsz_audio_language[i]; i++ ) 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 ) ...@@ -279,7 +279,7 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate )
free( psz_string ); free( psz_string );
psz_string = var_GetString( p_input, "sub-language" ); 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 ) if( p_sys->ppsz_sub_language )
{ {
for( int i = 0; p_sys->ppsz_sub_language[i]; i++ ) for( int i = 0; p_sys->ppsz_sub_language[i]; i++ )
...@@ -2728,7 +2728,7 @@ static char *LanguageGetCode( const char *psz_lang ) ...@@ -2728,7 +2728,7 @@ static char *LanguageGetCode( const char *psz_lang )
return strdup("??"); 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_dup;
char *psz_parser; char *psz_parser;
...@@ -2751,6 +2751,10 @@ static char **LanguageSplit( const char *psz_langs ) ...@@ -2751,6 +2751,10 @@ static char **LanguageSplit( const char *psz_langs )
{ {
TAB_APPEND( i_psz, ppsz, strdup("any") ); TAB_APPEND( i_psz, ppsz, strdup("any") );
} }
else if( !strcmp( psz_parser, "none" ) )
{
TAB_APPEND( i_psz, ppsz, strdup("none") );
}
else else
{ {
psz_code = LanguageGetCode( psz_parser ); psz_code = LanguageGetCode( psz_parser );
...@@ -2769,6 +2773,8 @@ static char **LanguageSplit( const char *psz_langs ) ...@@ -2769,6 +2773,8 @@ static char **LanguageSplit( const char *psz_langs )
if( i_psz ) 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 ); TAB_APPEND( i_psz, ppsz, NULL );
} }
...@@ -2786,9 +2792,9 @@ static int LanguageArrayIndex( char **ppsz_langs, char *psz_lang ) ...@@ -2786,9 +2792,9 @@ static int LanguageArrayIndex( char **ppsz_langs, char *psz_lang )
{ {
if( !strcasecmp( ppsz_langs[i], psz_lang ) || if( !strcasecmp( ppsz_langs[i], psz_lang ) ||
!strcasecmp( ppsz_langs[i], "any" ) ) !strcasecmp( ppsz_langs[i], "any" ) )
{
return i; return i;
} if( !strcasecmp( ppsz_langs[i], "none" ) )
break;
} }
return -1; return -1;
......
...@@ -701,12 +701,12 @@ static const char *const ppsz_clock_descriptions[] = ...@@ -701,12 +701,12 @@ static const char *const ppsz_clock_descriptions[] =
#define INPUT_AUDIOTRACK_LANG_TEXT N_("Audio language") #define INPUT_AUDIOTRACK_LANG_TEXT N_("Audio language")
#define INPUT_AUDIOTRACK_LANG_LONGTEXT N_( \ #define INPUT_AUDIOTRACK_LANG_LONGTEXT N_( \
"Language of the audio track you want to use " \ "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_TEXT N_("Subtitle language")
#define INPUT_SUBTRACK_LANG_LONGTEXT N_( \ #define INPUT_SUBTRACK_LANG_LONGTEXT N_( \
"Language of the subtitle track you want to use " \ "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 /// \todo Document how to find it
#define INPUT_AUDIOTRACK_ID_TEXT N_("Audio track ID") #define INPUT_AUDIOTRACK_ID_TEXT N_("Audio track ID")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment