>From 384a033fe072873a42d73e93567f810ebf201475 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Janne=20Kujanp=C3=A4=C3=A4?= <jikuja@iki.fi>
Date: Wed, 21 Sep 2011 23:54:28 +0300
Subject: [PATCH 2/2] Autodetect files which are cut. After detection do not
 create chapters.

---
 modules/access/vdr.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/modules/access/vdr.c b/modules/access/vdr.c
index 9490141..b2cd9f8 100644
--- a/modules/access/vdr.c
+++ b/modules/access/vdr.c
@@ -856,9 +856,21 @@ static void ImportMarks( access_t *p_access )
     /* parse lines of the form "0:00:00.00 foobar" */
     char *line = NULL;
     size_t line_len;
+    /* first cutmark could be "0:00:00.00" */
+    int64_t i_last_frame = -10000;
+
     while( ReadLine( &line, &line_len, marksfile ) )
     {
         int64_t i_frame = ParseFrameNumber( line, p_sys->fps );
+        /* ParseFrameNumber returns frame number instead of PCR
+         * => no need to check overflow. 12-15 frames realistic*/
+        if ( i_frame - i_last_frame < 45 ) 
+        {
+            msg_Info( p_access, "Detected %"PRId64" frames between marks. "\
+                "Not creating chapters.", i_frame - i_last_frame );
+            return;
+        }
+        i_last_frame=i_frame;
 
         /* move chapters (simple workaround for inaccurate cut marks) */
         if( i_frame > -i_chapter_offset )
-- 
1.7.6.3

