summaryrefslogtreecommitdiff
path: root/vdr.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2001-09-23 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2001-09-23 18:00:00 +0200
commit66bab90b60048a46e401ea506d3aa65c43779700 (patch)
tree376b0ed146b41a61eb6a8910d03fdcb7621aa78d /vdr.c
parent156831036e9b0fcbfc719033cc89e08c1985cad6 (diff)
downloadvdr-patch-lnbsharing-66bab90b60048a46e401ea506d3aa65c43779700.tar.gz
vdr-patch-lnbsharing-66bab90b60048a46e401ea506d3aa65c43779700.tar.bz2
Version 0.96vdr-0.96
- Made VDR compile with libdvdread-0.9.1 (thanks to Andreas Schultz). Note that you now _need_ version 0.9.1 of libdvdread to compile VDR with DVD support! - Several fixes to the replay mode display (thanks to Stefan Huelswitt): no more replay mode display when pressing the "Green" or "Yellow" button (Skip +/-60s); fixed timeout when pressing '0' to set an editing mark while the progress display is not shown; mode display is shown after progress display is closed; pressing "Ok" while the mode display is on brings up the progress display; no more unnecessary display of "normal play mode". - Supplying the new frontend parameter 'Inversion' (currently it is always set to INVERSION_AUTO, which should work with all channels on Astra). - Removing unnecessary double quotes from EPG Subtitle in EPGBugfixLevel >=1. - EPG info is now updated if the contents changes but the ID remains the same. - Fixed handling SVDRP commands whith more than one blank between the command word and the options. - The current volume setting is now saved to setup.conf and restored at the next program start. - New command line option '-r' to define a command that gets called before and after each recording (see INSTALL for details). - Implemented a check to see whether the system time is running linearly. - Writing the current time (as seen by VDR) into the log file when starting a timer recording (this may help debugging cases where timers don't start at the expected time). - Made the volume, mute and power keys work when a menu is active, too (thanks to Matthias Weingart).
Diffstat (limited to 'vdr.c')
-rw-r--r--vdr.c220
1 files changed, 120 insertions, 100 deletions
diff --git a/vdr.c b/vdr.c
index b288108..d7c3f06 100644
--- a/vdr.c
+++ b/vdr.c
@@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
- * $Id: vdr.c 1.73 2001/09/16 14:54:45 kls Exp $
+ * $Id: vdr.c 1.79 2001/09/23 14:33:39 kls Exp $
*/
#define _GNU_SOURCE
@@ -96,6 +96,7 @@ int main(int argc, char *argv[])
{ "help", no_argument, NULL, 'h' },
{ "log", required_argument, NULL, 'l' },
{ "port", required_argument, NULL, 'p' },
+ { "record", required_argument, NULL, 'r' },
{ "shutdown", required_argument, NULL, 's' },
{ "terminal", required_argument, NULL, 't' },
{ "video", required_argument, NULL, 'v' },
@@ -106,7 +107,7 @@ int main(int argc, char *argv[])
int c;
int option_index = 0;
- while ((c = getopt_long(argc, argv, "a:c:dD:E:hl:p:s:t:v:V:w:", long_options, &option_index)) != -1) {
+ while ((c = getopt_long(argc, argv, "a:c:dD:E:hl:p:r:s:t:v:V:w:", long_options, &option_index)) != -1) {
switch (c) {
case 'a': cDvbApi::SetAudioCommand(optarg);
break;
@@ -143,6 +144,7 @@ int main(int argc, char *argv[])
" 2 = errors and info, 3 = errors, info and debug\n"
" -p PORT, --port=PORT use PORT for SVDRP (default: %d)\n"
" 0 turns off SVDRP\n"
+ " -r CMD, --record=CMD call CMD before and after a recording\n"
" -s CMD, --shutdown=CMD call CMD to shutdown the computer\n"
" -t TTY, --terminal=TTY controlling tty\n"
" -v DIR, --video=DIR use DIR as video directory (default: %s)\n"
@@ -180,6 +182,8 @@ int main(int argc, char *argv[])
return 2;
}
break;
+ case 'r': cRecordingUserCommand::SetCommand(optarg);
+ break;
case 's': Shutdown = optarg;
break;
case 't': Terminal = optarg;
@@ -278,6 +282,7 @@ int main(int argc, char *argv[])
cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB);
Channels.SwitchTo(Setup.CurrentChannel);
+ cDvbApi::PrimaryDvbApi->SetVolume(Setup.CurrentVolume, true);
cEITScanner EITScanner;
@@ -305,6 +310,7 @@ int main(int argc, char *argv[])
int LastChannel = -1;
int PreviousChannel = cDvbApi::CurrentChannel();
time_t LastActivity = 0;
+ time_t LinearTime = time(NULL);
int MaxLatencyTime = 0;
bool ForceShutdown = false;
@@ -314,6 +320,14 @@ int main(int argc, char *argv[])
}
while (!Interrupted) {
+ // Test if we are running in the Einstein continuum:
+ time_t Now = time(NULL);
+ time_t LinearDelta = Now - LinearTime;
+ if (LinearDelta) {
+ if (LinearDelta < 0 || LinearDelta > 300) // assuming nothing will block for more than 5 minutes
+ esyslog(LOG_ERR, "ERROR: time warp detected (%d seconds)", LinearDelta);
+ LinearTime = Now;
+ }
// Handle emergency exits:
if (cThread::EmergencyExit()) {
esyslog(LOG_ERR, "emergency exit requested - shutting down");
@@ -341,6 +355,7 @@ int main(int argc, char *argv[])
cRecordControls::Process(Now);
cTimer *Timer = Timers.GetMatch(Now);
if (Timer) {
+ dsyslog(LOG_INFO, "system time seen is %s", ctime(&Now));
if (!cRecordControls::Start(Timer))
Timer->SetPending(true);
}
@@ -352,106 +367,111 @@ int main(int argc, char *argv[])
EITScanner.Activity();
LastActivity = time(NULL);
}
- if (*Interact && key != kPower) {
- switch ((*Interact)->ProcessKey(key)) {
- case osMenu: DELETENULL(Menu);
- Menu = new cMenuMain(ReplayControl);
- break;
- case osRecord: DELETENULL(Menu);
- if (!cRecordControls::Start())
- Interface->Error(tr("No free DVB device to record!"));
- break;
- case osRecordings:
- DELETENULL(Menu);
- DELETENULL(ReplayControl);
- Menu = new cMenuRecordings;
- break;
- case osReplay: DELETENULL(Menu);
- DELETENULL(ReplayControl);
- ReplayControl = new cReplayControl;
- break;
+ // Keys that must work independent of any interactive mode:
+ switch (key) {
+ // Volume Control:
+ case kVolUp|k_Repeat:
+ case kVolUp:
+ case kVolDn|k_Repeat:
+ case kVolDn:
+ cDvbApi::PrimaryDvbApi->SetVolume(NORMALKEY(key) == kVolDn ? -VOLUMEDELTA : VOLUMEDELTA);
+ break;
+ case kMute:
+ cDvbApi::PrimaryDvbApi->ToggleMute();
+ break;
+ // Power off:
+ case kPower: isyslog(LOG_INFO, "Power button pressed");
+ DELETENULL(*Interact);
+ if (!Shutdown) {
+ Interface->Error(tr("Can't shutdown - option '-s' not given!"));
+ break;
+ }
+ if (cRecordControls::Active()) {
+ if (Interface->Confirm(tr("Recording - shut down anyway?")))
+ ForceShutdown = true;
+ }
+ LastActivity = 1; // not 0, see below!
+ break;
+ default:
+ if (*Interact) {
+ switch ((*Interact)->ProcessKey(key)) {
+ case osMenu: DELETENULL(Menu);
+ Menu = new cMenuMain(ReplayControl);
+ break;
+ case osRecord: DELETENULL(Menu);
+ if (!cRecordControls::Start())
+ Interface->Error(tr("No free DVB device to record!"));
+ break;
+ case osRecordings:
+ DELETENULL(Menu);
+ DELETENULL(ReplayControl);
+ Menu = new cMenuRecordings;
+ break;
+ case osReplay: DELETENULL(Menu);
+ DELETENULL(ReplayControl);
+ ReplayControl = new cReplayControl;
+ break;
#ifdef DVDSUPPORT
- case osDVD: DELETENULL(Menu);
- DELETENULL(ReplayControl);
- Menu = new cMenuDVD;
- break;
+ case osDVD: DELETENULL(Menu);
+ DELETENULL(ReplayControl);
+ Menu = new cMenuDVD;
+ break;
#endif //DVDSUPPORT
- case osStopReplay:
- DELETENULL(*Interact);
- DELETENULL(ReplayControl);
- break;
- case osSwitchDvb:
- DELETENULL(*Interact);
- Interface->Info(tr("Switching primary DVB..."));
- cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB);
- break;
- case osBack:
- case osEnd: DELETENULL(*Interact);
- break;
- default: ;
- }
- }
- else {
- switch (key) {
- // Toggle channels:
- case k0: {
- int CurrentChannel = cDvbApi::CurrentChannel();
- Channels.SwitchTo(PreviousChannel);
- PreviousChannel = CurrentChannel;
- break;
- }
- // Direct Channel Select:
- case k1 ... k9:
- Menu = new cDisplayChannel(key);
- break;
- // Left/Right rotates trough channel groups:
- case kLeft|k_Repeat:
- case kLeft:
- case kRight|k_Repeat:
- case kRight:
- Menu = new cDisplayChannel(NORMALKEY(key));
- break;
- // Up/Down Channel Select:
- case kUp|k_Repeat:
- case kUp:
- case kDown|k_Repeat:
- case kDown: {
- int n = cDvbApi::CurrentChannel() + (NORMALKEY(key) == kUp ? 1 : -1);
- cChannel *channel = Channels.GetByNumber(n);
- if (channel)
- channel->Switch();
- break;
- }
- // Menu Control:
- case kMenu: Menu = new cMenuMain(ReplayControl); break;
- // Viewing Control:
- case kOk: LastChannel = -1; break; // forces channel display
- // Volume Control:
- case kVolUp|k_Repeat:
- case kVolUp:
- case kVolDn|k_Repeat:
- case kVolDn:
- cDvbApi::PrimaryDvbApi->SetVolume(NORMALKEY(key) == kVolDn ? -VOLUMEDELTA : VOLUMEDELTA);
- break;
- case kMute:
- cDvbApi::PrimaryDvbApi->ToggleMute();
- break;
- // Power off:
- case kPower: isyslog(LOG_INFO, "Power button pressed");
- DELETENULL(*Interact);
- if (!Shutdown) {
- Interface->Error(tr("Can't shutdown - option '-s' not given!"));
- break;
- }
- if (cRecordControls::Active()) {
- if (Interface->Confirm(tr("Recording - shut down anyway?")))
- ForceShutdown = true;
- }
- LastActivity = 1; // not 0, see below!
- break;
- default: break;
- }
- }
+ case osStopReplay:
+ DELETENULL(*Interact);
+ DELETENULL(ReplayControl);
+ break;
+ case osSwitchDvb:
+ DELETENULL(*Interact);
+ Interface->Info(tr("Switching primary DVB..."));
+ cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB);
+ break;
+ case osBack:
+ case osEnd: DELETENULL(*Interact);
+ break;
+ default: ;
+ }
+ }
+ else {
+ // Key functions in "normal" viewing mode:
+ switch (key) {
+ // Toggle channels:
+ case k0: {
+ int CurrentChannel = cDvbApi::CurrentChannel();
+ Channels.SwitchTo(PreviousChannel);
+ PreviousChannel = CurrentChannel;
+ break;
+ }
+ // Direct Channel Select:
+ case k1 ... k9:
+ Menu = new cDisplayChannel(key);
+ break;
+ // Left/Right rotates trough channel groups:
+ case kLeft|k_Repeat:
+ case kLeft:
+ case kRight|k_Repeat:
+ case kRight:
+ Menu = new cDisplayChannel(NORMALKEY(key));
+ break;
+ // Up/Down Channel Select:
+ case kUp|k_Repeat:
+ case kUp:
+ case kDown|k_Repeat:
+ case kDown: {
+ int n = cDvbApi::CurrentChannel() + (NORMALKEY(key) == kUp ? 1 : -1);
+ cChannel *channel = Channels.GetByNumber(n);
+ if (channel)
+ channel->Switch();
+ break;
+ }
+ // Menu Control:
+ case kMenu: Menu = new cMenuMain(ReplayControl); break;
+ // Viewing Control:
+ case kOk: LastChannel = -1; break; // forces channel display
+ default: break;
+ }
+ }
+ }
if (!Menu) {
EITScanner.Process();
cVideoCutter::Active();