mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 11:37:42 +00:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
02a842f95a | ||
|
a76ff4c25a | ||
|
64554ad0cc |
@ -76,13 +76,13 @@ void cSatipMsearch::Process(void)
|
|||||||
if (status) {
|
if (status) {
|
||||||
// Check the location data
|
// Check the location data
|
||||||
// LOCATION: http://192.168.0.115:8888/octonet.xml
|
// LOCATION: http://192.168.0.115:8888/octonet.xml
|
||||||
if (startswith(r, "LOCATION:")) {
|
if (strcasestr(r, "LOCATION:") == r) {
|
||||||
location = compactspace(r + 9);
|
location = compactspace(r + 9);
|
||||||
debug1("%s location='%s'", __PRETTY_FUNCTION__, location);
|
debug1("%s location='%s'", __PRETTY_FUNCTION__, location);
|
||||||
}
|
}
|
||||||
// Check the source type
|
// Check the source type
|
||||||
// ST: urn:ses-com:device:SatIPServer:1
|
// ST: urn:ses-com:device:SatIPServer:1
|
||||||
else if (startswith(r, "ST:")) {
|
else if (strcasestr(r, "ST:") == r) {
|
||||||
char *st = compactspace(r + 3);
|
char *st = compactspace(r + 3);
|
||||||
if (strstr(st, "urn:ses-com:device:SatIPServer:1"))
|
if (strstr(st, "urn:ses-com:device:SatIPServer:1"))
|
||||||
valid = true;
|
valid = true;
|
||||||
|
@ -18,35 +18,14 @@ cSatipSectionFilter::cSatipSectionFilter(int deviceIndexP, uint16_t pidP, uint8_
|
|||||||
secLenM(0),
|
secLenM(0),
|
||||||
tsFeedpM(0),
|
tsFeedpM(0),
|
||||||
pidM(pidP),
|
pidM(pidP),
|
||||||
|
tidM(tidP),
|
||||||
|
maskM(maskP),
|
||||||
ringBufferM(new cRingBufferFrame(eDmxMaxSectionCount * eDmxMaxSectionSize)),
|
ringBufferM(new cRingBufferFrame(eDmxMaxSectionCount * eDmxMaxSectionSize)),
|
||||||
deviceIndexM(deviceIndexP)
|
deviceIndexM(deviceIndexP)
|
||||||
{
|
{
|
||||||
debug16("%s (%d, %d, %d, %d) [device %d]", __PRETTY_FUNCTION__, deviceIndexM, pidM, tidP, maskP, deviceIndexM);
|
debug16("%s (%d, %d, %d, %d) [device %d]", __PRETTY_FUNCTION__, deviceIndexM, pidM, tidP, maskP, deviceIndexM);
|
||||||
int i;
|
|
||||||
|
|
||||||
memset(secBufBaseM, 0, sizeof(secBufBaseM));
|
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
|
// Create sockets
|
||||||
socketM[0] = socketM[1] = -1;
|
socketM[0] = socketM[1] = -1;
|
||||||
@ -89,23 +68,12 @@ void cSatipSectionFilter::New(void)
|
|||||||
int cSatipSectionFilter::Filter(void)
|
int cSatipSectionFilter::Filter(void)
|
||||||
{
|
{
|
||||||
if (secBufM) {
|
if (secBufM) {
|
||||||
int i;
|
if ((tidM & maskM) == (secBufM[0] & maskM)) {
|
||||||
uint8_t neq = 0;
|
if (ringBufferM && (secLenM > 0)) {
|
||||||
|
cFrame* section = new cFrame(secBufM, secLenM);
|
||||||
for (i = 0; i < eDmxMaxFilterSize; ++i) {
|
if (!ringBufferM->Put(section))
|
||||||
uint8_t calcxor = (uint8_t)(filterValueM[i] ^ secBufM[i]);
|
DELETE_POINTER(section);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -33,18 +33,13 @@ private:
|
|||||||
uint16_t secLenM;
|
uint16_t secLenM;
|
||||||
uint16_t tsFeedpM;
|
uint16_t tsFeedpM;
|
||||||
uint16_t pidM;
|
uint16_t pidM;
|
||||||
|
uint8_t tidM;
|
||||||
|
uint8_t maskM;
|
||||||
|
|
||||||
cRingBufferFrame *ringBufferM;
|
cRingBufferFrame *ringBufferM;
|
||||||
int deviceIndexM;
|
int deviceIndexM;
|
||||||
int socketM[2];
|
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);
|
inline uint16_t GetLength(const uint8_t *dataP);
|
||||||
void New(void);
|
void New(void);
|
||||||
int Filter(void);
|
int Filter(void);
|
||||||
|
26
server.c
26
server.c
@ -40,29 +40,43 @@ bool cSatipFrontends::Matches(int deviceIdP, int transponderP)
|
|||||||
bool cSatipFrontends::Assign(int deviceIdP, int transponderP)
|
bool cSatipFrontends::Assign(int deviceIdP, int transponderP)
|
||||||
{
|
{
|
||||||
cSatipFrontend *tmp = NULL;
|
cSatipFrontend *tmp = NULL;
|
||||||
// Prefer any unused one
|
// Prefer any used one
|
||||||
for (cSatipFrontend *f = First(); f; f = Next(f)) {
|
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;
|
tmp = f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!f->Attached()) {
|
||||||
|
tmp = f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
tmp->SetTransponder(transponderP);
|
tmp->SetTransponder(transponderP);
|
||||||
|
debug9("%s assigned TP %d to %s/#%d", __PRETTY_FUNCTION__, transponderP, *tmp->Description(), tmp->Index());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
error("no assignable frontend found [device %u]", deviceIdP);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cSatipFrontends::Attach(int deviceIdP, int transponderP)
|
bool cSatipFrontends::Attach(int deviceIdP, int transponderP)
|
||||||
{
|
{
|
||||||
|
cSatipFrontend *tmp = NULL;
|
||||||
for (cSatipFrontend *f = First(); f; f = Next(f)) {
|
for (cSatipFrontend *f = First(); f; f = Next(f)) {
|
||||||
if (f->Transponder() == transponderP) {
|
if (f->Transponder() == transponderP) {
|
||||||
f->Attach(deviceIdP);
|
tmp = f;
|
||||||
debug9("%s (%d, %d) %s/#%d", __PRETTY_FUNCTION__, deviceIdP, transponderP, *f->Description(), f->Index());
|
if (f->DeviceId() == deviceIdP) {
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +85,7 @@ bool cSatipFrontends::Detach(int deviceIdP, int transponderP)
|
|||||||
for (cSatipFrontend *f = First(); f; f = Next(f)) {
|
for (cSatipFrontend *f = First(); f; f = Next(f)) {
|
||||||
if (f->Transponder() == transponderP) {
|
if (f->Transponder() == transponderP) {
|
||||||
f->Detach(deviceIdP);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
tuner.c
11
tuner.c
@ -225,7 +225,7 @@ bool cSatipTuner::Connect(void)
|
|||||||
if (streamIdM >= 0) {
|
if (streamIdM >= 0) {
|
||||||
if (!strcmp(*streamParamM, *lastParamM) && hasLockM) {
|
if (!strcmp(*streamParamM, *lastParamM) && hasLockM) {
|
||||||
debug1("%s Identical parameters [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
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);
|
cString uri = cString::sprintf("%sstream=%d?%s", *connectionUri, streamIdM, *streamParamM);
|
||||||
debug1("%s Retuning [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
debug1("%s Retuning [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||||
@ -244,6 +244,7 @@ bool cSatipTuner::Connect(void)
|
|||||||
if (useTcp)
|
if (useTcp)
|
||||||
debug1("%s Requesting TCP [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
debug1("%s Requesting TCP [device %d]", __PRETTY_FUNCTION__, deviceIdM);
|
||||||
if (rtspM.Setup(*uri, rtpM.Port(), rtcpM.Port(), useTcp)) {
|
if (rtspM.Setup(*uri, rtpM.Port(), rtcpM.Port(), useTcp)) {
|
||||||
|
lastParamM = streamParamM;
|
||||||
keepAliveM.Set(timeoutM);
|
keepAliveM.Set(timeoutM);
|
||||||
if (nextServerM.IsValid()) {
|
if (nextServerM.IsValid()) {
|
||||||
currentServerM = nextServerM;
|
currentServerM = nextServerM;
|
||||||
@ -552,9 +553,11 @@ bool cSatipTuner::UpdatePids(bool forceP)
|
|||||||
tnrParamM = param;
|
tnrParamM = param;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pidUpdateCacheM.Set(ePidUpdateIntervalMs);
|
if (paramadded) {
|
||||||
if (!rtspM.Play(*uri))
|
pidUpdateCacheM.Set(ePidUpdateIntervalMs);
|
||||||
return false;
|
if (!rtspM.Play(*uri))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
addPidsM.Clear();
|
addPidsM.Clear();
|
||||||
delPidsM.Clear();
|
delPidsM.Clear();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user