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/common.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/common.c')
-rw-r--r-- | libhb/common.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libhb/common.c b/libhb/common.c index e21590fa2..df5d60467 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -4809,6 +4809,14 @@ hb_subtitle_t *hb_subtitle_copy(const hb_subtitle_t *src) subtitle->extradata = malloc( src->extradata_size ); memcpy( subtitle->extradata, src->extradata, src->extradata_size ); } + if (src->name != NULL) + { + subtitle->name = strdup(src->name); + } + if (src->config.name != NULL) + { + subtitle->config.name = strdup(src->config.name); + } } return subtitle; } @@ -4846,6 +4854,8 @@ void hb_subtitle_close( hb_subtitle_t **sub ) { if ( sub && *sub ) { + free ((char*)(*sub)->name); + free ((char*)(*sub)->config.name); free ((*sub)->extradata); free(*sub); *sub = NULL; @@ -4905,6 +4915,10 @@ int hb_subtitle_add(const hb_job_t * job, const hb_subtitle_config_t * subtitlec // "track" in job->list_audio is an index into title->list_audio subtitle->track = track; subtitle->config = *subtitlecfg; + if (subtitlecfg->name != NULL && subtitlecfg->name[0] != 0) + { + subtitle->config.name = strdup(subtitlecfg->name); + } subtitle->out_track = hb_list_count(job->list_subtitle) + 1; hb_list_add(job->list_subtitle, subtitle); return 1; @@ -4944,6 +4958,10 @@ int hb_import_subtitle_add( const hb_job_t * job, strcpy(subtitle->iso639_2, lang->iso639_2); subtitle->config = *subtitlecfg; + if (subtitlecfg->name != NULL && subtitlecfg->name[0] != 0) + { + subtitle->config.name = strdup(subtitlecfg->name); + } hb_list_add(job->list_subtitle, subtitle); return 1; |