SASC-NG
DVBSoftCAM

cChannelCaids Class Reference

Inheritance diagram for cChannelCaids:

List of all members.

Public Member Functions

 cChannelCaids (cChannel *channel)
bool IsChannel (cChannel *channel)
void Sort (void)
void Del (caid_t caid)
bool HasCaid (caid_t caid)
bool Same (cChannelCaids *ch, bool full)
void HistAdd (unsigned short *hist)
void Dump (const char *devId)
const caid_t * Caids (void)
int NumCaids (void)
int Source (void) const
int Transponder (void) const

Detailed Description

Definition at line 1484 of file cam.c.


Constructor & Destructor Documentation

cChannelCaids::cChannelCaids ( cChannel *  channel)

Definition at line 1504 of file cam.c.

References cChannel::Caids(), MAX_CI_SLOT_CAIDS, cChannel::Sid(), Sort(), cChannel::Source(), and cChannel::Transponder().

{
  prg=channel->Sid(); source=channel->Source(); transponder=channel->Transponder();
  numcaids=0;
  for(const caid_t *ids=channel->Caids(); *ids; ids++)
    if(numcaids<MAX_CI_SLOT_CAIDS) caids[numcaids++]=*ids;
  Sort();
}

Member Function Documentation

const caid_t* cChannelCaids::Caids ( void  ) [inline]

Definition at line 1498 of file cam.c.

Referenced by Dump().

{ caids[numcaids]=0; return caids; }
void cChannelCaids::Del ( caid_t  caid)

Definition at line 1530 of file cam.c.

References i, and Sort().

{
  for(int i=0; i<numcaids; i++)
    if(caids[i]==caid) {
      numcaids--; caids[i]=caids[numcaids];
      if(numcaids>0) Sort();
      caids[numcaids]=0;
      break;
      }
}
void cChannelCaids::Dump ( const char *  devId)

Definition at line 1559 of file cam.c.

References Caids(), L_CORE_CAIDS, LBEND, LBPUT, and LBSTART.

{
  LBSTART(L_CORE_CAIDS);
  LBPUT("%s: channel %d/%x/%x",devId,prg,source,transponder);
  for(const caid_t *ids=Caids(); *ids; ids++) LBPUT(" %04x",*ids);
  LBEND();
}
bool cChannelCaids::HasCaid ( caid_t  caid)

Definition at line 1541 of file cam.c.

References i.

{
  for(int i=0; i<numcaids; i++) if(caids[i]==caid) return true;
  return false;
}
void cChannelCaids::HistAdd ( unsigned short *  hist)

Definition at line 1554 of file cam.c.

References i.

{
  for(int i=numcaids-1; i>=0; i--) hist[caids[i]]++;
}
bool cChannelCaids::IsChannel ( cChannel *  channel)

Definition at line 1513 of file cam.c.

References cChannel::Sid(), cChannel::Source(), and cChannel::Transponder().

{
  return prg==channel->Sid() && source==channel->Source() && transponder==channel->Transponder();
}
int cChannelCaids::NumCaids ( void  ) [inline]

Definition at line 1499 of file cam.c.

{ return numcaids; }
bool cChannelCaids::Same ( cChannelCaids *  ch,
bool  full 
)

Definition at line 1547 of file cam.c.

{
  if(full && (source!=ch->source || transponder!=ch->transponder)) return false;
  if(numcaids!=ch->numcaids) return false;
  return memcmp(caids,ch->caids,numcaids*sizeof(caid_t))==0;
}
void cChannelCaids::Sort ( void  )

Definition at line 1518 of file cam.c.

References i, j, and MAX_CI_SLOT_CAIDS.

Referenced by cChannelCaids(), and Del().

{
  caid_t tmp[MAX_CI_SLOT_CAIDS];
  int c=0xFFFF;
  for(int i=0; i<numcaids; i++) {
    int d=0;
    for(int j=0; j<numcaids; j++) if(caids[j]>d && caids[j]<c) d=caids[j];
    tmp[i]=d; c=d;
    }
  memcpy(caids,tmp,sizeof(caids));
}
int cChannelCaids::Source ( void  ) const [inline]

Definition at line 1500 of file cam.c.

{ return source; }
int cChannelCaids::Transponder ( void  ) const [inline]

Definition at line 1501 of file cam.c.

{ return transponder; }

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines