From 978807e4d1873e878f3c23c4dda889c50a753a35 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 7 Feb 2010 12:08:13 +0100 Subject: [PATCH] Keeping subtitles visible when pausing replay --- CONTRIBUTORS | 1 + HISTORY | 3 +- device.c | 6 +++- dvbsubtitle.c | 78 +++++++++++++++++++++++++++------------------------ dvbsubtitle.h | 4 ++- 5 files changed, 52 insertions(+), 40 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index d2eb7d32..0455528d 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1091,6 +1091,7 @@ Rolf Ahrenberg for a patch that was used to implement handling the "component descriptor" ("genre") for a patch that was used to implement handling the "parental rating descriptor" suggesting to add plain text error messages to log entries from cOsd::SetAreas() + for keeping subtitles visible when pausing replay 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 586f6a67..4af6c0a3 100644 --- a/HISTORY +++ b/HISTORY @@ -6309,7 +6309,7 @@ Video Disk Recorder Revision History - The files "commands.conf" and "reccmd.conf" can now contain nested lists of commands. See vdr.5 for information about the new file format. -2010-02-06: Version 1.7.13 +2010-02-07: Version 1.7.13 - Updated the Italian OSD texts (thanks to Diego Pierotto). - Changed the position of Sirius 4 to S4.8E in sources.conf (thanks to Alexander Gross). @@ -6352,3 +6352,4 @@ Video Disk Recorder Revision History ------------------------------------------------------------ - Added device definitions to the diseqc.conf file format, so that certain satellite positions can be limited to a given list of devices. +- Keeping subtitles visible when pausing replay (thanks to Rolf Ahrenberg). diff --git a/device.c b/device.c index 4a30b69c..ac4d6d49 100644 --- a/device.c +++ b/device.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 2.34 2010/02/06 14:34:18 kls Exp $ + * $Id: device.c 2.35 2010/02/07 11:54:42 kls Exp $ */ #include "device.h" @@ -1053,11 +1053,15 @@ void cDevice::Clear(void) void cDevice::Play(void) { Audios.MuteAudio(mute); + if (dvbSubtitleConverter) + dvbSubtitleConverter->Freeze(false); } void cDevice::Freeze(void) { Audios.MuteAudio(true); + if (dvbSubtitleConverter) + dvbSubtitleConverter->Freeze(true); } void cDevice::Mute(void) diff --git a/dvbsubtitle.c b/dvbsubtitle.c index 221523fd..a02a01f3 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.3 2009/12/05 16:11:54 kls Exp $ + * $Id: dvbsubtitle.c 2.4 2010/02/07 12:08:13 kls Exp $ */ #include "dvbsubtitle.h" @@ -658,6 +658,7 @@ cDvbSubtitleConverter::cDvbSubtitleConverter(void) { dvbSubtitleAssembler = new cDvbSubtitleAssembler; osd = NULL; + frozen = false; pages = new cList; bitmaps = new cList; Start(); @@ -685,6 +686,7 @@ void cDvbSubtitleConverter::Reset(void) pages->Clear(); bitmaps->Clear(); DELETENULL(osd); + frozen = false; Unlock(); } @@ -776,46 +778,48 @@ void cDvbSubtitleConverter::Action(void) int LastSetupLevel = setupLevel; cTimeMs Timeout; while (Running()) { - if (osd) { - int NewSetupLevel = setupLevel; - if (Timeout.TimedOut() || LastSetupLevel != NewSetupLevel) { - DELETENULL(osd); - } - LastSetupLevel = NewSetupLevel; - } int WaitMs = 100; - Lock(); - if (cDvbSubtitleBitmaps *sb = bitmaps->First()) { - int64_t STC = cDevice::PrimaryDevice()->GetSTC(); - int64_t Delta = 0; - if (STC >= 0) { - Delta = LimitTo32Bit(sb->Pts()) - LimitTo32Bit(STC); // some devices only deliver 32 bits - if (Delta > (int64_t(1) << 31)) - 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 - if (Delta <= MAXDELTA) { - if (Delta <= 0) { - dbgconverter("Got %d bitmaps, showing #%d\n", bitmaps->Count(), sb->Index() + 1); - if (AssertOsd()) { - sb->Draw(osd); - Timeout.Set(sb->Timeout() * 1000); - dbgconverter("PTS: %lld STC: %lld (%lld) timeout: %d\n", sb->Pts(), cDevice::PrimaryDevice()->GetSTC(), Delta, sb->Timeout()); - } - bitmaps->Del(sb); + if (!frozen) { + if (osd) { + int NewSetupLevel = setupLevel; + if (Timeout.TimedOut() || LastSetupLevel != NewSetupLevel) { + DELETENULL(osd); } - else if (Delta < WaitMs) - WaitMs = Delta; + LastSetupLevel = NewSetupLevel; } - else - bitmaps->Del(sb); + Lock(); + if (cDvbSubtitleBitmaps *sb = bitmaps->First()) { + int64_t STC = cDevice::PrimaryDevice()->GetSTC(); + int64_t Delta = 0; + if (STC >= 0) { + Delta = LimitTo32Bit(sb->Pts()) - LimitTo32Bit(STC); // some devices only deliver 32 bits + if (Delta > (int64_t(1) << 31)) + 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 + if (Delta <= MAXDELTA) { + if (Delta <= 0) { + dbgconverter("Got %d bitmaps, showing #%d\n", bitmaps->Count(), sb->Index() + 1); + if (AssertOsd()) { + sb->Draw(osd); + Timeout.Set(sb->Timeout() * 1000); + dbgconverter("PTS: %lld STC: %lld (%lld) timeout: %d\n", sb->Pts(), cDevice::PrimaryDevice()->GetSTC(), Delta, sb->Timeout()); + } + bitmaps->Del(sb); + } + else if (Delta < WaitMs) + WaitMs = Delta; + } + else + bitmaps->Del(sb); + } + Unlock(); } - Unlock(); cCondWait::SleepMs(WaitMs); } } diff --git a/dvbsubtitle.h b/dvbsubtitle.h index 06bdea4d..c6775a9e 100644 --- a/dvbsubtitle.h +++ b/dvbsubtitle.h @@ -6,7 +6,7 @@ * * Original author: Marco Schlüßler * - * $Id: dvbsubtitle.h 2.1 2008/05/25 14:36:52 kls Exp $ + * $Id: dvbsubtitle.h 2.2 2010/02/07 11:55:14 kls Exp $ */ #ifndef __DVBSUBTITLE_H @@ -25,6 +25,7 @@ private: static int setupLevel; cDvbSubtitleAssembler *dvbSubtitleAssembler; cOsd *osd; + bool frozen; cList *pages; cList *bitmaps; tColor yuv2rgb(int Y, int Cb, int Cr); @@ -36,6 +37,7 @@ public: virtual ~cDvbSubtitleConverter(); void Action(void); void Reset(void); + void Freeze(bool Status) { frozen = Status; } int ConvertFragments(const uchar *Data, int Length); // for legacy PES recordings int Convert(const uchar *Data, int Length); static void SetupChanged(void);