summaryrefslogtreecommitdiff
path: root/vdr.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2000-05-27 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2000-05-27 18:00:00 +0200
commit9599a8fd8a6724e55ec4ad2ba2c975c0850073d9 (patch)
treea1bbeee86ba1066f1e15d8311714b895f4c7b9a2 /vdr.c
parent85b8e41e8bb16e4e66561768026456ec5f0ee276 (diff)
downloadvdr-patch-lnbsharing-9599a8fd8a6724e55ec4ad2ba2c975c0850073d9.tar.gz
vdr-patch-lnbsharing-9599a8fd8a6724e55ec4ad2ba2c975c0850073d9.tar.bz2
Version 0.05vdr-0.05
- Support for more than one DVB card. - Simultaneous record and replay (with two DVB cards). - Instant recordings no longer get the name "instant". They now get the name of the channel, with a prepended '@' character. - Timers that are not given an explicit Name now use the channel name with a prepended '@' character. - If an instant recording is currently active, the Main menu now contains an option to stop that recording. - Timers are now only processed when the Menu is not active. So after editing a timer the effect will take place only after the menu has been closed. In order to avoid missing a timer event by inadvertently leaving the menu open, the menu will be closed automatically after about two minutes of inactivity. - If a recording is currently being replayed, the Main menu now contains an option to stop replaying. - Displaying the recording DVB interface status in the decimal points of the RCU display. - Reduced the number of remote control keys. Modified the key assignments for the PC keyboard to better resemble the "up-down-left-right-ok" layout on menu controlling remote control units.
Diffstat (limited to 'vdr.c')
-rw-r--r--vdr.c135
1 files changed, 55 insertions, 80 deletions
diff --git a/vdr.c b/vdr.c
index cbc0950..bcda471 100644
--- a/vdr.c
+++ b/vdr.c
@@ -22,11 +22,12 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
- * $Id: vdr.c 1.12 2000/04/24 13:36:39 kls Exp $
+ * $Id: vdr.c 1.19 2000/05/27 15:38:35 kls Exp $
*/
#include <signal.h>
#include "config.h"
+#include "dvbapi.h"
#include "interface.h"
#include "menu.h"
#include "recording.h"
@@ -52,6 +53,9 @@ int main(int argc, char *argv[])
openlog("vdr", LOG_PID | LOG_CONS, LOG_USER);
isyslog(LOG_INFO, "started");
+ if (!cDvbApi::Init())
+ return 1;
+
Channels.Load("channels.conf");
Timers.Load("timers.conf");
if (!Keys.Load(KEYS_CONF))
@@ -65,15 +69,14 @@ int main(int argc, char *argv[])
if (signal(SIGTERM, SignalHandler) == SIG_IGN) signal(SIGTERM, SIG_IGN);
cMenuMain *Menu = NULL;
- cReplayDisplay *ReplayDisplay = NULL;
- cTimer *Timer = NULL;
+ cReplayControl *ReplayControl = NULL;
int dcTime = 0, dcNumber = 0;
int LastChannel = -1;
while (!Interrupted) {
// Channel display:
if (CurrentChannel != LastChannel) {
- if (!Menu && !ReplayDisplay) {
+ if (!Menu) {
cChannel *channel = Channels.Get(CurrentChannel);
if (channel)
Interface.DisplayChannel(CurrentChannel + 1, channel->name);
@@ -81,108 +84,80 @@ int main(int argc, char *argv[])
LastChannel = CurrentChannel;
}
// Direct Channel Select (action):
- if (dcNumber) {
- Interface.DisplayChannel(dcNumber);
- if (time_ms() - dcTime > DIRECTCHANNELTIMEOUT) {
- cChannel::SwitchTo(dcNumber - 1);
- dcNumber = 0;
- LastChannel = -1; // in case an invalid channel number was entered!
- }
+ if (dcNumber && time_ms() - dcTime > DIRECTCHANNELTIMEOUT) {
+ cChannel::SwitchTo(dcNumber - 1);
+ dcNumber = 0;
+ LastChannel = -1; // in case an invalid channel number was entered!
}
- // Timer Processing:
- else {
- AssertFreeDiskSpace();
- if (!Timer && (Timer = cTimer::GetMatch()) != NULL) {
- DELETENULL(Menu);
- DELETENULL(ReplayDisplay);
- // make sure the timer won't be deleted:
- Timer->SetRecording(true);
- // switch to channel:
- cChannel::SwitchTo(Timer->channel - 1);
- // start recording:
- cRecording Recording(Timer);
- DvbApi.StartRecord(Recording.FileName());
- }
- if (Timer && !Timer->Matches()) {
- // stop recording:
- DvbApi.StopRecord();
- // release timer:
- Timer->SetRecording(false);
- // clear single event timer:
- if (Timer->IsSingleEvent()) {
- DELETENULL(Menu); // must make sure no menu uses it
- isyslog(LOG_INFO, "deleting timer %d", Timer->Index() + 1);
- Timers.Del(Timer);
- Timers.Save();
+ // Timers and Recordings:
+ if (!Menu) {
+ cTimer *Timer = cTimer::GetMatch();
+ if (Timer) {
+ if (!cRecordControls::Start(Timer)) {
+ //TODO need to do something to prevent the timer from hitting over and over again...
}
- Timer = NULL;
}
+ cRecordControls::Process();
}
// User Input:
- eKeys key = Interface.GetKey(!ReplayDisplay);
- if (Menu) {
- switch (Menu->ProcessKey(key)) {
- default: if (key != kMenu)
- break;
+ cOsdBase **Interact = Menu ? (cOsdBase **)&Menu : (cOsdBase **)&ReplayControl;
+ eKeys key = Interface.GetKey(!*Interact || !(*Interact)->NeedsFastResponse());
+ if (*Interact) {
+ switch ((*Interact)->ProcessKey(key)) {
+ case osMenu: DELETENULL(Menu);
+ Menu = new cMenuMain(ReplayControl);
+ break;
+ case osRecord: DELETENULL(Menu);
+ if (!cRecordControls::Start())
+ Interface.Error("No free DVB device to record!");
+ break;
+ case osReplay: DELETENULL(Menu);
+ DELETENULL(ReplayControl);
+ ReplayControl = new cReplayControl;
+ break;
+ case osStopReplay:
+ DELETENULL(*Interact);
+ DELETENULL(ReplayControl);
+ break;
case osBack:
- case osEnd: DELETENULL(Menu);
- break;
+ case osEnd: DELETENULL(*Interact);
+ break;
+ default: ;
}
}
- else if (!ReplayDisplay || (key = ReplayDisplay->ProcessKey(key)) != kNone) {
+ else {
switch (key) {
// Direct Channel Select (input):
case k0: case k1: case k2: case k3: case k4: case k5: case k6: case k7: case k8: case k9:
- {
- if (!(DvbApi.Recording() || DvbApi.Replaying())) {
- dcNumber = dcNumber * 10 + key - k0;
- dcTime = time_ms();
+ {
+ if (!Interface.Recording()) {
+ dcNumber = dcNumber * 10 + key - k0;
+ dcTime = time_ms();
+ Interface.DisplayChannel(dcNumber);
+ }
}
- }
- // Record/Replay Control:
- case kBegin: DvbApi.Skip(-INT_MAX); break;
- case kRecord: if (!(DvbApi.Recording() || DvbApi.Replaying())) {
- cTimer *timer = new cTimer(true);
- Timers.Add(timer);
- Timers.Save();
- }
- break;
- case kPause: DvbApi.PauseReplay(); break;
- case kStop: DELETENULL(ReplayDisplay);
- DvbApi.StopReplay();
- break;
- case kSearchBack: DvbApi.FastRewind(); break;
- case kSearchForward: DvbApi.FastForward(); break;
- case kSkipBack: DvbApi.Skip(-60); break;
- case kSkipForward: DvbApi.Skip(60); break;
- // Menu Control:
- case kMenu: DELETENULL(ReplayDisplay);
- Menu = new cMenuMain;
- Menu->Display();
- break;
+ break;
// Up/Down Channel Select:
case kUp:
- case kDown: if (!(DvbApi.Recording() || DvbApi.Replaying())) {
+ case kDown: if (!Interface.Recording()) {
int n = CurrentChannel + (key == kUp ? 1 : -1);
cChannel *channel = Channels.Get(n);
if (channel)
channel->Switch();
}
break;
+ // Menu Control:
+ case kMenu: Menu = new cMenuMain(ReplayControl); break;
// Viewing Control:
- case kOk: if (ReplayDisplay)
- DELETENULL(ReplayDisplay);
- else if (DvbApi.Replaying())
- ReplayDisplay = new cReplayDisplay;
- else
- LastChannel = -1; break; // forces channel display
+ case kOk: LastChannel = -1; break; // forces channel display
default: break;
}
}
}
isyslog(LOG_INFO, "caught signal %d", Interrupted);
- DvbApi.StopRecord();
- DvbApi.StopReplay();
+ delete Menu;
+ delete ReplayControl;
+ cDvbApi::Cleanup();
isyslog(LOG_INFO, "exiting");
closelog();
return 0;