summaryrefslogtreecommitdiffstats
path: root/libhb/common.c
diff options
context:
space:
mode:
authoreddyg <[email protected]>2009-06-23 00:32:36 +0000
committereddyg <[email protected]>2009-06-23 00:32:36 +0000
commita51f35b6201202aed554f92fd540e4a3ca19cd0e (patch)
treec123aa5643eef80ff50b8ec7befbbf6272fa8851 /libhb/common.c
parent7b90e7deaa04a4ac7e1af7d8bf5996549dd2ea5f (diff)
CLI: SubRip Subtitle import
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2602 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/common.c')
-rw-r--r--libhb/common.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/libhb/common.c b/libhb/common.c
index cea4a5064..824996352 100644
--- a/libhb/common.c
+++ b/libhb/common.c
@@ -9,6 +9,7 @@
#include <sys/time.h>
#include "common.h"
+#include "lang.h"
#include "hb.h"
/**********************************************************************
@@ -864,8 +865,37 @@ int hb_subtitle_add(const hb_job_t * job, const hb_subtitle_config_t * subtitlec
/* We fail! */
return 0;
}
- subtitle->config = *subtitlecfg;
+ subtitle->config = *subtitlecfg;
hb_list_add(job->list_subtitle, subtitle);
return 1;
}
+int hb_srt_add( const hb_job_t * job,
+ const hb_subtitle_config_t * subtitlecfg,
+ const char *lang )
+{
+ hb_subtitle_t *subtitle;
+ iso639_lang_t *language = NULL;
+ int retval = 0;
+
+ subtitle = calloc( 1, sizeof( *subtitle ) );
+
+ subtitle->format = TEXTSUB;
+ subtitle->source = SRTSUB;
+
+ language = lang_for_code2( lang );
+
+ if( language )
+ {
+
+ strcpy( subtitle->lang, language->eng_name );
+ strncpy( subtitle->iso639_2, lang, 4 );
+
+ subtitle->config = *subtitlecfg;
+ subtitle->config.dest = PASSTHRUSUB;
+
+ hb_list_add(job->list_subtitle, subtitle);
+ retval = 1;
+ }
+ return retval;
+}