vdr 2.8.1
dvbspu.c
Go to the documentation of this file.
1/*
2 * SPU decoder for DVB devices
3 *
4 * Copyright (C) 2001.2002 Andreas Schultz <aschultz@warp10.net>
5 *
6 * This code is distributed under the terms and conditions of the
7 * GNU GENERAL PUBLIC LICENSE. See the file COPYING for details.
8 *
9 * parts of this file are derived from the OMS program.
10 *
11 * $Id: dvbspu.c 5.1 2026/03/09 20:08:29 kls Exp $
12 */
13
14#include "dvbspu.h"
15#include <assert.h>
16#include <string.h>
17#include <inttypes.h>
18#include <math.h>
19
20/*
21 * cDvbSpubitmap:
22 *
23 * this is a bitmap of the full screen and two palettes
24 * the normal palette for the background and the highlight palette
25 *
26 * Inputs:
27 * - a SPU rle encoded image on creation, which will be decoded into
28 * the full screen indexed bitmap
29 *
30 * Output:
31 * - a minimal sized cDvbSpuBitmap a given palette, the indexed bitmap
32 * will be scanned to get the smallest possible resulting bitmap considering
33 * transparencies
34 */
35
36// #define SPUDEBUG
37
38#ifdef SPUDEBUG
39#define DEBUG(format, args...) printf (format, ## args)
40#else
41#define DEBUG(format, args...) void()
42#endif
43
44// --- cDvbSpuPalette---------------------------------------------------------
45
46void cDvbSpuPalette::setPalette(const uint32_t * pal)
47{
48 for (int i = 0; i < 16; i++)
49 palette[i] = yuv2rgb(pal[i]);
50}
51
52// --- cDvbSpuBitmap ---------------------------------------------------------
53
54#define setMin(a, b) if (a > b) a = b
55#define setMax(a, b) if (a < b) a = b
56
57// DVD SPU bitmaps cover max. 720 x 576 - this sizes the SPU bitmap
58#define spuXres 720
59#define spuYres 576
60
61#define revRect(r1, r2) { r1.x1 = r2.x2; r1.y1 = r2.y2; r1.x2 = r2.x1; r1.y2 = r2.y1; }
62
64 uint8_t * fodd, uint8_t * eodd,
65 uint8_t * feven, uint8_t * eeven)
66{
67 size.x1 = max(size.x1, 0);
68 size.y1 = max(size.y1, 0);
69 size.x2 = min(size.x2, spuXres - 1);
70 size.y2 = min(size.y2, spuYres - 1);
71
72 bmpsize = size;
73 revRect(minsize[0], size);
74 revRect(minsize[1], size);
75 revRect(minsize[2], size);
76 revRect(minsize[3], size);
77
78 int MemSize = spuXres * spuYres * sizeof(uint8_t);
79 bmp = new uint8_t[MemSize];
80
81 if (bmp)
82 memset(bmp, 0, MemSize);
83 putFieldData(0, fodd, eodd);
84 putFieldData(1, feven, eeven);
85}
86
88{
89 delete[]bmp;
90}
91
93 const cDvbSpuPalette & pal,
94 sDvbSpuRect & size) const
95{
96 int h = size.height();
97 int w = size.width();
98
99 if (size.y1 + h >= spuYres)
100 h = spuYres - size.y1 - 1;
101 if (size.x1 + w >= spuXres)
102 w = spuXres - size.x1 - 1;
103
104 if (w & 0x03)
105 w += 4 - (w & 0x03);
106
107 cBitmap *ret = new cBitmap(w, h, 2);
108
109 // set the palette
110 for (int i = 0; i < 4; i++) {
111 uint32_t color =
112 pal.getColor(paldescr[i].index, paldescr[i].trans);
113 ret->SetColor(i, (tColor) color);
114 }
115
116 // set the content
117 if (bmp) {
118 for (int yp = 0; yp < h; yp++) {
119 for (int xp = 0; xp < w; xp++) {
120 uint8_t idx = bmp[(size.y1 + yp) * spuXres + size.x1 + xp];
121 ret->SetIndex(xp, yp, idx);
122 }
123 }
124 }
125 return ret;
126}
127
128// find the minimum non-transparent area
130 sDvbSpuRect & size) const
131{
132 bool ret = false;
133 for (int i = 0; i < 4; i++) {
134 if (paldescr[i].trans != 0) {
135 if (!ret)
136 size = minsize[i];
137 else {
138 setMin(size.x1, minsize[i].x1);
139 setMin(size.y1, minsize[i].y1);
140 setMax(size.x2, minsize[i].x2);
141 setMax(size.y2, minsize[i].y2);
142 }
143 ret = true;
144 }
145 }
146 if (ret)
147 DEBUG("MinSize: (%d, %d) x (%d, %d)\n",
148 size.x1, size.y1, size.x2, size.y2);
149 if (size.x1 > size.x2 || size.y1 > size.y2)
150 return false;
151
152 return ret;
153}
154
155void cDvbSpuBitmap::putPixel(int xp, int yp, int len, uint8_t colorid)
156{
157 if (bmp)
158 memset(bmp + spuXres * yp + xp, colorid, len);
159 setMin(minsize[colorid].x1, xp);
160 setMin(minsize[colorid].y1, yp);
161 setMax(minsize[colorid].x2, xp + len - 1);
162 setMax(minsize[colorid].y2, yp);
163}
164
165static uint8_t getBits(uint8_t * &data, uint8_t & bitf)
166{
167 uint8_t ret = *data;
168 if (bitf)
169 ret >>= 4;
170 else
171 data++;
172 bitf ^= 1;
173
174 return (ret & 0xf);
175}
176
177void cDvbSpuBitmap::putFieldData(int field, uint8_t * data, uint8_t * endp)
178{
179 int xp = bmpsize.x1;
180 int yp = bmpsize.y1 + field;
181 uint8_t bitf = 1;
182
183 while (data < endp) {
184 uint16_t vlc = getBits(data, bitf);
185 if (vlc < 0x0004) {
186 vlc = (vlc << 4) | getBits(data, bitf);
187 if (vlc < 0x0010) {
188 vlc = (vlc << 4) | getBits(data, bitf);
189 if (vlc < 0x0040) {
190 vlc = (vlc << 4) | getBits(data, bitf);
191 }
192 }
193 }
194
195 uint8_t color = vlc & 0x03;
196 int len = vlc >> 2;
197
198 // if len == 0 -> end sequence - fill to end of line
199 len = len ? len : bmpsize.x2 - xp + 1;
200 putPixel(xp, yp, len, color);
201 xp += len;
202
203 if (xp > bmpsize.x2) {
204 // nextLine
205 if (!bitf)
206 data++;
207 bitf = 1;
208 xp = bmpsize.x1;
209 yp += 2;
210 if (yp > bmpsize.y2)
211 return;
212 }
213 }
214}
215
216// --- cDvbSpuDecoder---------------------------------------------------------
217
218#define CMD_SPU_MENU 0x00
219#define CMD_SPU_SHOW 0x01
220#define CMD_SPU_HIDE 0x02
221#define CMD_SPU_SET_PALETTE 0x03
222#define CMD_SPU_SET_ALPHA 0x04
223#define CMD_SPU_SET_SIZE 0x05
224#define CMD_SPU_SET_PXD_OFFSET 0x06
225#define CMD_SPU_CHG_COLCON 0x07
226#define CMD_SPU_EOF 0xff
227
228#define spuU32(i) ((spu[i] << 8) + spu[i+1])
229
231{
232 clean = true;
234 xres = spuXres;
235 yres = spuYres;
236 spu = NULL;
237 osd = NULL;
238 spubmp = NULL;
239 allowedShow = false;
240}
241
243{
244 delete spubmp;
245 delete spu;
246 delete osd;
247}
248
249// SPUs must be scaled if screensize is not 720x576
250
252{
253 int Width = xres;
254 int Height = yres;
255 int OsdWidth = 0;
256 int OsdHeight = 0;
257 double VideoAspect;
258 cDevice::PrimaryDevice()->GetOsdSize(OsdWidth, OsdHeight, VideoAspect);
259 DEBUG("dvbspu SetSpuScaling OsdSize %d x %d\n", OsdWidth, OsdHeight);
260 if (!OsdWidth) { // guess correct size
261 if (Setup.OSDWidth <= 720 || Setup.OSDHeight <= 576)
262 xscaling = yscaling = 1.0;
263 else if (Setup.OSDWidth <= 1280 || Setup.OSDHeight <= 720) {
264 xscaling = 1280.0 / Width;
265 yscaling = 720.0 / Height;
266 }
267 else {
268 xscaling = 1920.0 / Width;
269 yscaling = 1080.0/ Height;
270 }
271 }
272 else {
273 xscaling = (double)OsdWidth / Width;
274 yscaling = (double)OsdHeight / Height;
275 }
276 DEBUG("dvbspu xscaling = %f yscaling = %f\n", xscaling, yscaling);
277}
278
279void cDvbSpuDecoder::processSPU(uint32_t pts, uint8_t * buf, bool AllowedShow)
280{
281 setTime(pts);
282
283 DEBUG("SPU pushData: pts: %d\n", pts);
284
285 delete spubmp;
286 spubmp = NULL;
287 delete[]spu;
288 spu = buf;
289 spupts = pts;
290
293
294 clean = true;
295 allowedShow = AllowedShow;
296}
297
299{
300 scaleMode = ScaleMode;
301}
302
303void cDvbSpuDecoder::setResolution(int Xres, int Yres)
304{
305 if (Xres > 0)
306 xres = Xres;
307 if (Yres > 0)
308 yres = Yres;
309}
310
311void cDvbSpuDecoder::setPalette(uint32_t * pal)
312{
313 palette.setPalette(pal);
314}
315
316void cDvbSpuDecoder::setHighlight(uint16_t sx, uint16_t sy,
317 uint16_t ex, uint16_t ey,
318 uint32_t palette)
319{
320 aDvbSpuPalDescr pld;
321 for (int i = 0; i < 4; i++) {
322 pld[i].index = 0xf & (palette >> (16 + 4 * i));
323 pld[i].trans = 0xf & (palette >> (4 * i));
324 }
325
326 bool ne = hlpsize.x1 != sx || hlpsize.y1 != sy ||
327 hlpsize.x2 != ex || hlpsize.y2 != ey ||
328 pld[0] != hlpDescr[0] || pld[1] != hlpDescr[1] ||
329 pld[2] != hlpDescr[2] || pld[3] != hlpDescr[3];
330
331 if (ne) {
332 DEBUG("setHighlight: %d,%d x %d,%d\n", sx, sy, ex, ey);
333 hlpsize.x1 = sx;
334 hlpsize.y1 = sy;
335 hlpsize.x2 = ex;
336 hlpsize.y2 = ey;
337 memcpy(hlpDescr, pld, sizeof(aDvbSpuPalDescr));
338 highlight = true;
339 clean = false;
340 Draw(); // we have to trigger Draw() here
341 }
342}
343
345{
346 clean &= !highlight;
347 highlight = false;
348 hlpsize.x1 = -1;
349 hlpsize.y1 = -1;
350 hlpsize.x2 = -1;
351 hlpsize.y2 = -1;
352}
353
355{
357 if (fgbmp && bgbmp) {
358 size.x1 = min(fgsize.x1, bgsize.x1);
359 size.y1 = min(fgsize.y1, bgsize.y1);
360 size.x2 = max(fgsize.x2, bgsize.x2);
361 size.y2 = max(fgsize.y2, bgsize.y2);
362 }
363 else if (fgbmp) {
364 size.x1 = fgsize.x1;
365 size.y1 = fgsize.y1;
366 size.x2 = fgsize.x2;
367 size.y2 = fgsize.y2;
368 }
369 else if (bgbmp) {
370 size.x1 = bgsize.x1;
371 size.y1 = bgsize.y1;
372 size.x2 = bgsize.x2;
373 size.y2 = bgsize.y2;
374 }
375 else {
376 size.x1 = 0;
377 size.y1 = 0;
378 size.x2 = 0;
379 size.y2 = 0;
380 }
381 return size;
382}
383
385{
386 int col = 1;
387 for (int i = 0; i < 4; i++) {
388 if (paldescr[i].trans != 0) {
389 col++;
390 }
391 }
392 return col > 2 ? 2 : 1;
393}
394
396{
397 int fgbpp = 0;
398 int bgbpp = 0;
399 int ret;
400 if (fgbmp) {
401 fgbpp = spubmp->getMinBpp(hlpDescr);
402 }
403 if (bgbmp) {
404 bgbpp = spubmp->getMinBpp(palDescr);
405 }
406 ret = fgbpp + bgbpp;
407 if (ret > 2)
408 ret = 4;
409 return ret;
410}
411
413{
414 cMutexLock MutexLock(&mutex);
415 if (!spubmp) {
416 Hide();
417 return;
418 }
419 sDvbSpuRect bgsize;
420 sDvbSpuRect drawsize;
421 sDvbSpuRect bgdrawsize;
422 cBitmap *fg = NULL;
423 cBitmap *bg = NULL;
424 cBitmap *tmp = NULL;
425
426 SetSpuScaling(); // always set current scaling, size could have changed
427
428 if (highlight) {
429 tmp = spubmp->getBitmap(hlpDescr, palette, hlpsize);
430 fg = tmp->Scaled(xscaling, yscaling, true);
431 drawsize.x1 = hlpsize.x1 * xscaling;
432 drawsize.y1 = hlpsize.y1 * yscaling;
433 drawsize.x2 = drawsize.x1 + fg->Width();
434 drawsize.y2 = drawsize.y1 + fg->Height();
435 }
436
437 if (spubmp->getMinSize(palDescr, bgsize)) {
438 tmp = spubmp->getBitmap(palDescr, palette, bgsize);
439 bg = tmp->Scaled(xscaling, yscaling, true);
440 bgdrawsize.x1 = bgsize.x1 * xscaling;
441 bgdrawsize.y1 = bgsize.y1 * yscaling;
442 bgdrawsize.x2 = bgdrawsize.x1 + bg->Width();
443 bgdrawsize.y2 = bgdrawsize.y1 + bg->Height();
444 }
445
446 if (osd) // always rewrite OSD
447 Hide();
448
449 if (osd == NULL) {
450 restricted_osd = false;
452
453 sDvbSpuRect areaSize = CalcAreaSize(drawsize, fg, bgdrawsize, bg); // combine
454 tArea Area = { areaSize.x1, areaSize.y1, areaSize.x2, areaSize.y2, 4 };
455 if (osd->CanHandleAreas(&Area, 1) != oeOk) {
456 DEBUG("dvbspu CanHandleAreas (%d,%d)x(%d,%d), 4 failed\n", areaSize.x1, areaSize.y1, areaSize.x2, areaSize.y2);
457 restricted_osd = true;
458 }
459 else
460 osd->SetAreas(&Area, 1);
461 }
462 if (restricted_osd) {
463 sDvbSpuRect hlsize;
464 bool setarea = false;
465 /* reduce fg area */
466 if (fg) {
467 spubmp->getMinSize(hlpDescr,hlsize);
468 /* clip to the highligh area */
469 setMax(hlsize.x1, hlpsize.x1);
470 setMax(hlsize.y1, hlpsize.y1);
471 setMin(hlsize.x2, hlpsize.x2);
472 setMin(hlsize.y2, hlpsize.y2);
473 if (hlsize.x1 > hlsize.x2 || hlsize.y1 > hlsize.y2)
474 hlsize.x1 = hlsize.x2 = hlsize.y1 = hlsize.y2 = 0;
475 /* resize scaled fg */
476 drawsize.x1=hlsize.x1 * xscaling;
477 drawsize.y1=hlsize.y1 * yscaling;
478 drawsize.x2=hlsize.x2 * xscaling;
479 drawsize.y2=hlsize.y2 * yscaling;
480 }
481 sDvbSpuRect areaSize = CalcAreaSize(drawsize, fg, bgdrawsize, bg);
482
483#define DIV(a, b) (a/b)?:1
484 for (int d = 1; !setarea && d <= 2; d++) {
485
486 /* first try old behaviour */
487 tArea Area = { areaSize.x1, areaSize.y1, areaSize.x2, areaSize.y2, DIV(CalcAreaBpp(fg, bg), d) };
488
489 if ((Area.Width() & 7) != 0)
490 Area.x2 += 8 - (Area.Width() & 7);
491
492 if (osd->CanHandleAreas(&Area, 1) == oeOk &&
493 osd->SetAreas(&Area, 1) == oeOk)
494 setarea = true;
495
496 /* second try to split area if there is both area */
497 if (!setarea && fg && bg) {
498 tArea Area_Both [2] = {
499 { bgdrawsize.x1, bgdrawsize.y1, bgdrawsize.x2, bgdrawsize.y2, DIV(CalcAreaBpp(0, bg), d) },
500 { drawsize.x1, drawsize.y1, drawsize.x2, drawsize.y2, DIV(CalcAreaBpp(fg, 0), d) }
501 };
502 if (!Area_Both[0].Intersects(Area_Both[1])) {
503 /* there is no intersection. We can try with split areas */
504 if ((Area_Both[0].Width() & 7) != 0)
505 Area_Both[0].x2 += 8 - (Area_Both[0].Width() & 7);
506 if ((Area_Both[1].Width() & 7) != 0)
507 Area_Both[1].x2 += 8 - (Area_Both[1].Width() & 7);
508 if (osd->CanHandleAreas(Area_Both, 2) == oeOk &&
509 osd->SetAreas(Area_Both, 2) == oeOk)
510 setarea = true;
511 }
512 }
513 }
514 if (setarea)
515 DEBUG("dvbspu: reduced AreaSize (%d, %d) (%d, %d) Bpp %d\n", areaSize.x1, areaSize.y1, areaSize.x2, areaSize.y2, (fg && bg) ? 4 : 2);
516 else
517 dsyslog("dvbspu: reduced AreaSize (%d, %d) (%d, %d) Bpp %d failed", areaSize.x1, areaSize.y1, areaSize.x2, areaSize.y2, (fg && bg) ? 4 : 2);
518 }
519
520 /* we could draw use DrawPixel on osd */
521 if (bg || fg) {
522 if (bg)
523 osd->DrawBitmap(bgdrawsize.x1, bgdrawsize.y1, *bg);
524 if (fg)
525 osd->DrawBitmap(drawsize.x1, drawsize.y1, *fg);
526 delete fg;
527 delete bg;
528 delete tmp;
529
530 osd->Flush();
531 }
532
533 clean = true;
534}
535
537{
538 cMutexLock MutexLock(&mutex);
539 delete osd;
540 osd = NULL;
541}
542
544{
545 Hide();
546
547 delete spubmp;
548 spubmp = NULL;
549
550 delete[]spu;
551 spu = NULL;
552
554 clean = true;
555}
556
557int cDvbSpuDecoder::setTime(uint32_t pts)
558{
559 if (!spu)
560 return 0;
561
562 if (!clean)
563 Draw();
564
565 while (DCSQ_offset != prev_DCSQ_offset) { /* Display Control Sequences */
566 int i = DCSQ_offset;
567 state = spNONE;
568
569 uint32_t exec_time = spupts + spuU32(i) * 1024;
570 if ((pts != 0) && (exec_time > pts))
571 return 0;
572 DEBUG("offs = %d, rel = %d, time = %d, pts = %d, diff = %d\n",
573 i, spuU32(i) * 1024, exec_time, pts, exec_time - pts);
574
575 if (pts != 0) {
576 uint16_t feven = 0;
577 uint16_t fodd = 0;
578
579 i += 2;
580
582 DCSQ_offset = spuU32(i);
583 DEBUG("offs = %d, DCSQ = %d, prev_DCSQ = %d\n",
585 i += 2;
586
587 while (spu[i] != CMD_SPU_EOF) { // Command Sequence
588 switch (spu[i]) {
589 case CMD_SPU_SHOW: // show subpicture
590 DEBUG("\tshow subpicture\n");
591 state = spSHOW;
592 i++;
593 break;
594
595 case CMD_SPU_HIDE: // hide subpicture
596 DEBUG("\thide subpicture\n");
597 state = spHIDE;
598 i++;
599 break;
600
601 case CMD_SPU_SET_PALETTE: // CLUT
602 palDescr[0].index = spu[i + 2] & 0xf;
603 palDescr[1].index = spu[i + 2] >> 4;
604 palDescr[2].index = spu[i + 1] & 0xf;
605 palDescr[3].index = spu[i + 1] >> 4;
606 i += 3;
607 break;
608
609 case CMD_SPU_SET_ALPHA: // transparency palette
610 palDescr[0].trans = spu[i + 2] & 0xf;
611 palDescr[1].trans = spu[i + 2] >> 4;
612 palDescr[2].trans = spu[i + 1] & 0xf;
613 palDescr[3].trans = spu[i + 1] >> 4;
614 i += 3;
615 break;
616
617 case CMD_SPU_SET_SIZE: // image coordinates
618 size.x1 = (spu[i + 1] << 4) | (spu[i + 2] >> 4);
619 size.x2 = ((spu[i + 2] & 0x0f) << 8) | spu[i + 3];
620
621 size.y1 = (spu[i + 4] << 4) | (spu[i + 5] >> 4);
622 size.y2 = ((spu[i + 5] & 0x0f) << 8) | spu[i + 6];
623
624 DEBUG("\t(%d, %d) x (%d, %d)\n",
625 size.x1, size.y1, size.x2, size.y2);
626 i += 7;
627 break;
628
629 case CMD_SPU_SET_PXD_OFFSET: // image 1 / image 2 offsets
630 fodd = spuU32(i + 1);
631 feven = spuU32(i + 3);
632 DEBUG("\todd = %d even = %d\n", fodd, feven);
633 i += 5;
634 break;
635
636 case CMD_SPU_CHG_COLCON: {
637 int size = spuU32(i + 1);
638 i += 1 + size;
639 }
640 break;
641
642 case CMD_SPU_MENU:
643 DEBUG("\tspu menu\n");
644 state = spMENU;
645
646 i++;
647 break;
648
649 default:
650 esyslog("invalid sequence in control header (%.2x)",
651 spu[i]);
652 Empty();
653 return 0;
654 }
655 }
656 if (fodd != 0 && feven != 0) {
657 Hide();
658 delete spubmp;
659 spubmp = new cDvbSpuBitmap(size, spu + fodd, spu + feven,
660 spu + feven, spu + cmdOffs());
661 }
662 } else if (!clean)
663 state = spSHOW;
664
665 if ((state == spSHOW && allowedShow) || state == spMENU)
666 Draw();
667
668 if (state == spHIDE)
669 Hide();
670
671 if (pts == 0)
672 return 0;
673 }
674
675 return 1;
676}
Definition osd.h:170
int Height(void) const
Definition osd.h:190
cBitmap * Scaled(double FactorX, double FactorY, bool AntiAlias=false) const
Creates a copy of this bitmap, scaled by the given factors.
Definition osd.c:838
void SetIndex(int x, int y, tIndex Index)
Sets the index at the given coordinates to Index.
Definition osd.c:500
int Width(void) const
Definition osd.h:189
static cDevice * PrimaryDevice(void)
Returns the primary device.
Definition device.h:148
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 ...
Definition device.c:540
uint8_t * bmp
Definition dvbspu.h:73
int getMinBpp(const aDvbSpuPalDescr paldescr)
Definition dvbspu.c:384
void putFieldData(int field, uint8_t *data, uint8_t *endp)
Definition dvbspu.c:177
sDvbSpuRect bmpsize
Definition dvbspu.h:71
void putPixel(int xp, int yp, int len, uint8_t colorid)
Definition dvbspu.c:155
bool getMinSize(const aDvbSpuPalDescr paldescr, sDvbSpuRect &size) const
Definition dvbspu.c:129
cBitmap * getBitmap(const aDvbSpuPalDescr paldescr, const cDvbSpuPalette &pal, sDvbSpuRect &size) const
Definition dvbspu.c:92
~cDvbSpuBitmap()
Definition dvbspu.c:87
cDvbSpuBitmap(sDvbSpuRect size, uint8_t *fodd, uint8_t *eodd, uint8_t *feven, uint8_t *eeven)
Definition dvbspu.c:63
sDvbSpuRect minsize[4]
Definition dvbspu.h:72
uint16_t prev_DCSQ_offset
Definition dvbspu.h:126
void Hide(void)
Definition dvbspu.c:536
void processSPU(uint32_t pts, uint8_t *buf, bool AllowedShow)
Definition dvbspu.c:279
void SetSpuScaling(void)
Definition dvbspu.c:251
void Draw(void)
Definition dvbspu.c:412
bool highlight
Definition dvbspu.h:114
void setHighlight(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint32_t palette)
Definition dvbspu.c:316
bool restricted_osd
Definition dvbspu.h:104
void setPalette(uint32_t *pal)
Definition dvbspu.c:311
void clearHighlight(void)
Definition dvbspu.c:344
cMutex mutex
Definition dvbspu.h:98
int setTime(uint32_t pts)
Definition dvbspu.c:557
aDvbSpuPalDescr hlpDescr
Definition dvbspu.h:116
void setScaleMode(cSpuDecoder::eScaleMode ScaleMode)
Definition dvbspu.c:298
bool allowedShow
Definition dvbspu.h:129
void Empty(void)
Definition dvbspu.c:543
cDvbSpuBitmap * spubmp
Definition dvbspu.h:128
spFlag state
Definition dvbspu.h:107
double yscaling
Definition dvbspu.h:111
double xscaling
Definition dvbspu.h:111
cOsd * osd
Definition dvbspu.h:97
uint8_t * spu
Definition dvbspu.h:101
int CalcAreaBpp(cBitmap *fgbmp, cBitmap *bgbmp)
Definition dvbspu.c:395
int cmdOffs(void)
Definition dvbspu.h:131
sDvbSpuRect CalcAreaSize(sDvbSpuRect fgsize, cBitmap *fgbmp, sDvbSpuRect bgsize, cBitmap *bgbmp)
Definition dvbspu.c:354
void setResolution(int Xres, int Yres)
Definition dvbspu.c:303
sDvbSpuRect size
Definition dvbspu.h:122
cSpuDecoder::eScaleMode scaleMode
Definition dvbspu.h:109
sDvbSpuRect hlpsize
Definition dvbspu.h:115
cDvbSpuPalette palette
Definition dvbspu.h:119
uint16_t DCSQ_offset
Definition dvbspu.h:125
uint32_t spupts
Definition dvbspu.h:102
aDvbSpuPalDescr palDescr
Definition dvbspu.h:123
uint32_t palette[16]
Definition dvbspu.h:57
void setPalette(const uint32_t *pal)
Definition dvbspu.c:46
uint32_t yuv2rgb(uint32_t yuv_color)
Definition dvbspu.h:164
uint32_t getColor(uint8_t idx, uint8_t trans) const
Definition dvbspu.h:205
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.
Definition osd.c:2290
void SetColor(int Index, tColor Color)
Sets the palette entry at Index to Color.
Definition osd.c:172
eScaleMode
Definition spu.h:21
@ eSpuNormal
Definition spu.h:21
cSetup Setup
Definition config.c:372
#define spuU32(i)
Definition dvbspu.c:228
#define CMD_SPU_SET_PXD_OFFSET
Definition dvbspu.c:224
#define spuYres
Definition dvbspu.c:59
static uint8_t getBits(uint8_t *&data, uint8_t &bitf)
Definition dvbspu.c:165
#define setMax(a, b)
Definition dvbspu.c:55
#define DEBUG(format, args...)
Definition dvbspu.c:41
#define CMD_SPU_SET_PALETTE
Definition dvbspu.c:221
#define DIV(a, b)
#define setMin(a, b)
Definition dvbspu.c:54
#define CMD_SPU_CHG_COLCON
Definition dvbspu.c:225
#define CMD_SPU_SET_ALPHA
Definition dvbspu.c:222
#define CMD_SPU_SHOW
Definition dvbspu.c:219
#define CMD_SPU_EOF
Definition dvbspu.c:226
#define CMD_SPU_MENU
Definition dvbspu.c:218
#define spuXres
Definition dvbspu.c:58
#define CMD_SPU_SET_SIZE
Definition dvbspu.c:223
#define revRect(r1, r2)
Definition dvbspu.c:61
#define CMD_SPU_HIDE
Definition dvbspu.c:220
struct sDvbSpuPalDescr aDvbSpuPalDescr[4]
uint32_t tColor
Definition font.h:30
@ oeOk
Definition osd.h:45
int width() const
Definition dvbspu.h:39
int height() const
Definition dvbspu.h:42
Definition osd.h:300
int Width(void) const
Definition osd.h:303
int x2
Definition osd.h:301
#define dsyslog(a...)
Definition tools.h:37
T min(T a, T b)
Definition tools.h:63
T max(T a, T b)
Definition tools.h:64
#define esyslog(a...)
Definition tools.h:35