diff options
author | jbrjake <[email protected]> | 2007-12-13 14:20:17 +0000 |
---|---|---|
committer | jbrjake <[email protected]> | 2007-12-13 14:20:17 +0000 |
commit | 8f302a693a498c4f28754f32452023681ca126d1 (patch) | |
tree | 10d1dd37cce6dfddc6068281d9efd9a25f621e90 /libhb/lang.c | |
parent | 98929d2b4c34f87899a212e865b55a273ac46a0e (diff) |
MPEG-2 stream reading fixes for missing audio, multiple audio tracks, language codes, reading streams larger than 2GB, and incorrect title numbers. This vastly expands HandBrake's TS/PS compatibility. Thanks, van!
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1123 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/lang.c')
-rw-r--r-- | libhb/lang.c | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/libhb/lang.c b/libhb/lang.c index f394c264d..24f93da49 100644 --- a/libhb/lang.c +++ b/libhb/lang.c @@ -6,6 +6,7 @@ #include "lang.h" #include <string.h> +#include <ctype.h> static const iso639_lang_t languages[] = { { "Unknown", "", "", "und" }, @@ -201,8 +202,8 @@ iso639_lang_t * lang_for_code( int code ) char code_string[2]; iso639_lang_t * lang; - code_string[0] = ( code >> 8 ) & 0xFF; - code_string[1] = code & 0xFF; + code_string[0] = tolower( ( code >> 8 ) & 0xFF ); + code_string[1] = tolower( code & 0xFF ); for( lang = (iso639_lang_t*) languages; lang->eng_name; lang++ ) { @@ -215,6 +216,37 @@ iso639_lang_t * lang_for_code( int code ) return (iso639_lang_t*) languages; } +iso639_lang_t * lang_for_code2( const char *code ) +{ + char code_string[4]; + iso639_lang_t * lang; + + code_string[0] = tolower( code[0] ); + code_string[1] = tolower( code[1] ); + code_string[2] = tolower( code[2] ); + code_string[3] = 0; + + for( lang = (iso639_lang_t*) languages; lang->eng_name; lang++ ) + { + if( !strcmp( lang->iso639_2, code_string ) ) + { + return lang; + } + } + + return (iso639_lang_t*) languages; +} + +int lang_to_code(const iso639_lang_t *lang) +{ + int code = 0; + + if (lang) + code = (lang->iso639_1[0] << 8) | lang->iso639_1[1]; + + return code; +} + iso639_lang_t * lang_for_english( const char * english ) { iso639_lang_t * lang; |