Implemented 'Rewind' in the 'Recordings' menu

This commit is contained in:
Klaus Schmidinger 2001-02-11 11:04:41 +01:00
parent 7a92a25954
commit 535e755278
9 changed files with 103 additions and 74 deletions

View File

@ -350,7 +350,7 @@ Video Disk Recorder Revision History
- Encrypted channels can now be selected even without knowing the PNR (however, it
is still necessary for the EPG info).
2001-02-10: Version 0.71
2001-02-11: Version 0.71
- Fixed 'Transfer Mode' in cases where a non-primary interface was switched to
a channel that only the primary interface can receive (which could happen in
@ -386,3 +386,5 @@ Video Disk Recorder Revision History
module only works if it is inserted into the last DVB card).
- The "Now", "Next" and "Schedule" menus now remember the current channel and
restore the list when switching between them.
- The "Green" button in the "Recordings" menu can now be used to rewind a
recording and play it from the very beginning.

6
MANUAL
View File

@ -18,10 +18,10 @@ Video Disk Recorder User's Manual
Menu Menu on Menu off Menu off Menu off Menu off Menu off Menu on
Back - Menu off Main menu Main menu Discard Main menu Recordings menu
Red - Record Edit Edit - Play -
Green - - New New - - Skip -60s
Green - - New New - Rewind Skip -60s
Yellow - - Delete Delete - Delete Skip +60s
Blue - Resume Mark Mark - - Stop
0..9 Ch select - - - Numeric inp. - -
Blue - Resume Mark Mark - Summary Stop
0..9 Ch select - - - Numeric inp. - Editing
* Navigating through the On Screen Menus

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbapi.c 1.57 2001/02/03 17:43:21 kls Exp $
* $Id: dvbapi.c 1.58 2001/02/11 11:04:41 kls Exp $
*/
#include "dvbapi.h"
@ -67,7 +67,6 @@ extern "C" {
#define DISKCHECKINTERVAL 100 // seconds
#define INDEXFILESUFFIX "/index.vdr"
#define RESUMEFILESUFFIX "/resume.vdr"
#define RECORDFILESUFFIX "/%03d.vdr"
#define RECORDFILESUFFIXLEN 20 // some additional bytes for safety...
@ -105,56 +104,6 @@ int HMSFToIndex(const char *HMSF)
return 0;
}
// --- cResumeFile ------------------------------------------------------------
cResumeFile::cResumeFile(const char *FileName)
{
fileName = new char[strlen(FileName) + strlen(RESUMEFILESUFFIX) + 1];
if (fileName) {
strcpy(fileName, FileName);
strcat(fileName, RESUMEFILESUFFIX);
}
else
esyslog(LOG_ERR, "ERROR: can't allocate memory for resume file name");
}
cResumeFile::~cResumeFile()
{
delete fileName;
}
int cResumeFile::Read(void)
{
int resume = -1;
if (fileName) {
int f = open(fileName, O_RDONLY);
if (f >= 0) {
if (read(f, &resume, sizeof(resume)) != sizeof(resume)) {
resume = -1;
LOG_ERROR_STR(fileName);
}
close(f);
}
else if (errno != ENOENT)
LOG_ERROR_STR(fileName);
}
return resume;
}
bool cResumeFile::Save(int Index)
{
if (fileName) {
int f = open(fileName, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP);
if (f >= 0) {
if (write(f, &Index, sizeof(Index)) != sizeof(Index))
LOG_ERROR_STR(fileName);
close(f);
return true;
}
}
return false;
}
// --- cIndexFile ------------------------------------------------------------
class cIndexFile {

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbapi.h 1.34 2001/02/10 13:11:48 kls Exp $
* $Id: dvbapi.h 1.35 2001/02/11 10:41:10 kls Exp $
*/
#ifndef __DVBAPI_H
@ -33,16 +33,6 @@ typedef struct CRect {
#define MenuLines 15
#define MenuColumns 40
class cResumeFile {
private:
char *fileName;
public:
cResumeFile(const char *FileName);
~cResumeFile();
int Read(void);
bool Save(int Index);
};
const char *IndexToHMSF(int Index, bool WithFrame = false);
// Converts the given index to a string, optionally containing the frame number.
int HMSFToIndex(const char *HMSF);

7
i18n.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: i18n.c 1.9 2001/02/03 16:06:04 kls Exp $
* $Id: i18n.c 1.10 2001/02/11 10:23:10 kls Exp $
*
* Slovenian translations provided by Miha Setina <mihasetina@softhome.net>
* Italian translations provided by Alberto Carraro <bertocar@tin.it>
@ -161,6 +161,11 @@ const tPhrase Phrases[] = {
"Predavajaj",
"Riproduci",
},
{ "Rewind",
"Anfang",
"",// TODO
"",// TODO
},
{ "Resume",
"Weiter",
"Nadaljuj",

17
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 1.64 2001/02/10 15:34:35 kls Exp $
* $Id: menu.c 1.65 2001/02/11 11:01:47 kls Exp $
*/
#include "menu.h"
@ -1497,7 +1497,7 @@ cMenuRecordings::cMenuRecordings(void)
recording = Recordings.Next(recording);
}
}
SetHelp(tr("Play"), NULL, tr("Delete"), tr("Summary"));
SetHelp(tr("Play"), tr("Rewind"), tr("Delete"), tr("Summary"));
Display();
}
@ -1511,6 +1511,18 @@ eOSState cMenuRecordings::Play(void)
return osContinue;
}
eOSState cMenuRecordings::Rewind(void)
{
cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current());
if (ri) {
cDvbApi::PrimaryDvbApi->StopReplay(); // must do this first to be able to rewind the currently replayed recording
cResumeFile ResumeFile(ri->recording->FileName());
ResumeFile.Delete();
return Play();
}
return osContinue;
}
eOSState cMenuRecordings::Del(void)
{
cMenuRecordingItem *ri = (cMenuRecordingItem *)Get(Current());
@ -1551,6 +1563,7 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key)
switch (Key) {
case kOk:
case kRed: return Play();
case kGreen: return Rewind();
case kYellow: return Del();
case kBlue: return Summary();
case kMenu: return osEnd;

3
menu.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.h 1.17 2001/02/04 11:47:21 kls Exp $
* $Id: menu.h 1.18 2001/02/11 10:30:35 kls Exp $
*/
#ifndef _MENU_H
@ -43,6 +43,7 @@ class cMenuRecordings : public cOsdMenu {
private:
cRecordings Recordings;
eOSState Play(void);
eOSState Rewind(void);
eOSState Del(void);
eOSState Summary(void);
public:

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.c 1.25 2001/02/04 12:36:32 kls Exp $
* $Id: recording.c 1.26 2001/02/11 10:47:31 kls Exp $
*/
#define _GNU_SOURCE
@ -15,7 +15,6 @@
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include "dvbapi.h"
#include "interface.h"
#include "tools.h"
#include "videodir.h"
@ -25,6 +24,7 @@
#define DATAFORMAT "%4d-%02d-%02d.%02d:%02d.%02d.%02d" RECEXT
#define NAMEFORMAT "%s/%s/" DATAFORMAT
#define RESUMEFILESUFFIX "/resume.vdr"
#define SUMMARYFILESUFFIX "/summary.vdr"
#define MARKSFILESUFFIX "/marks.vdr"
@ -109,6 +109,64 @@ void AssertFreeDiskSpace(void)
}
}
// --- cResumeFile ------------------------------------------------------------
cResumeFile::cResumeFile(const char *FileName)
{
fileName = new char[strlen(FileName) + strlen(RESUMEFILESUFFIX) + 1];
if (fileName) {
strcpy(fileName, FileName);
strcat(fileName, RESUMEFILESUFFIX);
}
else
esyslog(LOG_ERR, "ERROR: can't allocate memory for resume file name");
}
cResumeFile::~cResumeFile()
{
delete fileName;
}
int cResumeFile::Read(void)
{
int resume = -1;
if (fileName) {
int f = open(fileName, O_RDONLY);
if (f >= 0) {
if (read(f, &resume, sizeof(resume)) != sizeof(resume)) {
resume = -1;
LOG_ERROR_STR(fileName);
}
close(f);
}
else if (errno != ENOENT)
LOG_ERROR_STR(fileName);
}
return resume;
}
bool cResumeFile::Save(int Index)
{
if (fileName) {
int f = open(fileName, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP);
if (f >= 0) {
if (write(f, &Index, sizeof(Index)) != sizeof(Index))
LOG_ERROR_STR(fileName);
close(f);
return true;
}
}
return false;
}
void cResumeFile::Delete(void)
{
if (fileName) {
if (remove(fileName) < 0 && errno != ENOENT)
LOG_ERROR_STR(fileName);
}
}
// --- cRecording ------------------------------------------------------------
cRecording::cRecording(cTimer *Timer)

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.h 1.12 2001/02/04 11:44:37 kls Exp $
* $Id: recording.h 1.13 2001/02/11 10:45:52 kls Exp $
*/
#ifndef __RECORDING_H
@ -17,6 +17,17 @@
void RemoveDeletedRecordings(void);
void AssertFreeDiskSpace(void);
class cResumeFile {
private:
char *fileName;
public:
cResumeFile(const char *FileName);
~cResumeFile();
int Read(void);
bool Save(int Index);
void Delete(void);
};
class cRecording : public cListObject {
friend class cRecordings;
private: