>From 5014cb342d671577b0b9a856e2dff4b6f2769c64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tobias=20G=C3=BCntner?= <fatbull@web.de>
Date: Wed, 28 Sep 2011 15:47:43 +0000
Subject: [PATCH 2/2] Add chapter at the beginning only if necessary

---
 modules/access/vdr.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/access/vdr.c b/modules/access/vdr.c
index b0cf722..4102cc1 100644
--- a/modules/access/vdr.c
+++ b/modules/access/vdr.c
@@ -887,7 +887,8 @@ static void ImportMarks( access_t *p_access )
         TAB_APPEND( p_marks->i_seekpoint, p_marks->seekpoint, sp );
     }
 
-    if( p_marks->i_seekpoint > 0 )
+    /* add chapter at the beginning if necessary */
+    if( p_marks->i_seekpoint > 0 && p_marks->seekpoint[0]->i_byte_offset > 0 )
     {
         seekpoint_t *sp = vlc_seekpoint_New();
         if( sp )
@@ -897,12 +898,12 @@ static void ImportMarks( access_t *p_access )
             sp->psz_name = strdup( _("Start") );
             TAB_INSERT( p_marks->i_seekpoint, p_marks->seekpoint, sp, 0 );
         }
-        p_sys->p_marks = p_marks;
     }
+
+    if( p_marks->i_seekpoint > 0 )
+        p_sys->p_marks = p_marks;
     else
-    {
         vlc_input_title_Delete( p_marks );
-    }
 
     fclose( marksfile );
     fclose( indexfile );
-- 
1.7.0.4

