diff options
author | John Stebbins <[email protected]> | 2019-07-31 10:59:25 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2019-08-11 15:36:40 -0700 |
commit | cc33883b8a62e501d33c716f1e805601744d744f (patch) | |
tree | ebbec5d763cd5ccb693873d94ff12627eef9c2a2 /libhb/hb_json.c | |
parent | 6125d196cacf967e90ab499327dbcb83588778c1 (diff) |
libhb: make source audio track name available to frontends
It gets stored in new hb_audio_config_t.in.name field.
It is available in the title dict read through hb_title_to_dict() or
hb_title_to_json() in AudioList[].Name.
When a job is initialized with hb_preset_job_init or
hb_preset_job_init_json(), output audio tracks are initialized with the
source track name.
Also adds output track name initialization to LinGui.
Diffstat (limited to 'libhb/hb_json.c')
-rw-r--r-- | libhb/hb_json.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/libhb/hb_json.c b/libhb/hb_json.c index bd1e2f945..f69a1e322 100644 --- a/libhb/hb_json.c +++ b/libhb/hb_json.c @@ -397,6 +397,7 @@ static hb_dict_t* hb_title_to_dict_internal( hb_title_t *title ) "LanguageCode", hb_value_string(audio->config.lang.iso639_2), "Attributes", attributes, "Codec", hb_value_int(audio->config.in.codec), + "CodecParam", hb_value_int(audio->config.in.codec_param), "CodecName", hb_value_string(codec_name), "SampleRate", hb_value_int(audio->config.in.samplerate), "BitRate", hb_value_int(audio->config.in.bitrate), @@ -409,6 +410,10 @@ static hb_dict_t* hb_title_to_dict_internal( hb_title_t *title ) hb_error("json pack failure: %s", error.text); return NULL; } + if (audio->config.in.name != NULL) + { + hb_dict_set_string(audio_dict, "Name", audio->config.in.name); + } hb_value_array_append(audio_list, audio_dict); } hb_dict_set(dict, "AudioList", audio_list); @@ -840,8 +845,7 @@ hb_dict_t* hb_job_to_dict( const hb_job_t * job ) "CompressionLevel", hb_value_double(audio->config.out.compression_level)); if (audio->config.out.name != NULL) { - hb_dict_set(audio_dict, "Name", - hb_value_string(audio->config.out.name)); + hb_dict_set_string(audio_dict, "Name", audio->config.out.name); } hb_value_array_append(audio_list, audio_dict); @@ -1693,6 +1697,19 @@ char* hb_job_init_json(hb_handle_t *h, int title_index) return json_job; } +char* hb_preset_job_init_json(hb_handle_t *h, int title_index, + const char *json_preset) +{ + hb_dict_t * preset = hb_value_json(json_preset); + hb_dict_t * job = hb_preset_job_init(h, title_index, preset); + char * json_job = hb_value_get_json(job); + + hb_value_free(&preset); + hb_value_free(&job); + + return json_job; +} + /** * Add a json string job to the hb queue * @param h - Pointer to hb_handle_t instance that job is added to |