Idea and Patch: Compensate start time on cutting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi list,

I usually record with lots of margin before and after. I also cut 
everything after detecting commercial breaks. This however has two small 
side effects. First, the start margin time will be taken for the 
recording name, so its a bit off, like 20:55 instead of 21:00. Second, 
after cutting, its not possible to see the actual start time of the 
recording any more. (This is sometimes useful to know to adjust the 
margins of repeated timers.)

Recently I had the idea, when cutting why not shift the recording start 
time to the time of the beginning cut mark? This would even have another 
positive side effect: That way its easy to cut a recording into two 
parts, because they would have different start times.

Well, why not, so today I tried and the result is attached as patch. 
Unfortunately, a small API change is necessary, so plugins should be 
re-compiled. I don't expect this to go into VDR soon, but maybe when 
development cycle starts again.

Cheers,

Udo

-------------- next part --------------
--- 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)

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux