From a949b9c7d2bc14d2f6322764c88f4d11261680f1 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Wed, 22 Feb 2012 11:25:57 +0100 Subject: [PATCH] Fixed handling subtitle color palettes on channels where subtitles appear "word by word" --- CONTRIBUTORS | 2 ++ HISTORY | 4 +++- dvbsubtitle.c | 13 ++++++++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index e6739dee..b132516b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1131,6 +1131,8 @@ Rolf Ahrenberg for adding support for handling DVB-T2 transponders for suggesting to add member functions Adapter() and Frontend() to cDvbDevice for improving handling subtitles of BBC channels + for fixing handling subtitle color palettes on channels where subtitles appear + "word by word" Ralf Klueber for reporting a bug in cutting a recording if there is only a single editing mark diff --git a/HISTORY b/HISTORY index 25e3259f..a9044cdc 100644 --- a/HISTORY +++ b/HISTORY @@ -6889,7 +6889,7 @@ Video Disk Recorder Revision History - Fixed switching into time shift mode when pausing live video (thanks to Reinhard Nissl for helping to debug this one). -2012-02-21: Version 1.7.25 +2012-02-22: Version 1.7.25 - The fps value for channels where it differs from the default is now set correctly when pausing live video. @@ -6904,3 +6904,5 @@ Video Disk Recorder Revision History device. - Updated the Estonian OSD texts (thanks to Arthur Konovalov). - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). +- Fixed handling subtitle color palettes on channels where subtitles appear + "word by word" (thanks to Rolf Ahrenberg). diff --git a/dvbsubtitle.c b/dvbsubtitle.c index aa17a7af..7b8301d4 100644 --- a/dvbsubtitle.c +++ b/dvbsubtitle.c @@ -7,7 +7,7 @@ * Original author: Marco Schlüßler * With some input from the "subtitle plugin" by Pekka Virtanen * - * $Id: dvbsubtitle.c 2.22 2012/02/13 09:48:18 kls Exp $ + * $Id: dvbsubtitle.c 2.23 2012/02/22 09:33:45 kls Exp $ */ @@ -1035,7 +1035,7 @@ int cDvbSubtitleConverter::ExtractSegment(const uchar *Data, int Length, int64_t if (!page) { page = new cDvbSubtitlePage(pageId); pages->Add(page); - dbgpages("Create SubtitlePage %d (total pages = %d)\n", pageId, pages->Count()); + dbgpages("Create SubtitlePage %d (total pages = %d)\n", pageId, pages->Count()); } if (Pts) page->SetPts(Pts); @@ -1112,7 +1112,7 @@ int cDvbSubtitleConverter::ExtractSegment(const uchar *Data, int Length, int64_t } case CLUT_DEFINITION_SEGMENT: { dbgsegments("CLUT_DEFINITION_SEGMENT\n"); - cSubtitleClut *clut = page->GetClutById(bs.GetBits(8), true); + cSubtitleClut *clut = page->GetClutById(bs.GetBits(8), true); int clutVersion = bs.GetBits(4); if (clutVersion == clut->Version()) break; // no update @@ -1155,7 +1155,6 @@ int cDvbSubtitleConverter::ExtractSegment(const uchar *Data, int Length, int64_t clut->SetColor(8, clutEntryId, value); } dbgcluts("\n"); - page->UpdateRegionPalette(clut); break; } case OBJECT_DATA_SEGMENT: { @@ -1310,7 +1309,11 @@ void cDvbSubtitleConverter::FinishPage(cDvbSubtitlePage *Page) cDvbSubtitleBitmaps *Bitmaps = new cDvbSubtitleBitmaps(Page->Pts(), Page->Timeout(), Areas, NumAreas, osdFactorX, osdFactorY); bitmaps->Add(Bitmaps); for (cSubtitleRegion *sr = Page->regions.First(); sr; sr = Page->regions.Next(sr)) { - sr->UpdateTextData(Page->GetClutById(sr->ClutId())); + cSubtitleClut *clut = Page->GetClutById(sr->ClutId()); + if (!clut) + continue; + sr->Replace(*clut->GetPalette(sr->Bpp())); + sr->UpdateTextData(clut); int posX = sr->HorizontalAddress(); int posY = sr->VerticalAddress(); if (sr->Width() > 0 && sr->Height() > 0) {