1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Instant recording can now be stopped via the menu

This commit is contained in:
Klaus Schmidinger 2000-04-30 11:15:16 +02:00
parent 49ce70fdb3
commit f7ac74ede4
5 changed files with 41 additions and 17 deletions

3
MANUAL
View File

@ -52,7 +52,8 @@ Video Disk Recorder User's Manual
button. This will create a timer event named "instant" that starts button. This will create a timer event named "instant" that starts
at the current time and records for two hours. at the current time and records for two hours.
If you want to modify the recording time you need to edit the timer. If you want to modify the recording time you need to edit the timer.
Stop instant recording by disabling or deleting the timer. Stop instant recording by pressing the "Menu" button and selecting
"Stop Recording", or by disabling the timer.
* Replaying a Recording * Replaying a Recording

33
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: menu.c 1.11 2000/04/30 10:10:19 kls Exp $ * $Id: menu.c 1.12 2000/04/30 11:10:49 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -991,12 +991,14 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key)
// --- cMenuMain ------------------------------------------------------------- // --- cMenuMain -------------------------------------------------------------
cMenuMain::cMenuMain(void) cMenuMain::cMenuMain(bool Recording)
:cOsdMenu("Main") :cOsdMenu("Main")
{ {
Add(new cOsdItem("Channels", osChannels)); Add(new cOsdItem("Channels", osChannels));
Add(new cOsdItem("Timer", osTimer)); Add(new cOsdItem("Timer", osTimer));
Add(new cOsdItem("Recordings", osRecordings)); Add(new cOsdItem("Recordings", osRecordings));
if (Recording)
Add(new cOsdItem("Stop Recording", osStopRecord));
Display(); Display();
} }
@ -1008,6 +1010,8 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
case osChannels: return AddSubMenu(new cMenuChannels); case osChannels: return AddSubMenu(new cMenuChannels);
case osTimer: return AddSubMenu(new cMenuTimers); case osTimer: return AddSubMenu(new cMenuTimers);
case osRecordings: return AddSubMenu(new cMenuRecordings); case osRecordings: return AddSubMenu(new cMenuRecordings);
case osStopRecord: if (!Interface.Confirm("Stop Recording?"))
return osContinue;
default: if (Key == kMenu) default: if (Key == kMenu)
state = osEnd; state = osEnd;
} }
@ -1019,6 +1023,7 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
cRecordControl::cRecordControl(cTimer *Timer) cRecordControl::cRecordControl(cTimer *Timer)
{ {
timer = Timer; timer = Timer;
isInstant = !timer;
if (!timer) { if (!timer) {
timer = new cTimer(true); timer = new cTimer(true);
Timers.Add(timer); Timers.Add(timer);
@ -1032,14 +1037,22 @@ cRecordControl::cRecordControl(cTimer *Timer)
cRecordControl::~cRecordControl() cRecordControl::~cRecordControl()
{ {
DvbApi.StopRecord(); Stop(true);
timer->SetRecording(false); }
if (timer->IsSingleEvent() && !timer->Matches()) {
// checking timer->Matches() to make sure we don't delete the timer void cRecordControl::Stop(bool KeepInstant)
// if the program was cancelled before the timer's stop time! {
isyslog(LOG_INFO, "deleting timer %d", timer->Index() + 1); if (timer) {
Timers.Del(timer); DvbApi.StopRecord();
Timers.Save(); timer->SetRecording(false);
if ((isInstant && !KeepInstant) || (timer->IsSingleEvent() && !timer->Matches())) {
// checking timer->Matches() to make sure we don't delete the timer
// if the program was cancelled before the timer's stop time!
isyslog(LOG_INFO, "deleting timer %d", timer->Index() + 1);
Timers.Del(timer);
Timers.Save();
}
timer = NULL;
} }
} }

7
menu.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: menu.h 1.7 2000/04/29 17:54:55 kls Exp $ * $Id: menu.h 1.8 2000/04/30 10:58:49 kls Exp $
*/ */
#ifndef _MENU_H #ifndef _MENU_H
@ -14,17 +14,20 @@
class cMenuMain : public cOsdMenu { class cMenuMain : public cOsdMenu {
public: public:
cMenuMain(void); cMenuMain(bool Recording);
virtual eOSState ProcessKey(eKeys Key); virtual eOSState ProcessKey(eKeys Key);
}; };
class cRecordControl : public cOsdBase { class cRecordControl : public cOsdBase {
private: private:
cTimer *timer; cTimer *timer;
bool isInstant;
public: public:
cRecordControl(cTimer *Timer = NULL); cRecordControl(cTimer *Timer = NULL);
virtual ~cRecordControl(); virtual ~cRecordControl();
virtual eOSState ProcessKey(eKeys Key); virtual eOSState ProcessKey(eKeys Key);
void Stop(bool KeepInstant = false);
bool IsInstant(void) { return isInstant; }
}; };
class cReplayControl : public cOsdBase { class cReplayControl : public cOsdBase {

3
osd.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: osd.h 1.6 2000/04/30 09:47:52 kls Exp $ * $Id: osd.h 1.7 2000/04/30 10:37:15 kls Exp $
*/ */
#ifndef __OSD_H #ifndef __OSD_H
@ -23,6 +23,7 @@ enum eOSState { osUnknown,
osTimer, osTimer,
osRecordings, osRecordings,
osReplay, osReplay,
osStopRecord,
osBack, osBack,
osEnd, osEnd,
}; };

12
vdr.c
View File

@ -22,7 +22,7 @@
* *
* The project's page is at http://www.cadsoft.de/people/kls/vdr * The project's page is at http://www.cadsoft.de/people/kls/vdr
* *
* $Id: vdr.c 1.15 2000/04/30 10:19:52 kls Exp $ * $Id: vdr.c 1.16 2000/04/30 11:06:41 kls Exp $
*/ */
#include <signal.h> #include <signal.h>
@ -111,12 +111,18 @@ int main(int argc, char *argv[])
if (*Interact) { if (*Interact) {
switch ((*Interact)->ProcessKey(key)) { switch ((*Interact)->ProcessKey(key)) {
case osMenu: DELETENULL(Menu); case osMenu: DELETENULL(Menu);
Menu = new cMenuMain; Menu = new cMenuMain(RecordControl && RecordControl->IsInstant());
break; break;
case osReplay: DELETENULL(Menu); case osReplay: DELETENULL(Menu);
DELETENULL(ReplayControl); DELETENULL(ReplayControl);
ReplayControl = new cReplayControl; ReplayControl = new cReplayControl;
break; break;
case osStopRecord: if (RecordControl) {
RecordControl->Stop();
DELETENULL(Menu); // must make sure no menu uses the timer
DELETENULL(RecordControl);
}
break;
case osBack: case osBack:
case osEnd: DELETENULL(*Interact); case osEnd: DELETENULL(*Interact);
break; break;
@ -140,7 +146,7 @@ int main(int argc, char *argv[])
RecordControl = new cRecordControl; RecordControl = new cRecordControl;
break; break;
// Menu Control: // Menu Control:
case kMenu: Menu = new cMenuMain; break; case kMenu: Menu = new cMenuMain(RecordControl && RecordControl->IsInstant()); break;
// Up/Down Channel Select: // Up/Down Channel Select:
case kUp: case kUp:
case kDown: if (!RecordControl) { case kDown: if (!RecordControl) {