summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2000-04-16 15:50:21 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2000-04-16 15:50:21 +0200
commit38f799579d63af92450dbc2504057fbf21cd469e (patch)
tree6d1897582078f6ff056c74303ae567499799a56c
parente3fe42608da06dcaf6932472343b3f39ea1bcea3 (diff)
downloadvdr-38f799579d63af92450dbc2504057fbf21cd469e.tar.gz
vdr-38f799579d63af92450dbc2504057fbf21cd469e.tar.bz2
Removed DvbApi access from recording.c; added direct channel select
-rw-r--r--menu.c4
-rw-r--r--osm.c69
-rw-r--r--recording.c17
-rw-r--r--recording.h9
4 files changed, 46 insertions, 53 deletions
diff --git a/menu.c b/menu.c
index 92c0bd3e..1d94344e 100644
--- a/menu.c
+++ b/menu.c
@@ -4,7 +4,7 @@
* See the main source file 'osm.c' for copyright information and
* how to reach the author.
*
- * $Id: menu.c 1.3 2000/04/15 15:07:36 kls Exp $
+ * $Id: menu.c 1.4 2000/04/16 15:45:44 kls Exp $
*/
#include "menu.h"
@@ -957,7 +957,7 @@ eOSState cMenuRecordings::Play(void)
cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current());
if (ri) {
//XXX what if this recording's file is currently in use???
- if (ri->recording->Play())
+ if (DvbApi.StartReplay(ri->recording->FileName()))
return osEnd;
}
return osContinue;
diff --git a/osm.c b/osm.c
index 982e1e10..db526d9c 100644
--- a/osm.c
+++ b/osm.c
@@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
- * $Id: osm.c 1.4 2000/04/16 13:54:10 kls Exp $
+ * $Id: osm.c 1.5 2000/04/16 15:50:21 kls Exp $
*/
#include <signal.h>
@@ -38,6 +38,8 @@
#define KEYS_CONF "keys.conf"
#endif
+#define DIRECTCHANNELTIMEOUT 500 //ms
+
static int Interrupted = 0;
void SignalHandler(int signum)
@@ -64,38 +66,45 @@ int main(int argc, char *argv[])
cMenuMain *Menu = NULL;
cTimer *Timer = NULL;
- cRecording *Recording = NULL;
+ int dcTime = 0, dcNumber = 0;
while (!Interrupted) {
- AssertFreeDiskSpace();
- if (!Recording && !Timer && (Timer = cTimer::GetMatch()) != NULL) {
- DELETENULL(Menu);
- // make sure the timer won't be deleted:
- Timer->SetRecording(true);
- // switch to channel:
- cChannel::SwitchTo(Timer->channel - 1);
- // start recording:
- Recording = new cRecording(Timer);
- if (!Recording->Record())
- DELETENULL(Recording);
+ // Direct Channel Select (action):
+ if (dcNumber) {
+ if (time_ms() - dcTime > DIRECTCHANNELTIMEOUT) {
+ cChannel::SwitchTo(dcNumber - 1);
+ dcNumber = 0;
+ }
}
- if (Timer && !Timer->Matches()) {
- // stop recording:
- if (Recording) {
- Recording->Stop();
- DELETENULL(Recording);
+ // Timer Processing:
+ else {
+ AssertFreeDiskSpace();
+ if (!Timer && (Timer = cTimer::GetMatch()) != NULL) {
+ DELETENULL(Menu);
+ // 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());
}
- // 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();
+ 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();
+ }
+ Timer = NULL;
}
- Timer = NULL;
}
+ // User Input:
eKeys key = Interface.GetKey();
if (Menu) {
switch (Menu->ProcessKey(key)) {
@@ -108,6 +117,12 @@ int main(int argc, char *argv[])
}
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:
+ {
+ dcNumber = dcNumber * 10 + key - k0;
+ dcTime = time_ms();
+ }
// Record/Replay Control:
case kBegin: DvbApi.Skip(-INT_MAX); break;
case kRecord: if (!DvbApi.Recording()) {
diff --git a/recording.c b/recording.c
index 15c71630..de202ce0 100644
--- a/recording.c
+++ b/recording.c
@@ -4,7 +4,7 @@
* See the main source file 'osm.c' for copyright information and
* how to reach the author.
*
- * $Id: recording.c 1.2 2000/04/15 13:29:02 kls Exp $
+ * $Id: recording.c 1.3 2000/04/16 15:47:45 kls Exp $
*/
#define _GNU_SOURCE
@@ -180,21 +180,6 @@ bool cRecording::Remove(void)
return RemoveFileOrDir(FileName());
}
-bool cRecording::Record(void)
-{
- return DvbApi.StartRecord(FileName());
-}
-
-bool cRecording::Play(void)
-{
- return DvbApi.StartReplay(FileName());
-}
-
-void cRecording::Stop(void)
-{
- DvbApi.StopRecord();
-}
-
// --- cRecordings -----------------------------------------------------------
bool cRecordings::Load(bool Deleted)
diff --git a/recording.h b/recording.h
index 5a5e8de4..2e79a7da 100644
--- a/recording.h
+++ b/recording.h
@@ -4,7 +4,7 @@
* See the main source file 'osm.c' for copyright information and
* how to reach the author.
*
- * $Id: recording.h 1.2 2000/04/14 15:12:42 kls Exp $
+ * $Id: recording.h 1.3 2000/04/16 15:44:09 kls Exp $
*/
#ifndef __RECORDING_H
@@ -12,7 +12,6 @@
#include <time.h>
#include "config.h"
-#include "dvbapi.h"
#include "tools.h"
void AssertFreeDiskSpace(void);
@@ -35,12 +34,6 @@ public:
bool Remove(void);
// Actually removes the file from the disk
// Returns false in case of error
- bool Record(void);
- // Starts recording of the file
- bool Play(void);
- // Starts playback of the file
- void Stop(void);
- // Stops recording or playback of the file
};
class cRecordings : public cList<cRecording> {