diff options
author | jstebbins <[email protected]> | 2015-04-02 16:08:26 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2015-04-02 16:08:26 +0000 |
commit | eb3f55f728c92887b4a210015533e8e6e9a5357f (patch) | |
tree | d6f0e2276e4e1a7370c73cd9583cb7fb5831ea90 /libhb/lang.c | |
parent | 4e26c6488ca8910d834568d22c89b34c239798c7 (diff) |
libhb: add language lookup based on any of iso639_1/2/2b, eng_name, or native
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7038 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/lang.c')
-rw-r--r-- | libhb/lang.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libhb/lang.c b/libhb/lang.c index a336268a7..f40520a23 100644 --- a/libhb/lang.c +++ b/libhb/lang.c @@ -202,6 +202,25 @@ static const iso639_lang_t languages[] = static const int lang_count = sizeof(languages) / sizeof(languages[0]); +iso639_lang_t * lang_lookup( const char * str ) +{ + iso639_lang_t * lang; + + for (lang = (iso639_lang_t*) languages; lang->eng_name; lang++) + { + if ((lang->iso639_1 != NULL && !strcasecmp(lang->iso639_1, str)) || + (lang->iso639_2 != NULL && !strcasecmp(lang->iso639_2, str)) || + (lang->iso639_2b != NULL && !strcasecmp(lang->iso639_2b, str)) || + (lang->eng_name != NULL && !strcasecmp(lang->eng_name, str)) || + (lang->native_name != NULL && !strcasecmp(lang->native_name, str))) + { + return lang; + } + } + + return NULL; +} + iso639_lang_t * lang_for_code( int code ) { char code_string[2]; |