diff options
author | jstebbins <[email protected]> | 2014-02-24 02:24:45 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2014-02-24 02:24:45 +0000 |
commit | 885561442b9411399827a5bec53c4cc884a31862 (patch) | |
tree | 74f88f9890ffe2945c8247f7bc2cc02c9b15aec2 /gtk/src/hb-backend.c | |
parent | fb9ad35feadd0fdbb47854012bda690897234842 (diff) |
LinGui: fix selection of "feature" title
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6077 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/hb-backend.c')
-rw-r--r-- | gtk/src/hb-backend.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index 2bab2a7a0..1ce5d7b3d 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -2302,16 +2302,26 @@ ghb_longest_title() { hb_title_set_t * title_set; const hb_title_t * title; - gint count = 0; + gint count = 0, ii, longest = -1; + int64_t duration = 0; g_debug("ghb_longest_title ()\n"); if (h_scan == NULL) return 0; title_set = hb_get_title_set( h_scan ); count = hb_list_count( title_set->list_title ); - if (count < 1) return 0; - title = hb_list_item(title_set->list_title, 0); - (void)title; // Silence "unused variable" warning - return title_set->feature; + if (count < 1) return -1; + + // Check that the feature title in the title_set exists in the list + // of titles. If not, pick the longest. + for (ii = 0; ii < count; ii++) + { + title = hb_list_item(title_set->list_title, ii); + if (title->index == title_set->feature) + return title_set->feature; + if (title->duration > duration) + longest = title->index; + } + return longest; } const gchar* |