diff options
author | John Stebbins <[email protected]> | 2017-03-10 12:56:55 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2017-03-10 12:56:55 -0700 |
commit | bd22891d633e16d7aedddadd2e4dd716f615d847 (patch) | |
tree | 4194d0fd483759f8e8f5226ac479e5ad193a9ef9 /libhb/common.c | |
parent | 1f6c91c00be0f8f47de1d5c77b945ad6ecd50ec5 (diff) |
subtitles: simplify and shorten subtitle descriptions (#591)
* subtitles: simplify and shorten subtitle descriptions
Generally, it eliminates parens to make things more readable.
I.e. it turns this:
English (Closed Caption)(Wide Screen)(Bitmap)(VOBSUB)
Into this:
English, Closed Caption [Wide Screen, VOBSUB]
* Revise punctuation per BradleyS request
* fix subtitle description formatting
* incorporate suggestions from PR
Diffstat (limited to 'libhb/common.c')
-rw-r--r-- | libhb/common.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libhb/common.c b/libhb/common.c index 986044845..11928e519 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -4686,10 +4686,10 @@ int hb_subtitle_add(const hb_job_t * job, const hb_subtitle_config_t * subtitlec int hb_srt_add( const hb_job_t * job, const hb_subtitle_config_t * subtitlecfg, - const char *lang ) + const char *lang_code ) { hb_subtitle_t *subtitle; - iso639_lang_t *language = NULL; + iso639_lang_t *lang = NULL; subtitle = calloc( 1, sizeof( *subtitle ) ); if (subtitle == NULL) @@ -4703,14 +4703,16 @@ int hb_srt_add( const hb_job_t * job, subtitle->source = SRTSUB; subtitle->codec = WORK_DECSRTSUB; - language = lang_for_code2(lang); - if (language == NULL) + lang = lang_for_code2(lang_code); + if (lang == NULL) { - hb_log("hb_srt_add: unknown language code (%s)", lang); - language = lang_for_code2("und"); + hb_log("hb_srt_add: unknown language code (%s)", lang_code); + lang = lang_for_code2("und"); } - strcpy(subtitle->lang, language->eng_name); - strcpy(subtitle->iso639_2, language->iso639_2); + snprintf(subtitle->lang, sizeof(subtitle->lang), "%s [%s]", + strlen(lang->native_name) ? lang->native_name : lang->eng_name, + hb_subsource_name(subtitle->source)); + strcpy(subtitle->iso639_2, lang->iso639_2); subtitle->config = *subtitlecfg; hb_list_add(job->list_subtitle, subtitle); |