summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/iso639.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/iso639.h b/tools/iso639.h
index 66438f13..7f8d5e96 100644
--- a/tools/iso639.h
+++ b/tools/iso639.h
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: iso639.h,v 1.1 2008-02-20 03:55:11 phintuka Exp $
+ * $Id: iso639.h,v 1.2 2008-09-21 12:37:31 phintuka Exp $
*
*/
@@ -168,4 +168,19 @@ static const char *iso639_2_to_iso639_1(const char *lang)
return NULL;
}
+static const char *iso639_1_to_iso639_2(const char *lang)
+{
+ if (lang && lang[0]) {
+ if(lang[1] && lang[2] && !lang[3]) {
+ for (unsigned int i = 0 ; i < sizeof(ISO639_map) / sizeof(ISO639_map[0]); i++)
+ if (((uint16_t*)ISO639_map[i].iso639_2)[0] == ((uint16_t*)lang)[0] &&
+ ((uint8_t *)ISO639_map[i].iso639_2)[2] == ((uint8_t *)lang)[2])
+ return ISO639_map[i].iso639_1;
+ LOGMSG("Unknown iso639-1 code: %s", lang);
+ }
+ return lang;
+ }
+ return NULL;
+}
+
#endif