summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2017-01-11 11:00:52 -0700
committerJohn Stebbins <[email protected]>2017-01-11 11:02:48 -0700
commit0a876569e88943def836b16ecf4c76923e1500f2 (patch)
treec8b4d46b64c57c596b55689405b96abd9b764071 /libhb
parent78db4231c66f169c6c1ee7d19f75cc39140364ea (diff)
preset: fix "all" AudioTrackSelectionBehavior
When all tracks are requested, do not filter out secondary audio types. This should only be done when only the "first" track is requested.
Diffstat (limited to 'libhb')
-rw-r--r--libhb/preset.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libhb/preset.c b/libhb/preset.c
index b6c6605c7..e07620f19 100644
--- a/libhb/preset.c
+++ b/libhb/preset.c
@@ -381,7 +381,7 @@ static hb_dict_t * source_audio_track_used(hb_dict_t *track_dict, int track)
// Find a source audio track matching given language
static int find_audio_track(const hb_title_t *title,
- const char *lang, int start)
+ const char *lang, int start, int behavior)
{
hb_audio_config_t * audio;
int ii, count;
@@ -390,8 +390,13 @@ static int find_audio_track(const hb_title_t *title,
for (ii = start; ii < count; ii++)
{
audio = hb_list_audio_config_item(title->list_audio, ii);
- // Ignore secondary audio types
- if ((audio->lang.type == HB_AUDIO_TYPE_NONE ||
+ // When behavior is "first" matching track,
+ // ignore secondary audio types
+ //
+ // When behavior is "all" matching tracks,
+ // allow any audio track type
+ if ((behavior == 2 ||
+ audio->lang.type == HB_AUDIO_TYPE_NONE ||
audio->lang.type == HB_AUDIO_TYPE_NORMAL) &&
(!strcmp(lang, audio->lang.iso639_2) || !strcmp(lang, "und")))
{
@@ -609,7 +614,7 @@ static void add_audio_for_lang(hb_value_array_t *list, const hb_dict_t *preset,
{
hb_value_array_t * encoder_list = hb_dict_get(preset, "AudioList");
int count = hb_value_array_len(encoder_list);
- int track = find_audio_track(title, lang, 0);
+ int track = find_audio_track(title, lang, 0, behavior);
int current_mode = 0;
while (track >= 0)
{
@@ -718,7 +723,7 @@ static void add_audio_for_lang(hb_value_array_t *list, const hb_dict_t *preset,
hb_value_array_append(list, audio_dict);
}
if (behavior == 2)
- track = find_audio_track(title, lang, track + 1);
+ track = find_audio_track(title, lang, track + 1, behavior);
else
break;
}