summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2004-06-06 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2004-06-06 18:00:00 +0200
commitc281d01c089f4c9410a2756d3bcd99a56f702c86 (patch)
tree8fdb640ba345e60cb3de7816ef4983fb78e829a2
parentb81bf2d1c92e2ac820d2116c66f328869eb627cd (diff)
downloadvdr-patch-lnbsharing-c281d01c089f4c9410a2756d3bcd99a56f702c86.tar.gz
vdr-patch-lnbsharing-c281d01c089f4c9410a2756d3bcd99a56f702c86.tar.bz2
Version 1.3.10vdr-1.3.10
- Fixed some default parameters in 'skincurses'. - Fixed cBitmap::DrawPixel(), which messed with other bitmaps' palettes in case the pixel coordinates were outside this bitmap (thanks to Sascha Volkenandt for reporting this one). - The cBitmap::DrawText() function now doesn't set any background pixels if the given background color is clrTransparent. This allows drawing "transparent" texts (suggested by Sascha Volkenandt). - The cBitmap::SetXpm() function now ignores unused "none" color entries, which some broken graphics tools write into XPM files (suggested by Sascha Volkenandt). - No longer setting lnb voltage if the frontend is not DVB-S (thanks to Marco Schlüßler). - Fixed displaying the current channel when switching via the SVDRP command CHAN (thanks to Jürgen Schmitz for reporting this one). - Fixed missing audio after replaying a DVD (thanks to Marco Schlüßler). - Added a note about the default assignment of the color keys to MANUAL. - Added a note about NPTL ("Native Posix Thread Library") to the INSTALL file (apparently the "fix" in version 1.3.0 didn't really fix this). - Modified 'libsi' to require callers to state the buffer sizes when getting strings in order to avoid buffer overflows (thanks to Philip Lawatsch for debugging a buffer overflow in eit.c).
-rw-r--r--CONTRIBUTORS14
-rw-r--r--HISTORY23
-rw-r--r--INSTALL10
-rw-r--r--MANUAL8
-rw-r--r--PLUGINS/src/skincurses/HISTORY6
-rw-r--r--PLUGINS/src/skincurses/skincurses.c6
-rw-r--r--channels.conf8
-rw-r--r--config.h6
-rw-r--r--dvbdevice.c13
-rw-r--r--eit.c10
-rw-r--r--libsi/descriptor.c134
-rw-r--r--libsi/descriptor.h10
-rw-r--r--libsi/si.c33
-rw-r--r--libsi/si.h10
-rw-r--r--menu.c4
-rw-r--r--nit.c4
-rw-r--r--osd.c32
-rw-r--r--osd.h16
-rw-r--r--sdt.c4
19 files changed, 226 insertions, 125 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index cb59f2f..d6f34f1 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -713,6 +713,11 @@ Sascha Volkenandt <sascha@akv-soft.de>
for suggesting to map the color name "None" to #00000000 when processing XPM data
for suggesting to also reset the palette in cBitmap::DrawBitmap() if the entire
bitmap area is covered
+ for reporting a bug in cBitmap::DrawPixel(), which messed with other bitmaps'
+ palettes in case the pixel coordinates were outside this bitmap
+ for suggesting to allow drawing "transparent" texts
+ for suggesting to ignore unused "none" color entries in XPM files written by
+ some broken graphics tools
Malcolm Caldwell <malcolm.caldwell@ntu.edu.au>
for modifying LOF handling to allow for C-band reception
@@ -1010,3 +1015,12 @@ Wayne Keer <syphir@syphir.sytes.net>
Marco Schlüßler <marco@lordzodiac.de>
for fixing handling colors in cDvbSpuPalette::yuv2rgb()
+ for fixing setting lnb voltage if the frontend is not DVB-S
+ for fixing missing audio after replaying a DVD
+
+Jürgen Schmitz <j.schmitz@web.de>
+ for reporting a bug in displaying the current channel when switching via the SVDRP
+ command CHAN
+
+Philip Lawatsch <philip@lawatsch.at>
+ for debugging a buffer overflow in eit.c
diff --git a/HISTORY b/HISTORY
index 73cfdfe..56cae9d 100644
--- a/HISTORY
+++ b/HISTORY
@@ -2869,3 +2869,26 @@ Video Disk Recorder Revision History
- The new plugin 'skincurses' re-implements the functionality that was previously
available by compiling VDR with DEBUG_OSD. Some things may not yet work as they
should, but it's a starting point.
+
+2004-06-06: Version 1.3.10
+
+- Fixed some default parameters in 'skincurses'.
+- Fixed cBitmap::DrawPixel(), which messed with other bitmaps' palettes in case
+ the pixel coordinates were outside this bitmap (thanks to Sascha Volkenandt for
+ reporting this one).
+- The cBitmap::DrawText() function now doesn't set any background pixels if the
+ given background color is clrTransparent. This allows drawing "transparent"
+ texts (suggested by Sascha Volkenandt).
+- The cBitmap::SetXpm() function now ignores unused "none" color entries, which
+ some broken graphics tools write into XPM files (suggested by Sascha Volkenandt).
+- No longer setting lnb voltage if the frontend is not DVB-S (thanks to Marco
+ Schlüßler).
+- Fixed displaying the current channel when switching via the SVDRP command CHAN
+ (thanks to Jürgen Schmitz for reporting this one).
+- Fixed missing audio after replaying a DVD (thanks to Marco Schlüßler).
+- Added a note about the default assignment of the color keys to MANUAL.
+- Added a note about NPTL ("Native Posix Thread Library") to the INSTALL file
+ (apparently the "fix" in version 1.3.0 didn't really fix this).
+- Modified 'libsi' to require callers to state the buffer sizes when getting
+ strings in order to avoid buffer overflows (thanks to Philip Lawatsch for
+ debugging a buffer overflow in eit.c).
diff --git a/INSTALL b/INSTALL
index ec1906a..012dd94 100644
--- a/INSTALL
+++ b/INSTALL
@@ -4,6 +4,16 @@ Installation of the Video Disk Recorder
Version 1.3
-----------
+IMPORTANT NOTE:
+---------------
+
+VDR currently doesn't work with NPTL ("Native Posix Thread Library").
+Either don't use NPTL, or set the environment variable
+
+ LD_ASSUME_KERNEL=2.4.1
+
+before running VDR.
+
Compiling and running the program:
----------------------------------
diff --git a/MANUAL b/MANUAL
index ffbc460..9855d0e 100644
--- a/MANUAL
+++ b/MANUAL
@@ -59,6 +59,14 @@ Version 1.2
User1...9 additional user defined keys for macro functions
(defined in 'keymacros.conf')
+ Note that in normal viewing mode (no OSD active) the color keys can have user
+ defined functionality, as configured in 'keymacros.conf'.
+ The default assignment is
+
+ Red Recordings menu
+ Green Schedule menu
+ Blue Timers menu
+
(1) The "On/Off" button in the "Timers" menu only works if sorting the timers
has been enabled in the "Setup" menu. Otherwise the Blue button is used
to "mark" a timer for moving.
diff --git a/PLUGINS/src/skincurses/HISTORY b/PLUGINS/src/skincurses/HISTORY
index 9f459b4..df67358 100644
--- a/PLUGINS/src/skincurses/HISTORY
+++ b/PLUGINS/src/skincurses/HISTORY
@@ -1,6 +1,10 @@
VDR Plugin 'skincurses' Revision History
----------------------------------------
-2004-05-29: Version 0.0.1
+2004-05-31: Version 0.0.1
- Initial revision.
+
+2004-05-31: Version 0.0.2
+
+- Fixed some default parameters.
diff --git a/PLUGINS/src/skincurses/skincurses.c b/PLUGINS/src/skincurses/skincurses.c
index 38c297a..e2b218d 100644
--- a/PLUGINS/src/skincurses/skincurses.c
+++ b/PLUGINS/src/skincurses/skincurses.c
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: skincurses.c 1.1 2004/05/31 14:01:49 kls Exp $
+ * $Id: skincurses.c 1.2 2004/05/31 14:57:40 kls Exp $
*/
#include <ncurses.h>
@@ -11,7 +11,7 @@
#include <vdr/plugin.h>
#include <vdr/skins.h>
-static const char *VERSION = "0.0.1";
+static const char *VERSION = "0.0.2";
static const char *DESCRIPTION = "A text only skin";
static const char *MAINMENUENTRY = NULL;
@@ -133,7 +133,7 @@ void cCursesOsd::RestoreRegion(void)
}
}
-void cCursesOsd::DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width = 0, int Height = 0, int Alignment = taDefault)
+void cCursesOsd::DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width, int Height, int Alignment)
{
int w = Font->Width(s);
int h = Font->Height();
diff --git a/channels.conf b/channels.conf
index ec56295..8ce6917 100644
--- a/channels.conf
+++ b/channels.conf
@@ -46,9 +46,9 @@ rbb Berlin:12109:hC34:S19.2E:27500:601:602=deu:604:0:28206:1:1073:0
:Premiere World
START,PREMIERE START:11797:hC34:S19.2E:27500:255:256=deu:32:1702,1801,1722:8:133:2:0
PREM 1,PREMIERE 1:11797:hC34:S19.2E:27500:511:512=deu;515=deu:32:1801,1702,1722:10:133:2:0
-PREM 2,PREMIERE 2:11797:hC34:S19.2E:27500:1791:1792=deu,1793=deu;1795=deu:32:1722,1801,1702:11:133:2:0
+PREM 2,PREMIERE 2:11797:hC34:S19.2E:27500:1791:1792=deu;1795=deu:32:1722,1801,1702:11:133:2:0
PREM 3,PREMIERE 3:11797:hC34:S19.2E:27500:2303:2304=deu,2305=deu:32:1722,1801,1702:43:133:2:0
-PREM 4,PREMIERE 4:11797:hC34:S19.2E:27500:767:768=deu,769=deu:32:1801,1722,1702:9:133:2:0
+PREM 4,PREMIERE 4:11797:hC34:S19.2E:27500:767:768=deu:32:1801,1722,1702:9:133:2:0
PREM 5,PREMIERE 5:11797:hC34:S19.2E:27500:1279:1280=deu,1281=deu:32:1722,1702,1801:29:133:2:0
PREM 6,PREMIERE 6:11797:hC34:S19.2E:27500:1535:1536=deu:32:1702,1801,1722:41:133:2:0
PREM 7,PREMIERE 7:11797:hC34:S19.2E:27500:1023:1024=deu:32:1722,1801,1702:20:133:2:0
@@ -59,8 +59,8 @@ DIREKT,PREMIERE DIREKT:12031:hC34:S19.2E:27500:2815:2816=deu,2817=deu;2819=deu:0
B-UHSE,BEATE-UHSE.TV:12070:hC34:S19.2E:27500:1023:1024=deu:32:1801,1702,1722:21:133:1:0
EROTIK,PREMIERE EROTIK:12031:hC34:S19.2E:27500:1279:0:0:1722,1702,1801:513:133:4:0
:Sportsworld
-F1-Portal:11719:hC34:S19.2E:27500:255:256=deu,257=deu:32:1702,1722,1801:17:133:3:0
-SPORT 2,PREMIERE SPORT 2:12031:hC34:S19.2E:27500:3839:3840=deu:32:1702,1722,1801:27:133:4:0
+SPORT 1,PREMIERE SPORT 1:11719:hC34:S19.2E:27500:255:256=deu,257=deu:32:1702,1722,1801:17:133:3:0
+SPORT 2,PREMIERE SPORT 2:12031:hC34:S19.2E:27500:3839:3840=deu,3841=deu:32:1702,1722,1801:27:133:4:0
:Beta Digital
N24:12480:vC34:S19.2E:27500:2047:2048:36:0:47:133:33:0
Liberty TV.com:12610:vC56:S19.2E:22000:941:943=deu:0:0:12199:1:1112:0
diff --git a/config.h b/config.h
index 3f62fcb..f9d5016 100644
--- a/config.h
+++ b/config.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.h 1.196 2004/05/28 13:16:03 kls Exp $
+ * $Id: config.h 1.197 2004/06/05 10:06:50 kls Exp $
*/
#ifndef __CONFIG_H
@@ -20,8 +20,8 @@
#include "i18n.h"
#include "tools.h"
-#define VDRVERSION "1.3.9"
-#define VDRVERSNUM 10309 // Version * 10000 + Major * 100 + Minor
+#define VDRVERSION "1.3.10"
+#define VDRVERSNUM 10310 // Version * 10000 + Major * 100 + Minor
#define MAXPRIORITY 99
#define MAXLIFETIME 99
diff --git a/dvbdevice.c b/dvbdevice.c
index cb143a6..e5b777d 100644
--- a/dvbdevice.c
+++ b/dvbdevice.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: dvbdevice.c 1.86 2004/05/23 10:11:42 kls Exp $
+ * $Id: dvbdevice.c 1.89 2004/06/06 11:28:28 kls Exp $
*/
#include "dvbdevice.h"
@@ -101,7 +101,8 @@ cDvbTuner::cDvbTuner(int Fd_Frontend, int CardIndex, fe_type_t FrontendType, cCi
useCa = false;
tunerStatus = tsIdle;
startTime = time(NULL);
- CHECK(ioctl(fd_frontend, FE_SET_VOLTAGE, SEC_VOLTAGE_13)); // must explicitly turn on LNB power
+ if (frontendType == FE_QPSK)
+ CHECK(ioctl(fd_frontend, FE_SET_VOLTAGE, SEC_VOLTAGE_13)); // must explicitly turn on LNB power
SetDescription("tuner on device %d", cardIndex + 1);
Start();
}
@@ -560,15 +561,15 @@ void cDvbDevice::SetVideoFormat(bool VideoFormat16_9)
eVideoSystem cDvbDevice::GetVideoSystem(void)
{
- eVideoSystem VideoSytem = vsPAL;
+ eVideoSystem VideoSystem = vsPAL;
video_size_t vs;
if (ioctl(fd_video, VIDEO_GET_SIZE, &vs) == 0) {
if (vs.h == 480 || vs.h == 240)
- VideoSytem = vsNTSC;
+ VideoSystem = vsNTSC;
}
else
LOG_ERROR;
- return VideoSytem;
+ return VideoSystem;
}
// ptAudio ptVideo ptPcr ptTeletext ptDolby ptOther
@@ -766,6 +767,8 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView)
if (IsPrimaryDevice())
AddPid(Channel->Tpid(), ptTeletext);
CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, true));
+ CHECK(ioctl(fd_audio, AUDIO_SET_MUTE, false));
+ CHECK(ioctl(fd_video, VIDEO_SET_BLANK, false));
}
else if (StartTransferMode)
cControl::Launch(new cTransferControl(this, Channel->Vpid(), Channel->Apid1(), Channel->Apid2(), Channel->Dpid1(), Channel->Dpid2()));
diff --git a/eit.c b/eit.c
index 97ba523..3ac53fa 100644
--- a/eit.c
+++ b/eit.c
@@ -8,7 +8,7 @@
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
* Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg <marcel.wiesweg@gmx.de>.
*
- * $Id: eit.c 1.94 2004/03/20 10:53:23 kls Exp $
+ * $Id: eit.c 1.95 2004/06/06 14:49:45 kls Exp $
*/
#include "eit.h"
@@ -193,12 +193,12 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data)
if (!rEvent) {
if (ShortEventDescriptor) {
char buffer[256];
- pEvent->SetTitle(ShortEventDescriptor->name.getText(buffer));
- pEvent->SetShortText(ShortEventDescriptor->text.getText(buffer));
+ pEvent->SetTitle(ShortEventDescriptor->name.getText(buffer, sizeof(buffer)));
+ pEvent->SetShortText(ShortEventDescriptor->text.getText(buffer, sizeof(buffer)));
}
if (ExtendedEventDescriptors) {
- char buffer[ExtendedEventDescriptors->getMaximumTextLength(": ")];
- pEvent->SetDescription(ExtendedEventDescriptors->getText(buffer, ": "));
+ char buffer[ExtendedEventDescriptors->getMaximumTextLength(": ") + 1];
+ pEvent->SetDescription(ExtendedEventDescriptors->getText(buffer, sizeof(buffer), ": "));
}
}
delete ExtendedEventDescriptors;
diff --git a/libsi/descriptor.c b/libsi/descriptor.c
index 685722e..eb921c9 100644
--- a/libsi/descriptor.c
+++ b/libsi/descriptor.c
@@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: descriptor.c 1.12 2004/03/26 15:25:28 kls Exp $
+ * $Id: descriptor.c 1.13 2004/06/06 14:47:30 kls Exp $
* *
***************************************************************************/
@@ -84,53 +84,61 @@ int ExtendedEventDescriptors::getMaximumTextLength(const char *separation1, cons
}
char *ExtendedEventDescriptors::getText(const char *separation1, const char *separation2) {
- char *text=new char[getMaximumTextLength(separation1, separation2)];
- return getText(text, separation1, separation2);
+ int size = getMaximumTextLength(separation1, separation2);
+ char *text=new char[size];
+ return getText(text, size, separation1, separation2);
}
-char *ExtendedEventDescriptors::getText(char *buffer, const char *separation1, const char *separation2) {
+char *ExtendedEventDescriptors::getText(char *buffer, int size, const char *separation1, const char *separation2) {
int index=0, len;
- char tempbuf[256];
for (int i=0;i<length;i++) {
ExtendedEventDescriptor *d=(ExtendedEventDescriptor *)array[i];
if (!d)
continue;
- d->text.getText(tempbuf);
- len=strlen(tempbuf);
- if (len) {
- memcpy(buffer+index, tempbuf, len);
- index+=len;
- }
+ d->text.getText(buffer+index, size);
+ len = strlen(buffer+index);
+ index += len;
+ size -= len;
}
+ int sepLen1 = strlen(separation1);
+ int sepLen2 = strlen(separation2);
+ bool separated = false;
for (int i=0;i<length;i++) {
ExtendedEventDescriptor *d=(ExtendedEventDescriptor *)array[i];
if (!d)
continue;
- strcpy(buffer+index, separation2); // let's have a separator between the long text and the items
- index += strlen(separation2);
ExtendedEventDescriptor::Item item;
for (Loop::Iterator it; d->itemLoop.hasNext(it); ) {
item=d->itemLoop.getNext(it);
- item.itemDescription.getText(tempbuf);
- len=strlen(tempbuf);
- if (len) {
- memcpy(buffer+index, tempbuf, len);
- index+=len;
+ if (!separated && size > sepLen2) {
+ strcpy(buffer+index, separation2); // let's have a separator between the long text and the items
+ index += sepLen2;
+ size -= sepLen2;
+ separated = true;
+ }
+
+ item.itemDescription.getText(buffer+index, size);
+ len = strlen(buffer+index);
+ index += len;
+ size -= len;
+ if (size > sepLen1) {
+ strcpy(buffer+index, separation1);
+ index += sepLen1;
+ size -= sepLen1;
}
- strcpy(buffer+index, separation1);
- index += strlen(separation1);
-
- item.item.getText(tempbuf);
- len=strlen(tempbuf);
- if (len) {
- memcpy(buffer+index, tempbuf, len);
- index+=len;
+
+ item.item.getText(buffer+index, size);
+ len = strlen(buffer+index);
+ index += len;
+ size -= len;
+ if (size > sepLen2) {
+ strcpy(buffer+index, separation2);
+ index += sepLen2;
+ size -= sepLen2;
}
- strcpy(buffer+index, separation2);
- index += strlen(separation2);
}
}
@@ -150,23 +158,21 @@ int ExtendedEventDescriptors::getMaximumTextPlainLength() {
}
char *ExtendedEventDescriptors::getTextPlain() {
- char *text=new char[getMaximumTextPlainLength()];
- return getTextPlain(text);
+ int size = getMaximumTextPlainLength();
+ char *text=new char[size];
+ return getTextPlain(text, size);
}
-char *ExtendedEventDescriptors::getTextPlain(char *buffer) {
+char *ExtendedEventDescriptors::getTextPlain(char *buffer, int size) {
int index=0, len;
- char tempbuf[256];
for (int i=0;i<length;i++) {
ExtendedEventDescriptor *d=(ExtendedEventDescriptor *)array[i];
if (!d)
continue;
- d->text.getText(tempbuf);
- len=strlen(tempbuf);
- if (len) {
- memcpy(buffer+index, tempbuf, len);
- index+=len;
- }
+ d->text.getText(buffer+index, size);
+ len = strlen(buffer+index);
+ index += len;
+ size -= len;
}
buffer[index]='\0';
return buffer;
@@ -174,25 +180,27 @@ char *ExtendedEventDescriptors::getTextPlain(char *buffer) {
int ExtendedEventDescriptors::getMaximumTextItemizedLength(const char *separation1, const char *separation2) {
int ret=0;
- int sepLength=strlen(separation1)+strlen(separation2)-2;
+ int sepLength=strlen(separation1)+strlen(separation2);
for (int i=0;i<length;i++) {
ExtendedEventDescriptor *d=(ExtendedEventDescriptor *)array[i];
if (!d)
continue;
- //The length includes two 8-bit length fields which have already been subtracted from sepLength
+ //The length includes two 8-bit length fields which have already been subtracted from sepLength //XXX kls 2004-06-06: what does this mean???
ret+=d->itemLoop.getLength()+sepLength;
}
return ret;
}
char *ExtendedEventDescriptors::getTextItemized(const char *separation1, const char *separation2) {
- char *text=new char[getMaximumTextItemizedLength(separation1, separation2)];
- return getTextItemized(text, separation1, separation2);
+ int size = getMaximumTextItemizedLength(separation1, separation2);
+ char *text=new char[size];
+ return getTextItemized(text, size, separation1, separation2);
}
-char *ExtendedEventDescriptors::getTextItemized(char *buffer, const char *separation1, const char *separation2) {
+char *ExtendedEventDescriptors::getTextItemized(char *buffer, int size, const char *separation1, const char *separation2) {
int index=0, len;
- char tempbuf[256];
+ int sepLen1 = strlen(separation1);
+ int sepLen2 = strlen(separation2);
for (int i=0;i<length;i++) {
ExtendedEventDescriptor *d=(ExtendedEventDescriptor *)array[i];
if (!d)
@@ -202,23 +210,25 @@ char *ExtendedEventDescriptors::getTextItemized(char *buffer, const char *separa
for (Loop::Iterator it; d->itemLoop.hasNext(it); ) {
item=d->itemLoop.getNext(it);
- item.itemDescription.getText(tempbuf);
- len=strlen(tempbuf);
- if (len) {
- memcpy(buffer+index, tempbuf, len);
- index+=len;
+ item.itemDescription.getText(buffer+index, size);
+ len = strlen(buffer+index);
+ index += len;
+ size -= len;
+ if (size > sepLen1) {
+ strcpy(buffer+index, separation1);
+ index += sepLen1;
+ size -= sepLen1;
}
- strcpy(buffer+index, separation1);
- index += strlen(separation1);
-
- item.item.getText(tempbuf);
- len=strlen(tempbuf);
- if (len) {
- memcpy(buffer+index, tempbuf, len);
- index+=len;
+
+ item.item.getText(buffer+index, size);
+ len = strlen(buffer+index);
+ index += len;
+ size -= len;
+ if (size > sepLen2) {
+ strcpy(buffer+index, separation2);
+ index += sepLen2;
+ size -= sepLen2;
}
- strcpy(buffer+index, separation2);
- index += strlen(separation2);
}
}
buffer[index]='\0';
@@ -227,7 +237,7 @@ char *ExtendedEventDescriptors::getTextItemized(char *buffer, const char *separa
//returns the itemized text pair by pair. Maximum length for buffers is 256.
//Return value is false if and only if the end of the list is reached.
-bool ExtendedEventDescriptors::getTextItemized(Loop::Iterator &it, bool &valid, char *itemDescription, char *itemText) {
+bool ExtendedEventDescriptors::getTextItemized(Loop::Iterator &it, bool &valid, char *itemDescription, char *itemText, int sizeItemDescription, int sizeItemText) {
//The iterator has to store two values: The descriptor index (4bit)
//and the item loop index (max overall length 256, min item length 16 => max number 128 => 7bit)
valid=false;
@@ -244,8 +254,8 @@ bool ExtendedEventDescriptors::getTextItemized(Loop::Iterator &it, bool &valid,
if (d->itemLoop.hasNext(it)) {
item=d->itemLoop.getNext(it);
- item.item.getText(itemDescription);
- item.itemDescription.getText(itemText);
+ item.item.getText(itemDescription, sizeItemDescription);
+ item.itemDescription.getText(itemText, sizeItemText);
valid=true;
break;
} else {
diff --git a/libsi/descriptor.h b/libsi/descriptor.h
index db3bba6..9495923 100644
--- a/libsi/descriptor.h
+++ b/libsi/descriptor.h
@@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: descriptor.h 1.9 2004/03/26 15:26:03 kls Exp $
+ * $Id: descriptor.h 1.10 2004/06/06 13:51:29 kls Exp $
* *
***************************************************************************/
@@ -55,12 +55,12 @@ public:
//same semantics as with SI::String
char *getText(const char *separation1="\t", const char *separation2="\n");
//buffer must at least be getTextLength(), getMaximumTextLength() is a good choice
- char *getText(char *buffer, const char *separation1="\t", const char *separation2="\n");
+ char *getText(char *buffer, int size, const char *separation1="\t", const char *separation2="\n");
//these only return the non-itemized text fields in concatenated form
int getMaximumTextPlainLength();
char *getTextPlain();
- char *getTextPlain(char *buffer);
+ char *getTextPlain(char *buffer, int size);
//these only return the itemized text fields in concatenated form.
//Between the description and the text the separation1 character is used,
@@ -68,11 +68,11 @@ public:
//Director\tSteven Spielberg\nActor\tMichael Mendl\n
int getMaximumTextItemizedLength(const char *separation1="\t", const char *separation2="\n");
char *getTextItemized(const char *separation1="\t", const char *separation2="\n");
- char *getTextItemized(char *buffer, const char *separation1="\t", const char *separation2="\n");
+ char *getTextItemized(char *buffer, int size, const char *separation1="\t", const char *separation2="\n");
//returns the itemized text pair by pair. Maximum length for buffers is 256.
//Return value is false if and only if the end of the list is reached.
//The argument valid indicates whether the buffers contain valid content.
- bool getTextItemized(Loop::Iterator &it, bool &valid, char *itemDescription, char *itemText);
+ bool getTextItemized(Loop::Iterator &it, bool &valid, char *itemDescription, char *itemText, int sizeItemDescription, int sizeItemText);
};
class TimeShiftedEventDescriptor : public Descriptor {
diff --git a/libsi/si.c b/libsi/si.c
index 2bc8339..40f9453 100644
--- a/libsi/si.c
+++ b/libsi/si.c
@@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: si.c 1.10 2004/05/29 17:06:23 kls Exp $
+ * $Id: si.c 1.11 2004/06/06 14:43:56 kls Exp $
* *
***************************************************************************/
@@ -206,33 +206,36 @@ bool DescriptorGroup::isComplete() {
char *String::getText() {
if (getLength() < 0 || getLength() >4095)
- return "text error";
+ return strdup("text error"); // caller will delete it!
char *data=new char(getLength()+1);
- decodeText(data);
+ decodeText(data, getLength()+1);
return data;
}
-char *String::getText(char *buffer) {
- if (getLength() < 0 || getLength() >4095) {
- strncpy(buffer, "text error", getLength()+1);
+char *String::getText(char *buffer, int size) {
+ if (getLength() < 0 || getLength() >= size) {
+ strncpy(buffer, "text error", size);
+ buffer[size-1] = 0;
return buffer;
}
- decodeText(buffer);
+ decodeText(buffer, size);
return buffer;
}
//taken from VDR, Copyright Klaus Schmidinger <kls@cadsoft.de>
-char *String::getText(char *buffer, char *shortVersion) {
- if (getLength() < 0 || getLength() >4095) {
- strncpy(buffer, "text error", getLength()+1);
+char *String::getText(char *buffer, char *shortVersion, int sizeBuffer, int sizeShortVersion) {
+ if (getLength() < 0 || getLength() >= sizeBuffer) {
+ strncpy(buffer, "text error", sizeBuffer);
+ buffer[sizeBuffer-1] = 0;
+ *shortVersion = 0;
return buffer;
}
- decodeText(buffer, shortVersion);
+ decodeText(buffer, shortVersion, sizeBuffer, sizeShortVersion);
return buffer;
}
//taken from libdtv, Copyright Rolf Hakenes <hakenes@hippomi.de>
-void String::decodeText(char *buffer) {
+void String::decodeText(char *buffer, int size) {
const unsigned char *from=data.getData(0);
char *to=buffer;
@@ -254,11 +257,13 @@ void String::decodeText(char *buffer) {
else if (*from == 0x8A)
*to++ = '\n';
from++;
+ if (to - buffer >= size - 1)
+ break;
}
*to = '\0';
}
-void String::decodeText(char *buffer, char *shortVersion) {
+void String::decodeText(char *buffer, char *shortVersion, int sizeBuffer, int sizeShortVersion) {
const unsigned char *from=data.getData(0);
char *to=buffer;
char *toShort=shortVersion;
@@ -283,6 +288,8 @@ void String::decodeText(char *buffer, char *shortVersion) {
else if (*from == 0x87)
IsShortName--;
from++;
+ if (to - buffer >= sizeBuffer - 1 || toShort - shortVersion >= sizeShortVersion - 1)
+ break;
}
*to = '\0';
*toShort = '\0';
diff --git a/libsi/si.h b/libsi/si.h
index 195830d..85d16ed 100644
--- a/libsi/si.h
+++ b/libsi/si.h
@@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: si.h 1.9 2004/03/07 10:09:49 kls Exp $
+ * $Id: si.h 1.10 2004/06/06 13:35:21 kls Exp $
* *
***************************************************************************/
@@ -431,18 +431,18 @@ public:
//so the maximum there is 256.
//returns the given buffer for convenience.
//The emphasis marks 0x86 and 0x87 are still available.
- char *getText(char *buffer);
+ char *getText(char *buffer, int size);
//The same semantics as for getText(char*) apply.
//The short version of the text according to ETSI TR 101 211 (chapter 4.6)
//will be written into the shortVersion buffer (which should, therefore, have the same
//length as buffer). If no shortVersion is available, shortVersion will contain
//an empty string.
//The emphasis marks 0x86 and 0x87 are still available in buffer, but not in shortVersion.
- char *getText(char *buffer, char *shortVersion);
+ char *getText(char *buffer, char *shortVersion, int sizeBuffer, int sizeShortVersion);
protected:
virtual void Parse() {}
- void decodeText(char *buffer);
- void decodeText(char *buffer, char *shortVersion);
+ void decodeText(char *buffer, int size);
+ void decodeText(char *buffer, char *shortVersion, int sizeBuffer, int sizeShortVersion);
};
} //end of namespace
diff --git a/menu.c b/menu.c
index 49cdef4..0d01380 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.307 2004/05/29 10:19:22 kls Exp $
+ * $Id: menu.c 1.308 2004/06/06 15:06:28 kls Exp $
*/
#include "menu.h"
@@ -2643,6 +2643,8 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key)
}
};
if (time_ms() - lastTime < INFOTIMEOUT) {
+ if (!number && group < 0 && channel && channel->Number() != cDevice::CurrentChannel())
+ Refresh(); // makes sure a channel switch through the SVDRP CHAN command is displayed
DisplayInfo();
displayChannel->Flush();
return osContinue;
diff --git a/nit.c b/nit.c
index cf3b674..c515c24 100644
--- a/nit.c
+++ b/nit.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: nit.c 1.7 2004/05/22 15:46:21 kls Exp $
+ * $Id: nit.c 1.8 2004/06/06 14:24:49 kls Exp $
*/
#include "nit.h"
@@ -71,7 +71,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
switch (d->getDescriptorTag()) {
case SI::NetworkNameDescriptorTag: {
SI::NetworkNameDescriptor *nnd = (SI::NetworkNameDescriptor *)d;
- nnd->name.getText(nits[numNits].name);
+ nnd->name.getText(nits[numNits].name, MAXNETWORKNAME);
}
break;
default: ;
diff --git a/osd.c b/osd.c
index a63d0e1..ac950ff 100644
--- a/osd.c
+++ b/osd.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: osd.c 1.48 2004/05/28 15:33:22 kls Exp $
+ * $Id: osd.c 1.52 2004/06/05 16:52:51 kls Exp $
*/
#include "osd.h"
@@ -244,7 +244,7 @@ bool cBitmap::LoadXpm(const char *FileName)
return Result;
}
-bool cBitmap::SetXpm(char *Xpm[])
+bool cBitmap::SetXpm(char *Xpm[], bool IgnoreNone)
{
char **p = Xpm;
int w, h, n, c;
@@ -257,10 +257,11 @@ bool cBitmap::SetXpm(char *Xpm[])
return false;
}
int b = 0;
- while (1 << (1 << b) < n)
+ while (1 << (1 << b) < (IgnoreNone ? n - 1 : n))
b++;
SetBpp(1 << b);
SetSize(w, h);
+ int NoneColorIndex = MAXNUMCOLORS;
for (int i = 0; i < n; i++) {
const char *s = *++p;
if (int(strlen(s)) < c) {
@@ -273,14 +274,18 @@ bool cBitmap::SetXpm(char *Xpm[])
return false;
}
s = skipspace(s + 1);
- if (strcasecmp(s, "none") == 0)
+ if (strcasecmp(s, "none") == 0) {
s = "#00000000";
+ NoneColorIndex = i;
+ if (IgnoreNone)
+ continue;
+ }
if (*s != '#') {
esyslog("ERROR: unknown color code in XPM: '%c'", *s);
return false;
}
tColor color = strtoul(++s, NULL, 16) | 0xFF000000;
- SetColor(i, color);
+ SetColor((IgnoreNone && i > NoneColorIndex) ? i - 1 : i, color);
}
for (int y = 0; y < h; y++) {
const char *s = *++p;
@@ -295,13 +300,17 @@ bool cBitmap::SetXpm(char *Xpm[])
return false;
}
if (strncmp(Xpm[i + 1], s, c) == 0) {
- SetIndex(x, y, i);
+ if (i == NoneColorIndex)
+ NoneColorIndex = MAXNUMCOLORS;
+ SetIndex(x, y, (IgnoreNone && i > NoneColorIndex) ? i - 1 : i);
break;
}
}
s += c;
}
}
+ if (NoneColorIndex < MAXNUMCOLORS && !IgnoreNone)
+ return SetXpm(Xpm, true);
return true;
}
@@ -324,7 +333,8 @@ void cBitmap::DrawPixel(int x, int y, tColor Color)
{
x -= x0;
y -= y0;
- SetIndex(x, y, Index(Color));
+ if (0 <= x && x < width && 0 <= y && y < height)
+ SetIndex(x, y, Index(Color));
}
void cBitmap::DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg, tColor ColorBg)
@@ -354,7 +364,8 @@ void cBitmap::DrawText(int x, int y, const char *s, tColor ColorFg, tColor Color
int ch = Height ? Height : h;
if (!Intersects(x, y, x + cw - 1, y + ch - 1))
return;
- DrawRectangle(x, y, x + cw - 1, y + ch - 1, ColorBg);
+ if (ColorBg != clrTransparent)
+ DrawRectangle(x, y, x + cw - 1, y + ch - 1, ColorBg);
limit = x + cw - x0;
if (Width) {
if ((Alignment & taLeft) != 0)
@@ -386,7 +397,7 @@ void cBitmap::DrawText(int x, int y, const char *s, tColor ColorFg, tColor Color
x -= x0;
y -= y0;
tIndex fg = Index(ColorFg);
- tIndex bg = Index(ColorBg);
+ tIndex bg = (ColorBg != clrTransparent) ? Index(ColorBg) : 0;
while (s && *s) {
const cFont::tCharData *CharData = Font->CharData(*s++);
if (limit && int(x + CharData->width) > limit)
@@ -395,7 +406,8 @@ void cBitmap::DrawText(int x, int y, const char *s, tColor ColorFg, tColor Color
for (int row = 0; row < h; row++) {
cFont::tPixelData PixelData = CharData->lines[row];
for (int col = CharData->width; col-- > 0; ) {
- SetIndex(x + col, y + row, (PixelData & 1) ? fg : bg);
+ if (ColorBg != clrTransparent || (PixelData & 1))
+ SetIndex(x + col, y + row, (PixelData & 1) ? fg : bg);
PixelData >>= 1;
}
}
diff --git a/osd.h b/osd.h
index 848c68b..947e076 100644
--- a/osd.h
+++ b/osd.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: osd.h 1.43 2004/05/29 14:02:47 kls Exp $
+ * $Id: osd.h 1.45 2004/06/05 12:38:44 kls Exp $
*/
#ifndef __OSD_H
@@ -136,9 +136,15 @@ public:
bool LoadXpm(const char *FileName);
///< Calls SetXpm() with the data from the file FileName.
///< Returns true if the operation was successful.
- bool SetXpm(char *Xpm[]);
+ bool SetXpm(char *Xpm[], bool IgnoreNone = false);
///< Sets this bitmap to the given XPM data. Any previous bitmap or
///< palette data will be overwritten with the new data.
+ ///< If IgnoreNone is true, a "none" color entry will be ignored.
+ ///< Only set IgnoreNone to true if you know that there is a "none"
+ ///< color entry in the XPM data and that this entry is not used!
+ ///< If SetXpm() is called with IgnoreNone set to false and the XPM
+ ///< data contains an unused "none" entry, it will be automatically
+ ///< called again with IgnoreNone set to true.
///< Returns true if the operation was successful.
void SetIndex(int x, int y, tIndex Index);
///< Sets the index at the given coordinates to Index.
@@ -158,7 +164,8 @@ public:
///< Draws the given string at coordinates (x, y) with the given foreground
///< and background color and font. If Width and Height are given, the text
///< will be drawn into a rectangle with the given size and the given
- ///< Alignment (default is top-left).
+ ///< Alignment (default is top-left). If ColorBg is clrTransparent, no
+ ///< background pixels will be drawn, which allows drawing "transparent" text.
void DrawRectangle(int x1, int y1, int x2, int y2, tColor Color);
///< Draws a filled rectangle defined by the upper left (x1, y1) and lower right
///< (x2, y2) corners with the given Color. If the rectangle covers the entire
@@ -276,7 +283,8 @@ public:
///< Draws the given string at coordinates (x, y) with the given foreground
///< and background color and font. If Width and Height are given, the text
///< will be drawn into a rectangle with the given size and the given
- ///< Alignment (default is top-left).
+ ///< Alignment (default is top-left). If ColorBg is clrTransparent, no
+ ///< background pixels will be drawn, which allows drawing "transparent" text.
virtual void DrawRectangle(int x1, int y1, int x2, int y2, tColor Color);
///< Draws a filled rectangle defined by the upper left (x1, y1) and lower right
///< (x2, y2) corners with the given Color.
diff --git a/sdt.c b/sdt.c
index 5ac6b41..247d2c9 100644
--- a/sdt.c
+++ b/sdt.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: sdt.c 1.8 2004/03/07 10:46:08 kls Exp $
+ * $Id: sdt.c 1.9 2004/06/06 14:25:22 kls Exp $
*/
#include "sdt.h"
@@ -59,7 +59,7 @@ void cSdtFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length
{
char NameBuf[1024];
char ShortNameBuf[1024];
- sd->serviceName.getText(NameBuf, ShortNameBuf);
+ sd->serviceName.getText(NameBuf, ShortNameBuf, sizeof(NameBuf), sizeof(ShortNameBuf));
char *pn = compactspace(NameBuf);
char *ps = compactspace(ShortNameBuf);
if (*NameBuf && *ShortNameBuf && strcmp(NameBuf, ShortNameBuf) != 0) {