diff options
author | jstebbins <[email protected]> | 2011-09-26 20:37:46 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2011-09-26 20:37:46 +0000 |
commit | fa6fa44a3c499ce7eb35fdeb52bed431c3b47780 (patch) | |
tree | 6b1f15d9b281d08df8980c645b93a5ebe859a301 /libhb | |
parent | 3a34f16a25e45e87e27cc107fd489eef1abc73f7 (diff) |
Fix for DVD's that have broken udf filenames
A new obfuscation technique it to add UDF-16 filenames that have junk in
the high byte and things like "VIDEO_TS.IFO" in the low byte.
libdvdread throws away the high byte which results in references to the
bogus copy of the file.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4252 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/dvdnav.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/libhb/dvdnav.c b/libhb/dvdnav.c index e76357d32..1de7444af 100644 --- a/libhb/dvdnav.c +++ b/libhb/dvdnav.c @@ -1282,6 +1282,8 @@ static int hb_dvdnav_main_feature( hb_dvd_t * e, hb_list_t * list_title ) uint64_t longest_duration_root = 0; uint64_t longest_duration_title = 0; uint64_t longest_duration_fallback = 0; + uint64_t avg_duration = 0; + int avg_cnt = 0; hb_title_t * title; int index; @@ -1294,7 +1296,15 @@ static int hb_dvdnav_main_feature( hb_dvd_t * e, hb_list_t * list_title ) longest_duration_fallback = title->duration; longest_fallback = title->index; } + if ( title->duration > 90000L * 60 * 30 ) + { + avg_duration += title->duration; + avg_cnt++; + } } + if ( avg_cnt ) + avg_duration /= avg_cnt; + index = find_title( list_title, longest_fallback ); title = hb_list_item( list_title, index ); if ( title ) @@ -1381,10 +1391,17 @@ static int hb_dvdnav_main_feature( hb_dvd_t * e, hb_list_t * list_title ) longest_duration = longest_duration_title; longest = longest_title; } - if ((float)longest_duration_fallback * 0.7 > longest_duration) + if ((float)longest_duration_fallback * 0.7 > longest_duration && + longest_duration < 90000L * 60 * 30 ) { - longest = longest_fallback; - hb_deep_log( 2, "dvdnav: Using longest title %d", longest ); + float factor = (float)avg_duration / longest_duration; + if ( factor > 1 ) + factor = 1 / factor; + if ( avg_cnt > 10 && factor < 0.7 ) + { + longest = longest_fallback; + hb_deep_log( 2, "dvdnav: Using longest title %d", longest ); + } } return longest; } |