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

Fixed reusing OSD in cDvbSpuDecoder

This commit is contained in:
Klaus Schmidinger 2005-01-02 15:29:49 +01:00
parent 0b3a801ab4
commit ab177a1579
3 changed files with 25 additions and 5 deletions

View File

@ -901,6 +901,7 @@ Reinhard Nissl <rnissl@gmx.de>
for reporting a high CPU load in still picture mode after removing the usleep() for reporting a high CPU load in still picture mode after removing the usleep()
call from cDvbPlayer::Action() call from cDvbPlayer::Action()
for reporting a race condition in starting a thread for reporting a race condition in starting a thread
for fixing reusing OSD in cDvbSpuDecoder
Richard Robson <richard_robson@beeb.net> Richard Robson <richard_robson@beeb.net>
for reporting freezing replay if a timer starts while in Transfer Mode from the for reporting freezing replay if a timer starts while in Transfer Mode from the

View File

@ -3265,3 +3265,4 @@ Video Disk Recorder Revision History
used to get notified when the audio track has been switched. used to get notified when the audio track has been switched.
- Skins need to implement the new cSkinDisplayTrack class to display the audio - Skins need to implement the new cSkinDisplayTrack class to display the audio
track menu. track menu.
- Fixed reusing OSD in cDvbSpuDecoder (thanks to Reinhard Nissl).

View File

@ -8,7 +8,7 @@
* *
* parts of this file are derived from the OMS program. * parts of this file are derived from the OMS program.
* *
* $Id: dvbspu.c 1.8 2004/11/06 11:50:13 kls Exp $ * $Id: dvbspu.c 1.9 2005/01/02 15:27:07 kls Exp $
*/ */
#include <assert.h> #include <assert.h>
@ -349,6 +349,20 @@ sDvbSpuRect cDvbSpuDecoder::CalcAreaSize(sDvbSpuRect fgsize, cBitmap *fgbmp, sDv
return size; return size;
} }
static bool OsdMatchesArea(cOsd *osd, tArea &area)
{
cBitmap *bmp = osd->GetBitmap(0);
if (!bmp)
return false;
if (bmp->Bpp() != area.bpp)
return false;
if (bmp->X0() != area.x1 || bmp->Y0() != area.y1)
return false;
if (bmp->Width() != area.Width() || bmp->Height() != area.Height())
return false;
return true;
}
void cDvbSpuDecoder::Draw(void) void cDvbSpuDecoder::Draw(void)
{ {
if (!spubmp) { if (!spubmp) {
@ -386,12 +400,16 @@ void cDvbSpuDecoder::Draw(void)
} }
if (bg || fg) { if (bg || fg) {
if (osd == NULL) {
osd = cOsdProvider::NewOsd(0, 0);
int x2 = areaSize.x2; int x2 = areaSize.x2;
while ((x2 - areaSize.x1 + 1) & 0x03) while ((x2 - areaSize.x1 + 1) & 0x03)
x2++; x2++;
tArea Area = { areaSize.x1, areaSize.y1, x2, areaSize.y2, (fg && bg) ? 4 : 2 }; tArea Area = { areaSize.x1, areaSize.y1, x2, areaSize.y2, (fg && bg) ? 4 : 2 };
if (osd && !OsdMatchesArea(osd, Area)) {
delete osd;
osd = NULL;
}
if (osd == NULL) {
osd = cOsdProvider::NewOsd(0, 0);
osd->SetAreas(&Area, 1); osd->SetAreas(&Area, 1);
} }