[vlc-commits] access: bluray: avoid being spammed with menu chapters
Francois Cartegnie
git at videolan.org
Fri Nov 9 14:49:53 CET 2018
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Nov 8 21:53:25 2018 +0100| [ffb4ac001fbe4af3046d59313e31a54b3d81f728] | committer: Francois Cartegnie
access: bluray: avoid being spammed with menu chapters
(cherry picked from commit 6b146206086881599894f74eb5b8e1062a778ec3)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=ffb4ac001fbe4af3046d59313e31a54b3d81f728
---
modules/access/bluray.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index ca917db506..e8f6a390ca 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -1900,6 +1900,43 @@ static void bluraySendOverlayToVout(demux_t *p_demux, bluray_overlay_t *p_ov)
p_ov->status = Outdated;
}
+static bool blurayTitleIsRepeating(BLURAY_TITLE_INFO *title_info,
+ unsigned repeats, unsigned ratio)
+{
+ const BLURAY_CLIP_INFO *prev = NULL;
+ unsigned maxrepeats = 0;
+ unsigned sequence = 0;
+ if(!title_info->chapter_count)
+ return false;
+
+ for (unsigned int j = 0; j < title_info->chapter_count; j++)
+ {
+ unsigned i = title_info->chapters[j].clip_ref;
+ if(i < title_info->clip_count)
+ {
+ if(prev == NULL ||
+ /* non repeated does not need start time offset */
+ title_info->clips[i].start_time == 0 ||
+ /* repeats occurs on same segment */
+ memcmp(title_info->clips[i].clip_id, prev->clip_id, 6) ||
+ prev->in_time != title_info->clips[i].in_time ||
+ prev->pkt_count != title_info->clips[i].pkt_count)
+ {
+ sequence = 0;
+ prev = &title_info->clips[i];
+ continue;
+ }
+ else
+ {
+ if(maxrepeats < sequence++)
+ maxrepeats = sequence;
+ }
+ }
+ }
+ return (maxrepeats > repeats &&
+ (100 * maxrepeats / title_info->chapter_count) >= ratio);
+}
+
static void blurayUpdateTitleInfo(input_title_t *t, BLURAY_TITLE_INFO *title_info)
{
t->i_length = FROM_TICKS(title_info->duration);
@@ -1908,6 +1945,10 @@ static void blurayUpdateTitleInfo(input_title_t *t, BLURAY_TITLE_INFO *title_inf
vlc_seekpoint_Delete( t->seekpoint[i] );
TAB_CLEAN(t->i_seekpoint, t->seekpoint);
+ /* FIXME: have libbluray expose repeating titles */
+ if(blurayTitleIsRepeating(title_info, 50, 90))
+ return;
+
for (unsigned int j = 0; j < title_info->chapter_count; j++) {
seekpoint_t *s = vlc_seekpoint_New();
if (!s) {
More information about the vlc-commits
mailing list