Hi,

Sometimes when you want to pause live video you are already recording the current channel. In such case it is not practical to start a new instant recording but it would be more practical to start replaying the recording already being made, jump to correct position in the recording and then pause. So I have implemented this for VDR-1.7.16 as a patch which adds two new options to "Pause kay handling" menu item to enable this behavior with or without confirmation.

Any improvements or suggestions are welcome.

--
Matti Lehtimäki
diff -Naur -x PLUGINS -x po vdr-1.7.16_orig/menu.c vdr-1.7.16_pause/menu.c
--- vdr-1.7.16_orig/menu.c	2010-06-06 12:56:16.000000000 +0300
+++ vdr-1.7.16_pause/menu.c	2010-11-30 21:09:07.000000000 +0200
@@ -3025,7 +3025,7 @@
 
 class cMenuSetupRecord : public cMenuSetupBase {
 private:
-  const char *pauseKeyHandlingTexts[3];
+  const char *pauseKeyHandlingTexts[5];
   const char *delTimeshiftRecTexts[3];
 public:
   cMenuSetupRecord(void);
@@ -3036,6 +3036,8 @@
   pauseKeyHandlingTexts[0] = tr("do not pause live video");
   pauseKeyHandlingTexts[1] = tr("confirm pause live video");
   pauseKeyHandlingTexts[2] = tr("pause live video");
+  pauseKeyHandlingTexts[3] = tr("confirm pause and switch to replay mode");
+  pauseKeyHandlingTexts[4] = tr("switch to replay mode");
   delTimeshiftRecTexts[0] = tr("no");
   delTimeshiftRecTexts[1] = tr("confirm");
   delTimeshiftRecTexts[2] = tr("yes");
@@ -3045,7 +3047,7 @@
   Add(new cMenuEditIntItem( tr("Setup.Recording$Primary limit"),             &data.PrimaryLimit, 0, MAXPRIORITY));
   Add(new cMenuEditIntItem( tr("Setup.Recording$Default priority"),          &data.DefaultPriority, 0, MAXPRIORITY));
   Add(new cMenuEditIntItem( tr("Setup.Recording$Default lifetime (d)"),      &data.DefaultLifetime, 0, MAXLIFETIME));
-  Add(new cMenuEditStraItem(tr("Setup.Recording$Pause key handling"),        &data.PauseKeyHandling, 3, pauseKeyHandlingTexts));
+  Add(new cMenuEditStraItem(tr("Setup.Recording$Pause key handling"),        &data.PauseKeyHandling, 5, pauseKeyHandlingTexts));
   Add(new cMenuEditIntItem( tr("Setup.Recording$Pause priority"),            &data.PausePriority, 0, MAXPRIORITY));
   Add(new cMenuEditIntItem( tr("Setup.Recording$Pause lifetime (d)"),        &data.PauseLifetime, 0, MAXLIFETIME));
   Add(new cMenuEditBoolItem(tr("Setup.Recording$Use episode name"),          &data.UseSubtitle));
@@ -4207,6 +4209,19 @@
      AssertFreeDiskSpace(Timer->Priority(), !Timer->Pending());
      Timer->SetPending(true);
      }
+  else if (Setup.PauseKeyHandling > 2 && Pause) { // PauseLiveVideo & do not start recording
+     cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
+     for (cTimer *t = Timers.First(); t; t = Timers.Next(t)) {
+         if ((t->Channel() == channel) && t->Recording()) {
+            for (int i = 0; i < MAXRECORDCONTROLS; i++) {
+                if (RecordControls[i] && RecordControls[i]->Timer()->Channel() == t->Channel()) {
+                   cReplayControl::SetRecording(RecordControls[i]->FileName(), t->File());
+                   return true;
+                   }
+                }
+            }
+         }
+     }
   VideoDiskSpace(&FreeMB);
   if (FreeMB < MINFREEDISK) {
      if (!Timer || time(NULL) - LastNoDiskSpaceMessage > NODISKSPACEDELTA) {
@@ -4274,11 +4289,23 @@
 {
   Skins.Message(mtStatus, tr("Pausing live video..."));
   cReplayControl::SetRecording(NULL, NULL); // make sure the new cRecordControl will set cReplayControl::LastReplayed()
+  cTimer * timer = NULL;
+  if (Setup.PauseKeyHandling > 2) {
+    for (cTimer *t = Timers.First(); t; t = Timers.Next(t)) { // find timer of current recording
+      if ((t->Channel() == Channels.GetByNumber(cDevice::CurrentChannel())) && t->Recording())
+        timer = t;
+        }
+    }
   if (Start(NULL, true)) {
      sleep(2); // allow recorded file to fill up enough to start replaying
      cReplayControl *rc = new cReplayControl;
      cControl::Launch(rc);
      cControl::Attach();
+     if (timer) { // if already recording current channel before pause jump to correct position of recording
+        int Current, Total;
+        rc->GetIndex(Current, Total, true);
+        rc->Goto(SecondsToFrames((Total / rc->FramesPerSecond())-2), false);
+        }
      sleep(1); // allow device to replay some frames, so we have a picture
      Skins.Message(mtStatus, NULL);
      rc->ProcessKey(kPause); // pause, allowing replay mode display
diff -Naur -x PLUGINS -x po vdr-1.7.16_orig/vdr.c vdr-1.7.16_pause/vdr.c
--- vdr-1.7.16_orig/vdr.c	2010-04-05 13:06:16.000000000 +0300
+++ vdr-1.7.16_pause/vdr.c	2010-11-30 20:00:48.000000000 +0200
@@ -1074,7 +1074,7 @@
                if (!cControl::Control()) {
                   DELETE_MENU;
                   if (Setup.PauseKeyHandling) {
-                     if (Setup.PauseKeyHandling > 1 || Interface->Confirm(tr("Pause live video?"))) {
+                     if ((Setup.PauseKeyHandling == 2 || Setup.PauseKeyHandling == 4) || ((Setup.PauseKeyHandling == 1 || Setup.PauseKeyHandling == 3) && Interface->Confirm(tr("Pause live video?")))) {
                         if (!cRecordControls::PauseLiveVideo())
                            Skins.Message(mtError, tr("No free DVB device to record!"));
                         }
_______________________________________________
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

Reply via email to