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:
parent
e3fe42608d
commit
38f799579d
4
menu.c
4
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;
|
||||
|
73
osm.c
73
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);
|
||||
}
|
||||
if (Timer && !Timer->Matches()) {
|
||||
// stop recording:
|
||||
if (Recording) {
|
||||
Recording->Stop();
|
||||
DELETENULL(Recording);
|
||||
// Direct Channel Select (action):
|
||||
if (dcNumber) {
|
||||
if (time_ms() - dcTime > DIRECTCHANNELTIMEOUT) {
|
||||
cChannel::SwitchTo(dcNumber - 1);
|
||||
dcNumber = 0;
|
||||
}
|
||||
// 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 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());
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
// 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()) {
|
||||
|
17
recording.c
17
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)
|
||||
|
@ -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> {
|
||||
|
Loading…
Reference in New Issue
Block a user