From 939081e274d0a9868e5ba9a7951666ad508afb96 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Wed, 6 Jan 2010 13:34:00 +0100 Subject: =?UTF-8?q?Version=201.7.11=20-=20Fixed=20resetting=20the=20file?= =?UTF-8?q?=20size=20when=20regenerating=20the=20index=20file.=20-=20The?= =?UTF-8?q?=20new=20function=20cDevice::PatPmtParser()=20can=20be=20used?= =?UTF-8?q?=20in=20derived=20devices=20to=20access=20=20=20the=20PAT/PMT?= =?UTF-8?q?=20of=20the=20currently=20replayed=20material.=20-=20Updated=20?= =?UTF-8?q?the=20Italian=20OSD=20texts=20(thanks=20to=20Diego=20Pierotto).?= =?UTF-8?q?=20-=20The=20PCR=20pid=20in=20generated=20PMTs=20is=20now=20set?= =?UTF-8?q?=20to=200x1FFF=20("no=20PCR=20pid")=20in=20=20=20cPatPmtGenerat?= =?UTF-8?q?or::GeneratePmt(),=20because=20VDR=20doesn't=20record=20the=20P?= =?UTF-8?q?CR=20pid.=20-=20Updated=20the=20Estonian=20OSD=20texts=20(thank?= =?UTF-8?q?s=20to=20Arthur=20Konovalov).=20-=20The=20'sky'=20plugin=20is?= =?UTF-8?q?=20no=20longer=20part=20of=20the=20VDR=20source.=20-=20Improved?= =?UTF-8?q?=20SPU=20handling=20on=20devices=20with=20limited=20OSD=20capab?= =?UTF-8?q?ilities=20(thanks=20to=20=20=20Matthieu=20Castet).=20-=20Severa?= =?UTF-8?q?l=20code=20modifications=20to=20avoid=20compiler=20warnings=20(?= =?UTF-8?q?thanks=20to=20Winfried=20K=C3=B6hler).=20-=20Added=20stream=20t?= =?UTF-8?q?ype=2011172=20AUDIO=20to=20cPatPmtParser::ParsePmt()=20(thanks?= =?UTF-8?q?=20to=20Johann=20=20=20Friedrichs).=20-=20Removed=20debug=20out?= =?UTF-8?q?put=20of=20'-'=20from=20cTransfer::Receive().=20-=20Added=20def?= =?UTF-8?q?ines=20for=20large=20files=20to=20the=20'newplugin'=20script=20?= =?UTF-8?q?(reported=20by=20Udo=20Richter).=20-=20Removed=20the=20workarou?= =?UTF-8?q?nd=20for=20short=20channel=20names=20of=20"Kabel=20Deutschland"?= =?UTF-8?q?,=20because=20=20=20apparently=20they=20now=20have=20their=20da?= =?UTF-8?q?ta=20according=20to=20the=20DVB=20standard=20(thanks=20to=20=20?= =?UTF-8?q?=20Johann=20Friedrichs).=20-=20Some=20fixes=20to=20dvbspu.[hc]?= =?UTF-8?q?=20(thanks=20to=20Johann=20Friedrichs).=20-=20Fixed=20a=20busy?= =?UTF-8?q?=20loop=20when=20moving=20editing=20marks=20(thanks=20to=20Joha?= =?UTF-8?q?nn=20Friedrichs).=20-=20Updated=20sources.conf=20(thanks=20to?= =?UTF-8?q?=20Derek=20Kelly).=20-=20Modified=20cCharSetConv=20so=20that=20?= =?UTF-8?q?it=20can=20be=20used=20to=20convert=20from=20"whatever=20VDR=20?= =?UTF-8?q?uses"=20=20=20to=20a=20given=20code=20(thanks=20to=20Joachim=20?= =?UTF-8?q?Wilke).=20-=20Channel=20names=20containing=20commas=20are=20now?= =?UTF-8?q?=20handled=20correctly=20in=20channels.conf.=20=20=20If=20a=20c?= =?UTF-8?q?hannel's=20short=20name=20contains=20a=20comma,=20it=20is=20rep?= =?UTF-8?q?laced=20with=20a=20'.'.=20-=20cDevice=20now=20logs=20the=20devi?= =?UTF-8?q?ce=20number=20when=20a=20new=20device=20is=20created.=20-=20Fix?= =?UTF-8?q?ed=20handling=20STREAMTYPE=5F11172=5FAUDIO=20in=20cPatPmtParser?= =?UTF-8?q?::ParsePmt().=20-=20cParsePatPmt=20now=20has=20functions=20to?= =?UTF-8?q?=20retrieve=20the=20audio,=20dolby=20and=20subtitle=20pids.=20-?= =?UTF-8?q?=20cPatFilter::Process()=20now=20only=20stores=20CA=20descripto?= =?UTF-8?q?rs=20for=20video=20and=20audio=20pids=20=20=20(thanks=20to=20Fr?= =?UTF-8?q?ancesco=20Saverio=20Schiavarelli=20for=20reporting=20a=20proble?= =?UTF-8?q?m=20with=20channels=20=20=20that=20have=20some=20encrypted=20co?= =?UTF-8?q?mponents=20that=20VDR=20doesn't=20use).=20-=20cDevice::AddPid()?= =?UTF-8?q?=20now=20stores=20the=20stream=20type=20of=20the=20given=20pid?= =?UTF-8?q?=20(thanks=20to=20Andreas=20=20=20Regel).=20-=20Added=20cFont::?= =?UTF-8?q?FontName()=20and=20cFont::Size()=20(thanks=20to=20Andreas=20Reg?= =?UTF-8?q?el).=20-=20cPatPmtParser=20now=20also=20stores=20the=20audio=20?= =?UTF-8?q?stream=20types.=20-=20The=20support=20for=20full=20featured=20D?= =?UTF-8?q?VB=20cards=20of=20the=20TT/FuSi=20design=20has=20been=20moved?= =?UTF-8?q?=20=20=20into=20the=20new=20plugin=20'dvbsddevice'.=20On=20syst?= =?UTF-8?q?ems=20that=20use=20such=20a=20card=20as=20their=20=20=20primary?= =?UTF-8?q?=20device,=20this=20plugin=20now=20needs=20to=20be=20loaded=20w?= =?UTF-8?q?hen=20running=20VDR=20in=20order=20=20=20to=20view=20live=20or?= =?UTF-8?q?=20recorded=20video.=20If=20the=20plugin=20is=20not=20loaded,?= =?UTF-8?q?=20the=20card=20will=20=20=20be=20treated=20like=20a=20budget?= =?UTF-8?q?=20DVB=20card,=20and=20there=20will=20be=20no=20OSD=20or=20view?= =?UTF-8?q?ing=20=20=20capability.=20-=20Fixed=20handling=20the=20"CA=20PM?= =?UTF-8?q?T"=20generation=20(revised=20a=20change=20not=20mentioned=20in?= =?UTF-8?q?=20version=20=20=201.7.9's=20changes,=20which=20caused=20a=20ma?= =?UTF-8?q?lfunction=20with=20Conax=20and=20Viaccess=20CAMs).=20-=20Fixed?= =?UTF-8?q?=20stopping=20subtitle=20display=20when=20switching=20the=20pri?= =?UTF-8?q?mary=20device=20(thanks=20to=20=20=20Anssi=20Hannula).=20=20=20?= =?UTF-8?q?IMPORTANT=20NOTE=20TO=20PLUGIN=20AUTHORS:=20a=20plugin=20that?= =?UTF-8?q?=20implements=20a=20derived=20cDevice=20=20=20class=20that=20ca?= =?UTF-8?q?n=20replay=20video=20must=20now=20call=20the=20MakePrimaryDevic?= =?UTF-8?q?e()=20function=20of=20=20=20its=20base=20class.=20-=20Fixed=20c?= =?UTF-8?q?ompiler=20warnings=20"format=20not=20a=20string=20literal=20and?= =?UTF-8?q?=20no=20format=20arguments"=20=20=20in=20some=20syslog=20calls?= =?UTF-8?q?=20(thanks=20to=20Rolf=20Ahrenberg).=20-=20The=20new=20command?= =?UTF-8?q?=20line=20options=20--edit=20and=20--genindex=20can=20be=20used?= =?UTF-8?q?=20to=20edit=20a=20=20=20recording=20or=20generate=20its=20inde?= =?UTF-8?q?x=20without=20actually=20starting=20the=20entire=20VDR=20=20=20?= =?UTF-8?q?(based=20on=20a=20patch=20from=20Helmut=20Auer).=20-=20Improved?= =?UTF-8?q?=20the=20description=20of=20the=20transponder=20parameters=20in?= =?UTF-8?q?=20vdr.5=20(thanks=20to=20=20=20Winfried=20K=C3=B6hler).=20-=20?= =?UTF-8?q?Avoiding=20setting=20the=20video=20stream=20type=20to=202=20if?= =?UTF-8?q?=20the=20vpid=20is=200=20(problem=20reported=20=20=20by=20Arthu?= =?UTF-8?q?r=20Konovalov).=20-=20Implemented=20handling=20the=20"Content?= =?UTF-8?q?=20Descriptor"=20(based=20on=20a=20patch=20from=20Rolf=20=20=20?= =?UTF-8?q?Ahrenberg).=20The=20'classic',=20'sttng'=20and=20'curses'=20ski?= =?UTF-8?q?ns=20display=20the=20textual=20=20=20representation=20of=20the?= =?UTF-8?q?=20content=20descriptors=20as=20"genre".=20The=20epg.data=20fil?= =?UTF-8?q?e=20stores=20=20=20the=20genre=20using=20the=20tag=20character?= =?UTF-8?q?=20'G'.=20-=20Implemented=20handling=20the=20"Parental=20Rating?= =?UTF-8?q?=20Descriptor"=20(based=20on=20a=20patch=20from=20Rolf=20=20=20?= =?UTF-8?q?Ahrenberg).=20The=20'classic',=20'sttng'=20and=20'curses'=20ski?= =?UTF-8?q?ns=20display=20the=20parental=20=20=20rating=20(if=20given)=20i?= =?UTF-8?q?n=20their=20event=20displays.=20The=20epg.data=20file=20stores?= =?UTF-8?q?=20=20=20the=20parental=20rating=20using=20the=20tag=20characte?= =?UTF-8?q?r=20'R'.=20=20=20IMPORTANT=20NOTE:=20if=20VDR=20doesn't=20displ?= =?UTF-8?q?ay=20a=20parental=20rating,=20this=20does=20not=20=20=20necessa?= =?UTF-8?q?rily=20mean=20that=20the=20given=20programme=20is=20suitable=20?= =?UTF-8?q?for=20all=20audiences!=20-=20Rearranged=20cEvent=20members=20to?= =?UTF-8?q?=20minimize=20memory=20waste.=20-=20After=20a=20CLRE=20command,?= =?UTF-8?q?=20no=20further=20EPG=20processing=20is=20now=20done=20for=2010?= =?UTF-8?q?=20seconds,=20=20=20so=20that=20data=20sent=20with=20subsequent?= =?UTF-8?q?=20PUTE=20commands=20doesn't=20interfere=20with=20data=20=20=20?= =?UTF-8?q?from=20the=20broadcasters=20(suggested=20by=20Helmut=20Auer).?= =?UTF-8?q?=20-=20Added=20support=20for=20DVB=20cards=20with=20multiple=20?= =?UTF-8?q?fontends.=20Note=20that=20this=20only=20=20=20works=20for=20DVB?= =?UTF-8?q?=20cards=20where=20each=20frontend=20can=20be=20used=20independ?= =?UTF-8?q?ently=20of=20all=20=20=20the=20others=20on=20the=20same=20adapt?= =?UTF-8?q?er.=20-=20Fixed=20plugin=20arguments=20corruption=20with=20glib?= =?UTF-8?q?c=202.11=20on=20x86=5F64=20(thanks=20to=20=20=20Anssi=20Hannula?= =?UTF-8?q?).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PLUGINS/src/dvbsddevice/dvbsdffosd.c | 213 +++++++++++++++++++++++++++++++++++ 1 file changed, 213 insertions(+) create mode 100644 PLUGINS/src/dvbsddevice/dvbsdffosd.c (limited to 'PLUGINS/src/dvbsddevice/dvbsdffosd.c') diff --git a/PLUGINS/src/dvbsddevice/dvbsdffosd.c b/PLUGINS/src/dvbsddevice/dvbsdffosd.c new file mode 100644 index 0000000..4ff8db9 --- /dev/null +++ b/PLUGINS/src/dvbsddevice/dvbsdffosd.c @@ -0,0 +1,213 @@ +/* + * dvbsdffosd.c: Implementation of the DVB SD Full Featured On Screen Display + * + * See the README file for copyright information and how to reach the author. + * + * $Id: dvbsdffosd.c 2.1 2009/12/29 11:52:48 kls Exp $ + */ + +#include "dvbsdffosd.h" +#include +#include +#include +#include +#include "vdr/tools.h" + +// --- cDvbSdFfOsd ----------------------------------------------------------- + +#define MAXNUMWINDOWS 7 // OSD windows are counted 1...7 +#define MAXOSDMEMORY 92000 // number of bytes available to the OSD (for unmodified DVB cards) + +class cDvbSdFfOsd : public cOsd { +private: + int osdDev; + int osdMem; + bool shown; + void Cmd(OSD_Command cmd, int color = 0, int x0 = 0, int y0 = 0, int x1 = 0, int y1 = 0, const void *data = NULL); +protected: + virtual void SetActive(bool On); +public: + cDvbSdFfOsd(int Left, int Top, int OsdDev, uint Level); + virtual ~cDvbSdFfOsd(); + virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas); + virtual eOsdError SetAreas(const tArea *Areas, int NumAreas); + virtual void Flush(void); + }; + +cDvbSdFfOsd::cDvbSdFfOsd(int Left, int Top, int OsdDev, uint Level) +:cOsd(Left, Top, Level) +{ + osdDev = OsdDev; + shown = false; + if (osdDev < 0) + esyslog("ERROR: invalid OSD device handle (%d)!", osdDev); + else { + osdMem = MAXOSDMEMORY; +#ifdef OSD_CAP_MEMSIZE + // modified DVB cards may have more OSD memory: + osd_cap_t cap; + cap.cmd = OSD_CAP_MEMSIZE; + if (ioctl(osdDev, OSD_GET_CAPABILITY, &cap) == 0) + osdMem = cap.val; +#endif + } +} + +cDvbSdFfOsd::~cDvbSdFfOsd() +{ + SetActive(false); +} + +void cDvbSdFfOsd::SetActive(bool On) +{ + if (On != Active()) { + cOsd::SetActive(On); + if (On) { + // must clear all windows here to avoid flashing effects - doesn't work if done + // in Flush() only for the windows that are actually used... + for (int i = 0; i < MAXNUMWINDOWS; i++) { + Cmd(OSD_SetWindow, 0, i + 1); + Cmd(OSD_Clear); + } + if (GetBitmap(0)) // only flush here if there are already bitmaps + Flush(); + } + else if (shown) { + cBitmap *Bitmap; + for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++) { + Cmd(OSD_SetWindow, 0, i + 1); + Cmd(OSD_Close); + } + shown = false; + } + } +} + +eOsdError cDvbSdFfOsd::CanHandleAreas(const tArea *Areas, int NumAreas) +{ + eOsdError Result = cOsd::CanHandleAreas(Areas, NumAreas); + if (Result == oeOk) { + if (NumAreas > MAXNUMWINDOWS) + return oeTooManyAreas; + int TotalMemory = 0; + for (int i = 0; i < NumAreas; i++) { + if (Areas[i].bpp != 1 && Areas[i].bpp != 2 && Areas[i].bpp != 4 && Areas[i].bpp != 8) + return oeBppNotSupported; + if ((Areas[i].Width() & (8 / Areas[i].bpp - 1)) != 0) + return oeWrongAlignment; + if (Areas[i].Width() < 1 || Areas[i].Height() < 1 || Areas[i].Width() > 720 || Areas[i].Height() > 576) + return oeWrongAreaSize; + TotalMemory += Areas[i].Width() * Areas[i].Height() / (8 / Areas[i].bpp); + } + if (TotalMemory > osdMem) + return oeOutOfMemory; + } + return Result; +} + +eOsdError cDvbSdFfOsd::SetAreas(const tArea *Areas, int NumAreas) +{ + if (shown) { + cBitmap *Bitmap; + for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++) { + Cmd(OSD_SetWindow, 0, i + 1); + Cmd(OSD_Close); + } + shown = false; + } + return cOsd::SetAreas(Areas, NumAreas); +} + +void cDvbSdFfOsd::Cmd(OSD_Command cmd, int color, int x0, int y0, int x1, int y1, const void *data) +{ + if (osdDev >= 0) { + osd_cmd_t dc; + dc.cmd = cmd; + dc.color = color; + dc.x0 = x0; + dc.y0 = y0; + dc.x1 = x1; + dc.y1 = y1; + dc.data = (void *)data; + ioctl(osdDev, OSD_SEND_CMD, &dc); + } +} + +void cDvbSdFfOsd::Flush(void) +{ + if (!Active()) + return; + cBitmap *Bitmap; + for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++) { + Cmd(OSD_SetWindow, 0, i + 1); + if (!shown) + Cmd(OSD_Open, Bitmap->Bpp(), Left() + Bitmap->X0(), Top() + Bitmap->Y0(), Left() + Bitmap->X0() + Bitmap->Width() - 1, Top() + Bitmap->Y0() + Bitmap->Height() - 1, (void *)1); // initially hidden! + int x1 = 0, y1 = 0, x2 = 0, y2 = 0; + if (!shown || Bitmap->Dirty(x1, y1, x2, y2)) { + if (!shown) { + x1 = y1 = 0; + x2 = Bitmap->Width() - 1; + y2 = Bitmap->Height() - 1; + } + //TODO Workaround: apparently the bitmap sent to the driver always has to be a multiple + //TODO of 8 bits wide, and (dx * dy) also has to be a multiple of 8. + //TODO Fix driver (should be able to handle any size bitmaps!) + while ((x1 > 0 || x2 < Bitmap->Width() - 1) && ((x2 - x1) & 7) != 7) { + if (x2 < Bitmap->Width() - 1) + x2++; + else if (x1 > 0) + x1--; + } + //TODO "... / 2" <==> Bpp??? + while ((y1 > 0 || y2 < Bitmap->Height() - 1) && (((x2 - x1 + 1) * (y2 - y1 + 1) / 2) & 7) != 0) { + if (y2 < Bitmap->Height() - 1) + y2++; + else if (y1 > 0) + y1--; + } + while ((x1 > 0 || x2 < Bitmap->Width() - 1) && (((x2 - x1 + 1) * (y2 - y1 + 1) / 2) & 7) != 0) { + if (x2 < Bitmap->Width() - 1) + x2++; + else if (x1 > 0) + x1--; + } + // commit colors: + int NumColors; + const tColor *Colors = Bitmap->Colors(NumColors); + if (Colors) { + //TODO this should be fixed in the driver! + tColor colors[NumColors]; + for (int i = 0; i < NumColors; i++) { + // convert AARRGGBB to AABBGGRR (the driver expects the colors the wrong way): + colors[i] = (Colors[i] & 0xFF000000) | ((Colors[i] & 0x0000FF) << 16) | (Colors[i] & 0x00FF00) | ((Colors[i] & 0xFF0000) >> 16); + } + Colors = colors; + //TODO end of stuff that should be fixed in the driver + Cmd(OSD_SetPalette, 0, NumColors - 1, 0, 0, 0, Colors); + } + // commit modified data: + Cmd(OSD_SetBlock, Bitmap->Width(), x1, y1, x2, y2, Bitmap->Data(x1, y1)); + } + Bitmap->Clean(); + } + if (!shown) { + // Showing the windows in a separate loop to avoid seeing them come up one after another + for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++) { + Cmd(OSD_SetWindow, 0, i + 1); + Cmd(OSD_MoveWindow, 0, Left() + Bitmap->X0(), Top() + Bitmap->Y0()); + } + shown = true; + } +} + +// --- cDvbOsdProvider ------------------------------------------------------- + +cDvbOsdProvider::cDvbOsdProvider(int OsdDev) +{ + osdDev = OsdDev; +} + +cOsd *cDvbOsdProvider::CreateOsd(int Left, int Top, uint Level) +{ + return new cDvbSdFfOsd(Left, Top, osdDev, Level); +} -- cgit v1.2.3