[vlc-commits] access: bluray: improve loop detection

Francois Cartegnie git at videolan.org
Fri Nov 9 15:10:40 CET 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Nov  9 15:08:45 2018 +0100| [d48d327033b98c15461378dcb6ffecfc12510d38] | committer: Francois Cartegnie

access: bluray: improve loop detection

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d48d327033b98c15461378dcb6ffecfc12510d38
---

 modules/access/bluray.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 014179e7d1..6348c64e19 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -2029,7 +2029,7 @@ static void bluraySendOverlayToVout(demux_t *p_demux, int plane, bluray_overlay_
 static bool blurayTitleIsRepeating(BLURAY_TITLE_INFO *title_info,
                                    unsigned repeats, unsigned ratio)
 {
-    char clip_id[6] = {0};
+    const BLURAY_CLIP_INFO *prev = NULL;
     unsigned maxrepeats = 0;
     unsigned sequence = 0;
     if(!title_info->chapter_count)
@@ -2040,10 +2040,16 @@ static bool blurayTitleIsRepeating(BLURAY_TITLE_INFO *title_info,
         unsigned i = title_info->chapters[j].clip_ref;
         if(i < title_info->clip_count)
         {
-            if(memcmp(title_info->clips[i].clip_id, clip_id, 6))
+            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;
-                memcpy(clip_id, title_info->clips[i].clip_id, 6);
+                prev = &title_info->clips[i];
                 continue;
             }
             else
@@ -2066,7 +2072,7 @@ static void blurayUpdateTitleInfo(input_title_t *t, BLURAY_TITLE_INFO *title_inf
     TAB_CLEAN(t->i_seekpoint, t->seekpoint);
 
     /* FIXME: have libbluray expose repeating titles */
-    if(blurayTitleIsRepeating(title_info, 10, 90))
+    if(blurayTitleIsRepeating(title_info, 50, 90))
         return;
 
     for (unsigned int j = 0; j < title_info->chapter_count; j++) {



More information about the vlc-commits mailing list