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

Removed the check for positive STC values from cDvbSubtitleConverter::Action()

This commit is contained in:
Klaus Schmidinger 2010-10-24 12:29:04 +02:00
parent ad650b5883
commit fbbcb8e9c8
2 changed files with 8 additions and 13 deletions

View File

@ -6488,3 +6488,4 @@ Video Disk Recorder Revision History
Steffen Barszus). Steffen Barszus).
- Changed the description of cDevice::GetSTC() to make it mandatory for devices - Changed the description of cDevice::GetSTC() to make it mandatory for devices
that can replay. that can replay.
- Removed the check for positive STC values from cDvbSubtitleConverter::Action().

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.7 2010/08/29 14:08:23 kls Exp $ * $Id: dvbsubtitle.c 2.8 2010/10/24 12:25:45 kls Exp $
*/ */
#include "dvbsubtitle.h" #include "dvbsubtitle.h"
@ -781,7 +781,7 @@ int cDvbSubtitleConverter::Convert(const uchar *Data, int Length)
return 0; return 0;
} }
#define LimitTo32Bit(n) (n & 0x00000000FFFFFFFFL) #define LimitTo32Bit(n) ((n) & 0x00000000FFFFFFFFL)
#define MAXDELTA 40000 // max. reasonable PTS/STC delta in ms #define MAXDELTA 40000 // max. reasonable PTS/STC delta in ms
void cDvbSubtitleConverter::Action(void) void cDvbSubtitleConverter::Action(void)
@ -801,17 +801,11 @@ void cDvbSubtitleConverter::Action(void)
Lock(); 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 = 0; int64_t Delta = LimitTo32Bit(sb->Pts()) - LimitTo32Bit(STC); // some devices only deliver 32 bits
if (STC >= 0) { if (Delta > (int64_t(1) << 31))
Delta = LimitTo32Bit(sb->Pts()) - LimitTo32Bit(STC); // some devices only deliver 32 bits Delta -= (int64_t(1) << 32);
if (Delta > (int64_t(1) << 31)) else if (Delta < -((int64_t(1) << 31) - 1))
Delta -= (int64_t(1) << 32); Delta += (int64_t(1) << 32);
else if (Delta < -((int64_t(1) << 31) - 1))
Delta += (int64_t(1) << 32);
}
else {
//TODO sync on PTS? are there actually devices that don't deliver an STC?
}
Delta /= 90; // STC and PTS are in 1/90000s Delta /= 90; // STC and PTS are in 1/90000s
if (Delta <= MAXDELTA) { if (Delta <= MAXDELTA) {
if (Delta <= 0) { if (Delta <= 0) {