# Cuttime-Patch
# (c) Udo Richter udo_richter(a)gmx.de
# http://richter-udo.de/vdr/patches.html#cuttime
#
--- vdr-1.4.0-orig/recording.h	2006-05-14 17:04:48.000000000 +0200
+++ vdr-1.4.0/recording.h	2006-05-14 17:46:17.853979160 +0200
@@ -86,6 +86,7 @@
   const char *FileName(void) const;
   const char *Title(char Delimiter = ' ', bool NewIndicator = false, int Level = -1) const;
   const cRecordingInfo *Info(void) const { return info; }
+  void SetStartTime(time_t Start);
   const char *PrefixFileName(char Prefix);
   int HierarchyLevels(void) const;
   void ResetResume(void) const;
--- vdr-1.4.0-orig/recording.c	2006-05-14 17:04:48.000000000 +0200
+++ vdr-1.4.0/recording.c	2006-05-14 18:07:17.903778608 +0200
@@ -754,6 +754,15 @@
   return titleBuffer;
 }
 
+void cRecording::SetStartTime(time_t Start) 
+{
+  start=Start;
+  if (fileName) {
+  	 free(fileName);
+  	 fileName = NULL;
+  	 }
+}
+
 const char *cRecording::PrefixFileName(char Prefix)
 {
   cString p = PrefixVideoFileName(FileName(), Prefix);
--- vdr-1.4.0-orig/cutter.c	2006-02-12 11:07:23.000000000 +0100
+++ vdr-1.4.0/cutter.c	2006-05-14 18:13:04.591550216 +0200
@@ -189,6 +189,12 @@
      error = false;
      ended = false;
      cRecording Recording(FileName);
+     
+     cMarks FromMarks;
+     FromMarks.Load(FileName);
+     cMark *First=FromMarks.First();
+     if (First) Recording.SetStartTime(Recording.start+((First->position/FRAMESPERSEC+30)/60)*60);
+     
      const char *evn = Recording.PrefixFileName('%');
      if (evn && RemoveVideoFile(evn) && MakeDirs(evn, true)) {
         // XXX this can be removed once RenameVideoFile() follows symlinks (see videodir.c)
