diff options
author | John Stebbins <[email protected]> | 2019-08-02 11:41:13 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2019-08-11 15:36:40 -0700 |
commit | d62dfce98fda79ef6cd10d4089141c81fe994223 (patch) | |
tree | c07e3b2ce16a162bc9d6f2067659eedf94c3df7a /libhb/stream.c | |
parent | 692ac873ccf2ea3a5091566ed9e2d027d4825eda (diff) |
add subtitle track name read/write
Works similar to audio track names.
If source has a subtitle track name, hb_subtitle_t.name is set.
To set output subtitle track name, set hb_subtitle_config_t.name.
Source track names are available in title returned by hb_title_to_dict
and hb_title_to_json in SubtitleList[].Name
In job dict it is also SubtitleList[].Name
hb_preset_job_init and hb_preset_job_init_json initialize output tracks
with the source track name.
Also adds subtitle name support to LinGui
Diffstat (limited to 'libhb/stream.c')
-rw-r--r-- | libhb/stream.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libhb/stream.c b/libhb/stream.c index 1448ac4f0..8182cb35c 100644 --- a/libhb/stream.c +++ b/libhb/stream.c @@ -5414,6 +5414,8 @@ static void add_ffmpeg_subtitle( hb_title_t *title, hb_stream_t *stream, int id { AVStream * st = stream->ffmpeg_ic->streams[id]; AVCodecParameters * codecpar = st->codecpar; + AVDictionaryEntry * tag_lang = av_dict_get(st->metadata, "language", NULL, 0 ); + AVDictionaryEntry * tag_name = av_dict_get(st->metadata, "title", NULL, 0); hb_subtitle_t *subtitle = calloc( 1, sizeof(*subtitle) ); @@ -5474,16 +5476,18 @@ static void add_ffmpeg_subtitle( hb_title_t *title, hb_stream_t *stream, int id return; } - AVDictionaryEntry *tag; iso639_lang_t *lang; - tag = av_dict_get( st->metadata, "language", NULL, 0 ); - lang = lang_for_code2( tag ? tag->value : "und" ); + lang = lang_for_code2(tag_lang ? tag_lang->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, 3); subtitle->iso639_2[3] = 0; + if (tag_name != NULL) + { + subtitle->name = strdup(tag_name->value); + } // Copy the extradata for the subtitle track if (codecpar->extradata != NULL) |