Fixed (well, actually worked around) a problem with subtitles not being displayed because the broadcaster doesn't set the data's version numbers as required by the DVB standard

This commit is contained in:
Klaus Schmidinger 2015-01-09 12:03:31 +01:00
parent 7fac1d4ae2
commit 77173b7057
3 changed files with 34 additions and 17 deletions

View File

@ -1190,6 +1190,8 @@ Rolf Ahrenberg <Rolf.Ahrenberg@sci.fi>
registered registered
for adding support for "Pilot", "T2-System-Id" and "SISO/MISO" parameters for adding support for "Pilot", "T2-System-Id" and "SISO/MISO" parameters
for increasing the PMT_SCAN_TIMEOUT to avoid timeouts when scanning PMTs for increasing the PMT_SCAN_TIMEOUT to avoid timeouts when scanning PMTs
for fixing a problem with subtitles not being displayed because the broadcaster
doesn't set the data's version numbers as required by the DVB standard
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

@ -8340,3 +8340,6 @@ Video Disk Recorder Revision History
(reported by Dietmar Spingler). (reported by Dietmar Spingler).
- Fixed resetting the receiver for EMM pids for CAMs that need to receive the TS - Fixed resetting the receiver for EMM pids for CAMs that need to receive the TS
(reported by Dietmar Spingler). (reported by Dietmar Spingler).
- Fixed (well, actually worked around) a problem with subtitles not being displayed
because the broadcaster doesn't set the data's version numbers as required by the
DVB standard (thanks to Rolf Ahrenberg).

View File

@ -7,7 +7,7 @@
* Original author: Marco Schluessler <marco@lordzodiac.de> * Original author: Marco Schluessler <marco@lordzodiac.de>
* With some input from the "subtitles plugin" by Pekka Virtanen <pekka.virtanen@sci.fi> * With some input from the "subtitles plugin" by Pekka Virtanen <pekka.virtanen@sci.fi>
* *
* $Id: dvbsubtitle.c 3.6 2015/01/04 15:46:39 kls Exp $ * $Id: dvbsubtitle.c 3.7 2015/01/09 11:56:25 kls Exp $
*/ */
#include "dvbsubtitle.h" #include "dvbsubtitle.h"
@ -53,6 +53,8 @@ static bool DebugOutput = DebugVerbose;
#define DBGMAXBITMAPS 100 // debug output will be stopped after this many bitmaps #define DBGMAXBITMAPS 100 // debug output will be stopped after this many bitmaps
#define DBGBITMAPWIDTH 400 #define DBGBITMAPWIDTH 400
#define FIX_SUBTITLE_VERSION_BROADCASTER_STUPIDITY // some don't properly handle version numbers, which renders them useless because subtitles are not displayed
// --- cSubtitleDebug -------------------------------------------------------- // --- cSubtitleDebug --------------------------------------------------------
class cSubtitleDebug { class cSubtitleDebug {
@ -221,8 +223,10 @@ cSubtitleClut::cSubtitleClut(int ClutId)
void cSubtitleClut::Parse(cBitStream &bs) void cSubtitleClut::Parse(cBitStream &bs)
{ {
int Version = bs.GetBits(4); int Version = bs.GetBits(4);
#ifndef FIX_SUBTITLE_VERSION_BROADCASTER_STUPIDITY
if (clutVersionNumber == Version) if (clutVersionNumber == Version)
return; // no update return; // no update
#endif
clutVersionNumber = Version; clutVersionNumber = Version;
bs.SkipBits(4); // reserved bs.SkipBits(4); // reserved
dbgcluts("<b>clut</b> id %d version %d<br>\n", clutId, clutVersionNumber); dbgcluts("<b>clut</b> id %d version %d<br>\n", clutId, clutVersionNumber);
@ -355,8 +359,10 @@ cSubtitleObject::~cSubtitleObject()
void cSubtitleObject::Parse(cBitStream &bs) void cSubtitleObject::Parse(cBitStream &bs)
{ {
int Version = bs.GetBits(4); int Version = bs.GetBits(4);
#ifndef FIX_SUBTITLE_VERSION_BROADCASTER_STUPIDITY
if (objectVersionNumber == Version) if (objectVersionNumber == Version)
return; // no update return; // no update
#endif
objectVersionNumber = Version; objectVersionNumber = Version;
objectCodingMethod = bs.GetBits(2); objectCodingMethod = bs.GetBits(2);
nonModifyingColorFlag = bs.GetBit(); nonModifyingColorFlag = bs.GetBit();
@ -740,8 +746,10 @@ cSubtitleRegion::cSubtitleRegion(int RegionId)
void cSubtitleRegion::Parse(cBitStream &bs) void cSubtitleRegion::Parse(cBitStream &bs)
{ {
int Version = bs.GetBits(4); int Version = bs.GetBits(4);
#ifndef FIX_SUBTITLE_VERSION_BROADCASTER_STUPIDITY
if (regionVersionNumber == Version) if (regionVersionNumber == Version)
return; // no update return; // no update
#endif
regionVersionNumber = Version; regionVersionNumber = Version;
regionFillFlag = bs.GetBit(); regionFillFlag = bs.GetBit();
bs.SkipBits(3); // reserved bs.SkipBits(3); // reserved
@ -849,8 +857,10 @@ void cDvbSubtitlePage::Parse(int64_t Pts, cBitStream &bs)
pts = Pts; pts = Pts;
pageTimeout = bs.GetBits(8); pageTimeout = bs.GetBits(8);
int Version = bs.GetBits(4); int Version = bs.GetBits(4);
#ifndef FIX_SUBTITLE_VERSION_BROADCASTER_STUPIDITY
if (pageVersionNumber == Version) if (pageVersionNumber == Version)
return; // no update return; // no update
#endif
pageVersionNumber = Version; pageVersionNumber = Version;
pageState = bs.GetBits(2); pageState = bs.GetBits(2);
switch (pageState) { switch (pageState) {
@ -1387,23 +1397,25 @@ int cDvbSubtitleConverter::ExtractSegment(const uchar *Data, int Length, int64_t
case DISPLAY_DEFINITION_SEGMENT: { case DISPLAY_DEFINITION_SEGMENT: {
dbgsegments("DISPLAY_DEFINITION_SEGMENT<br>\n"); dbgsegments("DISPLAY_DEFINITION_SEGMENT<br>\n");
int version = bs.GetBits(4); int version = bs.GetBits(4);
if (version != ddsVersionNumber) { #ifndef FIX_SUBTITLE_VERSION_BROADCASTER_STUPIDITY
bool displayWindowFlag = bs.GetBit(); if (version == ddsVersionNumber)
windowHorizontalOffset = 0; break; // no update
windowVerticalOffset = 0; #endif
bs.SkipBits(3); // reserved bool displayWindowFlag = bs.GetBit();
displayWidth = windowWidth = bs.GetBits(16) + 1; windowHorizontalOffset = 0;
displayHeight = windowHeight = bs.GetBits(16) + 1; windowVerticalOffset = 0;
if (displayWindowFlag) { bs.SkipBits(3); // reserved
windowHorizontalOffset = bs.GetBits(16); // displayWindowHorizontalPositionMinimum displayWidth = windowWidth = bs.GetBits(16) + 1;
windowWidth = bs.GetBits(16) - windowHorizontalOffset + 1; // displayWindowHorizontalPositionMaximum displayHeight = windowHeight = bs.GetBits(16) + 1;
windowVerticalOffset = bs.GetBits(16); // displayWindowVerticalPositionMinimum if (displayWindowFlag) {
windowHeight = bs.GetBits(16) - windowVerticalOffset + 1; // displayWindowVerticalPositionMaximum windowHorizontalOffset = bs.GetBits(16); // displayWindowHorizontalPositionMinimum
} windowWidth = bs.GetBits(16) - windowHorizontalOffset + 1; // displayWindowHorizontalPositionMaximum
SetOsdData(); windowVerticalOffset = bs.GetBits(16); // displayWindowVerticalPositionMinimum
ddsVersionNumber = version; windowHeight = bs.GetBits(16) - windowVerticalOffset + 1; // displayWindowVerticalPositionMaximum
dbgdisplay("<b>display</b> version %d flag %d width %d height %d ofshor %d ofsver %d<br>\n", ddsVersionNumber, displayWindowFlag, windowWidth, windowHeight, windowHorizontalOffset, windowVerticalOffset);
} }
SetOsdData();
ddsVersionNumber = version;
dbgdisplay("<b>display</b> version %d flag %d width %d height %d ofshor %d ofsver %d<br>\n", ddsVersionNumber, displayWindowFlag, windowWidth, windowHeight, windowHorizontalOffset, windowVerticalOffset);
break; break;
} }
case DISPARITY_SIGNALING_SEGMENT: { case DISPARITY_SIGNALING_SEGMENT: {