vdr 2.8.3
receiver.h
Go to the documentation of this file.
1/*
2 * receiver.h: The basic receiver interface
3 *
4 * See the main source file 'vdr.c' for copyright information and
5 * how to reach the author.
6 *
7 * $Id: receiver.h 4.3 2017/05/01 08:48:34 kls Exp $
8 */
9
10#ifndef __RECEIVER_H
11#define __RECEIVER_H
12
13#include <atomic>
14#include "device.h"
15
16#define MAXRECEIVEPIDS 64 // the maximum number of PIDs per receiver
17
18class cReceiver {
19 friend class cDevice;
20private:
21 std::atomic<cDevice *> device; // cleared by cDevice::Detach() in any thread
24 // changed while attached (EMM/ECM PIDs), scanned by the device thread without a lock:
25 std::atomic<int> pids[MAXRECEIVEPIDS];
26 std::atomic<int> numPids;
32 bool WantsPid(int Pid);
33protected:
34 cDevice *Device(void) { return device; }
35 void Detach(void);
36 virtual void Activate(bool On) {}
41 virtual void Receive(const uchar *Data, int Length) = 0;
48public:
49 cReceiver(const cChannel *Channel = NULL, int Priority = MINPRIORITY);
58 virtual ~cReceiver();
59 int Priority(void) { return priority; }
60 void SetPriority(int Priority);
61 bool AddPid(int Pid);
63 bool AddPids(const int *Pids);
66 bool AddPids(int Pid1, int Pid2, int Pid3 = 0, int Pid4 = 0, int Pid5 = 0, int Pid6 = 0, int Pid7 = 0, int Pid8 = 0, int Pid9 = 0);
68 bool SetPids(const cChannel *Channel);
77 void DelPid(int Pid);
79 void DelPids(const int *Pids);
82 tChannelID ChannelID(void) { return channelID; }
83 int NumPids(void) const { return numPids; }
84 bool IsAttached(void) { return device != NULL; }
90 };
91
92#endif //__RECEIVER_H
void SetPriority(int Priority)
Definition receiver.c:37
time_t lastEitInjection
Definition receiver.h:31
bool IsAttached(void)
Returns true if this receiver is (still) attached to a device.
Definition receiver.h:84
int Priority(void)
Definition receiver.h:59
bool WantsPid(int Pid)
Definition receiver.c:114
bool AddPids(const int *Pids)
Adds the given zero terminated list of Pids to the list of PIDs of this receiver.
Definition receiver.c:60
std::atomic< int > pids[MAXRECEIVEPIDS]
Definition receiver.h:25
time_t startEitInjection
Definition receiver.h:30
tChannelID ChannelID(void)
Definition receiver.h:82
friend class cDevice
Definition receiver.h:19
std::atomic< cDevice * > device
Definition receiver.h:21
void Detach(void)
Definition receiver.c:125
int priority
Definition receiver.h:23
virtual void Receive(const uchar *Data, int Length)=0
This function is called from the cDevice we are attached to, and delivers one TS packet from the set ...
bool AddPid(int Pid)
Adds the given Pid to the list of PIDs of this receiver.
Definition receiver.c:42
bool SetPids(const cChannel *Channel)
Sets the PIDs of this receiver to those of the given Channel, replacing any previously stored PIDs.
Definition receiver.c:76
std::atomic< int > numPids
Definition receiver.h:26
void DelPids(const int *Pids)
Deletes the given zero terminated list of Pids from the list of PIDs of this receiver.
Definition receiver.c:106
time_t startScrambleDetection
Definition receiver.h:28
tChannelID channelID
Definition receiver.h:22
time_t lastScrambledPacket
Definition receiver.h:27
int NumPids(void) const
Definition receiver.h:83
int scramblingTimeout
Definition receiver.h:29
cReceiver(const cChannel *Channel=NULL, int Priority=MINPRIORITY)
Creates a new receiver for the given Channel with the given Priority.
Definition receiver.c:14
virtual void Activate(bool On)
This function is called just before the cReceiver gets attached to (On == true) and right after it ge...
Definition receiver.h:36
cDevice * Device(void)
Definition receiver.h:34
void DelPid(int Pid)
Deletes the given Pid from the list of PIDs of this receiver.
Definition receiver.c:90
#define MINPRIORITY
Definition config.h:42
#define MAXRECEIVEPIDS
Definition receiver.h:16
unsigned char uchar
Definition tools.h:31