mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 11:37:42 +00:00
Apply satip_secfilter_fix.diff
Author: FireFly VDR-Portal thread: https://www.vdr-portal.de/forum/index.php?thread/135143-satip-plugin-patches/&postID=1350960#post1350960 Patch URL: https://www.vdr-portal.de/index.php?attachment/46675-satip-secfilter-fix-diff/
This commit is contained in:
parent
0680871854
commit
fd75b510f8
@ -18,35 +18,14 @@ cSatipSectionFilter::cSatipSectionFilter(int deviceIndexP, uint16_t pidP, uint8_
|
||||
secLenM(0),
|
||||
tsFeedpM(0),
|
||||
pidM(pidP),
|
||||
tidM(tidP),
|
||||
maskM(maskP),
|
||||
ringBufferM(new cRingBufferFrame(eDmxMaxSectionCount * eDmxMaxSectionSize)),
|
||||
deviceIndexM(deviceIndexP)
|
||||
{
|
||||
debug16("%s (%d, %d, %d, %d) [device %d]", __PRETTY_FUNCTION__, deviceIndexM, pidM, tidP, maskP, deviceIndexM);
|
||||
int i;
|
||||
|
||||
memset(secBufBaseM, 0, sizeof(secBufBaseM));
|
||||
memset(filterValueM, 0, sizeof(filterValueM));
|
||||
memset(filterMaskM, 0, sizeof(filterMaskM));
|
||||
memset(filterModeM, 0, sizeof(filterModeM));
|
||||
memset(maskAndModeM, 0, sizeof(maskAndModeM));
|
||||
memset(maskAndNotModeM, 0, sizeof(maskAndNotModeM));
|
||||
|
||||
filterValueM[0] = tidP;
|
||||
filterMaskM[0] = maskP;
|
||||
|
||||
// Invert the filter
|
||||
for (i = 0; i < eDmxMaxFilterSize; ++i)
|
||||
filterValueM[i] ^= 0xFF;
|
||||
|
||||
uint8_t doneq = 0;
|
||||
for (i = 0; i < eDmxMaxFilterSize; ++i) {
|
||||
uint8_t mode = filterModeM[i];
|
||||
uint8_t mask = filterMaskM[i];
|
||||
maskAndModeM[i] = (uint8_t)(mask & mode);
|
||||
maskAndNotModeM[i] = (uint8_t)(mask & ~mode);
|
||||
doneq |= maskAndNotModeM[i];
|
||||
}
|
||||
doneqM = doneq ? 1 : 0;
|
||||
|
||||
// Create sockets
|
||||
socketM[0] = socketM[1] = -1;
|
||||
@ -89,23 +68,12 @@ void cSatipSectionFilter::New(void)
|
||||
int cSatipSectionFilter::Filter(void)
|
||||
{
|
||||
if (secBufM) {
|
||||
int i;
|
||||
uint8_t neq = 0;
|
||||
|
||||
for (i = 0; i < eDmxMaxFilterSize; ++i) {
|
||||
uint8_t calcxor = (uint8_t)(filterValueM[i] ^ secBufM[i]);
|
||||
if (maskAndModeM[i] & calcxor)
|
||||
return 0;
|
||||
neq |= (maskAndNotModeM[i] & calcxor);
|
||||
}
|
||||
|
||||
if (doneqM && !neq)
|
||||
return 0;
|
||||
|
||||
if (ringBufferM && (secLenM > 0)) {
|
||||
cFrame* section = new cFrame(secBufM, secLenM);
|
||||
if (!ringBufferM->Put(section))
|
||||
DELETE_POINTER(section);
|
||||
if ((tidM & maskM) == (secBufM[0] & maskM)) {
|
||||
if (ringBufferM && (secLenM > 0)) {
|
||||
cFrame* section = new cFrame(secBufM, secLenM);
|
||||
if (!ringBufferM->Put(section))
|
||||
DELETE_POINTER(section);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -33,18 +33,13 @@ private:
|
||||
uint16_t secLenM;
|
||||
uint16_t tsFeedpM;
|
||||
uint16_t pidM;
|
||||
uint8_t tidM;
|
||||
uint8_t maskM;
|
||||
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user