summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorRodeo <[email protected]>2013-07-13 16:41:49 +0000
committerRodeo <[email protected]>2013-07-13 16:41:49 +0000
commit1126b3488c02e40bf3426e35de26c420c20a3e76 (patch)
tree3aace5d02fa8c59d25b964d3e1b31013d04430f4 /libhb
parentc4a87e9ce22fff4a3f47cfd3d3b89278f63beb83 (diff)
MacGui: populate the SRT subtitle language list dynamically from libhb.
Adds several languages that were previously missing from the list. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5645 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/lang.c17
-rw-r--r--libhb/lang.h8
2 files changed, 25 insertions, 0 deletions
diff --git a/libhb/lang.c b/libhb/lang.c
index 2e0cc3a48..4600f1020 100644
--- a/libhb/lang.c
+++ b/libhb/lang.c
@@ -200,6 +200,8 @@ static const iso639_lang_t languages[] =
{ "Zulu", "", "zu", "zul" },
{ NULL, NULL, NULL } };
+static const int lang_count = sizeof(languages) / sizeof(languages[0]);
+
iso639_lang_t * lang_for_code( int code )
{
char code_string[2];
@@ -269,3 +271,18 @@ iso639_lang_t * lang_for_english( const char * english )
return (iso639_lang_t*) languages;
}
+const iso639_lang_t* lang_get_next(const iso639_lang_t *last)
+{
+ if (last == NULL)
+ {
+ return (const iso639_lang_t*)languages;
+ }
+ if (last < languages || // out of bounds
+ last >= languages + lang_count - 2) // last valid language
+ {
+ return NULL;
+ }
+ return ++last;
+}
+
+
diff --git a/libhb/lang.h b/libhb/lang.h
index 9df8e10f4..cf4ecc321 100644
--- a/libhb/lang.h
+++ b/libhb/lang.h
@@ -33,6 +33,14 @@ iso639_lang_t * lang_for_code2( const char *code2 );
int lang_to_code(const iso639_lang_t *lang);
iso639_lang_t * lang_for_english( const char * english );
+
+/*
+ * Get the next language in the list.
+ * Returns NULL if there are no more languages.
+ * Pass NULL to get the first language in the list.
+ */
+const iso639_lang_t* lang_get_next(const iso639_lang_t *last);
+
#ifdef __cplusplus
}
#endif