diff options
author | jstebbins <[email protected]> | 2010-01-14 23:27:58 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2010-01-14 23:27:58 +0000 |
commit | 5add69a1b0833d7c3e316f69e1f2713b8440d6d2 (patch) | |
tree | 34db7fd139e1f6f85397d3e1dba40873b01b1c9b /gtk/src/hb-backend.c | |
parent | c871247f8fe0d78de672a59dc58f3dd3fbc6379a (diff) |
prevent duplicate audio list entries
when the user has an obscene number of audios in a custom preset that
are all passthru, duplicate audios would populate the audio list.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3070 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/hb-backend.c')
-rw-r--r-- | gtk/src/hb-backend.c | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index b577a5b00..44de3c2d9 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -2099,7 +2099,10 @@ ghb_find_audio_track( gint track = -1; gint max_chan = 0; gboolean *used; + gboolean *passthru_used; gint try_acodec; + gint passthru_acodec; + gboolean passthru; g_debug("find_audio_track ()\n"); if (h_scan == NULL) return -1; @@ -2112,7 +2115,8 @@ ghb_find_audio_track( if (count > 10) count = 10; // Try to find an item that matches the preferred language and // the passthru codec type - if (acodec & (HB_ACODEC_AC3 | HB_ACODEC_DCA)) + passthru = (acodec & (HB_ACODEC_AC3 | HB_ACODEC_DCA)) != 0; + if (passthru) { for (ii = 0; ii < count; ii++) { @@ -2120,11 +2124,11 @@ ghb_find_audio_track( audio = (hb_audio_config_t*)hb_list_audio_config_item( title->list_audio, ii ); - try_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec; + passthru_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec; // Is the source track use a passthru capable codec? - if (try_acodec == 0) + if (passthru_acodec == 0) continue; - used = get_track_used(try_acodec, track_indices, count); + used = get_track_used(passthru_acodec, track_indices, count); // Has the track already been used with this codec? if (used[ii]) continue; @@ -2163,7 +2167,15 @@ ghb_find_audio_track( if (used[ii]) continue; audio = (hb_audio_config_t*)hb_list_audio_config_item( - title->list_audio, ii ); + title->list_audio, ii ); + passthru_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec; + if (passthru_acodec && passthru) + { + passthru_used = get_track_used(passthru_acodec, track_indices, count); + // Has the track already been used with this codec for passthru? + if (passthru_used[ii]) + continue; + } // Find a track that is not visually impaired or dirctor's commentary if ((audio->lang.type < 2) && ((strcmp(lang, audio->lang.iso639_2) == 0) || @@ -2180,7 +2192,7 @@ ghb_find_audio_track( } // Try to fine an item that does not match the preferred language and // matches the passthru codec type - if (acodec & (HB_ACODEC_AC3 | HB_ACODEC_DCA)) + if (passthru) { for (ii = 0; ii < count; ii++) { @@ -2188,11 +2200,11 @@ ghb_find_audio_track( audio = (hb_audio_config_t*)hb_list_audio_config_item( title->list_audio, ii ); - try_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec; + passthru_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec; // Is the source track use a passthru capable codec? - if (try_acodec == 0) + if (passthru_acodec == 0) continue; - used = get_track_used(try_acodec, track_indices, count); + used = get_track_used(passthru_acodec, track_indices, count); // Has the track already been used with this codec? if (used[ii]) continue; @@ -2230,6 +2242,14 @@ ghb_find_audio_track( continue; audio = (hb_audio_config_t*)hb_list_audio_config_item( title->list_audio, ii ); + passthru_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec; + if (passthru_acodec && passthru) + { + passthru_used = get_track_used(passthru_acodec, track_indices, count); + // Has the track already been used with this codec for passthru? + if (passthru_used[ii]) + continue; + } // Find a track that is not visually impaired or dirctor's commentary if (audio->lang.type < 2) { @@ -2246,7 +2266,15 @@ ghb_find_audio_track( for (ii = 0; ii < count; ii++) { audio = (hb_audio_config_t*)hb_list_audio_config_item( - title->list_audio, ii ); + title->list_audio, ii ); + passthru_acodec = (HB_ACODEC_AC3 | HB_ACODEC_DCA) & audio->in.codec; + if (passthru_acodec && passthru) + { + passthru_used = get_track_used(passthru_acodec, track_indices, count); + // Has the track already been used with this codec for passthru? + if (passthru_used[ii]) + continue; + } // Has the track already been used with this codec? if (!used[ii]) { |