From c723b48005e5fcef910f290f704a97f54ab5aa55 Mon Sep 17 00:00:00 2001 From: Manuel Reimer Date: Tue, 31 May 2022 16:55:14 +0200 Subject: [PATCH 1/3] Apply vdr-satip_transfer-mode_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/46673-vdr-satip-transfer-mode-fix-diff/ --- server.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/server.c b/server.c index 5cdba44..6584230 100644 --- a/server.c +++ b/server.c @@ -40,29 +40,43 @@ bool cSatipFrontends::Matches(int deviceIdP, int transponderP) bool cSatipFrontends::Assign(int deviceIdP, int transponderP) { cSatipFrontend *tmp = NULL; - // Prefer any unused one + // Prefer any used one for (cSatipFrontend *f = First(); f; f = Next(f)) { - if (!f->Attached() || (f->DeviceId() == deviceIdP)) { + if (f->DeviceId() == deviceIdP) { // give deviceID priority, but take detached frontend if deviceID ist not yet attached tmp = f; break; } + if (!f->Attached()) { + tmp = f; + } } if (tmp) { tmp->SetTransponder(transponderP); + debug9("%s assigned TP %d to %s/#%d", __PRETTY_FUNCTION__, transponderP, *tmp->Description(), tmp->Index()); return true; } + error("no assignable frontend found [device %u]", deviceIdP); return false; } bool cSatipFrontends::Attach(int deviceIdP, int transponderP) { + cSatipFrontend *tmp = NULL; for (cSatipFrontend *f = First(); f; f = Next(f)) { if (f->Transponder() == transponderP) { - f->Attach(deviceIdP); - debug9("%s (%d, %d) %s/#%d", __PRETTY_FUNCTION__, deviceIdP, transponderP, *f->Description(), f->Index()); - return true; + tmp = f; + if (f->DeviceId() == deviceIdP) { + break; + } } } + + if (tmp) { + tmp->Attach(deviceIdP); + debug9("%s attached deviceId %d (TP %d) to %s/#%d", __PRETTY_FUNCTION__, deviceIdP, transponderP, *tmp->Description(), tmp->Index()); + return true; + } + error("%s no Frontend found for attaching deviceID %d (TP %d)", __PRETTY_FUNCTION__, deviceIdP, transponderP); return false; } @@ -71,7 +85,7 @@ bool cSatipFrontends::Detach(int deviceIdP, int transponderP) for (cSatipFrontend *f = First(); f; f = Next(f)) { if (f->Transponder() == transponderP) { f->Detach(deviceIdP); - debug9("%s (%d, %d) %s/#%d", __PRETTY_FUNCTION__, deviceIdP, transponderP, *f->Description(), f->Index()); + debug9("%s detached deviceID %d (TP %d) from %s/#%d", __PRETTY_FUNCTION__, deviceIdP, transponderP, *f->Description(), f->Index()); return true; } } From 06808718546ba9be2af63ae5ae4901f66b2a365d Mon Sep 17 00:00:00 2001 From: Manuel Reimer Date: Tue, 31 May 2022 16:57:18 +0200 Subject: [PATCH 2/3] Apply satip_retune_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/46674-satip-retune-fix-diff/ --- tuner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tuner.c b/tuner.c index be7b392..c6670bb 100644 --- a/tuner.c +++ b/tuner.c @@ -225,7 +225,7 @@ bool cSatipTuner::Connect(void) if (streamIdM >= 0) { if (!strcmp(*streamParamM, *lastParamM) && hasLockM) { debug1("%s Identical parameters [device %d]", __PRETTY_FUNCTION__, deviceIdM); - return true; + //return true; // fall through because detection does not work reliably } cString uri = cString::sprintf("%sstream=%d?%s", *connectionUri, streamIdM, *streamParamM); debug1("%s Retuning [device %d]", __PRETTY_FUNCTION__, deviceIdM); From fd75b510f85247f4686ada3535539621938f77b4 Mon Sep 17 00:00:00 2001 From: Manuel Reimer Date: Tue, 31 May 2022 16:59:57 +0200 Subject: [PATCH 3/3] 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/ --- sectionfilter.c | 48 ++++++++---------------------------------------- sectionfilter.h | 9 ++------- 2 files changed, 10 insertions(+), 47 deletions(-) diff --git a/sectionfilter.c b/sectionfilter.c index d497e6a..247e4c4 100644 --- a/sectionfilter.c +++ b/sectionfilter.c @@ -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; diff --git a/sectionfilter.h b/sectionfilter.h index e5573d3..c0bca60 100644 --- a/sectionfilter.h +++ b/sectionfilter.h @@ -33,18 +33,13 @@ class cSatipSectionFilter : public cSatipSectionStatistics { 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);