summaryrefslogtreecommitdiff
path: root/receiver.c
diff options
context:
space:
mode:
Diffstat (limited to 'receiver.c')
-rw-r--r--receiver.c75
1 files changed, 58 insertions, 17 deletions
diff --git a/receiver.c b/receiver.c
index 08346e4f..f922e980 100644
--- a/receiver.c
+++ b/receiver.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: receiver.c 2.1 2010/01/01 15:38:48 kls Exp $
+ * $Id: receiver.c 2.2 2010/01/30 10:25:38 kls Exp $
*/
#include "receiver.h"
@@ -12,28 +12,26 @@
#include <stdio.h>
#include "tools.h"
+#ifdef LEGACY_CRECEIVER
cReceiver::cReceiver(tChannelID ChannelID, int Priority, int Pid, const int *Pids1, const int *Pids2, const int *Pids3)
{
device = NULL;
channelID = ChannelID;
priority = Priority;
numPids = 0;
- if (Pid)
- pids[numPids++] = Pid;
- if (Pids1) {
- while (*Pids1 && numPids < MAXRECEIVEPIDS)
- pids[numPids++] = *Pids1++;
- }
- 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");
+ AddPid(Pid);
+ AddPids(Pids1);
+ AddPids(Pids2);
+ AddPids(Pids3);
+}
+#endif
+
+cReceiver::cReceiver(const cChannel *Channel, int Priority)
+{
+ device = NULL;
+ priority = Priority;
+ numPids = 0;
+ SetPids(Channel);
}
cReceiver::~cReceiver()
@@ -46,6 +44,49 @@ cReceiver::~cReceiver()
}
}
+bool cReceiver::AddPid(int Pid)
+{
+ if (Pid) {
+ if (numPids < MAXRECEIVEPIDS)
+ pids[numPids++] = Pid;
+ else {
+ dsyslog("too many PIDs in cReceiver (Pid = %d)", Pid);
+ return false;
+ }
+ }
+ return true;
+}
+
+bool cReceiver::AddPids(const int *Pids)
+{
+ if (Pids) {
+ while (*Pids) {
+ if (!AddPid(*Pids++))
+ return false;
+ }
+ }
+ return true;
+}
+
+bool cReceiver::AddPids(int Pid1, int Pid2, int Pid3, int Pid4, int Pid5, int Pid6, int Pid7, int Pid8, int Pid9)
+{
+ return AddPid(Pid1) && AddPid(Pid2) && AddPid(Pid3) && AddPid(Pid4) && AddPid(Pid5) && AddPid(Pid6) && AddPid(Pid7) && AddPid(Pid8) && AddPid(Pid9);
+}
+
+bool cReceiver::SetPids(const cChannel *Channel)
+{
+ numPids = 0;
+ if (Channel) {
+ channelID = Channel->GetChannelID();
+ return AddPid(Channel->Vpid()) &&
+ (Channel->Ppid() == Channel->Vpid() || AddPid(Channel->Ppid())) &&
+ AddPids(Channel->Apids()) &&
+ (!Setup.UseDolbyDigital || AddPids(Channel->Dpids())) &&
+ AddPids(Channel->Spids());
+ }
+return true;
+}
+
bool cReceiver::WantsPid(int Pid)
{
if (Pid) {