blob: 8f94c1a144bf9a5b5cd5d7fa6a77f1c263a8ab4c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/*
* receiver.c: The basic receiver interface
*
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: receiver.c 1.2 2002/07/28 10:48:42 kls Exp $
*/
#include <stdarg.h>
#include <stdio.h>
#include "receiver.h"
cReceiver::cReceiver(int Ca, int Priority, int NumPids, ...)
{
device = NULL;
ca = Ca;
priority = Priority;
for (int i = 0; i < MAXRECEIVEPIDS; i++)
pids[i] = 0;
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);
}
|