forked from rofafor/vdr-plugin-satip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sectionfilter.h
95 lines (79 loc) · 2.33 KB
/
sectionfilter.h
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
* sectionfilter.h: SAT>IP plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
*/
#ifndef __SATIP_SECTIONFILTER_H
#define __SATIP_SECTIONFILTER_H
#include <poll.h>
#include <vdr/device.h>
#include "common.h"
#include "statistics.h"
class cSatipSectionFilter : public cSatipSectionStatistics {
private:
enum {
eDmxMaxFilterSize = 18,
eDmxMaxSectionCount = 64,
eDmxMaxSectionSize = 4096,
eDmxMaxSectionFeedSize = (eDmxMaxSectionSize + TS_SIZE)
};
int pusiSeenM;
int feedCcM;
int doneqM;
uint8_t *secBufM;
uint8_t secBufBaseM[eDmxMaxSectionFeedSize];
uint16_t secBufpM;
uint16_t secLenM;
uint16_t tsFeedpM;
uint16_t pidM;
cRingBufferFrame *ringBufferM;
int deviceIndexM;
int socketM[2];
uint8_t filterValueM[eDmxMaxFilterSize];
uint8_t filterMaskM[eDmxMaxFilterSize];
uint8_t filterModeM[eDmxMaxFilterSize];
uint8_t maskAndModeM[eDmxMaxFilterSize];
uint8_t maskAndNotModeM[eDmxMaxFilterSize];
inline uint16_t GetLength(const uint8_t *dataP);
void New(void);
int Filter(void);
inline int Feed(void);
int CopyDump(const uint8_t *bufP, uint8_t lenP);
public:
// constructor & destructor
cSatipSectionFilter(int deviceIndexP, uint16_t pidP, uint8_t tidP, uint8_t maskP);
virtual ~cSatipSectionFilter();
void Process(const uint8_t* dataP);
void Send(void);
int GetFd(void) { return socketM[0]; }
uint16_t GetPid(void) const { return pidM; }
int Available(void) const;
};
class cSatipSectionFilterHandler : public cThread {
private:
enum {
eMaxSecFilterCount = 32,
eSecFilterSendTimeoutMs = 10
};
cRingBufferLinear *ringBufferM;
cMutex mutexM;
int deviceIndexM;
cSatipSectionFilter *filtersM[eMaxSecFilterCount];
struct pollfd pollFdsM[eMaxSecFilterCount];
bool Delete(unsigned int indexP);
bool IsBlackListed(u_short pidP, u_char tidP, u_char maskP) const;
void SendAll(void);
protected:
virtual void Action(void);
public:
cSatipSectionFilterHandler(int deviceIndexP, unsigned int bufferLenP);
virtual ~cSatipSectionFilterHandler();
cString GetInformation(void);
bool Exists(u_short pidP);
int Open(u_short pidP, u_char tidP, u_char maskP);
void Close(int handleP);
int GetPid(int handleP);
void Write(u_char *bufferP, int lengthP);
};
#endif // __SATIP_SECTIONFILTER_H