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.
|
|
|
|
*
|
2002-08-04 14:57:29 +02:00
|
|
|
* $Id: receiver.c 1.3 2002/07/28 15:14:49 kls Exp $
|
2002-06-16 12:57:31 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "receiver.h"
|
2002-08-04 14:57:29 +02:00
|
|
|
#include "tools.h"
|
2002-06-16 12:57:31 +02:00
|
|
|
|
|
|
|
cReceiver::cReceiver(int Ca, int Priority, int NumPids, ...)
|
|
|
|
{
|
|
|
|
device = NULL;
|
|
|
|
ca = Ca;
|
|
|
|
priority = Priority;
|
2002-07-28 11:29:32 +02:00
|
|
|
for (int i = 0; i < MAXRECEIVEPIDS; i++)
|
|
|
|
pids[i] = 0;
|
2002-06-16 12:57:31 +02:00
|
|
|
if (NumPids) {
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, NumPids);
|
|
|
|
int n = 0;
|
|
|
|
while (n < MAXRECEIVEPIDS && NumPids--) {
|
|
|
|
if ((pids[n] = va_arg(ap, int)) != 0)
|
|
|
|
n++;
|
|
|
|
}
|
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
esyslog("ERROR: cReceiver called without a PID!");
|
|
|
|
}
|
|
|
|
|
|
|
|
cReceiver::~cReceiver()
|
|
|
|
{
|
|
|
|
Detach();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cReceiver::WantsPid(int Pid)
|
|
|
|
{
|
|
|
|
if (Pid) {
|
|
|
|
for (int i = 0; i < MAXRECEIVEPIDS; i++) {
|
|
|
|
if (pids[i] == Pid)
|
|
|
|
return true;
|
|
|
|
if (!pids[i])
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cReceiver::Detach(void)
|
|
|
|
{
|
|
|
|
if (device)
|
|
|
|
device->Detach(this);
|
|
|
|
}
|