summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2001-02-11 11:04:41 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2001-02-11 11:04:41 +0100
commit535e755278ef51b923a71299204ec86da4229d02 (patch)
treeae4a8678bb0d9c83d4be44e39ee43070f1e97aa7
parent7a92a259546000c367042e4c901fc4789f2225cb (diff)
downloadvdr-535e755278ef51b923a71299204ec86da4229d02.tar.gz
vdr-535e755278ef51b923a71299204ec86da4229d02.tar.bz2
Implemented 'Rewind' in the 'Recordings' menu
-rw-r--r--HISTORY4
-rw-r--r--MANUAL6
-rw-r--r--dvbapi.c53
-rw-r--r--dvbapi.h12
-rw-r--r--i18n.c7
-rw-r--r--menu.c17
-rw-r--r--menu.h3
-rw-r--r--recording.c62
-rw-r--r--recording.h13
9 files changed, 103 insertions, 74 deletions
diff --git a/HISTORY b/HISTORY
index 807bcf8d..27c2242d 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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.
diff --git a/MANUAL b/MANUAL
index b4d169ee..986da1dd 100644
--- a/MANUAL
+++ b/MANUAL
@@ -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
diff --git a/dvbapi.c b/dvbapi.c
index 94dd2c29..c1fb6efc 100644
--- a/dvbapi.c
+++ b/dvbapi.c
@@ -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 {
diff --git a/dvbapi.h b/dvbapi.h
index 517736da..de646121 100644
--- a/dvbapi.h
+++ b/dvbapi.h
@@ -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);
diff --git a/i18n.c b/i18n.c
index 90dd010d..3f092952 100644
--- a/i18n.c
+++ b/i18n.c
@@ -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",
diff --git a/menu.c b/menu.c
index 72fd66c1..92c8091d 100644
--- a/menu.c
+++ b/menu.c
@@ -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;
diff --git a/menu.h b/menu.h
index b8ea98b3..356122e0 100644
--- a/menu.h
+++ b/menu.h
@@ -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:
diff --git a/recording.c b/recording.c
index dd364638..72b3135f 100644
--- a/recording.c
+++ b/recording.c
@@ -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)
diff --git a/recording.h b/recording.h
index 2d3ea392..b561fa2f 100644
--- a/recording.h
+++ b/recording.h
@@ -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: