From patchwork Thu Jun 30 15:23:39 2005 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "C.Y.M" X-Patchwork-Id: 11929 Received: from c-24-10-6-146.hsd1.ca.comcast.net ([24.10.6.146] helo=nofear.bounceme.net) by www.linuxtv.org with esmtp (Exim 4.34) id 1Do0tq-0007Xj-6c for vdr@linuxtv.org; Thu, 30 Jun 2005 17:24:22 +0200 Received: from [10.1.1.66] (hades [10.1.1.66]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by nofear.bounceme.net (Postfix) with ESMTP id 04D0973534 for ; Thu, 30 Jun 2005 08:23:50 -0700 (PDT) Message-ID: <42C40E7B.2010900@syphir.sytes.net> Date: Thu, 30 Jun 2005 08:23:39 -0700 From: "C.Y.M" Organization: CooLNeT User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Vdr X-Enigmail-Version: 0.92.0.0 Subject: [vdr] examining debian's vdr patchset X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: syphir@syphir.sytes.net, Klaus Schmidinger's VDR List-Id: Klaus Schmidinger's VDR List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 15:24:22 -0000 Status: O X-Status: X-Keywords: X-UID: 3318 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/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; 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); }