diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 6f445a0e..b438dc6e 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1708,6 +1708,8 @@ Udo Richter the marks file has just been written" for suggesting a fix for a bug in handling DiSEqC codes for fixing handling the channelID in cMenuEditChanItem + for a patch that sets the start time of an edited recording to the time of the first + editing mark Sven Kreiensen for his help in keeping 'channels.conf.terr' up to date diff --git a/HISTORY b/HISTORY index 0040b4b0..b5cbcb91 100644 --- a/HISTORY +++ b/HISTORY @@ -6705,3 +6705,6 @@ Video Disk Recorder Revision History (reported by Derek Kelly). - Now initializing Setup.InitialChannel to an empty string to avoid problems in case there is no setup.conf. +- The start time of an edited recording is now set to the time of the first + editing mark (thanks to Udo Richter). + This obsoletes the CUTTIME patch. diff --git a/cutter.c b/cutter.c index 96739fdd..725adc51 100644 --- a/cutter.c +++ b/cutter.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: cutter.c 2.6 2011/03/06 14:54:33 kls Exp $ + * $Id: cutter.c 2.7 2011/08/20 09:57:27 kls Exp $ */ #include "cutter.h" @@ -208,6 +208,12 @@ bool cCutter::Start(const char *FileName) error = false; ended = false; cRecording Recording(FileName); + + cMarks FromMarks; + FromMarks.Load(FileName); + if (cMark *First = FromMarks.First()) + Recording.SetStartTime(Recording.start + (int(First->position / Recording.FramesPerSecond() + 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) diff --git a/recording.c b/recording.c index 4456bddb..cbe27882 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 2.33 2011/08/13 12:37:25 kls Exp $ + * $Id: recording.c 2.34 2011/08/20 09:53:45 kls Exp $ */ #include "recording.h" @@ -958,6 +958,13 @@ bool cRecording::WriteInfo(void) return true; } +void cRecording::SetStartTime(time_t Start) +{ + start = Start; + free(fileName); + fileName = NULL; +} + bool cRecording::Delete(void) { bool result = true; diff --git a/recording.h b/recording.h index 578dd455..7683d610 100644 --- a/recording.h +++ b/recording.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.h 2.22 2011/08/13 12:51:23 kls Exp $ + * $Id: recording.h 2.23 2011/08/20 09:52:07 kls Exp $ */ #ifndef __RECORDING_H @@ -119,6 +119,14 @@ public: bool IsPesRecording(void) const { return isPesRecording; } void ReadInfo(void); bool WriteInfo(void); + void SetStartTime(time_t Start); + ///< Sets the start time of this recording to the given value. + ///< If a filename has already been set for this recording, it will be + ///< deleted and a new one will be generated (using the new start time) + ///< at the next call to FileName(). + ///< Use this function with care - it does not check whether a recording with + ///< this new name already exists, and if there is one, results may be + ///< unexpected! bool Delete(void); ///< Changes the file name so that it will no longer be visible in the "Recordings" menu ///< Returns false in case of error