2002-06-16 12:57:31 +02:00
|
|
|
/*
|
|
|
|
* receiver.c: The basic receiver interface
|
|
|
|
*
|
|
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
|
|
* how to reach the author.
|
|
|
|
*
|
2006-03-26 14:12:08 +02:00
|
|
|
* $Id: receiver.c 1.5 2006/03/26 14:07:21 kls Exp $
|
2002-06-16 12:57:31 +02:00
|
|
|
*/
|
|
|
|
|
2006-03-26 14:12:08 +02:00
|
|
|
#include "receiver.h"
|
2002-06-16 12:57:31 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
2002-08-04 14:57:29 +02:00
|
|
|
#include "tools.h"
|
2002-06-16 12:57:31 +02:00
|
|
|
|
2005-01-16 14:40:47 +01:00
|
|
|
cReceiver::cReceiver(int Ca, int Priority, int Pid, const int *Pids1, const int *Pids2, const int *Pids3)
|
2002-06-16 12:57:31 +02:00
|
|
|
{
|
|
|
|
device = NULL;
|
|
|
|
ca = Ca;
|
|
|
|
priority = Priority;
|
2005-01-16 14:40:47 +01:00
|
|
|
numPids = 0;
|
|
|
|
if (Pid)
|
|
|
|
pids[numPids++] = Pid;
|
|
|
|
if (Pids1) {
|
|
|
|
while (*Pids1 && numPids < MAXRECEIVEPIDS)
|
|
|
|
pids[numPids++] = *Pids1++;
|
2002-06-16 12:57:31 +02:00
|
|
|
}
|
2005-01-16 14:40:47 +01:00
|
|
|
if (Pids2) {
|
|
|
|
while (*Pids2 && numPids < MAXRECEIVEPIDS)
|
|
|
|
pids[numPids++] = *Pids2++;
|
|
|
|
}
|
|
|
|
if (Pids3) {
|
|
|
|
while (*Pids3 && numPids < MAXRECEIVEPIDS)
|
|
|
|
pids[numPids++] = *Pids3++;
|
|
|
|
}
|
|
|
|
if (numPids >= MAXRECEIVEPIDS)
|
|
|
|
dsyslog("too many PIDs in cReceiver");
|
2002-06-16 12:57:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cReceiver::~cReceiver()
|
|
|
|
{
|
|
|
|
Detach();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cReceiver::WantsPid(int Pid)
|
|
|
|
{
|
|
|
|
if (Pid) {
|
2005-01-16 14:40:47 +01:00
|
|
|
for (int i = 0; i < numPids; i++) {
|
2002-06-16 12:57:31 +02:00
|
|
|
if (pids[i] == Pid)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cReceiver::Detach(void)
|
|
|
|
{
|
|
|
|
if (device)
|
|
|
|
device->Detach(this);
|
|
|
|
}
|