X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;ds=sidebyside;f=libhb%2Fcommon.c;h=82499635225fb2830c8bf7a81ab95d63c81fd36a;hb=d6a4ae73b86cca10f2342c9e26c132855cad6356;hp=cea4a50646636ba15b692d1c4b14fbcc4ae65a8e;hpb=fd080745fd404660e334b5ca31c55b0ea736f973;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/libhb/common.c b/libhb/common.c index cea4a506..82499635 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -9,6 +9,7 @@ #include #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; +}