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.
|
|
|
|
*
|
2010-01-01 15:44:52 +01:00
|
|
|
* $Id: receiver.c 2.1 2010/01/01 15:38:48 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
|
|
|
|
2007-01-07 14:46:14 +01:00
|
|
|
cReceiver::cReceiver(tChannelID ChannelID, int Priority, int Pid, const int *Pids1, const int *Pids2, const int *Pids3)
|
2002-06-16 12:57:31 +02:00
|
|
|
{
|
|
|
|
device = NULL;
|
2007-01-07 14:46:14 +01:00
|
|
|
channelID = ChannelID;
|
2002-06-16 12:57:31 +02:00
|
|
|
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()
|
|
|
|
{
|
2007-08-12 12:30:00 +02:00
|
|
|
if (device) {
|
|
|
|
const char *msg = "ERROR: cReceiver has not been detached yet! This is a design fault and VDR will segfault now!";
|
2010-01-01 15:44:52 +01:00
|
|
|
esyslog("%s", msg);
|
2007-08-12 12:30:00 +02:00
|
|
|
fprintf(stderr, "%s\n", msg);
|
|
|
|
*(char *)0 = 0; // cause a segfault
|
|
|
|
}
|
2002-06-16 12:57:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|