|
SASC-NG
DVBSoftCAM
|
Inheritance diagram for cChannelList:Public Member Functions | |
| cChannelList (const char *DevId) | |
| void | Unique (bool full) |
| void | CheckIgnore (void) |
| int | Histo (void) |
| void | Purge (int caid, bool fullch) |
| cChannelList::cChannelList | ( | const char * | DevId | ) |
| void cChannelList::CheckIgnore | ( | void | ) |
Definition at line 1585 of file cam.c.
References cSystems::FindIdentBySysId(), cSimpleList< cChannelCaids >::First(), free, cOverrides::Ignore(), L_CORE_CAIDS, MALLOC, cSimpleList< cChannelCaids >::Next(), overrides, and PRINTF.
{
char *cache=MALLOC(char,0x10000);
if(!cache) return;
memset(cache,0,sizeof(char)*0x10000);
int cTotal=0, cHits=0;
for(cChannelCaids *ch=First(); ch; ch=Next(ch)) {
const caid_t *ids=ch->Caids();
while(*ids) {
int pri=0;
if(overrides.Ignore(ch->Source(),ch->Transponder(),*ids))
ch->Del(*ids);
else {
char c=cache[*ids];
if(c==0) cache[*ids]=c=(cSystems::FindIdentBySysId(*ids,false,pri) ? 1 : -1);
else cHits++;
cTotal++;
if(c<0) {
for(cChannelCaids *ch2=Next(ch); ch2; ch2=Next(ch2)) ch2->Del(*ids);
ch->Del(*ids);
}
else ids++;
}
}
}
free(cache);
PRINTF(L_CORE_CAIDS,"%s: after check",devId);
for(cChannelCaids *ch=First(); ch; ch=Next(ch)) ch->Dump(devId);
PRINTF(L_CORE_CAIDS,"%s: check cache usage: %d requests, %d hits, %d%% hits",devId,cTotal,cHits,(cTotal>0)?(cHits*100/cTotal):0);
}
| int cChannelList::Histo | ( | void | ) |
Definition at line 1633 of file cam.c.
References cSimpleList< cChannelCaids >::First(), free, i, L_GEN_ERROR, MALLOC, cSimpleList< cChannelCaids >::Next(), and PRINTF.
{
int h=-1;
unsigned short *hist=MALLOC(unsigned short,0x10000);
if(hist) {
memset(hist,0,sizeof(unsigned short)*0x10000);
for(cChannelCaids *ch=First(); ch; ch=Next(ch)) ch->HistAdd(hist);
int c=0;
for(int i=0; i<0x10000; i++)
if(hist[i]>c) { h=i; c=hist[i]; }
free(hist);
}
else PRINTF(L_GEN_ERROR,"malloc failed in cChannelList::Histo");
return h;
}
| void cChannelList::Purge | ( | int | caid, |
| bool | fullch | ||
| ) |
Definition at line 1649 of file cam.c.
References cSimpleListBase::Count(), cSimpleListBase::Del(), cSimpleList< cChannelCaids >::First(), L_CORE_CAIDS, cSimpleList< cChannelCaids >::Next(), and PRINTF.
{
for(cChannelCaids *ch=First(); ch;) {
if(!fullch) ch->Del(caid);
if(ch->NumCaids()<=0 || (fullch && ch->HasCaid(caid))) {
cChannelCaids *t=Next(ch);
Del(ch);
ch=t;
}
else ch=Next(ch);
}
if(Count()>0) {
PRINTF(L_CORE_CAIDS,"%s: still left",devId);
for(cChannelCaids *ch=First(); ch; ch=Next(ch)) ch->Dump(devId);
}
}
| void cChannelList::Unique | ( | bool | full | ) |
Definition at line 1616 of file cam.c.
References cSimpleListBase::Count(), cSimpleListBase::Del(), cSimpleList< cChannelCaids >::First(), L_CORE_CAIDS, cSimpleList< cChannelCaids >::Next(), and PRINTF.
{
for(cChannelCaids *ch1=First(); ch1; ch1=Next(ch1)) {
for(cChannelCaids *ch2=Next(ch1); ch2;) {
if(ch1->Same(ch2,full) || ch2->NumCaids()<1) {
cChannelCaids *t=Next(ch2);
Del(ch2);
ch2=t;
}
else ch2=Next(ch2);
}
}
if(Count()==1 && First() && First()->NumCaids()<1) Del(First());
PRINTF(L_CORE_CAIDS,"%s: after unique (%d)",devId,full);
for(cChannelCaids *ch=First(); ch; ch=Next(ch)) ch->Dump(devId);
}