Commit ef8fe3f0 authored by Klaus Schmidinger's avatar Klaus Schmidinger

Version 0.65

- Modified LIRC interface to better handle repeat function.
- Faster OSD by first writing into a bitmap and then sending the entire bitmap
  to the DVB driver at once (requires the patch 'dvb.c.071.diff' to be applied
  against the version 0.71 DVB driver file 'dvb.c').
- When switching channels the channel is now immediately displayed, and the
  current/next information is shown as soon as it becomes available.
- No longer displaying the year in the 'Recordings' menu to saves space for the
  title.
- The 'Recordings' menu now displays a '*' to indicate new recordings.
- Added the description of the timers.conf file to the FORMATS file (thanks to
  Bastian Guse).
- Displaying as much as possible of the current/next info (dropping characters
  that would display only partially).
- In normal viewing mode the '0' key now toggles between the current and the
  previous channel.
parent 7e4b4d29
......@@ -6,6 +6,7 @@ Carsten Koch <Carsten.Koch@icem.de>
for implementing the 'Summary' feature
for adding the 'epg2timers' tool (see Tools/epg2timers)
for his idea of using multiple disks (and for testing this feature)
for implementing the 'new recording' indicator
Plamen Ganev <pganev@com-it.net>
for fixing the frequency offset for Hotbird channels
......@@ -30,3 +31,6 @@ Niels de Carpentier <niels@casema.net>
Martin Hammerschmid <martin@hammerschmid.com>
for suggesting to display the direct channel select input on the OSD
Bastian Guse <bastian@nocopy.de>
for writing the FORMATS entry for timers.conf
......@@ -32,4 +32,26 @@ Video Disk Recorder File Formats
* timers.conf
TODO
This file contains the timer setup.
The fields in a timer definition have the following meaning (from left
to right):
- Timer active (0 = inaactive, 1 = active)
- Program number of the channel to record
- Day of recording, either one or more of
M------ = Monday
-T----- = Tuesday
--W---- = Wednesday
---T--- = Thrusday
----F-- = Friday
-----S- = Saturday
------S = Sunday
(any combination is possible, for example MTWTF--) or the "day of month" (1..31)
- Star time (first two digits for the hour, second two digits for the minutes)
- End time (first two digits for the hour, second two digits for the minutes)
- Priority (from 00 to 99, 00 = lowest prioity, 99 = highest priority)
- Guaranteed lifetime of recording (in days)
- Name of timer (will be used to name the recording)
- Summary
......@@ -203,3 +203,21 @@ Video Disk Recorder Revision History
- The daemon mode (option '-d') now no longer works with REMOTE=KBD (there
is no stdin in daemon mode, so KBD makes no sense - plus it sometimes
crashed).
2000-10-03: Version 0.65
- Modified LIRC interface to better handle repeat function.
- Faster OSD by first writing into a bitmap and then sending the entire bitmap
to the DVB driver at once (requires the patch 'dvb.c.071.diff' to be applied
against the version 0.71 DVB driver file 'dvb.c').
- When switching channels the channel is now immediately displayed, and the
current/next information is shown as soon as it becomes available.
- No longer displaying the year in the 'Recordings' menu to saves space for the
title.
- The 'Recordings' menu now displays a '*' to indicate new recordings.
- Added the description of the timers.conf file to the FORMATS file (thanks to
Bastian Guse).
- Displaying as much as possible of the current/next info (dropping characters
that would display only partially).
- In normal viewing mode the '0' key now toggles between the current and the
previous channel.
......@@ -15,18 +15,22 @@ If you have the DVB driver source in a different location
you will have to change the definition of DVBDIR in the
Makefile.
This program requires the card driver version 0.05 or higher
to work properly. If you are using driver version 0.7 you need
to load the dvb.o module with option outstream=0, so your insmod
statement should read 'insmod dvb.o outstream=0'. This is currently
necessary because 'vdr' works with AV_PES data and will change
once it has been modified to work directly with MPEG2.
This program requires the card driver version 0.71 or higher
to work properly. Currently you need to load the dvb.o module with
option outstream=0, so your insmod statement should read
'insmod dvb.o outstream=0'. This is necessary because 'vdr' works
with AV_PES data and will change once it has been modified to work
directly with MPEG2. You also need to apply the patch 'dvb.c.071.diff'
for the On Screen Display to work properly.
After extracting the package, change into the VDR directory
and type 'make'. This should produce an executable file
named 'vdr', which can be run after the DVB driver has been
installed.
IMPORTANT: See "Configuration files" below for information on how
========= to set up the configuration files at the proper location!
The 'vdr' program can be controlled via the PC keyboard or
an infrared remote control unit. Define the REMOTE macro to one of the
following values 'make' call to activate the respective control mode:
......@@ -115,7 +119,8 @@ Configuration files:
There are three configuration files that hold information about
channels, remote control keys and timers. By default these files are
assumed to be located in the video directory, but a different directory
can be used with the '-c' option.
can be used with the '-c' option. For starters just copy all *.conf files from
the VDR directory into your video directory.
The configuration files can be edited with any text editor, or will be written
by the 'vdr' program if any changes are made inside the on-screen menus.
......
......@@ -66,9 +66,12 @@ Video Disk Recorder User's Manual
if no key is pressed for about half a second, the digits collected so
far will define the channel number.
Pressing the '0' key toggles between the current and the previous channel.
After switching to a different channel the channel number and name, as well
as the current time are displayed at the top of the screen. This line
automatically goes away after about two seconds, or if any key is pressed.
as the current time are displayed at the top of the screen. If available, the
'current/next' information will be displayed below this line. This display
automatically goes away after about five seconds, or if any key is pressed.
To bring up the channel display without switching channels you can press
the "Ok" button.
......@@ -97,7 +100,7 @@ Video Disk Recorder User's Manual
All recordings are listed in the "Recordings" menu. Browse through the
list with the "Up" and "Down" button and press "Ok" (or the "Red" button)
to start playback.
to start playback. New recordings are marked with an '*'.
Playback can be stopped via the Main menu by selecting "Stop replaying",
or by pressing the "Blue" button outside the menu.
......
......@@ -4,12 +4,15 @@
# See the main source file 'vdr.c' for copyright information and
# how to reach the author.
#
# $Id: Makefile 1.11 2000/09/20 17:01:57 kls Exp $
# $Id: Makefile 1.12 2000/10/01 14:27:12 kls Exp $
DVBDIR = ../DVB
INCLUDES = -I$(DVBDIR)/driver
OBJS = config.o dvbapi.o eit.o interface.o menu.o osd.o recording.o remote.o svdrp.o tools.o vdr.o videodir.o
OBJS = config.o dvbapi.o dvbosd.o eit.o font.o interface.o menu.o osd.o\
recording.o remote.o svdrp.o tools.o vdr.o videodir.o
OSDFONT = -adobe-helvetica-medium-r-normal--23-*-100-100-p-*-iso8859-1
ifndef REMOTE
REMOTE = KBD
......@@ -21,26 +24,52 @@ ifdef DEBUG_OSD
DEFINES += -DDEBUG_OSD
endif
all: vdr
font: genfontfile fontosd.c
@echo "font file created."
# Implicit rules:
%.o: %.c
g++ -g -O2 -Wall -m486 -c $(DEFINES) $(INCLUDES) $<
all: vdr
# Dependencies:
config.o : config.c config.h dvbapi.h eit.h interface.h svdrp.h tools.h
dvbapi.o : dvbapi.c config.h dvbapi.h interface.h svdrp.h tools.h videodir.h
config.o : config.c config.h dvbapi.h dvbosd.h eit.h font.h interface.h svdrp.h tools.h
dvbapi.o : dvbapi.c config.h dvbapi.h dvbosd.h font.h interface.h svdrp.h tools.h videodir.h
dvbosd.o : dvbosd.c dvbosd.h font.h tools.h
eit.o : eit.c eit.h tools.h
interface.o: interface.c config.h dvbapi.h eit.h interface.h remote.h svdrp.h tools.h
menu.o : menu.c config.h dvbapi.h interface.h menu.h osd.h recording.h svdrp.h tools.h
osd.o : osd.c config.h dvbapi.h interface.h osd.h svdrp.h tools.h
recording.o: recording.c config.h dvbapi.h interface.h recording.h svdrp.h tools.h videodir.h
remote.o : remote.c config.h dvbapi.h remote.h tools.h
svdrp.o : svdrp.c config.h dvbapi.h interface.h svdrp.h tools.h
font.o : font.c font.h fontosd.c tools.h
interface.o: interface.c config.h dvbapi.h dvbosd.h eit.h font.h interface.h remote.h svdrp.h tools.h
menu.o : menu.c config.h dvbapi.h dvbosd.h font.h interface.h menu.h osd.h recording.h svdrp.h tools.h
osd.o : osd.c config.h dvbapi.h dvbosd.h font.h interface.h osd.h svdrp.h tools.h
recording.o: recording.c config.h dvbapi.h dvbosd.h font.h interface.h recording.h svdrp.h tools.h videodir.h
remote.o : remote.c config.h dvbapi.h dvbosd.h font.h remote.h tools.h
svdrp.o : svdrp.c config.h dvbapi.h dvbosd.h font.h interface.h svdrp.h tools.h
tools.o : tools.c tools.h
vdr.o : vdr.c config.h dvbapi.h interface.h menu.h osd.h recording.h svdrp.h tools.h videodir.h
vdr.o : vdr.c config.h dvbapi.h dvbosd.h font.h interface.h menu.h osd.h recording.h svdrp.h tools.h videodir.h
videodir.o : videodir.c tools.h videodir.h
# The main program:
vdr: $(OBJS)
g++ -g -O2 $(OBJS) -lncurses -ljpeg -o vdr
# The font file:
fontosd.c:
genfontfile "cFont::tPixelData FontOsd" $(OSDFONT) > $@
# The font file generator:
genfontfile.o: genfontfile.c
gcc -O2 -c $<
genfontfile: genfontfile.o
gcc -o $@ -L/usr/X11R6/lib $< -lX11
# Housekeeping:
clean:
-rm $(OBJS) vdr
-rm -f $(OBJS) vdr genfontfile genfontfile.o
CLEAN: clean
-rm -f fontosd.c
......@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.h 1.21 2000/09/17 09:08:13 kls Exp $
* $Id: config.h 1.22 2000/10/01 14:14:18 kls Exp $
*/
#ifndef __CONFIG_H
......@@ -17,7 +17,7 @@
#include "dvbapi.h"
#include "tools.h"
#define VDRVERSION "0.64"
#define VDRVERSION "0.65"
#define MaxBuffer 10000
......
--- dvb.c.001 Sun Sep 17 22:02:37 2000
+++ dvb.c Tue Oct 3 12:11:46 2000
@@ -1143,6 +1143,8 @@
{
int bpp;
int i;
+ int d, delta; //XXX kls: additional variables for data compression
+ u8 c; //XXX kls: additional variables for data compression
DECLARE_WAITQUEUE(wait, current);
if (dvb->bmp_state==BMP_LOADING) {
@@ -1160,27 +1162,38 @@
if (dvb->bmp_state==BMP_LOADING)
return -1;
dvb->bmp_state=BMP_LOADING;
- if (format==BITMAP8) bpp=8;
- else if (format==BITMAP4) bpp=4;
- else if (format==BITMAP2) bpp=2;
- else if (format==BITMAP1) bpp=1;
+ if (format==BITMAP8) { bpp=8; delta = 1; } //XXX kls: initialize 'delta', too
+ else if (format==BITMAP4) { bpp=4; delta = 2; }
+ else if (format==BITMAP2) { bpp=2; delta = 4; }
+ else if (format==BITMAP1) { bpp=1; delta = 8; }
else {
dvb->bmp_state=BMP_NONE;
return -1;
}
- dvb->bmplen= (dx*dy*bpp)/8;
+ dvb->bmplen= ((dx*dy*bpp+7)&~7)/8; //XXX kls: need to round up to include partial bytes
dvb->bmpp=0;
if (dvb->bmplen>32768) {
dvb->bmp_state=BMP_NONE;
return -1;
}
for (i=0; i<dy; i++) {
- if (copy_from_user(dvb->bmpbuf+1024+i*dx, data+i*inc, (dx*bpp)/8)) {
+ if (copy_from_user(dvb->bmpbuf+1024+i*dx, data+i*inc, dx)) { //XXX kls: incoming data is "1 byte per pixel"
dvb->bmp_state=BMP_NONE;
return -1;
}
}
+ // XXX kls: Incoming data is always "one byte per pixel", so we need to compress
+ // the data in case we have a lower resolution than 8 bpp:
+ if (format != BITMAP8) {
+ for (i=0; i<dx*dy/delta; i++) {
+ c = ((u8 *)dvb->bmpbuf)[1024+i*delta+delta-1];
+ for (d=delta-2; d>=0; d--) {
+ c |= (((u8 *)dvb->bmpbuf)[1024+i*delta+d] << ((delta-d-1)*bpp));
+ ((u8 *)dvb->bmpbuf)[1024+i] = c;
+ }
+ }
+ }
dvb->bmplen+=1024;
return outcom(dvb, COMTYPE_OSD, LoadBmp, 3, format, dx, dy);
}
@@ -1256,24 +1269,25 @@
int i;
w=x1-x0+1; h=y1-y0+1;
- if (inc>0)
- w=inc;
- if (w>720 || h>576)
+ if (inc<=0)
+ inc=w; //XXX kls: see dvb_4l.h: "inc<=0 uses blockwidth as linewidth"
+ if (w<=0 || w>720 || h<=0 || h>576) //XXX kls: checking lower bounds, too
return -1;
- bpp=8; //dvb->osdbpp[dvb->osdwin];
- bpl=w*bpp/8;
+ bpp=dvb->osdbpp[dvb->osdwin]+1; //XXX kls: 'bpp' needs to be taken from the window
+ bpl=((w*bpp+7)&~7)/8; //XXX kls: need to round up to include partial bytes
size=h*bpl;
- lpb=(64*1024)/bpl;
+ lpb=(32*1024)/bpl; //XXX kls: apparently 32K is the maximum possible value
bnum=size/(lpb*bpl);
brest=size-bnum*lpb*bpl;
for (i=0; i<bnum; i++) {
- LoadBitmap(dvb, BITMAP8, w, lpb, inc, data);
+ LoadBitmap(dvb, bpp2bit[dvb->osdbpp[dvb->osdwin]], w, lpb, inc, data); //XXX kls: need to take the format from the actual window
BlitBitmap(dvb, dvb->osdwin, x0, y0+i*lpb, 1);
- data+=bpl;
+ data+=lpb*inc; //XXX kls: incrementing must be done in "one byte per pixel"
+ ddelay(2); //XXX kls: without this the block is sometimes not fully displayed - firmware bug?
}
if (brest) {
- LoadBitmap(dvb, BITMAP8, w, brest/bpl, inc, data);
+ LoadBitmap(dvb, bpp2bit[dvb->osdbpp[dvb->osdwin]], w, brest/bpl, inc, data); //XXX kls: need to take the format from the actual window
BlitBitmap(dvb, dvb->osdwin, x0, y0+bnum*lpb, 1);
}
ReleaseBitmap(dvb);
@@ -6141,7 +6155,7 @@
init_waitqueue_head(&dvb->bmpq);
spin_lock_init (&(dvb->bmplock));
dvb->bmpp=dvb->bmplen=0;
- dvb->bmpbuf=vmalloc(32768+1024);
+ dvb->bmpbuf=vmalloc(8*32768+1024); //XXX kls: '8*' to be prepared for the maximum possible incoming data at 1 bpp
init_waitqueue_head(&dvb->debiq);
dvb->debilock=SPIN_LOCK_UNLOCKED;
......@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbapi.c 1.27 2000/09/17 12:45:55 kls Exp $
* $Id: dvbapi.c 1.30 2000/10/03 13:26:16 kls Exp $
*/
#include "dvbapi.h"
......@@ -19,6 +19,7 @@ extern "C" {
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
#include "dvbapi.h"
#include "interface.h"
#include "tools.h"
#include "videodir.h"
......@@ -71,6 +72,56 @@ extern "C" {
typedef unsigned char uchar;
// --- 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 {
......@@ -78,8 +129,9 @@ private:
struct tIndex { int offset; uchar type; uchar number; short reserved; };
int f;
char *fileName, *pFileExt;
int size, last, resume;
int size, last;
tIndex *index;
cResumeFile resumeFile;
bool CatchUp(void);
public:
cIndexFile(const char *FileName, bool Record = false);
......@@ -89,21 +141,22 @@ public:
int GetNextIFrame(int Index, bool Forward, uchar *FileNumber, int *FileOffset, int *Length = NULL);
int Get(uchar FileNumber, int FileOffset);
int Last(void) { return last; }
int GetResume(void) { return resume; }
bool StoreResume(int Index);
int GetResume(void) { return resumeFile.Read(); }
bool StoreResume(int Index) { return resumeFile.Save(Index); }
static char *Str(int Index, bool WithFrame = false);
};
cIndexFile::cIndexFile(const char *FileName, bool Record)
:resumeFile(FileName)
{
f = -1;
fileName = pFileExt = NULL;
size = 0;
last = resume = -1;
last = -1;
index = NULL;
if (FileName) {
fileName = new char[strlen(FileName) + strlen(INDEXFILESUFFIX) + strlen(RESUMEFILESUFFIX) + 1];
if (fileName) { // no max() function at hand...
fileName = new char[strlen(FileName) + strlen(INDEXFILESUFFIX) + 1];
if (fileName) {
strcpy(fileName, FileName);
pFileExt = fileName + strlen(fileName);
strcpy(pFileExt, INDEXFILESUFFIX);
......@@ -155,19 +208,6 @@ cIndexFile::cIndexFile(const char *FileName, bool Record)
delete fileName;
fileName = pFileExt = NULL;
}
else {
strcpy(pFileExt, RESUMEFILESUFFIX);
int resumeFile = open(fileName, O_RDONLY);
if (resumeFile >= 0) {
if (read(resumeFile, &resume, sizeof(resume)) != sizeof(resume)) {
resume = -1;
LOG_ERROR_STR(fileName);
}
close(resumeFile);
}
else if (errno != ENOENT)
LOG_ERROR_STR(fileName);
}
}
else
esyslog(LOG_ERR, "ERROR: can't copy file name '%s'", FileName);
......@@ -298,22 +338,6 @@ int cIndexFile::Get(uchar FileNumber, int FileOffset)
return -1;
}
bool cIndexFile::StoreResume(int Index)
{
if (fileName) {
int resumeFile = open(fileName, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP);
if (resumeFile >= 0) {
if (write(resumeFile, &Index, sizeof(Index)) != sizeof(Index))
LOG_ERROR_STR(fileName);
close(resumeFile);
return true;
}
else if (errno != ENOENT)
LOG_ERROR_STR(fileName);
}
return false;
}
char *cIndexFile::Str(int Index, bool WithFrame)
{
static char buffer[16];
......@@ -1087,6 +1111,8 @@ cDvbApi::cDvbApi(const char *FileName)
start_color();
leaveok(stdscr, true);
window = NULL;
#else
osd = NULL;
#endif
lastProgress = lastTotal = -1;
replayTitle = NULL;
......@@ -1488,18 +1514,19 @@ void cDvbApi::Open(int w, int h)
d *= lineHeight;
int x = (720 - MenuColumns * charWidth) / 2; //TODO PAL vs. NTSC???
int y = (576 - MenuLines * lineHeight) / 2 + d;
Cmd(OSD_Open, 4, x, y, x + w - 1, y + h - 1);
osd = new cDvbOsd(videoDev, x, y, x + w - 1, y + h - 1, 4);
#define SETCOLOR(n, r, g, b, o) Cmd(OSD_SetColor, n, r, g, b, o)
SETCOLOR(clrTransparent, 0x00, 0x00, 0x00, 0);
#endif
SETCOLOR(clrBackground, 0x00, 0x00, 0x00, 127); // background 50% gray
SETCOLOR(clrBlack, 0x00, 0x00, 0x00, 255);
SETCOLOR(clrRed, 0xFC, 0x14, 0x14, 255);
SETCOLOR(clrGreen, 0x24, 0xFC, 0x24, 255);
SETCOLOR(clrYellow, 0xFC, 0xC0, 0x24, 255);
SETCOLOR(clrBlue, 0x00, 0x00, 0xFC, 255);
SETCOLOR(clrCyan, 0x00, 0xFC, 0xFC, 255);
SETCOLOR(clrMagenta, 0xB0, 0x00, 0xFC, 255);
SETCOLOR(clrWhite, 0xFC, 0xFC, 0xFC, 255);
SETCOLOR(clrBackground, 0x00, 0x00, 0x00, 127); // background 50% gray
SETCOLOR(clrBlack, 0x00, 0x00, 0x00, 255);
SETCOLOR(clrRed, 0xFC, 0x14, 0x14, 255);
SETCOLOR(clrGreen, 0x24, 0xFC, 0x24, 255);
SETCOLOR(clrYellow, 0xFC, 0xC0, 0x24, 255);
SETCOLOR(clrBlue, 0x00, 0x00, 0xFC, 255);
SETCOLOR(clrCyan, 0x00, 0xFC, 0xFC, 255);
SETCOLOR(clrMagenta, 0xB0, 0x00, 0xFC, 255);
SETCOLOR(clrWhite, 0xFC, 0xFC, 0xFC, 255);
lastProgress = lastTotal = -1;
}
......@@ -1512,7 +1539,8 @@ void cDvbApi::Close(void)
window = 0;
}
#else
Cmd(OSD_Close);
delete osd;
osd = NULL;
#endif
lastProgress = lastTotal = -1;
}
......@@ -1523,7 +1551,7 @@ void cDvbApi::Clear(void)
SetColor(clrBackground, clrBackground);
Fill(0, 0, cols, rows, clrBackground);
#else
Cmd(OSD_Clear);
osd->Clear();
#endif
}
......@@ -1539,7 +1567,7 @@ void cDvbApi::Fill(int x, int y, int w, int h, eDvbColor color)
}
wsyncup(window); // shouldn't be necessary because of 'syncok()', but w/o it doesn't work
#else
Cmd(OSD_FillBlock, color, x * charWidth, y * lineHeight, (x + w) * charWidth - 1, (y + h) * lineHeight - 1);
osd->Fill(x * charWidth, y * lineHeight, (x + w) * charWidth - 1, (y + h) * lineHeight - 1, color);
#endif
}
......@@ -1555,9 +1583,17 @@ void cDvbApi::Text(int x, int y, const char *s, eDvbColor colorFg, eDvbColor col
#ifdef DEBUG_OSD
SetColor(colorFg, colorBg);
wmove(window, y, x); // ncurses wants 'y' before 'x'!
waddstr(window, s);
waddnstr(window, s, cols - x);
#else
Cmd(OSD_Text, (int(colorBg) << 16) | colorFg, x * charWidth, y * lineHeight, 1, 0, s);
osd->Text(x * charWidth, y * lineHeight, s, colorFg, colorBg);
#endif
}
void cDvbApi::Flush(void)
{
#ifndef DEBUG_OSD
if (osd)
osd->Flush();
#endif
}
......@@ -1567,11 +1603,13 @@ bool cDvbApi::ShowProgress(bool Initial)
if (GetIndex(&Current, &Total)) {
if (Initial) {
Clear();
if (replayTitle)
Text(0, 0, replayTitle);
}
if (Total != lastTotal)
Text(-7, 2, cIndexFile::Str(Total));
Flush();
#ifdef DEBUG_OSD
int p = cols * Current / Total;
Fill(0, 1, p, 1, clrGreen);
......@@ -1597,12 +1635,14 @@ bool cDvbApi::ShowProgress(bool Initial)
color = clrWhite;
}
if (lastProgress < 0)
Cmd(OSD_FillBlock, clrWhite, 0, y1, w - 1, y2);
Cmd(OSD_FillBlock, color, x1, y1, x2, y2);
osd->Fill(0, y1, w - 1, y2, clrWhite);
osd->Fill(x1, y1, x2, y2, color);
lastProgress = p;
}
Flush();
#endif
Text(0, 2, cIndexFile::Str(Current));
Flush();
lastTotal = Total;
return true;
}
......
......@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbapi.h 1.16 2000/09/17 12:15:05 kls Exp $
* $Id: dvbapi.h 1.18 2000/10/03 11:26:10 kls Exp $
*/
#ifndef __DVBAPI_H
......@@ -20,6 +20,7 @@ typedef unsigned char __u8;
#endif
#include <stdio.h>
#include <dvb.h>
#include "dvbosd.h"
// Overlay facilities
#define MAXCLIPRECTS 100
......@@ -30,22 +31,16 @@ typedef struct CRect {
#define MenuLines 15
#define MenuColumns 40
enum eDvbColor { clrBackground,
#ifndef DEBUG_OSD
clrOBSOLETE, //FIXME apparently color '1' can't be used as FgColor with e.g. clrRed as BgColor???
clrBlack,
#else
clrBlack = clrBackground,
#endif
clrRed,
clrGreen,
clrYellow,
clrBlue,
clrMagenta,
clrCyan,
clrWhite,
};
class cResumeFile {
private:
char *fileName;
public:
cResumeFile(const char *FileName);
~cResumeFile();
int Read(void);
bool Save(int Index);
};
class cDvbApi {
private:
int videoDev;
......@@ -106,6 +101,8 @@ private:
enum { MaxColorPairs = 16 };
int colorPairs[MaxColorPairs];
void SetColor(eDvbColor colorFg, eDvbColor colorBg = clrBackground);
#else
cDvbOsd *osd;
#endif
int cols, rows;
void Cmd(OSD_Command cmd, int color = 0, int x0 = 0, int y0 = 0, int x1 = 0, int y1 = 0, const void *data = NULL);
......@@ -116,6 +113,7 @@ public:
void Fill(int x, int y, int w, int h, eDvbColor color = clrBackground);
void ClrEol(int x, int y, eDvbColor color = clrBackground);
void Text(int x, int y, const char *s, eDvbColor colorFg = clrWhite, eDvbColor colorBg = clrBackground);
void Flush(void);
// Progress Display facilities
......
/*
* dvbosd.c: Interface to the DVB On Screen Display
*
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbosd.c 1.2 2000/10/03 13:34:13 kls Exp $
*/
#include "dvbosd.h"
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/unistd.h>
#include "tools.h"
// --- cBitmap ---------------------------------------------------------------
cBitmap::cBitmap(int Width, int Height)
{
width = Width;
height = Height;
bitmap = NULL;
font = NULL;
if (width > 0 && height > 0) {
bitmap = new char[width * height];
if (bitmap) {
Clean();
memset(bitmap, clrTransparent, width * height);
SetFont(fontOsd);
}
else
esyslog(LOG_ERR, "ERROR: can't allocate bitmap!");
}
else
esyslog(LOG_ERR, "ERROR: illegal bitmap parameters (%d, %d)!", width, height);
}
cBitmap::~cBitmap()
{
delete font;
delete bitmap;
}
void cBitmap::SetFont(eDvbFont Font)
{
delete font;
font = new cFont(Font);
}
bool cBitmap::Dirty(void)
{
return dirtyX2 >= 0;
}
void cBitmap::Clean(void)
{
dirtyX1 = width;
dirtyY1 = height;
dirtyX2 = -1;
dirtyY2 = -1;
}
void cBitmap::SetPixel(int x, int y, eDvbColor Color)
{
if (bitmap) {
if (0 <= x && x < width && 0 <= y && y < height) {
if (bitmap[width * y + x] != Color) {
bitmap[width * y + x] = Color;
if (dirtyX1 > x) dirtyX1 = x;
if (dirtyY1 > y) dirtyY1 = y;
if (dirtyX2 < x) dirtyX2 = x;
if (dirtyY2 < y) dirtyY2 = y;
}
}
}
}
void cBitmap::Text(int x, int y, const char *s, eDvbColor ColorFg, eDvbColor ColorBg)
{
if (bitmap) {
int h = font->Height(s);
while (s && *s) {
const cFont::tCharData *CharData = font->CharData(*s++);
if (int(x + CharData->width) > width)
break;
for (int row = 0; row < h; row++) {
cFont::tPixelData PixelData = CharData->lines[row];