From ab6f2ccf424896a80b6e2fdf9ab9313ea4b7f316 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 14 Jun 2009 13:49:00 +0200 Subject: =?UTF-8?q?Version=201.7.8=20-=20The=20name=20of=20the=20function?= =?UTF-8?q?=20cDevice::GetVideoSize()=20wasn't=20very=20well=20chosen=20?= =?UTF-8?q?=20=20for=20its=20purpose=20of=20defining=20the=20optimum=20siz?= =?UTF-8?q?e=20of=20the=20OSD=20for=20the=20current=20=20=20output=20devic?= =?UTF-8?q?e.=20Therefore=20a=20new=20function=20named=20cDevice::GetOsdSi?= =?UTF-8?q?ze()=20has=20=20=20been=20introduced=20(suggested=20by=20Rolf?= =?UTF-8?q?=20Ahrenberg).=20Plugin=20authors=20should=20=20=20implement=20?= =?UTF-8?q?this=20function=20in=20classes=20derived=20from=20cDevice,=20if?= =?UTF-8?q?=20they=20are=20able=20=20=20to=20replay=20video.=20cDevice::Ge?= =?UTF-8?q?tVideoSize()=20still=20exists=20and=20should=20return=20the=20?= =?UTF-8?q?=20=20actual=20size=20of=20the=20video=20material=20that=20is?= =?UTF-8?q?=20currently=20replayed.=20Note=20that=20=20=20because=20of=20t?= =?UTF-8?q?he=20many=20possible=20aspect=20ratios=20for=20video=20material?= =?UTF-8?q?,=20the=20type=20=20=20of=20the=20Aspect=20parameter=20of=20Get?= =?UTF-8?q?VideoSize()=20has=20been=20changed=20to=20'double',=20=20=20and?= =?UTF-8?q?=20the=20Aspect=20parameter=20in=20both=20functions=20is=20name?= =?UTF-8?q?d=20differently,=20because=20=20=20it=20returns=20different=20v?= =?UTF-8?q?alues=20(suggested=20by=20Reinhard=20Nissl).=20=20=20Thanks=20t?= =?UTF-8?q?o=20Oliver=20Endriss=20for=20his=20input=20on=20calculating=20t?= =?UTF-8?q?he=20Aspect=20factor=20in=20=20=20GetOsdSize().=20-=20Fixed=20t?= =?UTF-8?q?he=20way=20the=20OSD=20size=20is=20determined=20on=20full=20fea?= =?UTF-8?q?tured=20DVB=20cards=20(thanks=20=20=20to=20Oliver=20Endriss).?= =?UTF-8?q?=20-=20Increased=20MAXOSDHEIGHT=20to=201200=20(suggested=20by?= =?UTF-8?q?=20Nicolas=20Huillard).=20-=20Removed=20limitation=20to=20PAL?= =?UTF-8?q?=20resolution=20from=20SPU=20handling.=20-=20Checking=20fd=5Fvi?= =?UTF-8?q?deo=20in=20cDvbDevice::GetVideoSize()=20to=20avoid=20error=20me?= =?UTF-8?q?ssages=20on=20=20=20systems=20with=20no=20real=20primary=20repl?= =?UTF-8?q?ay=20device=20(reported=20by=20Martin=20Neuditschko).=20-=20Add?= =?UTF-8?q?ed=20a=20note=20to=20cTsToPes::GetPes()=20about=20having=20to?= =?UTF-8?q?=20call=20it=20repeatedly,=20once=20=20=20it=20has=20returned?= =?UTF-8?q?=20a=20non-NULL=20value.=20-=20Added=20MPEG=201=20handling=20to?= =?UTF-8?q?=20remux.c=20(thanks=20to=20Ales=20Jurik).=20-=20Fixed=20use=20?= =?UTF-8?q?of=20time=5Ft=20in=20cEIT::cEIT()=20(thanks=20to=20Tobias=20Bra?= =?UTF-8?q?tfisch).=20-=20Added=20missing=20update=20of=20lastOsdSizeUpdat?= =?UTF-8?q?e.=20-=20EIT=20events=20are=20now=20only=20processed=20if=20a?= =?UTF-8?q?=20plausible=20system=20time=20is=20available,=20to=20=20=20avo?= =?UTF-8?q?id=20wrong=20handling=20of=20PDC=20descriptors=20(thanks=20to?= =?UTF-8?q?=20Tobias=20Bratfisch).=20-=20Removed=20unused=20'synced'=20mem?= =?UTF-8?q?ber=20from=20cTsToPes=20(reported=20by=20Christoph=20Haubrich).?= =?UTF-8?q?=20-=20Added=20a=20note=20to=20cTsToPes=20about=20all=20TS=20pa?= =?UTF-8?q?ckets=20having=20to=20belong=20to=20the=20same=20PID,=20=20=20a?= =?UTF-8?q?nd=20that=20for=20video=20data=20GetPes()=20may=20only=20be=20c?= =?UTF-8?q?alled=20if=20the=20next=20TS=20packet=20that=20=20=20will=20be?= =?UTF-8?q?=20given=20to=20PutTs()=20has=20the=20"payload=20start"=20flag?= =?UTF-8?q?=20set=20(suggested=20by=20Christoph=20=20=20Haubrich).=20-=20A?= =?UTF-8?q?dded=20a=20note=20about=20the=20meaning=20of=20PERCENTAGEDELTA?= =?UTF-8?q?=20in=20cRingBuffer::UpdatePercentage()=20=20=20(thanks=20to=20?= =?UTF-8?q?Rolf=20Ahrenberg).=20-=20The=20new=20setup=20option=20"Recordin?= =?UTF-8?q?g/Pause=20key=20handling"=20can=20be=20used=20to=20define=20=20?= =?UTF-8?q?=20what=20happens=20if=20the=20Pause=20key=20on=20the=20remote?= =?UTF-8?q?=20control=20is=20pressed=20during=20=20=20live=20tv=20(thanks?= =?UTF-8?q?=20to=20Timo=20Eskola).=20-=20Added=20a=20note=20about=20cFont:?= =?UTF-8?q?:GetFont()=20not=20being=20thread-safe.=20-=20Fixed=20generatin?= =?UTF-8?q?g=20PAT/PMT=20version=20numbers=20in=20case=20the=20PIDs=20chan?= =?UTF-8?q?ge=20during=20=20=20recording=20(reported=20by=20Reinhard=20Nis?= =?UTF-8?q?sl).=20-=20Updated=20the=20Ukrainian=20OSD=20texts=20(thanks=20?= =?UTF-8?q?to=20Yarema=20Aka=20Knedlyk).=20-=20Fixed=20a=20memory=20leak?= =?UTF-8?q?=20when=20reaching=20the=20end=20of=20a=20recording=20during=20?= =?UTF-8?q?replay=20(reported=20=20=20by=20Reinhard=20Nissl).=20-=20Fixed?= =?UTF-8?q?=20calling=20close(-1)=20in=20cUnbufferedFile::Close()=20(repor?= =?UTF-8?q?ted=20by=20Reinhard=20Nissl).=20-=20Added=20a=20workaround=20fo?= =?UTF-8?q?r=20the=20broken=20linux-dvb=20driver=20header=20files=20(based?= =?UTF-8?q?=20on=20a=20patch=20=20=20from=20Tobias=20Grimm).=20-=20Fixed?= =?UTF-8?q?=20handling=20the=20length=20of=20DiSEqC=20command=20sequences?= =?UTF-8?q?=20(reported=20by=20Reinhard=20Nissl).=20-=20Fixed=20cOsdMenu::?= =?UTF-8?q?Display()=20in=20case=20the=20menu=20size=20has=20changed=20(th?= =?UTF-8?q?anks=20to=20=20=20Reinhard=20Nissl).=20-=20Added=20some=20missi?= =?UTF-8?q?ng=20'const'=20keywords=20to=20avoid=20compilation=20errors=20w?= =?UTF-8?q?ith=20gcc=204.4=20=20=20(thanks=20to=20Ville=20Skytt=C3=A4=20an?= =?UTF-8?q?d=20Ludwig=20Nussel).=20-=20Modified=20cSVDRP::CmdGRAB()=20to?= =?UTF-8?q?=20avoid=20writing=20into=20const=20data=20(reported=20by=20=20?= =?UTF-8?q?=20Ludwig=20Nussel).=20-=20Fixed=20calculating=20menu=20colum?= =?UTF-8?q?=20widths=20in=20case=20the=20font=20has=20a=20size=20other=20t?= =?UTF-8?q?han=20the=20=20=20default=20size=20(reported=20by=20Reinhard=20?= =?UTF-8?q?Nissl).=20-=20Added=20a=20plausibility=20check=20for=20the=20OS?= =?UTF-8?q?D=20percentage=20parameters=20=20=20to=20avoid=20problems=20in?= =?UTF-8?q?=20case=20the=20values=20are=20stored=20in=20the=20setup.conf?= =?UTF-8?q?=20=20=20file=20in=20a=20=20wrong=20way.=20-=20Fixed=20variable?= =?UTF-8?q?=20types=20in=20cIndexFile=20(reported=20by=20Udo=20Richter).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dvbspu.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'dvbspu.c') diff --git a/dvbspu.c b/dvbspu.c index bef80c3..aaf608d 100644 --- a/dvbspu.c +++ b/dvbspu.c @@ -8,7 +8,7 @@ * * parts of this file are derived from the OMS program. * - * $Id: dvbspu.c 2.0 2007/02/03 10:13:18 kls Exp $ + * $Id: dvbspu.c 2.1 2009/05/09 16:25:59 kls Exp $ */ #include "dvbspu.h" @@ -55,18 +55,16 @@ void cDvbSpuPalette::setPalette(const uint32_t * pal) #define setMin(a, b) if (a > b) a = b #define setMax(a, b) if (a < b) a = b -#define spuXres 720 -#define spuYres 576 - #define revRect(r1, r2) { r1.x1 = r2.x2; r1.y1 = r2.y2; r1.x2 = r2.x1; r1.y2 = r2.y1; } cDvbSpuBitmap::cDvbSpuBitmap(sDvbSpuRect size, uint8_t * fodd, uint8_t * eodd, uint8_t * feven, uint8_t * eeven) { - if (size.x1 < 0 || size.y1 < 0 || size.x2 >= spuXres - || size.y2 >= spuYres) - throw; + size.x1 = max(size.x1, 0); + size.y1 = max(size.y1, 0); + size.x2 = min(size.x2, Setup.OSDWidth); + size.y2 = min(size.y2, Setup.OSDHeight); bmpsize = size; revRect(minsize[0], size); @@ -74,10 +72,11 @@ cDvbSpuBitmap::cDvbSpuBitmap(sDvbSpuRect size, revRect(minsize[2], size); revRect(minsize[3], size); - if (!(bmp = new uint8_t[spuXres * spuYres * sizeof(uint8_t)])) - throw; + int MemSize = bmpsize.width() * bmpsize.height() * sizeof(uint8_t); + bmp = new uint8_t[MemSize]; - memset(bmp, 0, spuXres * spuYres * sizeof(uint8_t)); + if (bmp) + memset(bmp, 0, MemSize); putFieldData(0, fodd, eodd); putFieldData(1, feven, eeven); } @@ -94,10 +93,10 @@ cBitmap *cDvbSpuBitmap::getBitmap(const aDvbSpuPalDescr paldescr, int h = size.height(); int w = size.width(); - if (size.y1 + h >= spuYres) - h = spuYres - size.y1 - 1; - if (size.x1 + w >= spuXres) - w = spuXres - size.x1 - 1; + if (size.y1 + h >= bmpsize.height()) + h = bmpsize.height() - size.y1 - 1; + if (size.x1 + w >= bmpsize.width()) + w = bmpsize.width() - size.x1 - 1; if (w & 0x03) w += 4 - (w & 0x03); @@ -114,7 +113,7 @@ cBitmap *cDvbSpuBitmap::getBitmap(const aDvbSpuPalDescr paldescr, // set the content for (int yp = 0; yp < h; yp++) { for (int xp = 0; xp < w; xp++) { - uint8_t idx = bmp[(size.y1 + yp) * spuXres + size.x1 + xp]; + uint8_t idx = bmp[(size.y1 + yp) * bmpsize.width() + size.x1 + xp]; ret->SetIndex(xp, yp, idx); } } @@ -150,7 +149,7 @@ bool cDvbSpuBitmap::getMinSize(const aDvbSpuPalDescr paldescr, void cDvbSpuBitmap::putPixel(int xp, int yp, int len, uint8_t colorid) { - memset(bmp + spuXres * yp + xp, colorid, len); + memset(bmp + bmpsize.width() * yp + xp, colorid, len); setMin(minsize[colorid].x1, xp); setMin(minsize[colorid].y1, yp); setMax(minsize[colorid].x2, xp + len - 1); -- cgit v1.2.3