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

Removed DvbApi access from recording.c; added direct channel select

This commit is contained in:
Klaus Schmidinger 2000-04-16 15:50:21 +02:00
parent e3fe42608d
commit 38f799579d
4 changed files with 48 additions and 55 deletions

4
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'osm.c' for copyright information and * See the main source file 'osm.c' for copyright information and
* how to reach the author. * 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" #include "menu.h"
@ -957,7 +957,7 @@ eOSState cMenuRecordings::Play(void)
cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current()); cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current());
if (ri) { if (ri) {
//XXX what if this recording's file is currently in use??? //XXX what if this recording's file is currently in use???
if (ri->recording->Play()) if (DvbApi.StartReplay(ri->recording->FileName()))
return osEnd; return osEnd;
} }
return osContinue; return osContinue;

35
osm.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: 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> #include <signal.h>
@ -38,6 +38,8 @@
#define KEYS_CONF "keys.conf" #define KEYS_CONF "keys.conf"
#endif #endif
#define DIRECTCHANNELTIMEOUT 500 //ms
static int Interrupted = 0; static int Interrupted = 0;
void SignalHandler(int signum) void SignalHandler(int signum)
@ -64,27 +66,32 @@ int main(int argc, char *argv[])
cMenuMain *Menu = NULL; cMenuMain *Menu = NULL;
cTimer *Timer = NULL; cTimer *Timer = NULL;
cRecording *Recording = NULL; int dcTime = 0, dcNumber = 0;
while (!Interrupted) { while (!Interrupted) {
// Direct Channel Select (action):
if (dcNumber) {
if (time_ms() - dcTime > DIRECTCHANNELTIMEOUT) {
cChannel::SwitchTo(dcNumber - 1);
dcNumber = 0;
}
}
// Timer Processing:
else {
AssertFreeDiskSpace(); AssertFreeDiskSpace();
if (!Recording && !Timer && (Timer = cTimer::GetMatch()) != NULL) { if (!Timer && (Timer = cTimer::GetMatch()) != NULL) {
DELETENULL(Menu); DELETENULL(Menu);
// make sure the timer won't be deleted: // make sure the timer won't be deleted:
Timer->SetRecording(true); Timer->SetRecording(true);
// switch to channel: // switch to channel:
cChannel::SwitchTo(Timer->channel - 1); cChannel::SwitchTo(Timer->channel - 1);
// start recording: // start recording:
Recording = new cRecording(Timer); cRecording Recording(Timer);
if (!Recording->Record()) DvbApi.StartRecord(Recording.FileName());
DELETENULL(Recording);
} }
if (Timer && !Timer->Matches()) { if (Timer && !Timer->Matches()) {
// stop recording: // stop recording:
if (Recording) { DvbApi.StopRecord();
Recording->Stop();
DELETENULL(Recording);
}
// release timer: // release timer:
Timer->SetRecording(false); Timer->SetRecording(false);
// clear single event timer: // clear single event timer:
@ -96,6 +103,8 @@ int main(int argc, char *argv[])
} }
Timer = NULL; Timer = NULL;
} }
}
// User Input:
eKeys key = Interface.GetKey(); eKeys key = Interface.GetKey();
if (Menu) { if (Menu) {
switch (Menu->ProcessKey(key)) { switch (Menu->ProcessKey(key)) {
@ -108,6 +117,12 @@ int main(int argc, char *argv[])
} }
else { else {
switch (key) { 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: // Record/Replay Control:
case kBegin: DvbApi.Skip(-INT_MAX); break; case kBegin: DvbApi.Skip(-INT_MAX); break;
case kRecord: if (!DvbApi.Recording()) { case kRecord: if (!DvbApi.Recording()) {

View File

@ -4,7 +4,7 @@
* See the main source file 'osm.c' for copyright information and * See the main source file 'osm.c' for copyright information and
* how to reach the author. * 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 #define _GNU_SOURCE
@ -180,21 +180,6 @@ bool cRecording::Remove(void)
return RemoveFileOrDir(FileName()); 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 ----------------------------------------------------------- // --- cRecordings -----------------------------------------------------------
bool cRecordings::Load(bool Deleted) bool cRecordings::Load(bool Deleted)

View File

@ -4,7 +4,7 @@
* See the main source file 'osm.c' for copyright information and * See the main source file 'osm.c' for copyright information and
* how to reach the author. * 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 #ifndef __RECORDING_H
@ -12,7 +12,6 @@
#include <time.h> #include <time.h>
#include "config.h" #include "config.h"
#include "dvbapi.h"
#include "tools.h" #include "tools.h"
void AssertFreeDiskSpace(void); void AssertFreeDiskSpace(void);
@ -35,12 +34,6 @@ public:
bool Remove(void); bool Remove(void);
// Actually removes the file from the disk // Actually removes the file from the disk
// Returns false in case of error // 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> { class cRecordings : public cList<cRecording> {