summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dvbapi.c10
-rw-r--r--dvbapi.h4
-rw-r--r--menu.c6
-rw-r--r--menu.h4
-rw-r--r--tools.c21
-rw-r--r--tools.h4
6 files changed, 37 insertions, 12 deletions
diff --git a/dvbapi.c b/dvbapi.c
index a9544ffa..719437d4 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.7 2000/04/24 13:27:38 kls Exp $
+ * $Id: dvbapi.c 1.8 2000/04/24 15:30:35 kls Exp $
*/
#include "dvbapi.h"
@@ -1150,7 +1150,7 @@ void cDvbApi::Text(int x, int y, const char *s, eDvbColor colorFg, eDvbColor col
#endif
}
-void cDvbApi::ShowProgress(bool Initial)
+bool cDvbApi::ShowProgress(bool Initial)
{
int Current, Total;
@@ -1191,7 +1191,9 @@ void cDvbApi::ShowProgress(bool Initial)
}
#endif
Text(0, 2, cIndexFile::Str(Current));
+ return true;
}
+ return false;
}
bool cDvbApi::SetChannel(int FrequencyMHz, char Polarization, int Diseqc, int Srate, int Vpid, int Apid, int Ca, int Pnr)
@@ -1538,6 +1540,7 @@ bool cDvbApi::GetIndex(int *Current, int *Total)
{
if (pidReplay) {
int total;
+ purge(fromReplay);
writechar(toReplay, dvbGetIndex);
if (readint(fromReplay, *Current) && readint(fromReplay, total)) {
if (Total)
@@ -1545,7 +1548,8 @@ bool cDvbApi::GetIndex(int *Current, int *Total)
}
else
*Current = -1;
+ return *Current >= 0;
}
- return *Current >= 0;
+ return false;
}
diff --git a/dvbapi.h b/dvbapi.h
index ddfdc154..91e554e9 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.7 2000/04/24 10:46:47 kls Exp $
+ * $Id: dvbapi.h 1.8 2000/04/24 15:31:07 kls Exp $
*/
#ifndef __DVBAPI_H
@@ -75,7 +75,7 @@ private:
int lastProgress;
char *replayTitle;
public:
- void ShowProgress(bool Initial = false);
+ bool ShowProgress(bool Initial = false);
// Channel facilities
diff --git a/menu.c b/menu.c
index 1a26730d..2a4cfa9f 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.7 2000/04/24 09:44:27 kls Exp $
+ * $Id: menu.c 1.8 2000/04/24 15:32:11 kls Exp $
*/
#include "menu.h"
@@ -1018,7 +1018,7 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
cReplayDisplay::cReplayDisplay(void)
{
Interface.Open(MenuColumns, -3);
- DvbApi.ShowProgress(true);
+ shown = DvbApi.ShowProgress(true);
}
cReplayDisplay::~cReplayDisplay()
@@ -1030,7 +1030,7 @@ eKeys cReplayDisplay::ProcessKey(eKeys Key)
{
if (!DvbApi.Replaying())
return kOk; // will turn off replay display
- DvbApi.ShowProgress();
+ shown = DvbApi.ShowProgress(!shown);
switch (Key) {
case kBegin:
case kPause:
diff --git a/menu.h b/menu.h
index 85758c8c..f6657996 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.4 2000/04/24 09:44:29 kls Exp $
+ * $Id: menu.h 1.5 2000/04/24 15:31:53 kls Exp $
*/
#ifndef _MENU_H
@@ -19,6 +19,8 @@ public:
};
class cReplayDisplay {
+private:
+ bool shown;
public:
cReplayDisplay(void);
~cReplayDisplay();
diff --git a/tools.c b/tools.c
index c43e610f..eb0a14a4 100644
--- a/tools.c
+++ b/tools.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.c 1.6 2000/04/24 13:54:23 kls Exp $
+ * $Id: tools.c 1.7 2000/04/24 15:01:35 kls Exp $
*/
#define _GNU_SOURCE
@@ -22,6 +22,17 @@
int SysLogLevel = 3;
+bool DataAvailable(int filedes)
+{
+ fd_set set;
+ FD_ZERO(&set);
+ FD_SET(filedes, &set);
+ struct timeval timeout;
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 10000;
+ return select(FD_SETSIZE, &set, NULL, NULL, &timeout) > 0 && FD_ISSET(filedes, &set);
+}
+
void writechar(int filedes, char c)
{
write(filedes, &c, sizeof(c));
@@ -41,7 +52,13 @@ char readchar(int filedes)
bool readint(int filedes, int &n)
{
- return read(filedes, &n, sizeof(n)) == sizeof(n);
+ return DataAvailable(filedes) && read(filedes, &n, sizeof(n)) == sizeof(n);
+}
+
+void purge(int filedes)
+{
+ while (DataAvailable(filedes))
+ readchar(filedes);
}
char *readline(FILE *f)
diff --git a/tools.h b/tools.h
index 3263b914..57b2065d 100644
--- a/tools.h
+++ b/tools.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.h 1.6 2000/04/24 13:09:20 kls Exp $
+ * $Id: tools.h 1.7 2000/04/24 15:01:49 kls Exp $
*/
#ifndef __TOOLS_H
@@ -30,10 +30,12 @@ extern int SysLogLevel;
#define DELETENULL(p) (delete (p), p = NULL)
+bool DataAvailable(int filedes);
void writechar(int filedes, char c);
void writeint(int filedes, int n);
char readchar(int filedes);
bool readint(int filedes, int &n);
+void purge(int filedes);
char *readline(FILE *f);
int time_ms(void);
void delay_ms(int ms);