1
0
mirror of https://github.com/rofafor/vdr-plugin-satip.git synced 2023-10-10 13:37:42 +02:00
vdr-plugin-satip/sectionfilter.h

95 lines
2.3 KiB
C
Raw Normal View History

2014-03-08 12:07:47 +01:00
/*
* 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 <sys/poll.h>
2014-03-08 12:07:47 +01:00
#include <vdr/device.h>
#include "common.h"
#include "statistics.h"
class cSatipSectionFilter : public cSatipSectionStatistics {
private:
enum {
eDmxMaxFilterSize = 18,
2014-04-03 23:56:00 +02:00
eDmxMaxSectionCount = 64,
eDmxMaxSectionSize = 4096,
eDmxMaxSectionFeedSize = (eDmxMaxSectionSize + TS_SIZE)
2014-03-08 12:07:47 +01:00
};
int pusiSeenM;
int feedCcM;
int doneqM;
uint8_t *secBufM;
uint8_t secBufBaseM[eDmxMaxSectionFeedSize];
2014-03-08 12:07:47 +01:00
uint16_t secBufpM;
uint16_t secLenM;
uint16_t tsFeedpM;
uint16_t pidM;
2014-04-03 23:56:00 +02:00
cRingBufferFrame *ringBufferM;
2014-03-08 12:07:47 +01:00
int deviceIndexM;
int socketM[2];
uint8_t filterValueM[eDmxMaxFilterSize];
uint8_t filterMaskM[eDmxMaxFilterSize];
uint8_t filterModeM[eDmxMaxFilterSize];
2014-03-08 12:07:47 +01:00
uint8_t maskAndModeM[eDmxMaxFilterSize];
uint8_t maskAndNotModeM[eDmxMaxFilterSize];
2014-03-08 12:07:47 +01:00
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);
2014-03-08 12:07:47 +01:00
int GetFd(void) { return socketM[0]; }
uint16_t GetPid(void) const { return pidM; }
int Available(void) const;
2014-03-08 12:07:47 +01:00
};
class cSatipSectionFilterHandler : public cThread {
private:
enum {
eMaxSecFilterCount = 32
};
2014-04-03 23:56:00 +02:00
cRingBufferLinear *ringBufferM;
2014-03-08 12:07:47 +01:00
cMutex mutexM;
int deviceIndexM;
cSatipSectionFilter *filtersM[eMaxSecFilterCount];
struct pollfd pollFdsM[eMaxSecFilterCount];
2014-03-08 12:07:47 +01:00
bool Delete(unsigned int indexP);
bool IsBlackListed(u_short pidP, u_char tidP, u_char maskP) const;
bool Send(void);
2014-03-08 12:07:47 +01:00
2014-04-03 23:56:00 +02:00
protected:
virtual void Action(void);
2014-03-08 12:07:47 +01:00
public:
cSatipSectionFilterHandler(int deviceIndexP, unsigned int bufferLenP);
virtual ~cSatipSectionFilterHandler();
cString GetInformation(void);
2016-12-15 23:39:41 +01:00
bool Exists(u_short pidP);
2014-03-08 12:07:47 +01:00
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