summaryrefslogtreecommitdiff
path: root/vdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'vdr.c')
-rw-r--r--vdr.c80
1 files changed, 50 insertions, 30 deletions
diff --git a/vdr.c b/vdr.c
index bef3919..10c54f7 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.114 2002/06/16 11:30:28 kls Exp $
+ * $Id: vdr.c 1.117 2002/06/23 11:23:34 kls Exp $
*/
#include <getopt.h>
@@ -31,6 +31,7 @@
#include <stdlib.h>
#include <unistd.h>
#include "config.h"
+#include "cutter.h"
#include "device.h"
#include "eitscan.h"
#include "i18n.h"
@@ -371,7 +372,7 @@ int main(int argc, char *argv[])
// Main program loop:
cOsdObject *Menu = NULL;
- cReplayControl *ReplayControl = NULL;
+ cOsdObject *Temp = NULL;
int LastChannel = -1;
int PreviousChannel = cDevice::CurrentChannel();
time_t LastActivity = 0;
@@ -389,6 +390,8 @@ int main(int argc, char *argv[])
esyslog("emergency exit requested - shutting down");
break;
}
+ // Attach launched player control:
+ cControl::Attach();
// Restart the Watchdog timer:
if (WatchdogTimeout > 0) {
int LatencyTime = WatchdogTimeout - alarm(WatchdogTimeout);
@@ -400,7 +403,7 @@ int main(int argc, char *argv[])
// Channel display:
if (!EITScanner.Active() && cDevice::CurrentChannel() != LastChannel) {
if (!Menu)
- Menu = new cDisplayChannel(cDevice::CurrentChannel(), LastChannel > 0);
+ Menu = Temp = new cDisplayChannel(cDevice::CurrentChannel(), LastChannel > 0);
if (LastChannel > 0)
PreviousChannel = LastChannel;
LastChannel = cDevice::CurrentChannel();
@@ -416,14 +419,26 @@ int main(int argc, char *argv[])
}
}
// User Input:
- cOsdObject **Interact = Menu ? &Menu : (cOsdObject **)&ReplayControl;
- eKeys key = Interface->GetKey(!*Interact || !(*Interact)->NeedsFastResponse());
+ cOsdObject *Interact = Menu ? Menu : cControl::Control();
+ eKeys key = Interface->GetKey(!Interact || !Interact->NeedsFastResponse());
if (NORMALKEY(key) != kNone) {
EITScanner.Activity();
LastActivity = time(NULL);
}
// Keys that must work independent of any interactive mode:
switch (key) {
+ // Menu control:
+ case kMenu:
+ if (Menu) {
+ DELETENULL(Menu);
+ if (!Temp)
+ break;
+ }
+ if (cControl::Control())
+ cControl::Control()->Hide();
+ Menu = new cMenuMain(cControl::Control());
+ Temp = NULL;
+ break;
// Volume Control:
case kVolUp|k_Repeat:
case kVolUp:
@@ -436,13 +451,15 @@ int main(int argc, char *argv[])
}
else
cDevice::PrimaryDevice()->SetVolume(NORMALKEY(key) == kVolDn ? -VOLUMEDELTA : VOLUMEDELTA);
- if (!Menu && (!ReplayControl || !ReplayControl->Visible()))
- Menu = cDisplayVolume::Create();
+ if (!Interface->IsOpen())
+ Menu = Temp = cDisplayVolume::Create();
cDisplayVolume::Process(key);
break;
// Power off:
case kPower: isyslog("Power button pressed");
- DELETENULL(*Interact);
+ DELETENULL(Menu);
+ cControl::Shutdown();
+ Temp = NULL;
if (!Shutdown) {
Interface->Error(tr("Can't shutdown - option '-s' not given!"));
break;
@@ -454,35 +471,42 @@ int main(int argc, char *argv[])
LastActivity = 1; // not 0, see below!
break;
default:
- if (*Interact) {
- switch ((*Interact)->ProcessKey(key)) {
- case osMenu: DELETENULL(Menu);
- Menu = new cMenuMain(ReplayControl);
- break;
+ if (Interact) {
+ switch (Interact->ProcessKey(key)) {
case osRecord: DELETENULL(Menu);
+ Temp = NULL;
if (!cRecordControls::Start())
Interface->Error(tr("No free DVB device to record!"));
break;
case osRecordings:
DELETENULL(Menu);
- DELETENULL(ReplayControl);
- Menu = new cMenuMain(ReplayControl, osRecordings);
+ cControl::Shutdown();
+ Temp = NULL;
+ Menu = new cMenuMain(false, osRecordings);
break;
case osReplay: DELETENULL(Menu);
- DELETENULL(ReplayControl);
- ReplayControl = new cReplayControl;
+ cControl::Shutdown();
+ Temp = NULL;
+ cControl::Launch(new cReplayControl);
break;
case osStopReplay:
- DELETENULL(*Interact);
- DELETENULL(ReplayControl);
+ DELETENULL(Menu);
+ cControl::Shutdown();
+ Temp = NULL;
break;
case osSwitchDvb:
- DELETENULL(*Interact);
+ DELETENULL(Menu);
+ cControl::Shutdown();
+ Temp = NULL;
Interface->Info(tr("Switching primary DVB..."));
cDevice::SetPrimaryDevice(Setup.PrimaryDVB);
break;
case osBack:
- case osEnd: DELETENULL(*Interact);
+ case osEnd: if (Interact == Menu)
+ DELETENULL(Menu);
+ else
+ cControl::Shutdown();
+ Temp = NULL;
break;
default: ;
}
@@ -519,8 +543,6 @@ int main(int argc, char *argv[])
channel->Switch();
break;
}
- // Menu Control:
- case kMenu: Menu = new cMenuMain(ReplayControl); break;
// Viewing Control:
case kOk: LastChannel = -1; break; // forces channel display
default: break;
@@ -529,16 +551,14 @@ int main(int argc, char *argv[])
}
if (!Menu) {
EITScanner.Process();
- /*XXX+
- if (!cVideoCutter::Active() && cVideoCutter::Ended()) {
- if (cVideoCutter::Error())
+ if (!cCutter::Active() && cCutter::Ended()) {
+ if (cCutter::Error())
Interface->Error(tr("Editing process failed!"));
else
Interface->Info(tr("Editing process finished"));
}
- XXX*/
}
- if (!*Interact && ((!cRecordControls::Active() /*XXX+&& !cVideoCutter::Active()XXX*/) || ForceShutdown)) {
+ if (!Interact && ((!cRecordControls::Active() && !cCutter::Active()) || ForceShutdown)) {
time_t Now = time(NULL);
if (Now - LastActivity > ACTIVITYTIMEOUT) {
// Shutdown:
@@ -598,9 +618,9 @@ int main(int argc, char *argv[])
if (Interrupted)
isyslog("caught signal %d", Interrupted);
cRecordControls::Shutdown();
- //XXX+cVideoCutter::Stop();
+ cCutter::Stop();
delete Menu;
- delete ReplayControl;
+ cControl::Shutdown();
delete Interface;
cOsd::Shutdown();
PluginManager.Shutdown(true);