vdr  2.4.0
filter.h
Go to the documentation of this file.
1 /*
2  * filter.h: Section filter
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * $Id: filter.h 4.3 2017/05/07 15:18:48 kls Exp $
8  */
9 
10 #ifndef __FILTER_H
11 #define __FILTER_H
12 
13 #include <sys/types.h>
14 #include "tools.h"
15 
17 private:
20  bool synced;
21  bool complete;
22  uchar sections[32]; // holds 32 * 8 = 256 bits, as flags for the sections
23  void SetSectionFlag(uchar Section, bool On) { if (On) sections[Section / 8] |= (1 << (Section % 8)); else sections[Section / 8] &= ~(1 << (Section % 8)); }
24  bool GetSectionFlag(uchar Section) { return sections[Section / 8] & (1 << (Section % 8)); }
25 public:
26  cSectionSyncer(void);
27  void Reset(void);
28  void Repeat(void);
29  bool Complete(void) { return complete; }
30  bool Sync(uchar Version, int Number, int LastNumber);
31  };
32 
33 class cFilterData : public cListObject {
34 public:
35  u_short pid;
38  bool sticky;
39  cFilterData(void);
40  cFilterData(u_short Pid, u_char Tid, u_char Mask, bool Sticky);
41  cFilterData& operator= (const cFilterData &FilterData);
42  bool Is(u_short Pid, u_char Tid, u_char Mask);
43  bool Matches(u_short Pid, u_char Tid);
44  };
45 
46 class cChannel;
47 class cSectionHandler;
48 
49 class cFilter : public cListObject {
50  friend class cSectionHandler;
51 private:
54  bool on;
55 protected:
56  cFilter(void);
57  cFilter(u_short Pid, u_char Tid, u_char Mask = 0xFF);
58  virtual ~cFilter();
59  virtual void SetStatus(bool On);
66  virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length) = 0;
77  int Source(void);
79  int Transponder(void);
81  const cChannel *Channel(void);
83  bool Matches(u_short Pid, u_char Tid);
85  void Set(u_short Pid, u_char Tid, u_char Mask = 0xFF);
87  void Add(u_short Pid, u_char Tid, u_char Mask = 0xFF, bool Sticky = false);
91  void Del(u_short Pid, u_char Tid, u_char Mask = 0xFF);
93  };
94 
95 #endif //__FILTER_H
bool synced
Definition: filter.h:20
unsigned char uchar
Definition: tools.h:31
bool sticky
Definition: filter.h:38
cFilterData(void)
Definition: filter.c:58
bool Matches(u_short Pid, u_char Tid)
Definition: filter.c:88
cList< cFilterData > data
Definition: filter.h:53
void Add(u_short Pid, u_char Tid, u_char Mask=0xFF, bool Sticky=false)
Adds the given filter data to this filter.
Definition: filter.c:167
const cChannel * Channel(void)
Returns the channel of the data delivered to this filter.
Definition: filter.c:124
cFilterData & operator=(const cFilterData &FilterData)
Definition: filter.c:74
bool on
Definition: filter.h:54
u_short pid
Definition: filter.h:35
bool GetSectionFlag(uchar Section)
Definition: filter.h:24
void SetSectionFlag(uchar Section, bool On)
Definition: filter.h:23
Definition: filter.h:49
bool Sync(uchar Version, int Number, int LastNumber)
Definition: filter.c:36
cSectionSyncer(void)
Definition: filter.c:15
virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length)=0
Processes the data delivered to this filter.
cFilter(void)
Definition: filter.c:95
bool Matches(u_short Pid, u_char Tid)
Indicates whether this filter wants to receive data from the given Pid/Tid.
Definition: filter.c:151
void Del(u_short Pid, u_char Tid, u_char Mask=0xFF)
Deletes the given filter data from this filter.
Definition: filter.c:175
u_char mask
Definition: filter.h:37
int currentVersion
Definition: filter.h:18
int Source(void)
Returns the source of the data delivered to this filter.
Definition: filter.c:114
cSectionHandler * sectionHandler
Definition: filter.h:52
void Repeat(void)
Definition: filter.c:29
u_char tid
Definition: filter.h:36
bool Is(u_short Pid, u_char Tid, u_char Mask)
Definition: filter.c:83
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
Definition: filter.c:129
bool Complete(void)
Definition: filter.h:29
unsigned char u_char
Definition: headers.h:24
int currentSection
Definition: filter.h:19
int Transponder(void)
Returns the transponder of the data delivered to this filter.
Definition: filter.c:119
void Set(u_short Pid, u_char Tid, u_char Mask=0xFF)
Sets the given filter data by calling Add() with Sticky = true.
Definition: filter.c:162
bool complete
Definition: filter.h:21
uchar sections[32]
Definition: filter.h:22
void Reset(void)
Definition: filter.c:20
virtual ~cFilter()
Definition: filter.c:108