I was just looking at the patches included with debian's vdr package, and there
were two patches included that I had never seen before. I did not write these
patches, but I just wanted to post them to see what everyone's
thoughts/reactions are about them (if they should be added to core vdr or not).
Best Regards,
C.
diff -ru vdr-1.3.27-eepg-orig/dvbspu.c vdr-1.3.27-eepg/dvbspu.c
--- vdr-1.3.27-orig/dvbspu.c 2005-05-07 04:13:48.000000000 -0700
+++ vdr-1.3.27/dvbspu.c 2005-06-29 16:20:58.000000000 -0700
@@ -155,7 +155,7 @@
setMin(minsize[colorid].x1, xp);
setMin(minsize[colorid].y1, yp);
setMax(minsize[colorid].x2, xp + len - 1);
- setMax(minsize[colorid].y2, yp + len - 1);
+ setMax(minsize[colorid].y2, yp);
}
static uint8_t getBits(uint8_t * &data, uint8_t & bitf)
@@ -336,6 +336,20 @@
return size;
}
+static bool OsdMatchesArea(cOsd *osd, tArea &area)
+{
+ cBitmap *bmp = osd->GetBitmap(0);
+ if (!bmp)
+ return false;
+ if (bmp->Bpp() < area.bpp)
+ return false;
+ if (bmp->X0() > area.x1 || bmp->Y0() > area.y1)
+ return false;
+ if ((bmp->X0() + bmp->Width()) <= area.x2 || (bmp->Y0() + bmp->Height()) <= area.y2)
+ return false;
+ return true;
+}
+
void cDvbSpuDecoder::Draw(void)
{
if (!spubmp) {
@@ -366,12 +380,16 @@
}
if (bg || fg) {
+ int x2 = areaSize.x2;
+ while ((x2 - areaSize.x1 + 1) & 0x03)
+ x2++;
+ tArea Area = { areaSize.x1, areaSize.y1, x2, areaSize.y2, (fg && bg) ? 4 : 2 };
+ if (osd && !OsdMatchesArea(osd, Area)) {
+ delete osd;
+ osd = NULL;
+ }
if (osd == NULL) {
osd = cOsdProvider::NewOsd(0, 0);
- int x2 = areaSize.x2;
- while ((x2 - areaSize.x1 + 1) & 0x03)
- x2++;
- tArea Area = { areaSize.x1, areaSize.y1, x2, areaSize.y2, (fg && bg) ? 4 : 2 };
osd->SetAreas(&Area, 1);
}
diff -ru vdr-1.3.27-eepg-orig/dvbdevice.c vdr-1.3.27-eepg/dvbdevice.c
--- vdr-1.3.27-orig/dvbdevice.c 2005-06-19 08:21:07.000000000 -0700
+++ vdr-1.3.27/dvbdevice.c 2005-06-29 15:56:57.000000000 -0700
@@ -699,7 +699,9 @@
Quality = 100;
isyslog("grabbing to %s (%s %d %d %d)", FileName, Jpeg ? "JPEG" : "PNM", Quality, vm.width, vm.height);
- FILE *f = fopen(FileName, "wb");
+ int fd = open(FileName, O_CREAT | O_EXCL | O_TRUNC | O_RDWR, 00640);
+ if (fd > -1) {
+ FILE *f = fdopen(fd, "wb");
if (f) {
if (Jpeg) {
// write JPEG file:
@@ -735,6 +737,7 @@
}
fclose(f);
}
+ }
else {
LOG_ERROR_STR(FileName);
result |= 1;