summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY1
-rw-r--r--dvbsubtitle.c20
3 files changed, 15 insertions, 7 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 38458790..0b4768ab 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -1107,6 +1107,7 @@ Rolf Ahrenberg <rahrenbe@cc.hut.fi>
for adding an include of VDR's 'Make.global' to libsi's Makefile
for adding handling of "ANSI/SCTE 57" descriptors
for some input on how to use BER and UNC values to generate a "quality" value
+ for fixing some crashes in subtitle display
Ralf Klueber <ralf.klueber@vodafone.com>
for reporting a bug in cutting a recording if there is only a single editing mark
diff --git a/HISTORY b/HISTORY
index e0d7dbed..93838331 100644
--- a/HISTORY
+++ b/HISTORY
@@ -6681,3 +6681,4 @@ Video Disk Recorder Revision History
- Implemented static cIndexFile::IndexFileName().
- The length (as number of frames) of a recording's index file can now be determined
by a call to cIndexFile::GetLength() (suggested by Christoph Haubrich).
+- Fixed some crashes in subtitle display (thanks to Rolf Ahrenberg).
diff --git a/dvbsubtitle.c b/dvbsubtitle.c
index de1cd1c0..43d072d4 100644
--- a/dvbsubtitle.c
+++ b/dvbsubtitle.c
@@ -7,7 +7,7 @@
* Original author: Marco Schlüßler <marco@lordzodiac.de>
* With some input from the "subtitle plugin" by Pekka Virtanen <pekka.virtanen@sci.fi>
*
- * $Id: dvbsubtitle.c 2.17 2011/04/17 14:34:05 kls Exp $
+ * $Id: dvbsubtitle.c 2.18 2011/08/13 13:33:00 kls Exp $
*/
@@ -826,6 +826,7 @@ void cDvbSubtitleConverter::Action(void)
while (Running()) {
int WaitMs = 100;
if (!frozen) {
+ LOCK_THREAD;
if (osd) {
int NewSetupLevel = setupLevel;
if (Timeout.TimedOut() || LastSetupLevel != NewSetupLevel) {
@@ -833,7 +834,6 @@ void cDvbSubtitleConverter::Action(void)
}
LastSetupLevel = NewSetupLevel;
}
- Lock();
if (cDvbSubtitleBitmaps *sb = bitmaps->First()) {
int64_t STC = cDevice::PrimaryDevice()->GetSTC();
int64_t Delta = LimitTo32Bit(sb->Pts()) - LimitTo32Bit(STC); // some devices only deliver 32 bits
@@ -858,7 +858,6 @@ void cDvbSubtitleConverter::Action(void)
else
bitmaps->Del(sb);
}
- Unlock();
}
cCondWait::SleepMs(WaitMs);
}
@@ -902,6 +901,7 @@ void cDvbSubtitleConverter::SetOsdData(void)
bool cDvbSubtitleConverter::AssertOsd(void)
{
+ LOCK_THREAD;
return osd || (osd = cOsdProvider::NewOsd(int(round(osdFactorX * windowHorizontalOffset + osdDeltaX)), int(round(osdFactorY * windowVerticalOffset + osdDeltaY)) + Setup.SubtitleOffset, OSD_LEVEL_SUBTITLES));
}
@@ -957,7 +957,11 @@ int cDvbSubtitleConverter::ExtractSegment(const uchar *Data, int Length, int64_t
region->SetVersion(regionVersion);
bool regionFillFlag = (Data[6 + 1] & 0x08) >> 3;
int regionWidth = (Data[6 + 2] << 8) | Data[6 + 3];
+ if (regionWidth < 1)
+ regionWidth = 1;
int regionHeight = (Data[6 + 4] << 8) | Data[6 + 5];
+ if (regionHeight < 1)
+ regionHeight = 1;
region->SetSize(regionWidth, regionHeight);
region->SetLevel((Data[6 + 6] & 0xE0) >> 5);
region->SetDepth((Data[6 + 6] & 0x1C) >> 2);
@@ -1103,7 +1107,7 @@ void cDvbSubtitleConverter::FinishPage(cDvbSubtitlePage *Page)
int NumAreas = Page->regions.Count();
int Bpp = 8;
bool Reduced = false;
- while (osd->CanHandleAreas(Areas, NumAreas) != oeOk) {
+ while (osd && osd->CanHandleAreas(Areas, NumAreas) != oeOk) {
int HalfBpp = Bpp / 2;
if (HalfBpp >= 2) {
for (int i = 0; i < NumAreas; i++) {
@@ -1141,8 +1145,10 @@ void cDvbSubtitleConverter::FinishPage(cDvbSubtitlePage *Page)
for (cSubtitleRegion *sr = Page->regions.First(); sr; sr = Page->regions.Next(sr)) {
int posX = sr->HorizontalAddress();
int posY = sr->VerticalAddress();
- cBitmap *bm = new cBitmap(sr->Width(), sr->Height(), sr->Bpp(), posX, posY);
- bm->DrawBitmap(posX, posY, *sr);
- Bitmaps->AddBitmap(bm);
+ if (sr->Width() > 0 && sr->Height() > 0) {
+ cBitmap *bm = new cBitmap(sr->Width(), sr->Height(), sr->Bpp(), posX, posY);
+ bm->DrawBitmap(posX, posY, *sr);
+ Bitmaps->AddBitmap(bm);
+ }
}
}