mirror of
https://github.com/rofafor/vdr-plugin-satip.git
synced 2023-10-10 13:37:42 +02:00
Added cSatipPid().
This commit is contained in:
parent
123fc5f96b
commit
72a5ad34fb
47
tuner.c
47
tuner.c
@ -474,50 +474,15 @@ bool cSatipTuner::SetPid(int pidP, int typeP, bool onP)
|
||||
{
|
||||
//debug("cSatipTuner::%s(%d, %d, %d) [device %d]", __FUNCTION__, pidP, typeP, onP, deviceM->GetId());
|
||||
cMutexLock MutexLock(&mutexM);
|
||||
bool found = false;
|
||||
for (int i = 0; i < pidsM.Size(); ++i) {
|
||||
if (pidsM[i] == pidP) {
|
||||
found = true;
|
||||
if (!onP)
|
||||
pidsM.Remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (onP && !found)
|
||||
pidsM.Append(pidP);
|
||||
// Generate deltas
|
||||
found = false;
|
||||
if (onP) {
|
||||
for (int i = 0; i < addPidsM.Size(); ++i) {
|
||||
if (addPidsM[i] == pidP) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
addPidsM.Append(pidP);
|
||||
for (int i = 0; i < delPidsM.Size(); ++i) {
|
||||
if (delPidsM[i] == pidP) {
|
||||
delPidsM.Remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
pidsM.AddPid(pidP);
|
||||
addPidsM.AddPid(pidP);
|
||||
delPidsM.RemovePid(pidP);
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < delPidsM.Size(); ++i) {
|
||||
if (delPidsM[i] == pidP) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
delPidsM.Append(pidP);
|
||||
for (int i = 0; i < addPidsM.Size(); ++i) {
|
||||
if (addPidsM[i] == pidP) {
|
||||
addPidsM.Remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
pidsM.RemovePid(pidP);
|
||||
delPidsM.AddPid(pidP);
|
||||
addPidsM.RemovePid(pidP);
|
||||
}
|
||||
pidUpdateCacheM.Set(ePidUpdateIntervalMs);
|
||||
return true;
|
||||
|
32
tuner.h
32
tuner.h
@ -23,6 +23,32 @@
|
||||
#include "statistics.h"
|
||||
#include "socket.h"
|
||||
|
||||
class cSatipPid : public cVector<int> {
|
||||
private:
|
||||
int PidIndex(const int &pidP)
|
||||
{
|
||||
for (int i = 0; i < this->Size(); ++i) {
|
||||
if (pidP == this->At(i))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public:
|
||||
void RemovePid(const int &pidP)
|
||||
{
|
||||
int i = PidIndex(pidP);
|
||||
if (i >= 0)
|
||||
this->Remove(i);
|
||||
}
|
||||
|
||||
void AddPid(int pidP)
|
||||
{
|
||||
if (PidIndex(pidP) < 0)
|
||||
this->Append(pidP);
|
||||
}
|
||||
};
|
||||
|
||||
class cSatipTuner : public cThread, public cSatipTunerStatistics {
|
||||
private:
|
||||
enum {
|
||||
@ -65,9 +91,9 @@ private:
|
||||
int signalStrengthM;
|
||||
int signalQualityM;
|
||||
int streamIdM;
|
||||
cVector<int> addPidsM;
|
||||
cVector<int> delPidsM;
|
||||
cVector<int> pidsM;
|
||||
cSatipPid addPidsM;
|
||||
cSatipPid delPidsM;
|
||||
cSatipPid pidsM;
|
||||
|
||||
bool Connect(void);
|
||||
bool Disconnect(void);
|
||||
|
Loading…
Reference in New Issue
Block a user