diff options
author | jstebbins <[email protected]> | 2015-05-11 15:45:25 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2015-05-11 15:45:25 +0000 |
commit | 7d0f528cb5a168bba6306458f904e21e156901c9 (patch) | |
tree | 68e2314cdd38e6abadf2c92116e681fbaf2edc71 /libhb/preset.c | |
parent | 6e59c5d576fc695f59bf661e752c7f004ac6133b (diff) |
cli: fix missing subtitle "Default" flag when --all-subtitles is used
Also fix case that can cause all subtitles to be added twice.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7169 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/preset.c')
-rw-r--r-- | libhb/preset.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libhb/preset.c b/libhb/preset.c index 3fef7c686..c49073cf4 100644 --- a/libhb/preset.c +++ b/libhb/preset.c @@ -620,6 +620,17 @@ int hb_preset_job_add_subtitles(hb_handle_t *h, int title_index, // We do not want to add the same track with the same settings twice behavior.used = calloc(source_subtitle_count, sizeof(*behavior.used)); + // Since this function can be called multiple times, we need to + // initialize the "used" array from the existing subtitles in the list. + int count, ii; + count = hb_value_array_len(list); + for (ii = 0; ii < count; ii++) + { + hb_value_t *sub = hb_value_array_get(list, ii); + int track = hb_value_get_int(hb_dict_get(sub, "Track")); + behavior.used[track] = 1; + } + const char *s; s = hb_value_get_string(hb_dict_get(preset, "SubtitleTrackSelectionBehavior")); @@ -659,7 +670,7 @@ int hb_preset_job_add_subtitles(hb_handle_t *h, int title_index, // Add tracks for all languages in the language list hb_value_array_t *lang_list = hb_dict_get(preset, "SubtitleLanguageList"); - int count = hb_value_array_len(lang_list); + count = hb_value_array_len(lang_list); const char *pref_lang = "und"; if (count > 0) { |