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

Improved replay progress display

This commit is contained in:
Klaus Schmidinger 2000-04-24 15:32:11 +02:00
parent 8a84f6b751
commit ba70704694
6 changed files with 37 additions and 12 deletions

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "dvbapi.h"
@ -1150,7 +1150,7 @@ void cDvbApi::Text(int x, int y, const char *s, eDvbColor colorFg, eDvbColor col
#endif #endif
} }
void cDvbApi::ShowProgress(bool Initial) bool cDvbApi::ShowProgress(bool Initial)
{ {
int Current, Total; int Current, Total;
@ -1191,7 +1191,9 @@ void cDvbApi::ShowProgress(bool Initial)
} }
#endif #endif
Text(0, 2, cIndexFile::Str(Current)); 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) 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) { if (pidReplay) {
int total; int total;
purge(fromReplay);
writechar(toReplay, dvbGetIndex); writechar(toReplay, dvbGetIndex);
if (readint(fromReplay, *Current) && readint(fromReplay, total)) { if (readint(fromReplay, *Current) && readint(fromReplay, total)) {
if (Total) if (Total)
@ -1545,7 +1548,8 @@ bool cDvbApi::GetIndex(int *Current, int *Total)
} }
else else
*Current = -1; *Current = -1;
return *Current >= 0;
} }
return *Current >= 0; return false;
} }

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __DVBAPI_H
@ -75,7 +75,7 @@ private:
int lastProgress; int lastProgress;
char *replayTitle; char *replayTitle;
public: public:
void ShowProgress(bool Initial = false); bool ShowProgress(bool Initial = false);
// Channel facilities // Channel facilities

6
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "menu.h"
@ -1018,7 +1018,7 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
cReplayDisplay::cReplayDisplay(void) cReplayDisplay::cReplayDisplay(void)
{ {
Interface.Open(MenuColumns, -3); Interface.Open(MenuColumns, -3);
DvbApi.ShowProgress(true); shown = DvbApi.ShowProgress(true);
} }
cReplayDisplay::~cReplayDisplay() cReplayDisplay::~cReplayDisplay()
@ -1030,7 +1030,7 @@ eKeys cReplayDisplay::ProcessKey(eKeys Key)
{ {
if (!DvbApi.Replaying()) if (!DvbApi.Replaying())
return kOk; // will turn off replay display return kOk; // will turn off replay display
DvbApi.ShowProgress(); shown = DvbApi.ShowProgress(!shown);
switch (Key) { switch (Key) {
case kBegin: case kBegin:
case kPause: case kPause:

4
menu.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef _MENU_H
@ -19,6 +19,8 @@ public:
}; };
class cReplayDisplay { class cReplayDisplay {
private:
bool shown;
public: public:
cReplayDisplay(void); cReplayDisplay(void);
~cReplayDisplay(); ~cReplayDisplay();

21
tools.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #define _GNU_SOURCE
@ -22,6 +22,17 @@
int SysLogLevel = 3; 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) void writechar(int filedes, char c)
{ {
write(filedes, &c, sizeof(c)); write(filedes, &c, sizeof(c));
@ -41,7 +52,13 @@ char readchar(int filedes)
bool readint(int filedes, int &n) 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) char *readline(FILE *f)

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __TOOLS_H
@ -30,10 +30,12 @@ extern int SysLogLevel;
#define DELETENULL(p) (delete (p), p = NULL) #define DELETENULL(p) (delete (p), p = NULL)
bool DataAvailable(int filedes);
void writechar(int filedes, char c); void writechar(int filedes, char c);
void writeint(int filedes, int n); void writeint(int filedes, int n);
char readchar(int filedes); char readchar(int filedes);
bool readint(int filedes, int &n); bool readint(int filedes, int &n);
void purge(int filedes);
char *readline(FILE *f); char *readline(FILE *f);
int time_ms(void); int time_ms(void);
void delay_ms(int ms); void delay_ms(int ms);