From d5c85f5ff84ffea666c63eca5dbe04632283cb04 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 11 Sep 2005 18:00:00 +0200 Subject: =?UTF-8?q?Version=201.3.32=20-=20Added=20some=20missing=20braces?= =?UTF-8?q?=20in=20remux.c=20(thanks=20to=20Wayne=20Keer=20for=20reporting?= =?UTF-8?q?=20this=20one).=20-=20Removed=20unused=20MAINMENUENTRY=20from?= =?UTF-8?q?=20svdrpdemo.c=20(thanks=20to=20Udo=20Richter=20for=20reporting?= =?UTF-8?q?=20=20=20this=20one).=20-=20Fixed=20appending=20sequence=20end?= =?UTF-8?q?=20code=20in=20cDvbPlayer::Goto()=20(thanks=20to=20Reinhard=20N?= =?UTF-8?q?issl).=20-=20Fixed=20syncing=20in=20cRepacker=20(thanks=20to=20?= =?UTF-8?q?Reinhard=20Nissl).=20-=20Now=20always=20using=20stream=20id=200?= =?UTF-8?q?xE0=20for=20the=20video=20stream,=20to=20avoid=20problems=20wit?= =?UTF-8?q?h=20=20=20post=20processing=20tools=20that=20choke=20on=20diffe?= =?UTF-8?q?rent=20ids=20(suggested=20by=20Reinhard=20Nissl).=20-=20Updated?= =?UTF-8?q?=20the=20Estonian=20OSD=20texts=20(thanks=20to=20Arthur=20Konov?= =?UTF-8?q?alov).=20-=20Fixed=20cDvbPlayer::SkipFrames()=20to=20properly?= =?UTF-8?q?=20handle=20radio=20recordings=20(thanks=20to=20=20=20Reinhard?= =?UTF-8?q?=20Nissl).=20-=20Updated=20the=20Swedish=20OSD=20texts=20(thank?= =?UTF-8?q?s=20to=20Tomas=20Prybil).=20-=20Updated=20the=20Slovenian=20OSD?= =?UTF-8?q?=20texts=20(thanks=20to=20Matjaz=20Thaler).=20-=20Updated=20the?= =?UTF-8?q?=20Danish=20OSD=20texts=20(thanks=20to=20Mogens=20Elneff).=20-?= =?UTF-8?q?=20Made=20LIRC=20command=20parsing=20more=20robust=20(thanks=20?= =?UTF-8?q?to=20Ville=20Skytt=C3=A4).=20-=20Introduced=20a=20separate=20'p?= =?UTF-8?q?lugins-install'=20target=20in=20the=20Makefile=20(thanks=20to?= =?UTF-8?q?=20Daniel=20=20=20Thompson).=20-=20Re-introduced=20the=20code?= =?UTF-8?q?=20that=20waits=20for=20a=20tuner=20lock=20in=20VDR/device.c,?= =?UTF-8?q?=20since=20=20=20apparently=20some=20users=20actually=20need=20?= =?UTF-8?q?it.=20It's=20not=20active=20by=20default,=20you'll=20have=20=20?= =?UTF-8?q?=20to=20define=20the=20WAIT=5FFOR=5FTUNER=5FLOCK=20macro=20in?= =?UTF-8?q?=20that=20file=20if=20you=20need=20it=20(suggested=20=20=20by?= =?UTF-8?q?=20Malcolm=20Caldwell).=20-=20Adjusted=20the=20Makefile=20to=20?= =?UTF-8?q?the=20dvb-kernel=20driver=20on=20kernel=202.6=20and=20up=20(tha?= =?UTF-8?q?nks=20to=20=20=20Lauri=20Tischler).=20-=20Repeat=20keys=20are?= =?UTF-8?q?=20now=20ignored=20when=20waiting=20for=20a=20keypress=20to=20c?= =?UTF-8?q?ancel=20an=20operation=20=20=20(thanks=20to=20Marko=20M=C3=A4ke?= =?UTF-8?q?l=C3=A4).=20-=20The=20main=20menu=20function=20of=20a=20plugin?= =?UTF-8?q?=20can=20now=20be=20activated=20through=20a=20key=20macro=20of?= =?UTF-8?q?=20=20=20the=20form=20"@plugin"=20even=20if=20that=20plugin=20d?= =?UTF-8?q?oesn't=20have=20a=20main=20menu=20entry=20(using=20=20=20part?= =?UTF-8?q?=20of=20a=20patch=20by=20Hardy=20Flor,=20which=20originally=20i?= =?UTF-8?q?mplemented=20calling=20plugins=20from=20=20=20SVDRP).=20-=20The?= =?UTF-8?q?=20menu=20timeout=20handling=20is=20now=20done=20centrally=20in?= =?UTF-8?q?=20the=20main=20program=20loop.=20-=20Added=20missing=20help=20?= =?UTF-8?q?for=20the=20'help'=20keyword=20in=20the=20SVDRP=20command=20PLU?= =?UTF-8?q?G.=20-=20The=20main=20menu=20function=20of=20a=20plugin=20can?= =?UTF-8?q?=20now=20be=20called=20programmatically=20through=20=20=20the?= =?UTF-8?q?=20static=20function=20cRemote::CallPlugin().=20-=20The=20SVDRP?= =?UTF-8?q?=20command=20PLUG=20now=20has=20a=20new=20option=20'main'=20whi?= =?UTF-8?q?ch=20can=20be=20used=20to=20initiate=20=20=20a=20call=20to=20th?= =?UTF-8?q?e=20main=20menu=20function=20of=20a=20plugin=20(using=20part=20?= =?UTF-8?q?of=20a=20patch=20by=20Hardy=20Flor).=20-=20The=20new=20command?= =?UTF-8?q?=20line=20option=20'--vfat'=20can=20be=20used=20to=20make=20VDR?= =?UTF-8?q?=20encode=20special=20=20=20characters=20in=20recording=20file?= =?UTF-8?q?=20names,=20even=20if=20it=20wasn't=20compiled=20with=20VFAT=3D?= =?UTF-8?q?1=20=20=20(suggested=20by=20Peter=20Bieringer).=20The=20compile?= =?UTF-8?q?=20time=20option=20VFAT=20still=20exists=20and=20=20=20creates?= =?UTF-8?q?=20a=20VDR=20that=20always=20behaves=20as=20if=20it=20were=20ca?= =?UTF-8?q?lled=20with=20'--vfat'.=20-=20Replaced=20the=20':'=20delimiter?= =?UTF-8?q?=20between=20hour=20and=20minute=20in=20recording=20file=20name?= =?UTF-8?q?s=20with=20=20=20a=20'.'=20under=20Linux,=20too.=20Existing=20r?= =?UTF-8?q?ecordings=20with=20':'=20as=20delimiter=20will=20still=20work.?= =?UTF-8?q?=20-=20Implemented=20the=20SVDRP=20command=20MOVC=20(thanks=20t?= =?UTF-8?q?o=20Andreas=20Brachold).=20-=20Added=20support=20for=20multiple?= =?UTF-8?q?=20audio=20language=20codes=20in=20ISO639LanguageDescriptors=20?= =?UTF-8?q?to=20=20=20'libsi'=20(thanks=20to=20Marcel=20Wiesweg).=20-=20Ch?= =?UTF-8?q?anged=20the=20audio=20PID=20language=20codes=20to=20hold=20up?= =?UTF-8?q?=20to=20two=203=20letter=20codes,=20separated=20=20=20by=20'+',?= =?UTF-8?q?=20to=20store=20separate=20languages=20broadcast=20in=20two=20c?= =?UTF-8?q?hannel=20audio=20mode.=20-=20If=20the=20preferred=20audio=20lan?= =?UTF-8?q?guage=20is=20broadcast=20on=20a=20PID=20that=20has=20two=20diff?= =?UTF-8?q?erent=20=20=20languages=20in=20the=20two=20stereo=20channels,?= =?UTF-8?q?=20the=20audio=20channel=20is=20now=20properly=20set=20when=20?= =?UTF-8?q?=20=20switching=20to=20such=20a=20channel=20(thanks=20to=20Moge?= =?UTF-8?q?ns=20Elneff=20for=20his=20help=20in=20testing=20this).=20-=20Fi?= =?UTF-8?q?xed=20some=20typos=20in=20MANUAL=20(thanks=20to=20Ville=20Skytt?= =?UTF-8?q?=C3=A4).=20-=20Fixed=20the=20default=20value=20for=20"Setup/EPG?= =?UTF-8?q?=20bugfix=20level"=20(thanks=20to=20Ville=20Skytt=C3=A4=20for?= =?UTF-8?q?=20=20=20reporting=20this=20one).=20-=20Fixed=20defining=20time?= =?UTF-8?q?rs=20that=20only=20differ=20in=20the=20day=20of=20week=20(thank?= =?UTF-8?q?s=20to=20Patrick=20=20=20Rother=20for=20reporting=20this=20one)?= =?UTF-8?q?.=20-=20Fixed=20converting=20summary.vdr=20files=20that=20would?= =?UTF-8?q?=20result=20in=20a=20very=20long=20'short=20text'=20=20=20(than?= =?UTF-8?q?ks=20to=20Carsten=20Koch).=20-=20Implemented=20a=20hash=20for?= =?UTF-8?q?=20the=20channels=20to=20reduce=20the=20system=20load=20in=20th?= =?UTF-8?q?e=20EIT=20scanning=20=20=20thread=20(based=20on=20a=20patch=20b?= =?UTF-8?q?y=20Georg=20Acher).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- channels.c | 89 +++++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 59 insertions(+), 30 deletions(-) (limited to 'channels.c') diff --git a/channels.c b/channels.c index 8577852..939c29f 100644 --- a/channels.c +++ b/channels.c @@ -4,12 +4,13 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.c 1.44 2005/08/06 12:22:41 kls Exp $ + * $Id: channels.c 1.46 2005/09/11 14:22:24 kls Exp $ */ #include "channels.h" #include #include +#include "device.h" // IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d' // format characters in order to allow any number of blanks after a numeric @@ -341,11 +342,14 @@ void cChannel::SetId(int Nid, int Tid, int Sid, int Rid) dsyslog("changing id of channel %d from %d-%d-%d-%d to %d-%d-%d-%d", Number(), nid, tid, sid, rid, Nid, Tid, Sid, Rid); modification |= CHANNELMOD_ID; Channels.SetModified(); + Channels.UnhashChannel(this); } nid = Nid; tid = Tid; sid = Sid; rid = Rid; + if (Number()) + Channels.HashChannel(this); } } @@ -386,7 +390,7 @@ void cChannel::SetPortalName(const char *PortalName) #define STRDIFF 0x01 #define VALDIFF 0x02 -static int IntArraysDiffer(const int *a, const int *b, const char na[][4] = NULL, const char nb[][4] = NULL) +static int IntArraysDiffer(const int *a, const int *b, const char na[][MAXLANGCODE2] = NULL, const char nb[][MAXLANGCODE2] = NULL) { int result = 0; for (int i = 0; a[i] || b[i]; i++) { @@ -400,7 +404,7 @@ static int IntArraysDiffer(const int *a, const int *b, const char na[][4] = NULL return result; } -static int IntArrayToString(char *s, const int *a, int Base = 10, const char n[][4] = NULL) +static int IntArrayToString(char *s, const int *a, int Base = 10, const char n[][MAXLANGCODE2] = NULL) { char *q = s; int i = 0; @@ -416,7 +420,7 @@ static int IntArrayToString(char *s, const int *a, int Base = 10, const char n[] return q - s; } -void cChannel::SetPids(int Vpid, int Ppid, int *Apids, char ALangs[][4], int *Dpids, char DLangs[][4], int Tpid) +void cChannel::SetPids(int Vpid, int Ppid, int *Apids, char ALangs[][MAXLANGCODE2], int *Dpids, char DLangs[][MAXLANGCODE2], int Tpid) { int mod = CHANNELMOD_NONE; if (vpid != Vpid || ppid != Ppid || tpid != Tpid) @@ -427,8 +431,9 @@ void cChannel::SetPids(int Vpid, int Ppid, int *Apids, char ALangs[][4], int *Dp if (m & VALDIFF) mod |= CHANNELMOD_PIDS; if (mod) { - char OldApidsBuf[(MAXAPIDS + MAXDPIDS) * 10 + 10]; // 10: 5 digits plus delimiting ',' or ';' plus optional '=cod', +10: paranoia - char NewApidsBuf[(MAXAPIDS + MAXDPIDS) * 10 + 10]; + const int BufferSize = (MAXAPIDS + MAXDPIDS) * (5 + 1 + MAXLANGCODE2) + 10; // 5 digits plus delimiting ',' or ';' plus optional '=cod+cod', +10: paranoia + char OldApidsBuf[BufferSize]; + char NewApidsBuf[BufferSize]; char *q = OldApidsBuf; q += IntArrayToString(q, apids, 10, alangs); if (dpids[0]) { @@ -448,12 +453,12 @@ void cChannel::SetPids(int Vpid, int Ppid, int *Apids, char ALangs[][4], int *Dp ppid = Ppid; for (int i = 0; i < MAXAPIDS; i++) { apids[i] = Apids[i]; - strn0cpy(alangs[i], ALangs[i], 4); + strn0cpy(alangs[i], ALangs[i], MAXLANGCODE2); } apids[MAXAPIDS] = 0; for (int i = 0; i < MAXDPIDS; i++) { dpids[i] = Dpids[i]; - strn0cpy(dlangs[i], DLangs[i], 4); + strn0cpy(dlangs[i], DLangs[i], MAXLANGCODE2); } dpids[MAXDPIDS] = 0; tpid = Tpid; @@ -633,7 +638,8 @@ cString cChannel::ToText(const cChannel *Channel) if (Channel->ppid && Channel->ppid != Channel->vpid) q += snprintf(q, sizeof(vpidbuf) - (q - vpidbuf), "+%d", Channel->ppid); *q = 0; - char apidbuf[(MAXAPIDS + MAXDPIDS) * 10 + 10]; // 10: 5 digits plus delimiting ',' or ';' plus optional '=cod', +10: paranoia + const int BufferSize = (MAXAPIDS + MAXDPIDS) * (5 + 1 + MAXLANGCODE2) + 10; // 5 digits plus delimiting ',' or ';' plus optional '=cod+cod', +10: paranoia + char apidbuf[BufferSize]; q = apidbuf; q += IntArrayToString(q, Channel->apids, 10, Channel->alangs); if (Channel->dpids[0]) { @@ -722,7 +728,7 @@ bool cChannel::Parse(const char *s) char *l = strchr(q, '='); if (l) { *l++ = 0; - strn0cpy(alangs[NumApids], l, 4); + strn0cpy(alangs[NumApids], l, MAXLANGCODE2); } else *alangs[NumApids] = 0; @@ -743,7 +749,7 @@ bool cChannel::Parse(const char *s) char *l = strchr(q, '='); if (l) { *l++ = 0; - strn0cpy(dlangs[NumDpids], l, 4); + strn0cpy(dlangs[NumDpids], l, MAXLANGCODE2); } else *dlangs[NumDpids] = 0; @@ -865,6 +871,16 @@ bool cChannels::Load(const char *FileName, bool AllowComments, bool MustExist) return false; } +void cChannels::HashChannel(cChannel *Channel) +{ + channelsHashSid.Add(Channel, Channel->Sid()); +} + +void cChannels::UnhashChannel(cChannel *Channel) +{ + channelsHashSid.Del(Channel, Channel->Sid()); +} + int cChannels::GetNextGroup(int Idx) { cChannel *channel = Get(++Idx); @@ -891,6 +907,7 @@ int cChannels::GetNextNormal(int Idx) void cChannels::ReNumber( void ) { + channelsHashSid.Clear(); int Number = 1; for (cChannel *channel = First(); channel; channel = Next(channel)) { if (channel->GroupSep()) { @@ -898,6 +915,7 @@ void cChannels::ReNumber( void ) Number = channel->Number(); } else { + HashChannel(channel); maxNumber = Number; channel->SetNumber(Number++); } @@ -921,32 +939,43 @@ cChannel *cChannels::GetByNumber(int Number, int SkipGap) cChannel *cChannels::GetByServiceID(int Source, int Transponder, unsigned short ServiceID) { - for (cChannel *channel = First(); channel; channel = Next(channel)) { - if (!channel->GroupSep() && channel->Source() == Source && ISTRANSPONDER(channel->Transponder(), Transponder) && channel->Sid() == ServiceID) - return channel; - } + cList *list = channelsHashSid.GetList(ServiceID); + if (list) { + for (cHashObject *hobj = list->First(); hobj; hobj = list->Next(hobj)) { + cChannel *channel = (cChannel *)hobj->Object(); + if (channel->Sid() == ServiceID && channel->Source() == Source && ISTRANSPONDER(channel->Transponder(), Transponder)) + return channel; + } + } return NULL; } cChannel *cChannels::GetByChannelID(tChannelID ChannelID, bool TryWithoutRid, bool TryWithoutPolarization) { - for (cChannel *channel = First(); channel; channel = Next(channel)) { - if (!channel->GroupSep() && channel->GetChannelID() == ChannelID) - return channel; - } - if (TryWithoutRid) { - ChannelID.ClrRid(); - for (cChannel *channel = First(); channel; channel = Next(channel)) { - if (!channel->GroupSep() && channel->GetChannelID().ClrRid() == ChannelID) - return channel; - } - } - if (TryWithoutPolarization) { - ChannelID.ClrPolarization(); - for (cChannel *channel = First(); channel; channel = Next(channel)) { - if (!channel->GroupSep() && channel->GetChannelID().ClrPolarization() == ChannelID) + int sid = ChannelID.Sid(); + cList *list = channelsHashSid.GetList(sid); + if (list) { + for (cHashObject *hobj = list->First(); hobj; hobj = list->Next(hobj)) { + cChannel *channel = (cChannel *)hobj->Object(); + if (channel->Sid() == sid && channel->GetChannelID() == ChannelID) return channel; } + if (TryWithoutRid) { + ChannelID.ClrRid(); + for (cHashObject *hobj = list->First(); hobj; hobj = list->Next(hobj)) { + cChannel *channel = (cChannel *)hobj->Object(); + if (channel->Sid() == sid && channel->GetChannelID().ClrRid() == ChannelID) + return channel; + } + } + if (TryWithoutPolarization) { + ChannelID.ClrPolarization(); + for (cHashObject *hobj = list->First(); hobj; hobj = list->Next(hobj)) { + cChannel *channel = (cChannel *)hobj->Object(); + if (channel->Sid() == sid && channel->GetChannelID().ClrPolarization() == ChannelID) + return channel; + } + } } return NULL; } -- cgit v1.2.3