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

Fixed some crashes in subtitle display

This commit is contained in:
Klaus Schmidinger 2011-08-13 13:34:32 +02:00
parent 06513252b1
commit da8cde8615
3 changed files with 15 additions and 7 deletions

View File

@ -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 an include of VDR's 'Make.global' to libsi's Makefile
for adding handling of "ANSI/SCTE 57" descriptors 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 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> Ralf Klueber <ralf.klueber@vodafone.com>
for reporting a bug in cutting a recording if there is only a single editing mark for reporting a bug in cutting a recording if there is only a single editing mark

View File

@ -6681,3 +6681,4 @@ Video Disk Recorder Revision History
- Implemented static cIndexFile::IndexFileName(). - Implemented static cIndexFile::IndexFileName().
- The length (as number of frames) of a recording's index file can now be determined - 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). by a call to cIndexFile::GetLength() (suggested by Christoph Haubrich).
- Fixed some crashes in subtitle display (thanks to Rolf Ahrenberg).

View File

@ -7,7 +7,7 @@
* Original author: Marco Schlüßler <marco@lordzodiac.de> * Original author: Marco Schlüßler <marco@lordzodiac.de>
* With some input from the "subtitle plugin" by Pekka Virtanen <pekka.virtanen@sci.fi> * 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()) { while (Running()) {
int WaitMs = 100; int WaitMs = 100;
if (!frozen) { if (!frozen) {
LOCK_THREAD;
if (osd) { if (osd) {
int NewSetupLevel = setupLevel; int NewSetupLevel = setupLevel;
if (Timeout.TimedOut() || LastSetupLevel != NewSetupLevel) { if (Timeout.TimedOut() || LastSetupLevel != NewSetupLevel) {
@ -833,7 +834,6 @@ void cDvbSubtitleConverter::Action(void)
} }
LastSetupLevel = NewSetupLevel; LastSetupLevel = NewSetupLevel;
} }
Lock();
if (cDvbSubtitleBitmaps *sb = bitmaps->First()) { if (cDvbSubtitleBitmaps *sb = bitmaps->First()) {
int64_t STC = cDevice::PrimaryDevice()->GetSTC(); int64_t STC = cDevice::PrimaryDevice()->GetSTC();
int64_t Delta = LimitTo32Bit(sb->Pts()) - LimitTo32Bit(STC); // some devices only deliver 32 bits int64_t Delta = LimitTo32Bit(sb->Pts()) - LimitTo32Bit(STC); // some devices only deliver 32 bits
@ -858,7 +858,6 @@ void cDvbSubtitleConverter::Action(void)
else else
bitmaps->Del(sb); bitmaps->Del(sb);
} }
Unlock();
} }
cCondWait::SleepMs(WaitMs); cCondWait::SleepMs(WaitMs);
} }
@ -902,6 +901,7 @@ void cDvbSubtitleConverter::SetOsdData(void)
bool cDvbSubtitleConverter::AssertOsd(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)); 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); region->SetVersion(regionVersion);
bool regionFillFlag = (Data[6 + 1] & 0x08) >> 3; bool regionFillFlag = (Data[6 + 1] & 0x08) >> 3;
int regionWidth = (Data[6 + 2] << 8) | Data[6 + 3]; int regionWidth = (Data[6 + 2] << 8) | Data[6 + 3];
if (regionWidth < 1)
regionWidth = 1;
int regionHeight = (Data[6 + 4] << 8) | Data[6 + 5]; int regionHeight = (Data[6 + 4] << 8) | Data[6 + 5];
if (regionHeight < 1)
regionHeight = 1;
region->SetSize(regionWidth, regionHeight); region->SetSize(regionWidth, regionHeight);
region->SetLevel((Data[6 + 6] & 0xE0) >> 5); region->SetLevel((Data[6 + 6] & 0xE0) >> 5);
region->SetDepth((Data[6 + 6] & 0x1C) >> 2); region->SetDepth((Data[6 + 6] & 0x1C) >> 2);
@ -1103,7 +1107,7 @@ void cDvbSubtitleConverter::FinishPage(cDvbSubtitlePage *Page)
int NumAreas = Page->regions.Count(); int NumAreas = Page->regions.Count();
int Bpp = 8; int Bpp = 8;
bool Reduced = false; bool Reduced = false;
while (osd->CanHandleAreas(Areas, NumAreas) != oeOk) { while (osd && osd->CanHandleAreas(Areas, NumAreas) != oeOk) {
int HalfBpp = Bpp / 2; int HalfBpp = Bpp / 2;
if (HalfBpp >= 2) { if (HalfBpp >= 2) {
for (int i = 0; i < NumAreas; i++) { 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)) { for (cSubtitleRegion *sr = Page->regions.First(); sr; sr = Page->regions.Next(sr)) {
int posX = sr->HorizontalAddress(); int posX = sr->HorizontalAddress();
int posY = sr->VerticalAddress(); int posY = sr->VerticalAddress();
if (sr->Width() > 0 && sr->Height() > 0) {
cBitmap *bm = new cBitmap(sr->Width(), sr->Height(), sr->Bpp(), posX, posY); cBitmap *bm = new cBitmap(sr->Width(), sr->Height(), sr->Bpp(), posX, posY);
bm->DrawBitmap(posX, posY, *sr); bm->DrawBitmap(posX, posY, *sr);
Bitmaps->AddBitmap(bm); Bitmaps->AddBitmap(bm);
} }
} }
}