vdr 2.7.2
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 5.3 2024/09/09 22:15:59 kls Exp $
8 */
9
10#ifndef __FILTER_H
11#define __FILTER_H
12
13#include <sys/types.h>
14#include "tools.h"
15
16#ifndef DEPRECATED_SECTIONSYNCER_SYNC_REPEAT
17#define DEPRECATED_SECTIONSYNCER_SYNC_REPEAT 0
18#endif
19
21private:
24 bool random;
25 bool synced;
27 uint32_t segments; // bit flags for the 32 segments
28 uchar sections[32]; // holds 32 * 8 = 256 bits, as flags for the sections
29 void SetSectionFlag(uchar Section, bool On) { if (On) sections[Section / 8] |= (1 << (Section % 8)); else sections[Section / 8] &= ~(1 << (Section % 8)); }
30 bool GetSectionFlag(uchar Section) { return sections[Section / 8] & (1 << (Section % 8)); }
31public:
32 cSectionSyncer(bool Random = false);
41 void Reset(void);
42 bool Check(uchar Version, int SectionNumber);
46 bool Processed(int SectionNumber, int LastSectionNumber, int SegmentLastSectionNumber = -1);
52 bool Complete(void) { return complete; }
54#if DEPRECATED_SECTIONSYNCER_SYNC_REPEAT
55 [[deprecated("see HISTORY, version 2.5.2")]]
56 void Repeat(void);
57 [[deprecated("see HISTORY, version 2.5.2")]]
58 bool Sync(uchar Version, int Number, int LastNumber);
59#endif
60 };
61
64public:
66 };
67
68class cFilterData : public cListObject {
69public:
70 u_short pid;
71 u_char tid;
72 u_char mask;
73 bool sticky;
74 cFilterData(void);
75 cFilterData(u_short Pid, u_char Tid, u_char Mask, bool Sticky);
76 cFilterData& operator= (const cFilterData &FilterData);
77 bool Is(u_short Pid, u_char Tid, u_char Mask);
78 bool Matches(u_short Pid, u_char Tid);
79 };
80
81class cChannel;
82class cSectionHandler;
83
84class cFilter : public cListObject {
85 friend class cSectionHandler;
86private:
89 bool on;
90protected:
91 cFilter(void);
92 cFilter(u_short Pid, u_char Tid, u_char Mask = 0xFF);
93 virtual ~cFilter();
94 virtual void SetStatus(bool On);
101 virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length) = 0;
112 int Source(void);
114 int Transponder(void);
116 const cChannel *Channel(void);
118 bool Matches(u_short Pid, u_char Tid);
120 void Set(u_short Pid, u_char Tid, u_char Mask = 0xFF);
122 void Add(u_short Pid, u_char Tid, u_char Mask = 0xFF, bool Sticky = false);
126 void Del(u_short Pid, u_char Tid, u_char Mask = 0xFF);
128 };
129
130#endif //__FILTER_H
cFilterData & operator=(const cFilterData &FilterData)
Definition filter.c:123
bool Matches(u_short Pid, u_char Tid)
Definition filter.c:137
bool Is(u_short Pid, u_char Tid, u_char Mask)
Definition filter.c:132
u_short pid
Definition filter.h:70
bool sticky
Definition filter.h:73
u_char tid
Definition filter.h:71
cFilterData(void)
Definition filter.c:107
u_char mask
Definition filter.h:72
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:211
virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length)=0
Processes the data delivered to this filter.
cSectionHandler * sectionHandler
Definition filter.h:87
int Transponder(void)
Returns the transponder of the data delivered to this filter.
Definition filter.c:168
virtual void SetStatus(bool On)
Turns this filter on or off, depending on the value of On.
Definition filter.c:178
int Source(void)
Returns the source of the data delivered to this filter.
Definition filter.c:163
const cChannel * Channel(void)
Returns the channel of the data delivered to this filter.
Definition filter.c:173
bool on
Definition filter.h:89
cList< cFilterData > data
Definition filter.h:88
void Del(u_short Pid, u_char Tid, u_char Mask=0xFF)
Deletes the given filter data from this filter.
Definition filter.c:224
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:216
virtual ~cFilter()
Definition filter.c:157
cFilter(void)
Definition filter.c:144
bool Matches(u_short Pid, u_char Tid)
Indicates whether this filter wants to receive data from the given Pid/Tid.
Definition filter.c:200
Definition tools.h:631
cSectionSyncerRandom(void)
< Helper class for having an array of random section syncers.
Definition filter.h:65
void SetSectionFlag(uchar Section, bool On)
Definition filter.h:29
bool Check(uchar Version, int SectionNumber)
Returns true if Version is not the current version, or the given SectionNumber has not been marked as...
Definition filter.c:31
int currentSection
Definition filter.h:23
cSectionSyncer(bool Random=false)
Sets up a new section syncer.
Definition filter.c:15
int currentVersion
Definition filter.h:22
bool complete
Definition filter.h:26
bool Processed(int SectionNumber, int LastSectionNumber, int SegmentLastSectionNumber=-1)
Marks the given SectionNumber as processed.
Definition filter.c:54
bool Complete(void)
Returns true if all sections have been processed.
Definition filter.h:52
uchar sections[32]
Definition filter.h:28
uint32_t segments
Definition filter.h:27
void Reset(void)
Definition filter.c:21
bool random
Definition filter.h:24
bool GetSectionFlag(uchar Section)
Definition filter.h:30
bool synced
Definition filter.h:25
unsigned char uchar
Definition tools.h:31