summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2017-03-10 12:56:55 -0700
committerGitHub <[email protected]>2017-03-10 12:56:55 -0700
commitbd22891d633e16d7aedddadd2e4dd716f615d847 (patch)
tree4194d0fd483759f8e8f5226ac479e5ad193a9ef9 /libhb
parent1f6c91c00be0f8f47de1d5c77b945ad6ecd50ec5 (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')
-rw-r--r--libhb/bd.c12
-rw-r--r--libhb/common.c18
-rw-r--r--libhb/decavcodec.c35
-rw-r--r--libhb/dvd.c33
-rw-r--r--libhb/dvdnav.c33
-rw-r--r--libhb/stream.c23
-rw-r--r--libhb/work.c34
7 files changed, 107 insertions, 81 deletions
diff --git a/libhb/bd.c b/libhb/bd.c
index 98f49206c..843fd6c53 100644
--- a/libhb/bd.c
+++ b/libhb/bd.c
@@ -95,11 +95,6 @@ static void add_subtitle(int track, hb_list_t *list_subtitle, BLURAY_STREAM_INFO
subtitle->track = track;
subtitle->id = bdsub->pid;
- lang = lang_for_code2( (char*)bdsub->lang );
- snprintf( subtitle->lang, sizeof( subtitle->lang ), "%s",
- strlen(lang->native_name) ? lang->native_name : lang->eng_name);
- snprintf( subtitle->iso639_2, sizeof( subtitle->iso639_2 ), "%s",
- lang->iso639_2);
switch ( bdsub->coding_type )
{
@@ -113,6 +108,13 @@ static void add_subtitle(int track, hb_list_t *list_subtitle, BLURAY_STREAM_INFO
free( subtitle );
return;
}
+ lang = lang_for_code2( (char*)bdsub->lang );
+ snprintf(subtitle->lang, sizeof( subtitle->lang ), "%s [%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);
+
subtitle->reg_desc = STR4_TO_UINT32("HDMV");
subtitle->stream_type = bdsub->coding_type;
subtitle->codec = codec;
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);
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);
}
}
diff --git a/libhb/dvd.c b/libhb/dvd.c
index 1cca5b98f..078806d89 100644
--- a/libhb/dvd.c
+++ b/libhb/dvd.c
@@ -213,31 +213,31 @@ static void add_subtitle( hb_list_t * list_subtitle, int position,
switch (lang_extension)
{
case 2:
- strcat( subtitle->lang, " (Caption with bigger size character)" );
+ strcat(subtitle->lang, " Large Type");
break;
case 3:
- strcat( subtitle->lang, " (Caption for Children)" );
+ strcat(subtitle->lang, " Children");
break;
case 5:
- strcat( subtitle->lang, " (Closed Caption)" );
+ strcat(subtitle->lang, " Closed Caption");
break;
case 6:
- strcat( subtitle->lang, " (Closed Caption with bigger size character)" );
+ strcat(subtitle->lang, " Closed Caption, Large Type");
break;
case 7:
- strcat( subtitle->lang, " (Closed Caption for Children)" );
+ strcat(subtitle->lang, " Closed Caption, Children");
break;
case 9:
- strcat( subtitle->lang, " (Forced Caption)" );
+ strcat(subtitle->lang, " Forced");
break;
case 13:
- strcat( subtitle->lang, " (Director's Commentary)" );
+ strcat(subtitle->lang, " Director's Commentary");
break;
case 14:
- strcat( subtitle->lang, " (Director's Commentary with bigger size character)" );
+ strcat(subtitle->lang, " Director's Commentary, Large Type");
break;
case 15:
- strcat( subtitle->lang, " (Director's Commentary for Children)" );
+ strcat(subtitle->lang, " Director's Commentary, Children");
default:
break;
}
@@ -245,21 +245,24 @@ static void add_subtitle( hb_list_t * list_subtitle, int position,
switch (style)
{
case HB_VOBSUB_STYLE_4_3:
- strcat( subtitle->lang, " (4:3)" );
+ strcat(subtitle->lang, " (4:3)");
break;
case HB_VOBSUB_STYLE_WIDE:
- strcat( subtitle->lang, " (Wide Screen)" );
+ strcat(subtitle->lang, " (Wide Screen)");
break;
case HB_VOBSUB_STYLE_LETTERBOX:
- strcat( subtitle->lang, " (Letterbox)" );
+ strcat(subtitle->lang, " (Letterbox)");
break;
case HB_VOBSUB_STYLE_PANSCAN:
- strcat( subtitle->lang, " (Pan & Scan)" );
+ strcat(subtitle->lang, " (Pan & Scan)");
break;
}
+ strcat(subtitle->lang, " [");
+ strcat(subtitle->lang, hb_subsource_name(subtitle->source));
+ strcat(subtitle->lang, "]");
- hb_log( "scan: id=0x%x, lang=%s, 3cc=%s ext=%i", subtitle->id,
- subtitle->lang, subtitle->iso639_2, lang_extension );
+ hb_log("scan: id=0x%x, lang=%s, 3cc=%s ext=%i", subtitle->id,
+ subtitle->lang, subtitle->iso639_2, lang_extension);
hb_list_add(list_subtitle, subtitle);
}
diff --git a/libhb/dvdnav.c b/libhb/dvdnav.c
index ed7dd26c7..4a1cbfb57 100644
--- a/libhb/dvdnav.c
+++ b/libhb/dvdnav.c
@@ -357,31 +357,31 @@ static void add_subtitle( hb_list_t * list_subtitle, int position,
switch (lang_extension)
{
case 2:
- strcat( subtitle->lang, " (Caption with bigger size character)" );
+ strcat(subtitle->lang, " Large Type");
break;
case 3:
- strcat( subtitle->lang, " (Caption for Children)" );
+ strcat(subtitle->lang, " Children");
break;
case 5:
- strcat( subtitle->lang, " (Closed Caption)" );
+ strcat(subtitle->lang, " Closed Caption");
break;
case 6:
- strcat( subtitle->lang, " (Closed Caption with bigger size character)" );
+ strcat(subtitle->lang, " Closed Caption, Large Type");
break;
case 7:
- strcat( subtitle->lang, " (Closed Caption for Children)" );
+ strcat(subtitle->lang, " Closed Caption, Children");
break;
case 9:
- strcat( subtitle->lang, " (Forced Caption)" );
+ strcat(subtitle->lang, " Forced");
break;
case 13:
- strcat( subtitle->lang, " (Director's Commentary)" );
+ strcat(subtitle->lang, " Director's Commentary");
break;
case 14:
- strcat( subtitle->lang, " (Director's Commentary with bigger size character)" );
+ strcat(subtitle->lang, " Director's Commentary, Large Type");
break;
case 15:
- strcat( subtitle->lang, " (Director's Commentary for Children)" );
+ strcat(subtitle->lang, " Director's Commentary, Children");
default:
break;
}
@@ -389,21 +389,24 @@ static void add_subtitle( hb_list_t * list_subtitle, int position,
switch (style)
{
case HB_VOBSUB_STYLE_4_3:
- strcat( subtitle->lang, " (4:3)" );
+ strcat(subtitle->lang, " (4:3)");
break;
case HB_VOBSUB_STYLE_WIDE:
- strcat( subtitle->lang, " (Wide Screen)" );
+ strcat(subtitle->lang, " (Wide Screen)");
break;
case HB_VOBSUB_STYLE_LETTERBOX:
- strcat( subtitle->lang, " (Letterbox)" );
+ strcat(subtitle->lang, " (Letterbox)");
break;
case HB_VOBSUB_STYLE_PANSCAN:
- strcat( subtitle->lang, " (Pan & Scan)" );
+ strcat(subtitle->lang, " (Pan & Scan)");
break;
}
+ strcat(subtitle->lang, " [");
+ strcat(subtitle->lang, hb_subsource_name(subtitle->source));
+ strcat(subtitle->lang, "]");
- hb_log( "scan: id=0x%x, lang=%s, 3cc=%s ext=%i", subtitle->id,
- subtitle->lang, subtitle->iso639_2, lang_extension );
+ hb_log("scan: id=0x%x, lang=%s, 3cc=%s ext=%i", subtitle->id,
+ subtitle->lang, subtitle->iso639_2, lang_extension);
hb_list_add(list_subtitle, subtitle);
}
diff --git a/libhb/stream.c b/libhb/stream.c
index 69af167b7..baa53018f 100644
--- a/libhb/stream.c
+++ b/libhb/stream.c
@@ -1964,11 +1964,6 @@ static void pes_add_subtitle_to_title(
subtitle->track = idx;
subtitle->id = id;
- lang = lang_for_code( pes->lang_code );
- snprintf( subtitle->lang, sizeof( subtitle->lang ), "%s",
- strlen(lang->native_name) ? lang->native_name : lang->eng_name);
- snprintf( subtitle->iso639_2, sizeof( subtitle->iso639_2 ), "%s",
- lang->iso639_2);
switch ( pes->codec )
{
@@ -1988,6 +1983,12 @@ static void pes_add_subtitle_to_title(
free( subtitle );
return;
}
+ lang = lang_for_code( pes->lang_code );
+ snprintf(subtitle->lang, sizeof( subtitle->lang ), "%s [%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);
subtitle->reg_desc = stream->reg_desc;
subtitle->stream_type = pes->stream_type;
subtitle->substream_type = pes->stream_id_ext;
@@ -5354,12 +5355,14 @@ static void add_ffmpeg_subtitle( hb_title_t *title, hb_stream_t *stream, int id
}
AVDictionaryEntry *tag;
- iso639_lang_t *language;
+ iso639_lang_t *lang;
tag = av_dict_get( st->metadata, "language", NULL, 0 );
- language = lang_for_code2( tag ? tag->value : "und" );
- strcpy( subtitle->lang, language->eng_name );
- strncpy( subtitle->iso639_2, language->iso639_2, 4 );
+ lang = lang_for_code2( tag ? tag->value : "und" );
+ snprintf(subtitle->lang, sizeof( subtitle->lang ), "%s [%s]",
+ strlen(lang->native_name) ? lang->native_name : lang->eng_name,
+ hb_subsource_name(subtitle->source));
+ strncpy(subtitle->iso639_2, lang->iso639_2, 4);
// Copy the extradata for the subtitle track
if (codecpar->extradata != NULL)
@@ -5375,7 +5378,7 @@ static void add_ffmpeg_subtitle( hb_title_t *title, hb_stream_t *stream, int id
subtitle->config.default_track = 1;
}
- subtitle->track = id;
+ subtitle->track = hb_list_count(title->list_subtitle);
hb_list_add(title->list_subtitle, subtitle);
}
diff --git a/libhb/work.c b/libhb/work.c
index 5af53cb5d..1358bc12e 100644
--- a/libhb/work.c
+++ b/libhb/work.c
@@ -540,29 +540,33 @@ void hb_display_job_info(hb_job_t *job)
{
if( job->indepth_scan )
{
- hb_log( " + subtitle, %s (track %d, id 0x%x) %s [%s]",
+ hb_log( " + subtitle, %s (track %d, id 0x%x, %s)",
subtitle->lang, subtitle->track, subtitle->id,
- subtitle->format == PICTURESUB ? "Picture" : "Text",
- hb_subsource_name( subtitle->source ) );
+ subtitle->format == PICTURESUB ? "Picture" : "Text");
}
else if( subtitle->source == SRTSUB )
{
/* For SRT, print offset and charset too */
- hb_log( " * subtitle track %d, %s (track %d, id 0x%x) Text [SRT] -> %s%s, offset: %"PRId64", charset: %s",
- subtitle->out_track, subtitle->lang, subtitle->track, subtitle->id,
- subtitle->config.dest == RENDERSUB ? "Render/Burn-in" : "Passthrough",
- subtitle->config.default_track ? ", Default" : "",
- subtitle->config.offset, subtitle->config.src_codeset );
+ hb_log(" * subtitle track %d, %s (track %d, id 0x%x, Text) -> "
+ "%s%s, offset: %"PRId64", charset: %s",
+ subtitle->out_track, subtitle->lang, subtitle->track,
+ subtitle->id,
+ subtitle->config.dest == RENDERSUB ? "Render/Burn-in"
+ : "Passthrough",
+ subtitle->config.default_track ? ", Default" : "",
+ subtitle->config.offset, subtitle->config.src_codeset);
}
else
{
- hb_log( " * subtitle track %d, %s (track %d, id 0x%x) %s [%s] -> %s%s%s",
- subtitle->out_track, subtitle->lang, subtitle->track, subtitle->id,
- subtitle->format == PICTURESUB ? "Picture" : "Text",
- hb_subsource_name( subtitle->source ),
- subtitle->config.dest == RENDERSUB ? "Render/Burn-in" : "Passthrough",
- subtitle->config.force ? ", Forced Only" : "",
- subtitle->config.default_track ? ", Default" : "" );
+ hb_log(" * subtitle track %d, %s (track %d, id 0x%x, %s) -> "
+ "%s%s%s",
+ subtitle->out_track, subtitle->lang, subtitle->track,
+ subtitle->id,
+ subtitle->format == PICTURESUB ? "Picture" : "Text",
+ subtitle->config.dest == RENDERSUB ? "Render/Burn-in"
+ : "Passthrough",
+ subtitle->config.force ? ", Forced Only" : "",
+ subtitle->config.default_track ? ", Default" : "" );
}
}
}