vdr 2.8.4
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.5 2026/10/21 13:58:44 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 highlight = false;
241 memset(hlpDescr, 0, sizeof(hlpDescr));
242}
243
245{
246 delete spubmp;
247 delete[] spu;
249}
250
251// SPUs must be scaled if screensize is not 720x576
252
254{
255 int Width = xres;
256 int Height = yres;
257 int OsdWidth = 0;
258 int OsdHeight = 0;
259 double VideoAspect;
260 cDevice::PrimaryDevice()->GetOsdSize(OsdWidth, OsdHeight, VideoAspect);
261 DEBUG("dvbspu SetSpuScaling OsdSize %d x %d\n", OsdWidth, OsdHeight);
262 if (!OsdWidth) { // guess correct size
263 if (Setup.OSDWidth <= 720 || Setup.OSDHeight <= 576)
264 xscaling = yscaling = 1.0;
265 else if (Setup.OSDWidth <= 1280 || Setup.OSDHeight <= 720) {
266 xscaling = 1280.0 / Width;
267 yscaling = 720.0 / Height;
268 }
269 else {
270 xscaling = 1920.0 / Width;
271 yscaling = 1080.0/ Height;
272 }
273 }
274 else {
275 xscaling = (double)OsdWidth / Width;
276 yscaling = (double)OsdHeight / Height;
277 }
278 DEBUG("dvbspu xscaling = %f yscaling = %f\n", xscaling, yscaling);
279}
280
281void cDvbSpuDecoder::processSPU(uint32_t pts, uint8_t * buf, bool AllowedShow)
282{
283 setTime(pts);
284
285 DEBUG("SPU pushData: pts: %d\n", pts);
286
287 delete spubmp;
288 spubmp = NULL;
289 delete[]spu;
290 spu = buf;
291 spupts = pts;
292
295
296 clean = true;
297 allowedShow = AllowedShow;
298}
299
301{
302 scaleMode = ScaleMode;
303}
304
305void cDvbSpuDecoder::setResolution(int Xres, int Yres)
306{
307 if (Xres > 0)
308 xres = Xres;
309 if (Yres > 0)
310 yres = Yres;
311}
312
313void cDvbSpuDecoder::setPalette(uint32_t * pal)
314{
315 palette.setPalette(pal);
316}
317
318void cDvbSpuDecoder::setHighlight(uint16_t sx, uint16_t sy,
319 uint16_t ex, uint16_t ey,
320 uint32_t palette)
321{
322 aDvbSpuPalDescr pld;
323 for (int i = 0; i < 4; i++) {
324 pld[i].index = 0xf & (palette >> (16 + 4 * i));
325 pld[i].trans = 0xf & (palette >> (4 * i));
326 }
327
328 bool ne = hlpsize.x1 != sx || hlpsize.y1 != sy ||
329 hlpsize.x2 != ex || hlpsize.y2 != ey ||
330 pld[0] != hlpDescr[0] || pld[1] != hlpDescr[1] ||
331 pld[2] != hlpDescr[2] || pld[3] != hlpDescr[3];
332
333 if (ne) {
334 DEBUG("setHighlight: %d,%d x %d,%d\n", sx, sy, ex, ey);
335 hlpsize.x1 = sx;
336 hlpsize.y1 = sy;
337 hlpsize.x2 = ex;
338 hlpsize.y2 = ey;
339 memcpy(hlpDescr, pld, sizeof(aDvbSpuPalDescr));
340 highlight = true;
341 clean = false;
342 Draw(); // we have to trigger Draw() here
343 }
344}
345
347{
348 clean &= !highlight;
349 highlight = false;
350 hlpsize.x1 = -1;
351 hlpsize.y1 = -1;
352 hlpsize.x2 = -1;
353 hlpsize.y2 = -1;
354}
355
357{
359 if (fgbmp && bgbmp) {
360 size.x1 = min(fgsize.x1, bgsize.x1);
361 size.y1 = min(fgsize.y1, bgsize.y1);
362 size.x2 = max(fgsize.x2, bgsize.x2);
363 size.y2 = max(fgsize.y2, bgsize.y2);
364 }
365 else if (fgbmp) {
366 size.x1 = fgsize.x1;
367 size.y1 = fgsize.y1;
368 size.x2 = fgsize.x2;
369 size.y2 = fgsize.y2;
370 }
371 else if (bgbmp) {
372 size.x1 = bgsize.x1;
373 size.y1 = bgsize.y1;
374 size.x2 = bgsize.x2;
375 size.y2 = bgsize.y2;
376 }
377 else {
378 size.x1 = 0;
379 size.y1 = 0;
380 size.x2 = 0;
381 size.y2 = 0;
382 }
383 return size;
384}
385
387{
388 int col = 1;
389 for (int i = 0; i < 4; i++) {
390 if (paldescr[i].trans != 0) {
391 col++;
392 }
393 }
394 return col > 2 ? 2 : 1;
395}
396
398{
399 int fgbpp = 0;
400 int bgbpp = 0;
401 int ret;
402 if (fgbmp) {
403 fgbpp = spubmp->getMinBpp(hlpDescr);
404 }
405 if (bgbmp) {
406 bgbpp = spubmp->getMinBpp(palDescr);
407 }
408 ret = fgbpp + bgbpp;
409 if (ret > 2)
410 ret = 4;
411 return ret;
412}
413
415{
416 cMutexLock MutexLock(&mutex);
417 if (!spubmp) {
418 Hide();
419 return;
420 }
421 sDvbSpuRect bgsize;
422 sDvbSpuRect drawsize;
423 sDvbSpuRect bgdrawsize;
424 cBitmap *fg = NULL;
425 cBitmap *bg = NULL;
426 cBitmap *tmp = NULL;
427
428 SetSpuScaling(); // always set current scaling, size could have changed
429
430 if (highlight) {
432 fg = tmp->Scaled(xscaling, yscaling, true);
433 drawsize.x1 = hlpsize.x1 * xscaling;
434 drawsize.y1 = hlpsize.y1 * yscaling;
435 drawsize.x2 = drawsize.x1 + fg->Width();
436 drawsize.y2 = drawsize.y1 + fg->Height();
437 }
438
439 if (spubmp->getMinSize(palDescr, bgsize)) {
440 tmp = spubmp->getBitmap(palDescr, palette, bgsize);
441 bg = tmp->Scaled(xscaling, yscaling, true);
442 bgdrawsize.x1 = bgsize.x1 * xscaling;
443 bgdrawsize.y1 = bgsize.y1 * yscaling;
444 bgdrawsize.x2 = bgdrawsize.x1 + bg->Width();
445 bgdrawsize.y2 = bgdrawsize.y1 + bg->Height();
446 }
447
448 if (osd) // always rewrite OSD
449 Hide();
450
451 if (osd == NULL) {
452 restricted_osd = false;
454
455 sDvbSpuRect areaSize = CalcAreaSize(drawsize, fg, bgdrawsize, bg); // combine
456 tArea Area = { areaSize.x1, areaSize.y1, areaSize.x2, areaSize.y2, 4 };
457 if (osd->CanHandleAreas(&Area, 1) != oeOk) {
458 DEBUG("dvbspu CanHandleAreas (%d,%d)x(%d,%d), 4 failed\n", areaSize.x1, areaSize.y1, areaSize.x2, areaSize.y2);
459 restricted_osd = true;
460 }
461 else
462 osd->SetAreas(&Area, 1);
463 }
464 if (restricted_osd) {
465 sDvbSpuRect hlsize;
466 bool setarea = false;
467 /* reduce fg area */
468 if (fg) {
469 spubmp->getMinSize(hlpDescr,hlsize);
470 /* clip to the highligh area */
471 setMax(hlsize.x1, hlpsize.x1);
472 setMax(hlsize.y1, hlpsize.y1);
473 setMin(hlsize.x2, hlpsize.x2);
474 setMin(hlsize.y2, hlpsize.y2);
475 if (hlsize.x1 > hlsize.x2 || hlsize.y1 > hlsize.y2)
476 hlsize.x1 = hlsize.x2 = hlsize.y1 = hlsize.y2 = 0;
477 /* resize scaled fg */
478 drawsize.x1=hlsize.x1 * xscaling;
479 drawsize.y1=hlsize.y1 * yscaling;
480 drawsize.x2=hlsize.x2 * xscaling;
481 drawsize.y2=hlsize.y2 * yscaling;
482 }
483 sDvbSpuRect areaSize = CalcAreaSize(drawsize, fg, bgdrawsize, bg);
484
485#define DIV(a, b) (a/b)?:1
486 for (int d = 1; !setarea && d <= 2; d++) {
487
488 /* first try old behaviour */
489 tArea Area = { areaSize.x1, areaSize.y1, areaSize.x2, areaSize.y2, DIV(CalcAreaBpp(fg, bg), d) };
490
491 if ((Area.Width() & 7) != 0)
492 Area.x2 += 8 - (Area.Width() & 7);
493
494 if (osd->CanHandleAreas(&Area, 1) == oeOk &&
495 osd->SetAreas(&Area, 1) == oeOk)
496 setarea = true;
497
498 /* second try to split area if there is both area */
499 if (!setarea && fg && bg) {
500 tArea Area_Both [2] = {
501 { bgdrawsize.x1, bgdrawsize.y1, bgdrawsize.x2, bgdrawsize.y2, DIV(CalcAreaBpp(0, bg), d) },
502 { drawsize.x1, drawsize.y1, drawsize.x2, drawsize.y2, DIV(CalcAreaBpp(fg, 0), d) }
503 };
504 if (!Area_Both[0].Intersects(Area_Both[1])) {
505 /* there is no intersection. We can try with split areas */
506 if ((Area_Both[0].Width() & 7) != 0)
507 Area_Both[0].x2 += 8 - (Area_Both[0].Width() & 7);
508 if ((Area_Both[1].Width() & 7) != 0)
509 Area_Both[1].x2 += 8 - (Area_Both[1].Width() & 7);
510 if (osd->CanHandleAreas(Area_Both, 2) == oeOk &&
511 osd->SetAreas(Area_Both, 2) == oeOk)
512 setarea = true;
513 }
514 }
515 }
516 if (setarea)
517 DEBUG("dvbspu: reduced AreaSize (%d, %d) (%d, %d) Bpp %d\n", areaSize.x1, areaSize.y1, areaSize.x2, areaSize.y2, (fg && bg) ? 4 : 2);
518 else
519 dsyslog("dvbspu: reduced AreaSize (%d, %d) (%d, %d) Bpp %d failed", areaSize.x1, areaSize.y1, areaSize.x2, areaSize.y2, (fg && bg) ? 4 : 2);
520 }
521
522 /* we could draw use DrawPixel on osd */
523 if (bg || fg) {
524 if (bg)
525 osd->DrawBitmap(bgdrawsize.x1, bgdrawsize.y1, *bg);
526 if (fg)
527 osd->DrawBitmap(drawsize.x1, drawsize.y1, *fg);
528 delete fg;
529 delete bg;
530 delete tmp;
531
532 osd->Flush();
533 }
534
535 clean = true;
536}
537
539{
540 cMutexLock MutexLock(&mutex);
542}
543
545{
546 Hide();
547
548 delete spubmp;
549 spubmp = NULL;
550
551 delete[]spu;
552 spu = NULL;
553
555 clean = true;
556}
557
558int cDvbSpuDecoder::setTime(uint32_t pts)
559{
560 if (!spu)
561 return 0;
562
563 if (!clean)
564 Draw();
565
566 while (DCSQ_offset != prev_DCSQ_offset) { /* Display Control Sequences */
567 int i = DCSQ_offset;
568 state = spNONE;
569
570 uint32_t exec_time = spupts + spuU32(i) * 1024;
571 if ((pts != 0) && (int32_t(exec_time - pts) > 0)) // PTS values wrap around
572 return 0;
573 DEBUG("offs = %d, rel = %d, time = %d, pts = %d, diff = %d\n",
574 i, spuU32(i) * 1024, exec_time, pts, exec_time - pts);
575
576 if (pts != 0) {
577 uint16_t feven = 0;
578 uint16_t fodd = 0;
579
580 i += 2;
581
583 DCSQ_offset = spuU32(i);
584 DEBUG("offs = %d, DCSQ = %d, prev_DCSQ = %d\n",
586 i += 2;
587
588 while (spu[i] != CMD_SPU_EOF) { // Command Sequence
589 switch (spu[i]) {
590 case CMD_SPU_SHOW: // show subpicture
591 DEBUG("\tshow subpicture\n");
592 state = spSHOW;
593 i++;
594 break;
595
596 case CMD_SPU_HIDE: // hide subpicture
597 DEBUG("\thide subpicture\n");
598 state = spHIDE;
599 i++;
600 break;
601
602 case CMD_SPU_SET_PALETTE: // CLUT
603 palDescr[0].index = spu[i + 2] & 0xf;
604 palDescr[1].index = spu[i + 2] >> 4;
605 palDescr[2].index = spu[i + 1] & 0xf;
606 palDescr[3].index = spu[i + 1] >> 4;
607 i += 3;
608 break;
609
610 case CMD_SPU_SET_ALPHA: // transparency palette
611 palDescr[0].trans = spu[i + 2] & 0xf;
612 palDescr[1].trans = spu[i + 2] >> 4;
613 palDescr[2].trans = spu[i + 1] & 0xf;
614 palDescr[3].trans = spu[i + 1] >> 4;
615 i += 3;
616 break;
617
618 case CMD_SPU_SET_SIZE: // image coordinates
619 size.x1 = (spu[i + 1] << 4) | (spu[i + 2] >> 4);
620 size.x2 = ((spu[i + 2] & 0x0f) << 8) | spu[i + 3];
621
622 size.y1 = (spu[i + 4] << 4) | (spu[i + 5] >> 4);
623 size.y2 = ((spu[i + 5] & 0x0f) << 8) | spu[i + 6];
624
625 DEBUG("\t(%d, %d) x (%d, %d)\n",
626 size.x1, size.y1, size.x2, size.y2);
627 i += 7;
628 break;
629
630 case CMD_SPU_SET_PXD_OFFSET: // image 1 / image 2 offsets
631 fodd = spuU32(i + 1);
632 feven = spuU32(i + 3);
633 DEBUG("\todd = %d even = %d\n", fodd, feven);
634 i += 5;
635 break;
636
637 case CMD_SPU_CHG_COLCON: {
638 int size = spuU32(i + 1);
639 i += 1 + size;
640 }
641 break;
642
643 case CMD_SPU_MENU:
644 DEBUG("\tspu menu\n");
645 state = spMENU;
646
647 i++;
648 break;
649
650 default:
651 esyslog("invalid sequence in control header (%.2x)",
652 spu[i]);
653 Empty();
654 return 0;
655 }
656 }
657 if (fodd != 0 && feven != 0) {
658 Hide();
659 delete spubmp;
660 spubmp = new cDvbSpuBitmap(size, spu + fodd, spu + feven,
661 spu + feven, spu + cmdOffs());
662 }
663 } else if (!clean)
664 state = spSHOW;
665
666 if ((state == spSHOW && allowedShow) || state == spMENU)
667 Draw();
668
669 if (state == spHIDE)
670 Hide();
671
672 if (pts == 0)
673 return 0;
674 }
675
676 return 1;
677}
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
cBitmap(int Width, int Height, int Bpp, int X0=0, int Y0=0)
Creates a bitmap with the given Width, Height and color depth (Bpp).
Definition osd.c:261
int Width(void) const
Definition osd.h:189
static cDevice * PrimaryDevice(void)
Returns the primary device.
Definition device.h:149
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:549
uint8_t * bmp
Definition dvbspu.h:73
int getMinBpp(const aDvbSpuPalDescr paldescr)
Definition dvbspu.c:386
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:538
void processSPU(uint32_t pts, uint8_t *buf, bool AllowedShow)
Definition dvbspu.c:281
void SetSpuScaling(void)
Definition dvbspu.c:253
void Draw(void)
Definition dvbspu.c:414
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:318
bool restricted_osd
Definition dvbspu.h:104
void setPalette(uint32_t *pal)
Definition dvbspu.c:313
void clearHighlight(void)
Definition dvbspu.c:346
cMutex mutex
Definition dvbspu.h:98
int setTime(uint32_t pts)
Definition dvbspu.c:558
aDvbSpuPalDescr hlpDescr
Definition dvbspu.h:116
void setScaleMode(cSpuDecoder::eScaleMode ScaleMode)
Definition dvbspu.c:300
bool allowedShow
Definition dvbspu.h:129
cDvbSpuDecoder(void)
Definition dvbspu.c:230
void Empty(void)
Definition dvbspu.c:544
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:397
int cmdOffs(void)
Definition dvbspu.h:131
sDvbSpuRect CalcAreaSize(sDvbSpuRect fgsize, cBitmap *fgbmp, sDvbSpuRect bgsize, cBitmap *bgbmp)
Definition dvbspu.c:356
void setResolution(int Xres, int Yres)
Definition dvbspu.c:305
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:2323
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas)
Sets the sub-areas to the given areas.
Definition osd.c:2121
virtual 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 the OSD with the data from the given Bitmap, putting the upper left corner of the ...
Definition osd.c:2239
virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas)
Checks whether the OSD can display the given set of sub-areas.
Definition osd.c:2099
virtual void Flush(void)
Actually commits all data to the OSD hardware.
Definition osd.c:2299
static void Delete(cOsd *&Osd)
Deletes the given Osd (if any) and sets it to NULL.
Definition osd.c:1960
void SetColor(int Index, tColor Color)
Sets the palette entry at Index to Color.
Definition osd.c:172
int OSDHeight
Definition config.h:341
int OSDWidth
Definition config.h:341
eScaleMode
Definition spu.h:21
@ eSpuNormal
Definition spu.h:21
cSetup Setup
Definition config.c:373
#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 height(void) const
Definition dvbspu.h:42
int width(void) const
Definition dvbspu.h:39
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