[vdr] Update to 1.7.22. Build docs by default.

Ville Skyttä scop at fedoraproject.org
Sun Dec 4 19:33:23 UTC 2011


commit 844269bbc8bd80c9a8e1afb5201a1e7efe39d3ef
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sun Dec 4 21:33:02 2011 +0200

    Update to 1.7.22.
    Build docs by default.

 .gitignore                                         |    1 -
 0002-Add-and-install-pkg-config-file.patch         |   93 ----
 sources                                            |    6 +-
 vdr-1.7.21-hlcutter-delwhilecutting.patch          |   14 +
 vdr-1.7.22-hlcutter-0.2.2.diff                     |  556 ++++++++++++++++++++
 ...1-msgidbugs.patch => vdr-1.7.22-msgidbugs.patch |    6 +-
 vdr-1.7.21-paths.patch => vdr-1.7.22-paths.patch   |   42 +-
 vdr.spec                                           |   40 +-
 8 files changed, 619 insertions(+), 139 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index ed48f90..c4cc295 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
 /*.gz
 /*.bz2
 /vdr-1.5.17-progressbar-support-0.0.1.diff
-/vdr-1.7.14-hlcutter-0.2.2.diff
 /vdr-1.7.21-ttxtsubs.patch
 /vdr-timer-info-0.5-1.7.13.diff
 /vdr.epgsearch-exttimeredit-0.0.2.diff
diff --git a/sources b/sources
index f936d0b..1e7f83a 100644
--- a/sources
+++ b/sources
@@ -1,10 +1,10 @@
 3e9287f726df5a667054a15078235791  vdr_1.4.5-2.ds.diff.gz
 c34d06b00218d3c04f5bbca3fc773535  MainMenuHooks-v1_0_1.diff.gz
 49db9691fe6023270d443a62bab0411b  vdr-1.5.17-progressbar-support-0.0.1.diff
-65d8616d536c0743efc60f155edcfa1f  vdr-1.7.14-hlcutter-0.2.2.diff
 fae3698214bd45de1f675c2b037d5f3b  vdr-1.7.21-ttxtsubs.patch
-7300bfd997db1a848bd774fefe4aec80  vdr-1.7.21.tar.bz2
 04511ae02243eb1bab94f3f45b59e574  vdr-timer-info-0.5-1.7.13.diff
 71f7281d55eba1957f4267f596b11e29  vdr.epgsearch-exttimeredit-0.0.2.diff
 2b6adcd1e09f009ba12d0fb454e29808  vdr_1.7.20-1.debian.tar.bz2
-e934a5a1c1b2fb63544852053883b809  vdr-1.7.21-liemikuutio-1.33.patch.gz
+b9c0fe1aac8e653c0d0234bc72c2bb2c  vdr-1.7.22.tar.bz2
+612ff95c5f67fffe331c10c0d33340e8  vdr-1.7.22-liemikuutio-1.33.patch.gz
+8d1ecfd83dc6bef54f8263ad25d9186c  vdr-1.7.22-finnish.patch.gz
diff --git a/vdr-1.7.21-hlcutter-delwhilecutting.patch b/vdr-1.7.21-hlcutter-delwhilecutting.patch
new file mode 100644
index 0000000..d3bc7b2
--- /dev/null
+++ b/vdr-1.7.21-hlcutter-delwhilecutting.patch
@@ -0,0 +1,14 @@
+diff -up vdr-1.7.21/cutter.c~ vdr-1.7.21/cutter.c
+--- vdr-1.7.21/cutter.c~	2011-11-20 23:14:29.961933292 +0200
++++ vdr-1.7.21/cutter.c	2011-11-20 23:23:42.707386435 +0200
+@@ -107,6 +107,10 @@ void cCuttingThread::Action(void)
+ 
+            if (FileNumber != CurrentFileNumber) {
+               fromFile = fromFileName->SetOffset(FileNumber, FileOffset);
++              if (!fromFile) {
++                 error = "fromFile 0";
++                 break;
++                 }
+               fromFile->SetReadAhead(MEGABYTE(20));
+               CurrentFileNumber = FileNumber;
+               if (SkipThisSourceFile) {
diff --git a/vdr-1.7.22-hlcutter-0.2.2.diff b/vdr-1.7.22-hlcutter-0.2.2.diff
new file mode 100644
index 0000000..9135555
--- /dev/null
+++ b/vdr-1.7.22-hlcutter-0.2.2.diff
@@ -0,0 +1,556 @@
+diff -Naur vdr-1.7.15/config.c vdr-1.7.15-hlcutter/config.c
+--- vdr-1.7.15/config.c	2010-06-06 12:06:43.000000000 +0200
++++ vdr-1.7.15-hlcutter/config.c	2010-06-06 21:55:25.000000000 +0200
+@@ -384,8 +384,10 @@
+   FontSmlSize = 18;
+   FontFixSize = 20;
+   MaxVideoFileSize = MAXVIDEOFILESIZEDEFAULT;
++  MaxRecordingSize = DEFAULTRECORDINGSIZE;
+   SplitEditedFiles = 0;
+   DelTimeshiftRec = 0;
++  HardLinkCutter = 0;
+   MinEventTimeout = 30;
+   MinUserInactivity = 300;
+   NextWakeupTime = 0;
+@@ -575,8 +577,10 @@
+   else if (!strcasecmp(Name, "FontSmlSize"))         FontSmlSize        = atoi(Value);
+   else if (!strcasecmp(Name, "FontFixSize"))         FontFixSize        = atoi(Value);
+   else if (!strcasecmp(Name, "MaxVideoFileSize"))    MaxVideoFileSize   = atoi(Value);
++  else if (!strcasecmp(Name, "MaxRecordingSize"))    MaxRecordingSize   = atoi(Value);
+   else if (!strcasecmp(Name, "SplitEditedFiles"))    SplitEditedFiles   = atoi(Value);
+   else if (!strcasecmp(Name, "DelTimeshiftRec"))     DelTimeshiftRec    = atoi(Value);
++  else if (!strcasecmp(Name, "HardLinkCutter"))      HardLinkCutter     = atoi(Value);
+   else if (!strcasecmp(Name, "MinEventTimeout"))     MinEventTimeout    = atoi(Value);
+   else if (!strcasecmp(Name, "MinUserInactivity"))   MinUserInactivity  = atoi(Value);
+   else if (!strcasecmp(Name, "NextWakeupTime"))      NextWakeupTime     = atoi(Value);
+@@ -671,8 +675,10 @@
+   Store("FontSmlSize",        FontSmlSize);
+   Store("FontFixSize",        FontFixSize);
+   Store("MaxVideoFileSize",   MaxVideoFileSize);
++  Store("MaxRecordingSize",   MaxRecordingSize);
+   Store("SplitEditedFiles",   SplitEditedFiles);
+   Store("DelTimeshiftRec",    DelTimeshiftRec);
++  Store("HardLinkCutter",     HardLinkCutter);
+   Store("MinEventTimeout",    MinEventTimeout);
+   Store("MinUserInactivity",  MinUserInactivity);
+   Store("NextWakeupTime",     NextWakeupTime);
+diff -Naur vdr-1.7.15/config.h vdr-1.7.15-hlcutter/config.h
+--- vdr-1.7.15/config.h	2010-06-06 11:53:02.000000000 +0200
++++ vdr-1.7.15-hlcutter/config.h	2010-06-06 21:55:25.000000000 +0200
+@@ -277,8 +277,10 @@
+   int FontSmlSize;
+   int FontFixSize;
+   int MaxVideoFileSize;
++  int MaxRecordingSize;
+   int SplitEditedFiles;
+   int DelTimeshiftRec;
++  int HardLinkCutter;
+   int MinEventTimeout, MinUserInactivity;
+   time_t NextWakeupTime;
+   int MultiSpeedMode;
+diff -Naur vdr-1.7.15/cutter.c vdr-1.7.15-hlcutter/cutter.c
+--- vdr-1.7.15/cutter.c	2010-01-02 14:08:08.000000000 +0100
++++ vdr-1.7.15-hlcutter/cutter.c	2010-06-06 21:55:25.000000000 +0200
+@@ -78,6 +78,7 @@
+      Mark = fromMarks.Next(Mark);
+      off_t FileSize = 0;
+      int CurrentFileNumber = 0;
++     bool SkipThisSourceFile = false;
+      int LastIFrame = 0;
+      toMarks.Add(0);
+      toMarks.Save();
+@@ -96,13 +97,92 @@
+ 
+            // Read one frame:
+ 
+-           if (fromIndex->Get(Index++, &FileNumber, &FileOffset, &Independent, &Length)) {
+-              if (FileNumber != CurrentFileNumber) {
+-                 fromFile = fromFileName->SetOffset(FileNumber, FileOffset);
+-                 if (fromFile)
+-                    fromFile->SetReadAhead(MEGABYTE(20));
+-                 CurrentFileNumber = FileNumber;
+-                 }
++           if (!fromIndex->Get(Index++, &FileNumber, &FileOffset, &Independent, &Length)) {
++              // Error, unless we're past last cut-in and there's no cut-out
++              if (Mark || LastMark)
++                 error = "index";
++              break;
++              }
++
++           if (FileNumber != CurrentFileNumber) {
++              fromFile = fromFileName->SetOffset(FileNumber, FileOffset);
++              fromFile->SetReadAhead(MEGABYTE(20));
++              CurrentFileNumber = FileNumber;
++              if (SkipThisSourceFile) {
++                 // At end of fast forward: Always skip to next file
++                 toFile = toFileName->NextFile();
++                 if (!toFile) {
++                    error = "toFile 4";
++                    break;
++                    }
++                 FileSize = 0;
++                 SkipThisSourceFile = false;
++                 }                 
++              
++
++              if (Setup.HardLinkCutter && FileOffset == 0) {
++                 // We are at the beginning of a new source file.
++                 // Do we need to copy the whole file?
++
++                 // if !Mark && LastMark, then we're past the last cut-out and continue to next I-frame
++                 // if !Mark && !LastMark, then there's just a cut-in, but no cut-out
++                 // if Mark, then we're between a cut-in and a cut-out
++                 
++                 uint16_t MarkFileNumber;
++                 off_t MarkFileOffset;
++                 // Get file number of next cut mark
++                 if (!Mark && !LastMark
++                     || Mark
++                        && fromIndex->Get(Mark->position, &MarkFileNumber, &MarkFileOffset)
++                        && (MarkFileNumber != CurrentFileNumber)) {
++                    // The current source file will be copied completely.
++                    // Start new output file unless we did that already
++                    if (FileSize != 0) {
++                       toFile = toFileName->NextFile();
++                       if (!toFile) {
++                          error = "toFile 3";
++                          break;
++                          }
++                       FileSize = 0;
++                       }
++
++                    // Safety check that file has zero size
++                    struct stat buf;
++                    if (stat(toFileName->Name(), &buf) == 0) {
++                       if (buf.st_size != 0) {
++                          esyslog("cCuttingThread: File %s exists and has nonzero size", toFileName->Name());
++                          error = "nonzero file exist";
++                          break;
++                          }
++                       }
++                    else if (errno != ENOENT) {
++                       esyslog("cCuttingThread: stat failed on %s", toFileName->Name());
++                       error = "stat";
++                       break;
++                       }
++
++                    // Clean the existing 0-byte file
++                    toFileName->Close();
++                    cString ActualToFileName(ReadLink(toFileName->Name()), true);
++                    unlink(ActualToFileName);
++                    unlink(toFileName->Name());
++
++                    // Try to create a hard link
++                    if (HardLinkVideoFile(fromFileName->Name(), toFileName->Name())) {
++                       // Success. Skip all data transfer for this file
++                       SkipThisSourceFile = true;
++                       cutIn = false;
++                       toFile = NULL; // was deleted by toFileName->Close()
++                       } 
++                    else {
++                       // Fallback: Re-open the file if necessary
++                       toFile = toFileName->Open();
++                       }
++                    }
++                 } 
++              }
++
++           if (!SkipThisSourceFile) {
+               if (fromFile) {
+                  int len = ReadFrame(fromFile, buffer,  Length, sizeof(buffer));
+                  if (len < 0) {
+@@ -118,19 +199,12 @@
+                  break;
+                  }
+               }
+-           else {
+-              // Error, unless we're past the last cut-in and there's no cut-out
+-              if (Mark || LastMark)
+-                 error = "index";
+-              break;
+-              }
+-
+            // Write one frame:
+ 
+            if (Independent) { // every file shall start with an independent frame
+               if (LastMark) // edited version shall end before next I-frame
+                  break;
+-              if (FileSize > maxVideoFileSize) {
++              if (!SkipThisSourceFile && FileSize > toFileName->MaxFileSize()) {
+                  toFile = toFileName->NextFile();
+                  if (!toFile) {
+                     error = "toFile 1";
+@@ -140,7 +214,7 @@
+                  }
+               LastIFrame = 0;
+ 
+-              if (cutIn) {
++              if (!SkipThisSourceFile && cutIn) {
+                  if (isPesRecording)
+                     cRemux::SetBrokenLink(buffer, Length);
+                  else
+@@ -148,7 +222,7 @@
+                  cutIn = false;
+                  }
+               }
+-           if (toFile->Write(buffer, Length) < 0) {
++           if (!SkipThisSourceFile && toFile->Write(buffer, Length) < 0) {
+               error = "safe_write";
+               break;
+               }
+@@ -183,7 +257,7 @@
+                     }
+                  }
+               else
+-                 LastMark = true;
++                 LastMark = true; // After last cut-out: Write on until next I-frame, then exit
+               }
+            }
+      Recordings.TouchUpdate();
+diff -Naur vdr-1.7.15/menu.c vdr-1.7.15-hlcutter/menu.c
+--- vdr-1.7.15/menu.c	2010-06-06 11:56:16.000000000 +0200
++++ vdr-1.7.15-hlcutter/menu.c	2010-06-06 21:55:25.000000000 +0200
+@@ -3055,8 +3055,10 @@
+   Add(new cMenuEditStrItem( tr("Setup.Recording$Name instant recording"),     data.NameInstantRecord, sizeof(data.NameInstantRecord)));
+   Add(new cMenuEditIntItem( tr("Setup.Recording$Instant rec. time (min)"),   &data.InstantRecordTime, 1, MAXINSTANTRECTIME));
+   Add(new cMenuEditIntItem( tr("Setup.Recording$Max. video file size (MB)"), &data.MaxVideoFileSize, MINVIDEOFILESIZE, MAXVIDEOFILESIZETS));
++  Add(new cMenuEditIntItem( tr("Setup.Recording$Max. recording size (GB)"),  &data.MaxRecordingSize, MINRECORDINGSIZE, MAXRECORDINGSIZE));
+   Add(new cMenuEditBoolItem(tr("Setup.Recording$Split edited files"),        &data.SplitEditedFiles));
+   Add(new cMenuEditStraItem(tr("Setup.Recording$Delete timeshift recording"),&data.DelTimeshiftRec, 3, delTimeshiftRecTexts));
++  Add(new cMenuEditBoolItem(tr("Setup.Recording$Hard Link Cutter"),          &data.HardLinkCutter));
+ }
+ 
+ // --- cMenuSetupReplay ------------------------------------------------------
+diff -Naur vdr-1.7.15/README-HLCUTTER vdr-1.7.15-hlcutter/README-HLCUTTER
+--- vdr-1.7.15/README-HLCUTTER	1970-01-01 01:00:00.000000000 +0100
++++ vdr-1.7.15-hlcutter/README-HLCUTTER	2010-06-06 21:55:25.000000000 +0200
+@@ -0,0 +1,117 @@
++
++                    VDR-HLCUTTER README
++
++
++Written by:           Udo Richter
++Available at:         http://www.udo-richter.de/vdr/patches.html#hlcutter
++                      http://www.udo-richter.de/vdr/patches.en.html#hlcutter
++Contact:              udo_richter at gmx.de
++
++
++
++About
++-----
++
++The hard link cutter patch changes the recording editing algorithms of VDR to
++use filesystem hard links to 'copy' recording files whenever possible to speed
++up editing recordings noticeably.
++
++The patch has matured to be quite stable, at least I'm using it without issues.
++Nevertheless the patch is still in development and should be used with caution. 
++The patch is EXPERIMENTAL for multiple /videoxx folders. The safety checks 
++should prevent data loss, but you should always carefully check the results.
++
++While editing a recording, the patch searches for any 00x.vdr files that dont
++contain editing marks and would normally be copied 1:1 unmodified to the edited
++recording. In this case the current target 00x.vdr file will be aborted, and 
++the cutter process attempts to duplicate the source file as a hard link, so 
++that both files share the same disk space. If this succeeds, the editing 
++process fast-forwards through the duplicated file and continues normally 
++beginning with the next source file. If hard linking fails, the cutter process
++continues with plain old copying. (but does not take up the aborted last file.)
++
++After editing, the un-edited recording can be deleted as usual, the hard linked
++copies will continue to exist as the only remaining copy.
++
++To be effective, the default 'Max. video file size (MB)' should be lowered. 
++The patch lowers the smallest possible file size to 1mb. Since VDR only 
++supports up to 255 files, this would limit the recording size to 255Mb or
++10 minutes, in other words: This setting is insane!
++
++To make sure that the 255 file limit will not be reached, the patch also 
++introduces "Max. recording size (GB)" with a default of 100Gb (66 hours), and 
++increases the file size to 2000Mb early enough, so that 100Gb-recordings will
++fit into the 255 files.
++
++Picking the right parameters can be tricky. The smaller the file size, the 
++faster the editing process works. However, with a small file size, long 
++recordings will fall back to 2000Mb files soon, that are slow on editing again.
++
++Here are some examples:
++
++Max file size:      100Gb   100Gb   100Gb   100Gb   100Gb   100Gb   100Gb
++Max recording size: 1Mb     10Mb    20Mb    30Mb    40Mb    50Mb    100Mb
++
++Small files:        1-203   1-204   1-205   1-206   1-207   1-209   1-214
++  GBytes:           0.2     2.0     4.0     6.0     8.1     10.2    20.9
++  Hours:            0.13    1.3     2.65    4       5.4     6.8     13.9
++
++Big (2000mb) files: 204-255 204-255 206-255 207-255 208-255 210-255 215-255
++  GBytes:           101.5   99.6    97.7    95.7    93.8    89.8    80.1
++  Hours:            67      66      65      63      62      60      53
++
++A recording limit of 100Gb keeps plenty of reserve without blocking too much
++file numbers. And with a file size of 30-40Mb, recordings of 4-5 hours fit into
++small files completely. (depends on bit rate of course)
++
++
++
++The patch must be enabled in Setup-> Recordings-> Hard Link Cutter. When 
++disabled, the cutter process behaves identical to VDR's default cutter.
++
++There's a //#define HARDLINK_TEST_ONLY in the videodir.c file that enables a
++test-mode that hard-links 00x.vdr_ files only, and continues the classic 
++editing. The resulting 00x.vdr and 00x.vdr_ files should be identical. If you 
++delete the un-edited recording, dont forget to delete the *.vdr_ files too, 
++they will now eat real disk space.
++
++Note: 'du' displays the disk space of hard links only on first appearance, and
++usually you will see a noticeably smaller size on the edited recording.
++
++
++History
++-------
++
++Version 0.2.0
++  New: Support for multiple /videoXX recording folders, using advanced searching
++       for matching file systems where a hard link can be created.
++       Also supports deep mounted file systems.
++  Fix: Do not fail if last mark is a cut-in. (Again.)
++
++Version 0.1.4
++  New: Dynamic increase of file size before running out of xxx.vdr files
++  Fix: Last edit mark is not a cut-out
++  Fix: Write error if link-copied file is smaller than allowed file size
++  Fix: Broken index/marks if cut-in is at the start of a new file
++  Fix: Clear dangeling pointer to free'd cUnbufferedFile, 
++       thx to Matthias Schwarzott
++
++Version 0.1.0
++  Initial release
++
++
++
++
++Future plans
++------------
++
++Since original and edited copy share disk space, free space is wrong if one of
++them is moved to *.del. Free space should only count files with hard link 
++count = 1. This still goes wrong if all copies get deleted.
++
++
++For more safety, the hard-linked files may be made read-only, as modifications
++to one copy will affect the other copy too. (except deleting, of course)
++
++
++SetBrokenLink may get lost on rare cases, this needs some more thoughts.
+diff -Naur vdr-1.7.15/recorder.c vdr-1.7.15-hlcutter/recorder.c
+--- vdr-1.7.15/recorder.c	2010-01-29 17:37:22.000000000 +0100
++++ vdr-1.7.15-hlcutter/recorder.c	2010-06-06 21:55:25.000000000 +0200
+@@ -87,7 +87,7 @@
+ bool cRecorder::NextFile(void)
+ {
+   if (recordFile && frameDetector->IndependentFrame()) { // every file shall start with an independent frame
+-     if (fileSize > MEGABYTE(off_t(Setup.MaxVideoFileSize)) || RunningLowOnDiskSpace()) {
++     if (fileSize > fileName->MaxFileSize() || RunningLowOnDiskSpace()) {
+         recordFile = fileName->NextFile();
+         fileSize = 0;
+         }
+diff -Naur vdr-1.7.15/recording.c vdr-1.7.15-hlcutter/recording.c
+--- vdr-1.7.15/recording.c	2010-03-07 15:06:04.000000000 +0100
++++ vdr-1.7.15-hlcutter/recording.c	2010-06-06 21:55:25.000000000 +0200
+@@ -1935,6 +1935,20 @@
+   return NULL;
+ }
+ 
++off_t cFileName::MaxFileSize() {
++  const int maxVideoFileSize = isPesRecording ? MAXVIDEOFILESIZEPES : MAXVIDEOFILESIZETS;
++  const int setupMaxVideoFileSize = min(maxVideoFileSize, Setup.MaxVideoFileSize);
++  const int maxFileNumber = isPesRecording ? 255 : 65535;
++
++  const off_t smallFiles = (maxFileNumber * off_t(maxVideoFileSize) - 1024 * Setup.MaxRecordingSize)
++                           / max(maxVideoFileSize - setupMaxVideoFileSize, 1);
++
++  if (fileNumber <= smallFiles)
++     return MEGABYTE(off_t(setupMaxVideoFileSize));
++  
++  return MEGABYTE(off_t(maxVideoFileSize));
++}
++
+ cUnbufferedFile *cFileName::NextFile(void)
+ {
+   return SetOffset(fileNumber + 1);
+diff -Naur vdr-1.7.15/recording.h vdr-1.7.15-hlcutter/recording.h
+--- vdr-1.7.15/recording.h	2010-03-07 15:06:15.000000000 +0100
++++ vdr-1.7.15-hlcutter/recording.h	2010-06-06 21:55:25.000000000 +0200
+@@ -220,9 +220,17 @@
+ // before the next independent frame, to have a complete Group Of Pictures):
+ #define MAXVIDEOFILESIZETS  1048570 // MB
+ #define MAXVIDEOFILESIZEPES    2000 // MB
+-#define MINVIDEOFILESIZE        100 // MB
++#define MINVIDEOFILESIZE          1 // MB
+ #define MAXVIDEOFILESIZEDEFAULT MAXVIDEOFILESIZEPES
+ 
++#define MINRECORDINGSIZE      25 // GB
++#define MAXRECORDINGSIZE     500 // GB
++#define DEFAULTRECORDINGSIZE 100 // GB
++// Dynamic recording size:
++// Keep recording file size at Setup.MaxVideoFileSize for as long as possible,
++// but switch to MAXVIDEOFILESIZE early enough, so that Setup.MaxRecordingSize
++// will be reached, before recording to file 65535.vdr
++
+ struct tIndexTs;
+ class cIndexFileGenerator;
+ 
+@@ -271,6 +279,8 @@
+   cUnbufferedFile *Open(void);
+   void Close(void);
+   cUnbufferedFile *SetOffset(int Number, off_t Offset = 0); // yes, Number is int for easier internal calculating
++  off_t MaxFileSize();
++      // Dynamic file size for this file
+   cUnbufferedFile *NextFile(void);
+   };
+ 
+diff -Naur vdr-1.7.15/videodir.c vdr-1.7.15-hlcutter/videodir.c
+--- vdr-1.7.15/videodir.c	2008-02-16 14:00:03.000000000 +0100
++++ vdr-1.7.15-hlcutter/videodir.c	2010-06-06 21:55:25.000000000 +0200
+@@ -19,6 +19,9 @@
+ #include "recording.h"
+ #include "tools.h"
+ 
++
++//#define HARDLINK_TEST_ONLY
++
+ const char *VideoDirectory = VIDEODIR;
+ 
+ class cVideoDirectory {
+@@ -168,6 +171,120 @@
+   return RemoveFileOrDir(FileName, true);
+ }
+ 
++static bool StatNearestDir(const char *FileName, struct stat *Stat)
++{
++  cString Name(FileName);
++  char *p;
++  while ((p = strrchr((char*)(const char*)Name + 1, '/')) != NULL) {
++        *p = 0; // truncate at last '/'
++        if (stat(Name, Stat) == 0) {
++           isyslog("StatNearestDir: Stating %s", (const char*)Name);
++           return true;
++           }
++        }
++  return false;
++}
++
++bool HardLinkVideoFile(const char *OldName, const char *NewName)
++{
++  // Incoming name must be in base video directory:
++  if (strstr(OldName, VideoDirectory) != OldName) {
++     esyslog("ERROR: %s not in %s", OldName, VideoDirectory);
++     return false;
++     }
++  if (strstr(NewName, VideoDirectory) != NewName) {
++     esyslog("ERROR: %s not in %s", NewName, VideoDirectory);
++     return false;
++     }
++
++  const char *ActualNewName = NewName;
++  cString ActualOldName(ReadLink(OldName), true);
++
++  // Some safety checks:
++  struct stat StatOldName;
++  if (lstat(ActualOldName, &StatOldName) == 0) {
++     if (S_ISLNK(StatOldName.st_mode)) {
++        esyslog("HardLinkVideoFile: Failed to resolve symbolic link %s", (const char*)ActualOldName);
++        return false;
++        }
++     }
++  else {
++     esyslog("HardLinkVideoFile: lstat failed on %s", (const char*)ActualOldName);
++     return false;
++     }
++  isyslog("HardLinkVideoFile: %s is on %i", (const char*)ActualOldName, (int)StatOldName.st_dev);
++
++  // Find the video directory where ActualOldName is located
++
++  cVideoDirectory Dir;
++  struct stat StatDir;
++  if (!StatNearestDir(NewName, &StatDir)) {
++     esyslog("HardLinkVideoFile: stat failed on %s", NewName);
++     return false;
++     }
++  
++  isyslog("HardLinkVideoFile: %s is on %i", NewName, (int)StatDir.st_dev);
++  if (StatDir.st_dev != StatOldName.st_dev) {
++     // Not yet found.
++     
++     if (!Dir.IsDistributed()) {
++        esyslog("HardLinkVideoFile: No matching video folder to hard link %s", (const char*)ActualOldName);
++        return false;
++        }
++
++     // Search in video01 and upwards
++     bool found = false;
++     while (Dir.Next()) {
++           Dir.Store();
++           const char *TmpNewName = Dir.Adjust(NewName);
++           if (StatNearestDir(TmpNewName, &StatDir) && StatDir.st_dev == StatOldName.st_dev) {
++              isyslog("HardLinkVideoFile: %s is on %i (match)", TmpNewName, (int)StatDir.st_dev);
++              ActualNewName = TmpNewName;
++              found = true;
++              break;
++              }
++           isyslog("HardLinkVideoFile: %s is on %i", TmpNewName, (int)StatDir.st_dev);
++           }
++     if (ActualNewName == NewName) {
++        esyslog("HardLinkVideoFile: No matching video folder to hard link %s", (const char*)ActualOldName);
++        return false;
++        }
++
++     // Looking good, we have a match. Create necessary folders.
++     if (!MakeDirs(ActualNewName, false))
++        return false;
++     // There's no guarantee that the directory of ActualNewName 
++     // is on the same device as the dir that StatNearestDir found.
++     // But worst case is that the link fails.
++     }
++
++#ifdef HARDLINK_TEST_ONLY
++  // Do the hard link to *.vdr_ for testing only
++  char *name = NULL;
++  asprintf(&name, "%s_",ActualNewName);
++  link(ActualOldName, name); 
++  free(name);
++  return false;
++#endif // HARDLINK_TEST_ONLY
++  
++  // Try creating the hard link
++  if (link(ActualOldName, ActualNewName) != 0) {
++     // Failed to hard link. Maybe not allowed on file system.
++     LOG_ERROR_STR(ActualNewName);
++     isyslog("HardLinkVideoFile: failed to hard link from %s to %s", (const char*)ActualOldName, ActualNewName);
++     return false;
++     }
++  
++  if (ActualNewName != NewName) {
++     // video01 and up. Do the remaining symlink
++     if (symlink(ActualNewName, NewName) < 0) {
++        LOG_ERROR_STR(NewName);
++        return false;
++        }
++     }
++  return true;
++}
++
+ bool VideoFileSpaceAvailable(int SizeMB)
+ {
+   cVideoDirectory Dir;
+diff -Naur vdr-1.7.15/videodir.h vdr-1.7.15-hlcutter/videodir.h
+--- vdr-1.7.15/videodir.h	2008-02-16 13:53:11.000000000 +0100
++++ vdr-1.7.15-hlcutter/videodir.h	2010-06-06 21:55:25.000000000 +0200
+@@ -19,6 +19,7 @@
+ int CloseVideoFile(cUnbufferedFile *File);
+ bool RenameVideoFile(const char *OldName, const char *NewName);
+ bool RemoveVideoFile(const char *FileName);
++bool HardLinkVideoFile(const char *OldName, const char *NewName);
+ bool VideoFileSpaceAvailable(int SizeMB);
+ int VideoDiskSpace(int *FreeMB = NULL, int *UsedMB = NULL); // returns the used disk space in percent
+ cString PrefixVideoFileName(const char *FileName, char Prefix);
diff --git a/vdr-1.7.21-msgidbugs.patch b/vdr-1.7.22-msgidbugs.patch
similarity index 62%
rename from vdr-1.7.21-msgidbugs.patch
rename to vdr-1.7.22-msgidbugs.patch
index cc168f8..f3ed9b5 100644
--- a/vdr-1.7.21-msgidbugs.patch
+++ b/vdr-1.7.22-msgidbugs.patch
@@ -1,6 +1,6 @@
-diff -up vdr-1.7.21/i18n-to-gettext.pl~ vdr-1.7.21/i18n-to-gettext.pl
---- vdr-1.7.21/i18n-to-gettext.pl~	2009-10-18 17:07:49.000000000 +0300
-+++ vdr-1.7.21/i18n-to-gettext.pl	2011-10-16 20:32:19.878167497 +0300
+diff -up vdr-1.7.22/i18n-to-gettext~ vdr-1.7.22/i18n-to-gettext
+--- vdr-1.7.22/i18n-to-gettext~	2011-12-04 16:17:35.000000000 +0200
++++ vdr-1.7.22/i18n-to-gettext	2011-12-04 20:01:16.781159483 +0200
 @@ -90,7 +90,7 @@ $TITLE = "VDR plugin language source fil
  $COPYRIGHT = "2007 Klaus Schmidinger <kls\@tvdr.de>";
  $PACKAGE = "VDR";
diff --git a/vdr-1.7.21-paths.patch b/vdr-1.7.22-paths.patch
similarity index 77%
rename from vdr-1.7.21-paths.patch
rename to vdr-1.7.22-paths.patch
index f43d08f..6af185f 100644
--- a/vdr-1.7.21-paths.patch
+++ b/vdr-1.7.22-paths.patch
@@ -1,6 +1,6 @@
-diff -up vdr-1.7.21/epg2html.pl~ vdr-1.7.21/epg2html.pl
---- vdr-1.7.21/epg2html.pl~	2006-04-17 15:19:08.000000000 +0300
-+++ vdr-1.7.21/epg2html.pl	2011-10-16 22:20:16.199200873 +0300
+diff -up vdr-1.7.22/epg2html~ vdr-1.7.22/epg2html
+--- vdr-1.7.22/epg2html~	2011-12-04 16:17:35.000000000 +0200
++++ vdr-1.7.22/epg2html	2011-12-04 19:53:55.500393671 +0200
 @@ -2,12 +2,12 @@
  
  # A simple EPG to HTML converter
@@ -11,14 +11,14 @@ diff -up vdr-1.7.21/epg2html.pl~ vdr-1.7.21/epg2html.pl
  # plus an 'index.htm' file. All output files are written into the current
  # directory.
  #
--# Usage: epg2html.pl < /video/epg.data
-+# Usage: epg2html.pl < __CACHEDIR__/epg.data
+-# Usage: epg2html < /video/epg.data
++# Usage: epg2html < __CACHEDIR__/epg.data
  #
  # See the main source file 'vdr.c' for copyright information and
  # how to reach the author.
-diff -up vdr-1.7.21/newplugin~ vdr-1.7.21/newplugin
---- vdr-1.7.21/newplugin~	2011-02-27 12:06:06.000000000 +0200
-+++ vdr-1.7.21/newplugin	2011-10-16 22:22:23.996772653 +0300
+diff -up vdr-1.7.22/newplugin~ vdr-1.7.22/newplugin
+--- vdr-1.7.22/newplugin~	2011-02-27 12:06:06.000000000 +0200
++++ vdr-1.7.22/newplugin	2011-12-04 19:53:55.943434599 +0200
 @@ -24,7 +24,7 @@ $PLUGIN_VERSION = "0.0.1";
  $PLUGIN_DESCRIPTION = "Enter description for '$PLUGIN_NAME' plugin";
  $PLUGIN_MAINENTRY = $PLUGIN_CLASS;
@@ -28,9 +28,9 @@ diff -up vdr-1.7.21/newplugin~ vdr-1.7.21/newplugin
  
  $README = qq
  {This is a "plugin" for the Video Disk Recorder (VDR).
-diff -up vdr-1.7.21/vdr.1~ vdr-1.7.21/vdr.1
---- vdr-1.7.21/vdr.1~	2011-08-15 15:28:54.000000000 +0300
-+++ vdr-1.7.21/vdr.1	2011-10-16 22:22:23.006682907 +0300
+diff -up vdr-1.7.22/vdr.1~ vdr-1.7.22/vdr.1
+--- vdr-1.7.22/vdr.1~	2011-12-04 16:41:00.000000000 +0200
++++ vdr-1.7.22/vdr.1	2011-12-04 19:53:56.315468967 +0200
 @@ -45,7 +45,7 @@ Send Dolby Digital audio to stdin of com
  .TP
  .BI \-c\  dir ,\ \-\-config= dir
@@ -67,10 +67,10 @@ diff -up vdr-1.7.21/vdr.1~ vdr-1.7.21/vdr.1
  .TP
  .B \-V, \-\-version
  Print version information and exit.
-diff -up vdr-1.7.21/vdr.5~ vdr-1.7.21/vdr.5
---- vdr-1.7.21/vdr.5~	2011-08-21 17:06:50.000000000 +0300
-+++ vdr-1.7.21/vdr.5	2011-10-16 22:22:23.465724517 +0300
-@@ -659,7 +659,7 @@ The file \fIsetup.conf\fR contains the b
+diff -up vdr-1.7.22/vdr.5~ vdr-1.7.22/vdr.5
+--- vdr-1.7.22/vdr.5~	2011-09-25 16:51:34.000000000 +0300
++++ vdr-1.7.22/vdr.5	2011-12-04 19:53:56.711505553 +0200
+@@ -701,7 +701,7 @@ The file \fIsetup.conf\fR contains the b
  Each line contains one option in the format "Name = Value".
  See the MANUAL file for a description of the available options.
  .SS THEMES
@@ -79,10 +79,10 @@ diff -up vdr-1.7.21/vdr.5~ vdr-1.7.21/vdr.5
  color theme definitions for the various skins. In the actual file names \fI<skin>\fR
  will be replaced by the name if the skin this theme belongs to, and \fI<theme>\fR
  will be the name of this theme.
-diff -up vdr-1.7.21/vdr.c~ vdr-1.7.21/vdr.c
---- vdr-1.7.21/vdr.c~	2011-08-15 15:42:39.000000000 +0300
-+++ vdr-1.7.21/vdr.c	2011-10-16 22:22:21.508547111 +0300
-@@ -427,7 +427,7 @@ int main(int argc, char *argv[])
+diff -up vdr-1.7.22/vdr.c~ vdr-1.7.22/vdr.c
+--- vdr-1.7.22/vdr.c~	2011-12-04 19:50:57.831980555 +0200
++++ vdr-1.7.22/vdr.c	2011-12-04 19:53:57.114542787 +0200
+@@ -428,7 +428,7 @@ int main(int argc, char *argv[])
                 "                           devices will be used)\n"
                 "            --edit=REC     cut recording REC and exit\n"
                 "  -E FILE,  --epgfile=FILE write the EPG data into the given FILE (default is\n"
@@ -91,7 +91,7 @@ diff -up vdr-1.7.21/vdr.c~ vdr-1.7.21/vdr.c
                 "                           '-E-' disables this\n"
                 "                           if FILE is a directory, the default EPG file will be\n"
                 "                           created in that directory\n"
-@@ -593,7 +593,7 @@ int main(int argc, char *argv[])
+@@ -594,7 +594,7 @@ int main(int argc, char *argv[])
       ConfigDirectory = DEFAULTCONFDIR;
  
    cPlugin::SetConfigDirectory(ConfigDirectory);
@@ -100,7 +100,7 @@ diff -up vdr-1.7.21/vdr.c~ vdr-1.7.21/vdr.c
  
    Setup.Load(AddDirectory(ConfigDirectory, "setup.conf"));
    Sources.Load(AddDirectory(ConfigDirectory, "sources.conf"), true, true);
-@@ -627,7 +627,7 @@ int main(int argc, char *argv[])
+@@ -629,7 +629,7 @@ int main(int argc, char *argv[])
          EpgDataFileName = DEFAULTEPGDATAFILENAME;
          }
       else if (*EpgDataFileName != '/' && *EpgDataFileName != '.')
diff --git a/vdr.spec b/vdr.spec
index 61602f5..76b3095 100644
--- a/vdr.spec
+++ b/vdr.spec
@@ -6,8 +6,7 @@
 #   http://www.tolleri.net/vdr/vdr/vdr-1.6.0-2-pause-0.0.1.patch
 #   http://thread.gmane.org/gmane.linux.vdr/40188
 
-%bcond_with       docs
-%bcond_with       plugins
+%bcond_without    docs
 
 %global varbase   %{_var}/lib/vdr
 %global videodir  %{varbase}/video
@@ -20,11 +19,11 @@
 %global vdr_user  vdr
 %global vdr_group video
 # From APIVERSION in config.h
-%global apiver    1.7.21
+%global apiver    1.7.22
 
 Name:           vdr
-Version:        1.7.21
-Release:        2%{?dist}
+Version:        1.7.22
+Release:        1%{?dist}
 Summary:        Video Disk Recorder
 
 License:        GPLv2+
@@ -50,10 +49,10 @@ Source17:       %{name}.macros
 Source18:       http://cdn.debian.net/debian/pool/main/v/vdr/vdr_1.7.20-1.debian.tar.bz2
 Patch0:         %{name}-channel+epg.patch
 Patch1:         http://zap.tartarus.org/~ds/debian/dists/stable/main/source/vdr_1.4.5-2.ds.diff.gz
-Patch2:         http://www.saunalahti.fi/~rahrenbe/vdr/patches/vdr-1.7.21-liemikuutio-1.33.patch.gz
+Patch2:         http://www.saunalahti.fi/~rahrenbe/vdr/patches/vdr-1.7.22-liemikuutio-1.33.patch.gz
 # Extracted from http://copperhead.htpc-forum.de/downloads/extensionpatch/extpngvdr1.7.21v1.diff.gz
 Patch3:         %{name}-1.7.21-plugin-missing.patch
-Patch4:         %{name}-1.7.21-paths.patch
+Patch4:         %{name}-1.7.22-paths.patch
 Patch5:         http://toms-cafe.de/vdr/download/vdr-timer-info-0.5-1.7.13.diff
 # http://article.gmane.org/gmane.linux.vdr/36097
 Patch6:         %{name}-1.5.18-syncearly.patch
@@ -62,7 +61,9 @@ Patch7:         http://projects.vdr-developer.org/projects/plg-ttxtsubs/reposito
 # Original at http://toms-cafe.de/vdr/download/vdr-jumpplay-1.0-1.7.6.diff
 Patch8:        %{name}-1.7.21-jumpplay.patch
 # http://www.udo-richter.de/vdr/patches.en.html#hlcutter
-Patch9:         http://www.udo-richter.de/vdr/files/vdr-1.7.14-hlcutter-0.2.2.diff
+# http://www.udo-richter.de/vdr/files/vdr-1.7.14-hlcutter-0.2.2.diff
+# Modified so that it applies to 1.7.22
+Patch9:         %{name}-1.7.22-hlcutter-0.2.2.diff
 # Sent to hlcutter upstream 2009-06-15 and 2011-10-16
 Patch10:        %{name}-1.7.21-hlcutter-0.2.2-finnish.patch
 # http://article.gmane.org/gmane.linux.vdr/43590
@@ -71,12 +72,13 @@ Patch11:        MainMenuHooks-v1_0_1.diff.gz
 # Modified so that it applies over the timer-info patch
 Patch12:        %{name}-1.7.21-timercmd.patch
 Patch13:        http://projects.vdr-developer.org/git/vdr-plugin-epgsearch.git/plain/patches/vdr-1.5.17-progressbar-support-0.0.1.diff
-# Sent upstream 2011-10-16
-Patch14:        0002-Add-and-install-pkg-config-file.patch
+Patch14:        http://www.saunalahti.fi/~rahrenbe/vdr/patches/vdr-1.7.22-finnish.patch.gz
 Patch15:        %{name}-1.7.21-fedora-pkgconfig.patch
 Patch16:        %{name}-1.7.21-jumpplay-finnish.patch
 Patch17:        http://projects.vdr-developer.org/git/vdr-plugin-epgsearch.git/plain/patches/vdr.epgsearch-exttimeredit-0.0.2.diff
-Patch18:        %{name}-1.7.21-msgidbugs.patch
+Patch18:        %{name}-1.7.22-msgidbugs.patch
+# Sent to hlcutter upstream 2011-11-21
+Patch19:        %{name}-1.7.21-hlcutter-delwhilecutting.patch
 
 BuildRequires:  libjpeg-devel
 BuildRequires:  libcap-devel
@@ -183,7 +185,7 @@ sed \
 %patch5 -p1
 # TODO: does not apply
 #patch6 -p0
-%patch7 -p1
+%patch7 -p1 -F 1
 %patch8 -p1
 %patch9 -p1
 %patch10 -p1
@@ -197,13 +199,12 @@ sed \
 # TODO: build failure
 #patch17 -p0 -F 3
 %patch18 -p1
+%patch19 -p1
 
 for f in CONTRIBUTORS HISTORY UPDATE-1.4.0 README.timer-info ; do
   iconv -f iso-8859-1 -t utf-8 -o $f.utf8 $f && mv $f.utf8 $f
 done
 
-sed -i -e 's|/dev/lircd\b|%{_localstatedir}/run/lirc/lircd|' vdr.1
-
 cp -p %{SOURCE5} reccmds.conf
 cp -p %{SOURCE13} timercmds.conf
 cp -p %{SOURCE6} commands.conf
@@ -293,7 +294,7 @@ install -Dpm 755 vdr $RPM_BUILD_ROOT%{_sbindir}/vdr
 
 install -dm 755 $RPM_BUILD_ROOT%{_bindir}
 install -pm 755 svdrpsend.pl $RPM_BUILD_ROOT%{_bindir}/svdrpsend
-install -pm 755 epg2html.pl $RPM_BUILD_ROOT%{_bindir}/epg2html
+install -pm 755 epg2html $RPM_BUILD_ROOT%{_bindir}/epg2html
 
 make install-pc DESTDIR=$RPM_BUILD_ROOT
 PKG_CONFIG_PATH=$RPM_BUILD_ROOT%{_libdir}/pkgconfig \
@@ -362,8 +363,7 @@ install -Dpm 644 %{name}.rwtab $RPM_BUILD_ROOT%{_sysconfdir}/rwtab.d/%{name}
 # devel
 
 install -pm 755 %{SOURCE9} $RPM_BUILD_ROOT%{_bindir}/vdr-config
-install -pm 755 i18n-to-gettext.pl \
-  $RPM_BUILD_ROOT%{_bindir}/vdr-i18n-to-gettext
+install -pm 755 i18n-to-gettext $RPM_BUILD_ROOT%{_bindir}/vdr-i18n-to-gettext
 install -pm 755 newplugin $RPM_BUILD_ROOT%{_bindir}/vdr-newplugin
 install -pm 644 Make.config Make.global $RPM_BUILD_ROOT%{_libdir}/vdr
 ln -s $(abs2rel %{_includedir}/vdr/config.h %{_libdir}/vdr) \
@@ -375,7 +375,7 @@ install -Dpm 644 %{SOURCE17} $RPM_BUILD_ROOT%{_sysconfdir}/rpm/macros.vdr
 %find_lang %{name}
 sed -i -e '1i%%defattr(-,root,root,-)' %{name}.lang
 
-%if 0%{?fedora} > 14 || 0%{?rhel} > 6
+%if 0%{?fedora} || 0%{?rhel} > 6
 install -dm 755 $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
 echo "D %{rundir} 0755 %{vdr_user} root -" \
   > $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
@@ -512,6 +512,10 @@ fi
 
 
 %changelog
+* Sun Dec  4 2011 Ville Skyttä <ville.skytta at iki.fi> - 1.7.22-1
+- Update to 1.7.22.
+- Build docs by default.
+
 * Thu Nov 17 2011 Ville Skyttä <ville.skytta at iki.fi> - 1.7.21-2
 - Update liemikuutio patch to 1.33.
 


More information about the scm-commits mailing list