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/decavcodec.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/decavcodec.c')
-rw-r--r-- | libhb/decavcodec.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index bed5d2cfb..e038efd6d 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -40,6 +40,7 @@ #include "hb.h" #include "hbffmpeg.h" +#include "lang.h" #include "audio_resample.h" #ifdef USE_QSV @@ -1226,29 +1227,37 @@ static int decodeFrame( hb_work_object_t *w, packet_info_t * packet_info ) } if (subtitle == NULL) { - subtitle = calloc(sizeof( hb_subtitle_t ), 1); + iso639_lang_t * lang; + hb_audio_t * audio; + + subtitle = calloc(sizeof( hb_subtitle_t ), 1); subtitle->track = hb_list_count(pv->title->list_subtitle); - subtitle->id = 0; - subtitle->format = TEXTSUB; - subtitle->source = CC608SUB; + subtitle->id = 0; + subtitle->format = TEXTSUB; + subtitle->source = CC608SUB; subtitle->config.dest = PASSTHRUSUB; - subtitle->codec = WORK_DECCC608; - subtitle->type = 5; - snprintf(subtitle->lang, sizeof( subtitle->lang ), - "Closed Captions"); + subtitle->codec = WORK_DECCC608; + subtitle->type = 5; + /* * The language of the subtitles will be the same as the * first audio track, i.e. the same as the video. */ - hb_audio_t *audio = hb_list_item(pv->title->list_audio, 0); + audio = hb_list_item(pv->title->list_audio, 0); if (audio != NULL) { - snprintf(subtitle->iso639_2, sizeof(subtitle->iso639_2), - "%s", audio->config.lang.iso639_2); + lang = lang_for_code2( audio->config.lang.iso639_2 ); } else { - snprintf(subtitle->iso639_2, sizeof(subtitle->iso639_2), - "und"); + lang = lang_for_code2( "und" ); } + snprintf(subtitle->lang, sizeof(subtitle->lang), + "%s, Closed Caption [%s]", + strlen(lang->native_name) ? lang->native_name : + lang->eng_name, + hb_subsource_name(subtitle->source)); + snprintf(subtitle->iso639_2, sizeof(subtitle->iso639_2), + "%s", lang->iso639_2); + hb_list_add(pv->title->list_subtitle, subtitle); } } |