Go to the documentation of this file.
14 #define __STDC_FORMAT_MACROS // Required for format specifiers
19 #define PAGE_COMPOSITION_SEGMENT 0x10
20 #define REGION_COMPOSITION_SEGMENT 0x11
21 #define CLUT_DEFINITION_SEGMENT 0x12
22 #define OBJECT_DATA_SEGMENT 0x13
23 #define DISPLAY_DEFINITION_SEGMENT 0x14
24 #define DISPARITY_SIGNALING_SEGMENT 0x15 // DVB BlueBook A156
25 #define END_OF_DISPLAY_SET_SEGMENT 0x80
26 #define STUFFING_SEGMENT 0xFF
28 #define PGS_PALETTE_SEGMENT 0x14
29 #define PGS_OBJECT_SEGMENT 0x15
30 #define PGS_PRESENTATION_SEGMENT 0x16
31 #define PGS_WINDOW_SEGMENT 0x17
32 #define PGS_DISPLAY_SEGMENT 0x80
49 #define dbgdisplay(a...) if (DebugDisplay) SD.WriteHtml(a)
50 #define dbgpages(a...) if (DebugPages) SD.WriteHtml(a)
51 #define dbgregions(a...) if (DebugRegions) SD.WriteHtml(a)
52 #define dbgobjects(a...) if (DebugObjects) SD.WriteHtml(a)
53 #define dbgconverter(a...) if (DebugConverter) SD.WriteHtml(a)
54 #define dbgsegments(a...) if (DebugSegments) SD.WriteHtml(a)
55 #define dbgpixel(a...) if (DebugPixel) SD.WriteHtml(a)
56 #define dbgcluts(a...) if (DebugCluts) SD.WriteHtml(a)
57 #define dbgoutput(a...) if (DebugOutput) SD.WriteHtml(a)
59 #define DBGMAXBITMAPS 100 // debug output will be stopped after this many bitmaps
60 #define DBGBITMAPWIDTH 400
62 #define FIX_SUBTITLE_VERSION_BROADCASTER_STUPIDITY // some don't properly handle version numbers, which renders them useless because subtitles are not displayed
98 int w = MaxX ? int(round(MaxX *
factor)) : Scaled->
Width();
99 int h = MaxY ? int(round(MaxY *
factor)) : Scaled->
Height();
100 uchar mem[w * h * 3];
101 for (
int x = 0; x < w; x++) {
102 for (
int y = 0; y < h; y++) {
104 int o = (y * w + x) * 3;
105 mem[o++] = (c & 0x00FF0000) >> 16;
106 mem[o++] = (c & 0x0000FF00) >> 8;
107 mem[o] = (c & 0x000000FF);
114 int f = open(ImgName, O_WRONLY | O_CREAT, DEFFILEMODE);
116 if (write(f, Jpeg, Size) < 0)
129 if (FILE *f = fopen(
"dbg-log.htm",
newFile ?
"w" :
"a")) {
131 va_start(ap, Format);
132 vfprintf(f, Format, ap);
166 int a = 0, r = 0, g = 0, b = 0;
176 for (
int i = 1; i < 16; ++i) {
178 r = (i & 1) ? 255 : 0;
179 g = (i & 2) ? 255 : 0;
180 b = (i & 4) ? 255 : 0;
183 r = (i & 1) ? 127 : 0;
184 g = (i & 2) ? 127 : 0;
185 b = (i & 4) ? 127 : 0;
191 for (
int i = 1; i < 256; ++i) {
193 r = (i & 1) ? 255 : 0;
194 g = (i & 2) ? 255 : 0;
195 b = (i & 4) ? 255 : 0;
201 r = ((i & 1) ? 85 : 0) + ((i & 0x10) ? 170 : 0);
202 g = ((i & 2) ? 85 : 0) + ((i & 0x20) ? 170 : 0);
203 b = ((i & 4) ? 85 : 0) + ((i & 0x40) ? 170 : 0);
207 r = ((i & 1) ? 85 : 0) + ((i & 0x10) ? 170 : 0);
208 g = ((i & 2) ? 85 : 0) + ((i & 0x20) ? 170 : 0);
209 b = ((i & 4) ? 85 : 0) + ((i & 0x40) ? 170 : 0);
213 r = 127 + ((i & 1) ? 43 : 0) + ((i & 0x10) ? 85 : 0);
214 g = 127 + ((i & 2) ? 43 : 0) + ((i & 0x20) ? 85 : 0);
215 b = 127 + ((i & 4) ? 43 : 0) + ((i & 0x40) ? 85 : 0);
219 r = ((i & 1) ? 43 : 0) + ((i & 0x10) ? 85 : 0);
220 g = ((i & 2) ? 43 : 0) + ((i & 0x20) ? 85 : 0);
221 b = ((i & 4) ? 43 : 0) + ((i & 0x40) ? 85 : 0);
233 #ifndef FIX_SUBTITLE_VERSION_BROADCASTER_STUPIDITY
240 while (!bs.
IsEOF()) {
242 bool entryClut2Flag = bs.
GetBit();
243 bool entryClut4Flag = bs.
GetBit();
244 bool entryClut8Flag = bs.
GetBit();
264 value =
yuv2rgb(yval, cbval, crval);
267 dbgcluts(
"%2d %d %d %d %08X<br>\n", clutEntryId, entryClut2Flag ? 2 : 0, entryClut4Flag ? 4 : 0, entryClut8Flag ? 8 : 0, value);
284 for (
int i = 0; i < 256; ++i)
286 while (!bs.
IsEOF()) {
294 value =
yuv2rgb(yval, cbval, crval);
297 dbgcluts(
"%2d %08X<br>\n", clutEntryId, value);
311 Er =
constrain((298 * Ey + 460 * Epr) / 256, 0, 255);
312 Eg =
constrain((298 * Ey - 55 * Epb - 137 * Epr) / 256, 0, 255);
313 Eb =
constrain((298 * Ey + 543 * Epb ) / 256, 0, 255);
315 return (Er << 16) | (Eg << 8) | Eb;
324 default:
esyslog(
"ERROR: wrong Bpp in cSubtitleClut::SetColor(%d, %d, %08X)", Bpp,
Index, Color);
334 default:
esyslog(
"ERROR: wrong Bpp in cSubtitleClut::GetPalette(%d)", Bpp);
398 #ifndef FIX_SUBTITLE_VERSION_BROADCASTER_STUPIDITY
423 int numberOfCodes = bs.
GetBits(8);
436 if (b.
Dirty(x1, y1, x2, y2)) {
438 dbgobjects(
"<img src=\"%s\"><br>\n", *ImgName);
450 int sequenceDescriptor = bs.
GetBits(8);
451 if (!(sequenceDescriptor & 0x80) &&
topData != NULL) {
477 if (NumberOfCodes > 0) {
478 char txt[NumberOfCodes + 1];
479 for (
int i = 0; i < NumberOfCodes; i++)
480 txt[i] = Data[i * 2 + 1];
481 txt[NumberOfCodes] = 0;
483 int len = NumberOfCodes;
485 dbgobjects(
" table %s raw '%s'", CharacterTable, from);
487 const char *s = conv.
Convert((
const char *)from);
497 int y = Even ? 0 : 1;
498 uint8_t map2to4[ 4] = { 0x00, 0x07, 0x08, 0x0F };
499 uint8_t map2to8[ 4] = { 0x00, 0x77, 0x88, 0xFF };
500 uint8_t map4to8[16] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF };
501 const uint8_t *mapTable = NULL;
503 while (!bs.
IsEOF()) {
506 dbgpixel(
"2-bit / pixel code string<br>\n");
507 switch (Bitmap->
Bpp()) {
508 case 8: mapTable = map2to8;
break;
509 case 4: mapTable = map2to4;
break;
510 default: mapTable = NULL;
break;
517 dbgpixel(
"4-bit / pixel code string<br>\n");
518 switch (Bitmap->
Bpp()) {
519 case 8: mapTable = map4to8;
break;
520 default: mapTable = NULL;
break;
527 dbgpixel(
"8-bit / pixel code string<br>\n");
532 dbgpixel(
"sub block 2 to 4 map<br>\n");
533 for (
int i = 0; i < 4; ++i)
537 dbgpixel(
"sub block 2 to 8 map<br>\n");
538 for (
int i = 0; i < 4; ++i)
542 dbgpixel(
"sub block 4 to 8 map<br>\n");
543 for (
int i = 0; i < 16; ++i)
547 dbgpixel(
"end of object line<br>\n");
552 dbgpixel(
"PGS code string, including EOLs<br>\n");
558 default:
dbgpixel(
"unknown sub block %s %d<br>\n", __FUNCTION__, __LINE__);
567 for (
int pos = x; pos < x + Length; pos++)
605 color = MapTable[color];
606 DrawLine(Bitmap, px + x, py + y, color, rl);
620 else if (bs->
GetBit() == 0) {
627 else if (bs->
GetBit() == 0) {
650 color = MapTable[color];
651 DrawLine(Bitmap, px + x, py + y, color, rl);
676 DrawLine(Bitmap, px + x, py + y, color, rl);
683 while (!bs->
IsEOF()) {
690 rl = (rl << 8) + bs->
GetBits(8);
691 color = flags & 0x80 ? bs->
GetBits(8) : 0;
694 DrawLine(Bitmap, px + x, py + y, color, rl);
737 if (so->ObjectId() == ObjectId)
882 #ifndef FIX_SUBTITLE_VERSION_BROADCASTER_STUPIDITY
926 switch (Bitmap->
Bpp()) {
930 default:
dbgregions(
"unknown bpp %d (%s %d)<br>\n", Bitmap->
Bpp(), __FUNCTION__, __LINE__);
935 so->Render(Bitmap, sor->ObjectHorizontalPosition(), sor->ObjectVerticalPosition(), sor->ForegroundPixelCode(), sor->BackgroundPixelCode());
1023 #ifndef FIX_SUBTITLE_VERSION_BROADCASTER_STUPIDITY
1090 a->
x1 = srr->RegionHorizontalAddress();
1091 a->
y1 = srr->RegionVerticalAddress();
1092 a->
x2 = srr->RegionHorizontalAddress() + sr->RegionWidth() - 1;
1093 a->
y2 = srr->RegionVerticalAddress() + sr->RegionHeight() - 1;
1094 a->
bpp = sr->RegionDepth();
1114 for (
int i = 0; i < NumAreas; i++) {
1127 a.
x1 = int(round(FactorX * Area.
x1) );
1128 a.
x2 = int(round(FactorX * Area.
x2) - 1);
1129 a.
y1 = int(round(FactorY * Area.
y1) );
1130 a.
y2 = int(round(FactorY * Area.
y2) - 1);
1132 while ((a.
Width() & 3) != 0)
1140 if (sc->ClutId() == ClutId)
1153 if (sr->RegionId() == RegionId)
1181 unsigned char *
Get(
int &Length);
1182 void Put(
const uchar *Data,
int Length);
1206 Size =
max(Size, 2048);
1212 esyslog(
"ERROR: can't allocate memory for subtitle assembler");
1228 unsigned char *result =
data +
pos;
1267 void DbgDump(
int WindowWidth,
int WindowHeight);
1329 double End = Start + Duration;
1330 cBitmap Bitmap(WindowWidth, WindowHeight, 8);
1331 #define DBGBACKGROUND 0xA0A0A0
1338 #define BORDER //" border=1"
1344 SD.
WriteHtml(
"</td><td style=\"height:100%%\"><table" BORDER " style=\"height:100%%\">");
1345 SD.
WriteHtml(
"<tr><td valign=top><b>%.2f</b></td></tr>", Start);
1346 SD.
WriteHtml(
"<tr><td valign=middle>%.2f</td></tr>", Duration);
1347 SD.
WriteHtml(
"<tr><td valign=bottom>%.2f</td></tr>", End);
1357 :
cThread(
"subtitle converter")
1389 dbgconverter(
"converter reset -----------------------<br>\n");
1406 if (Data && Length > 8) {
1408 int SubstreamHeaderLength = 4;
1409 bool ResetSubtitleAssembler = Data[PayloadOffset + 3] == 0x00;
1412 if ((Data[7] & 0x01) && (Data[PayloadOffset - 3] & 0x81) == 0x01 && Data[PayloadOffset - 2] == 0x81) {
1414 SubstreamHeaderLength = 1;
1415 ResetSubtitleAssembler = Data[8] >= 5;
1418 if (Length > PayloadOffset + SubstreamHeaderLength) {
1422 const uchar *data = Data + PayloadOffset + SubstreamHeaderLength;
1423 int length = Length - PayloadOffset - SubstreamHeaderLength;
1424 if (ResetSubtitleAssembler)
1428 if (data[0] == 0x20 && data[1] == 0x00 && data[2] == 0x0F)
1436 if (b && b[0] == 0x0F) {
1452 if (Data && Length > 8) {
1454 if (Length > PayloadOffset) {
1458 const uchar *data = Data + PayloadOffset;
1459 int length = Length - PayloadOffset;
1461 if (length > 2 && data[0] == 0x20 && data[1] == 0x00 && data[2] == 0x0F) {
1465 const uchar *b = data;
1466 while (length > 0) {
1486 #define LimitTo32Bit(n) ((n) & 0x00000000FFFFFFFFL)
1498 if (Timeout.
TimedOut() || LastSetupLevel != NewSetupLevel) {
1502 LastSetupLevel = NewSetupLevel;
1510 if (Delta > (int64_t(1) << 31))
1511 Delta -= (int64_t(1) << 32);
1512 else if (Delta < -((int64_t(1) << 31) - 1))
1513 Delta += (int64_t(1) << 32);
1516 if (Delta < sb->Timeout() * 1000) {
1517 if (!sb->HasBitmaps()) {
1524 Timeout.
Set(sb->Timeout() * 1000);
1525 dbgconverter(
"PTS: %" PRId64
" STC: %" PRId64
" (%" PRId64
") timeout: %d<br>\n", sb->Pts(), STC, Delta, sb->Timeout());
1542 int OsdWidth, OsdHeight;
1544 int VideoWidth, VideoHeight;
1572 if (sp->PageId() == PageId)
1585 if (Length > 5 && bs.
GetBits(8) == 0x0F) {
1586 int segmentType = bs.
GetBits(8);
1591 int segmentLength = bs.
GetBits(16);
1594 switch (segmentType) {
1597 dbgsegments(
"END_OF_DISPLAY_SET_SEGMENT (simulated)<br>\n");
1601 page->
Parse(Pts, bs);
1626 #ifndef FIX_SUBTITLE_VERSION_BROADCASTER_STUPIDITY
1630 bool displayWindowFlag = bs.
GetBit();
1636 if (displayWindowFlag) {
1650 bool disparity_shift_update_sequence_page_flag = bs.
GetBit();
1653 if (disparity_shift_update_sequence_page_flag) {
1656 int division_period_count = bs.
GetBits(8);
1657 for (
int i = 0; i < division_period_count; ++i) {
1662 while (!bs.
IsEOF()) {
1664 bool disparity_shift_update_sequence_region_flag = bs.
GetBit();
1666 int number_of_subregions_minus_1 = bs.
GetBits(2);
1667 for (
int i = 0; i <= number_of_subregions_minus_1; ++i) {
1668 if (number_of_subregions_minus_1 > 0) {
1675 if (disparity_shift_update_sequence_region_flag) {
1678 int division_period_count = bs.
GetBits(8);
1679 for (
int i = 0; i < division_period_count; ++i) {
1695 dbgsegments(
"*** unknown segment type: %02X<br>\n", segmentType);
1706 int segmentType = bs.
GetBits(8);
1707 int segmentLength = bs.
GetBits(16);
1712 switch (segmentType) {
1715 dbgsegments(
"PGS_DISPLAY_SEGMENT (simulated)<br>\n");
1730 int regionHorizontalAddress = bs.
GetBits(16);
1731 int regionVerticalAddress = bs.
GetBits(16);
1732 int regionWidth = bs.
GetBits(16);
1733 int regionHeight = bs.
GetBits(16);
1759 dbgsegments(
"*** unknown segment type: %02X<br>\n", segmentType);
1776 bool Reduced =
false;
1777 if (
osd && NumAreas > 0) {
1780 int HalfBpp = Bpp / 2;
1782 if (AreaOsd.
bpp >= Bpp) {
1783 AreaOsd.
bpp = HalfBpp;
1794 for (
int i = 0; i < NumAreas; i++) {
1798 cBitmap *bm =
new cBitmap(sr->RegionWidth(), sr->RegionHeight(), sr->RegionDepth());
1799 bm->
Replace(*clut->GetPalette(sr->RegionDepth()));
1800 sr->Render(bm, Page->
Objects());
1802 if (sr->RegionDepth() != Areas[i].
bpp) {
1803 if (sr->RegionLevelOfCompatibility() <= Areas[i].
bpp) {
1806 dbgregions(
"reduce region %d bpp %d level %d area bpp %d<br>\n", sr->RegionId(), sr->RegionDepth(), sr->RegionLevelOfCompatibility(), Areas[i].
bpp);
1810 dbgregions(
"condense region %d bpp %d level %d area bpp %d<br>\n", sr->RegionId(), sr->RegionDepth(), sr->RegionLevelOfCompatibility(), Areas[i].
bpp);
1815 bm->
SetOffset(srr->RegionHorizontalAddress(), srr->RegionVerticalAddress());
#define REGION_COMPOSITION_SEGMENT
bool SetLength(int Length)
void ParsePgs(int64_t Pts, cBitStream &bs)
static const char * SystemCharacterTable(void)
cDvbSubtitleConverter(void)
cList< cSubtitleClut > cluts
bool Decode2BppCodeString(cBitmap *Bitmap, int px, int py, cBitStream *bs, int &x, int y, const uint8_t *MapTable)
static void SetupChanged(void)
static cOsd * NewOsd(int Left, int Top, uint Level=OSD_LEVEL_DEFAULT)
Returns a pointer to a newly created cOsd object, which will be located at the given coordinates.
static cString sprintf(const char *fmt,...) __attribute__((format(printf
#define PGS_OBJECT_SEGMENT
void SetIndex(int x, int y, tIndex Index)
Sets the index at the given coordinates to Index.
#define PAGE_COMPOSITION_SEGMENT
void SetFirstPts(int64_t FirstPts)
cDvbSubtitlePage(int PageId)
void AddBitmap(cBitmap *Bitmap)
tColor GetColor(int x, int y) const
Returns the color at the given coordinates.
cList< cDvbSubtitlePage > * pages
const T * Get(int Index) const
Returns the list element at the given Index, or NULL if no such element exists.
int ExtractPgsSegment(const uchar *Data, int Length, int64_t Pts)
int ClutVersionNumber(void)
cList< cSubtitleRegionRef > regionRefs
#define DISPLAY_DEFINITION_SEGMENT
void Fill(tIndex Index)
Fills the bitmap data with the given Index.
void SetFactor(double Factor)
virtual int64_t GetSTC(void)
Gets the current System Time Counter, which can be used to synchronize audio, video and subtitles.
tArea * GetAreas(int &NumAreas)
int ObjectVerticalPosition(void)
tColor Color(int Index) const
Returns the color at the given Index.
const uint8_t * GetData(void) const
bool NonModifyingColorFlag(void)
The cOsd class is the interface to the "On Screen Display".
cList< cDvbSubtitleBitmaps > * bitmaps
void ParsePgs(cBitStream &bs)
cDvbSubtitleBitmaps(int State, int64_t Pts, int Timeout, tArea *Areas, int NumAreas, double OsdFactorX, double OsdFactorY, tArea &AreaCombined, tArea &AreaOsd)
int Convert(const uchar *Data, int Length)
static bool DebugSegments
unsigned char * Get(int &Length)
void DecodeCharacterString(const uchar *Data, int NumberOfCodes)
int regionVerticalAddress
cBitmap * Scaled(double FactorX, double FactorY, bool AntiAlias=false) const
Creates a copy of this bitmap, scaled by the given factors.
void DrawRectangle(int x1, int y1, int x2, int y2, tColor Color)
Draws a filled rectangle defined by the upper left (x1, y1) and lower right (x2, y2) corners with the...
void Add(cListObject *Object, cListObject *After=NULL)
tColor ArgbToColor(uint8_t A, uint8_t R, uint8_t G, uint8_t B)
#define dbgsegments(a...)
void ParsePgs(cBitStream &bs)
void DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width=0, int Height=0, int Alignment=taDefault)
Draws the given string at coordinates (x, y) with the given foreground and background color and font.
virtual ~cDvbSubtitleConverter()
int BackgroundPixelCode(void)
void Cancel(int WaitSeconds=0)
Cancels the thread by first setting 'running' to false, so that the Action() loop can finish in an or...
void Render(cBitmap *Bitmap, int px, int py, tIndex IndexFg, tIndex IndexBg)
bool DecodePgsCodeString(cBitmap *Bitmap, int px, int py, cBitStream *bs, int &x, int y)
#define END_OF_DISPLAY_SET_SEGMENT
static cDevice * PrimaryDevice(void)
Returns the primary device.
bool nonModifyingColorFlag
cVector< cBitmap * > bitmaps
void Set(int Ms=0)
Sets the timer.
const char * getCharacterTable(const unsigned char *&buffer, int &length, bool *isSingleByte)
int ObjectProviderFlag(void)
void WriteHtml(const char *Format,...)
void FinishPage(cDvbSubtitlePage *Page)
cSubtitleObjectRefPgs(cBitStream &bs)
#define OBJECT_DATA_SEGMENT
void DrawLine(cBitmap *Bitmap, int x, int y, tIndex Index, int Length)
int RegionVerticalAddress(void)
void Clean(void)
Marks the dirty area as clean.
void Del(cListObject *Object, bool DeleteObject=true)
#define dbgconverter(a...)
bool Running(void)
Returns false if a derived cThread object shall leave its Action() function.
int ObjectVersionNumber(void)
void SetPending(bool Pending)
void Parse(cBitStream &bs)
int ForegroundPixelCode(void)
#define PGS_PRESENTATION_SEGMENT
cSubtitleObject * GetObjectById(int ObjectId, bool New=false)
#define PGS_WINDOW_SEGMENT
virtual void GetVideoSize(int &Width, int &Height, double &VideoAspect)
Returns the Width, Height and VideoAspect ratio of the currently displayed video material.
cString WriteJpeg(const cBitmap *Bitmap, int MaxX=0, int MaxY=0)
virtual int Height(void) const =0
Returns the height of this font in pixel (all characters have the same height).
bool RegionFillFlag(void)
const char * Convert(const char *From, char *To=NULL, size_t ToLength=0)
Converts the given Text from FromCode to ToCode (as set in the constructor).
int objectHorizontalPosition
virtual ~cDvbSubtitleAssembler()
#define CLUT_DEFINITION_SEGMENT
void Parse(cBitStream &bs)
int SubtitleBgTransparency
#define PGS_PALETTE_SEGMENT
cSubtitleRegionRef * GetRegionRefByIndex(int RegionRefIndex)
cSubtitleRegionRef(int id, int x, int y)
cSubtitleObjects * Objects(void)
void SetColor(int Index, tColor Color)
Sets the palette entry at Index to Color.
void DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg=0, tColor ColorBg=0, bool ReplacePalette=false, bool Overlay=false)
Sets the pixels in this bitmap with the data from the given Bitmap, putting the upper left corner of ...
const cSubtitleObject * First(void) const
Returns the first element in this list, or NULL if the list is empty.
void Parse(int64_t Pts, cBitStream &bs)
cDvbSubtitleAssembler * dvbSubtitleAssembler
cDvbSubtitlePage * GetPageById(int PageId, bool New=false)
int windowHorizontalOffset
virtual void GetOsdSize(int &Width, int &Height, double &PixelAspect)
Returns the Width, Height and PixelAspect ratio the OSD should use to best fit the resolution of the ...
#define OSD_LEVEL_SUBTITLES
int PageVersionNumber(void)
void Render(cBitmap *Bitmap, cSubtitleObjects *Objects)
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas)
Sets the sub-areas to the given areas.
tArea CombineAreas(int NumAreas, const tArea *Areas)
cList< cSubtitleObjectRef > objectRefs
int objectVerticalPosition
cList< cSubtitleRegion > regions
int ObjectCodingMethod(void)
void ReduceBpp(const cPalette &Palette)
Reduces the color depth of the bitmap to that of the given Palette.
static cFont * CreateFont(const char *Name, int CharHeight, int CharWidth=0)
Creates a new font object with the given Name and makes its characters CharHeight pixels high.
bool Dirty(int &x1, int &y1, int &x2, int &y2)
Tells whether there is a dirty area and returns the bounding rectangle of that area (relative to the ...
int ConvertFragments(const uchar *Data, int Length)
static void SleepMs(int TimeoutMs)
Creates a cCondWait object and uses it to sleep for TimeoutMs milliseconds, immediately giving up the...
cSubtitleRegion(int RegionId)
cSubtitleClut * GetClutById(int ClutId, bool New=false)
void Put(const uchar *Data, int Length)
void SetColor(int Bpp, int Index, tColor Color)
bool TimedOut(void) const
virtual void DrawScaledBitmap(int x, int y, const cBitmap &Bitmap, double FactorX, double FactorY, bool AntiAlias=false)
Sets the pixels in the OSD with the data from the given Bitmap, putting the upper left corner of the ...
int ObjectHorizontalPosition(void)
cSubtitleRegion * GetRegionById(int RegionId, bool New=false)
cSubtitleClut(int ClutId)
const cPalette * GetPalette(int Bpp)
void SetOffset(int X0, int Y0)
Sets the offset of this bitmap to the given values.
virtual void Action(void)
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas)
Checks whether the OSD can display the given set of sub-areas.
static bool DebugConverter
virtual int Width(void) const =0
Returns the original character width as requested when the font was created, or 0 if the default widt...
const cSubtitleObject * Next(const cSubtitleObject *Object) const
< Returns the element immediately before Object in this list, or NULL if Object is the first element ...
int ExtractSegment(const uchar *Data, int Length, int64_t Pts)
void bool Start(void)
Sets the description of this thread, which will be used when logging starting or stopping of the thre...
tArea ScaleArea(const tArea &Area, double FactorX, double FactorY)
virtual void Append(T Data)
cSubtitleObject(int ObjectId)
void SetDimensions(int Width, int Height)
cDvbSubtitleAssembler(void)
int regionLevelOfCompatibility
void ParsePgs(cBitStream &bs)
int64_t PesGetPts(const uchar *p)
void DbgDump(int WindowWidth, int WindowHeight)
void Replace(const cPalette &Palette)
Replaces the colors of this palette with the colors from the given palette.
int RegionHorizontalAddress(void)
#define PGS_DISPLAY_SEGMENT
virtual void Flush(void)
Actually commits all data to the OSD hardware.
int RegionVersionNumber(void)
void Parse(cBitStream &bs)
int PesPayloadOffset(const uchar *p)
char FontOsd[MAXFONTNAME]
#define DISPARITY_SIGNALING_SEGMENT
bool Decode8BppCodeString(cBitmap *Bitmap, int px, int py, cBitStream *bs, int &x, int y)
tColor yuv2rgb(int Y, int Cb, int Cr)
void AddRegionRef(cSubtitleRegionRef *rf)
int RegionLevelOfCompatibility(void)
cSubtitleObject * GetObjectById(int ObjectId, bool New=false)
bool PesHasPts(const uchar *p)
void ShrinkBpp(int NewBpp)
Shrinks the color depth of the bitmap to NewBpp by keeping only the 2^NewBpp most frequently used col...
bool Decode4BppCodeString(cBitmap *Bitmap, int px, int py, cBitStream *bs, int &x, int y, const uint8_t *MapTable)
int SubtitleFgTransparency
void DecodeSubBlock(cBitmap *Bitmap, int px, int py, const uchar *Data, int Length, bool Even)
int regionHorizontalAddress