mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
Fix a device is currently recording
The token indicating whether a device is currently recording was not updated correctly
This commit is contained in:
parent
b977e3582a
commit
3c7e014dcc
@ -160,12 +160,12 @@ bool cVeMessage::Parse(bool forced) {
|
|||||||
* cVeDevices
|
* cVeDevices
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
cVeDevices::cVeDevices(void) {
|
cVeDevices::cVeDevices(void) {
|
||||||
lastRefresh = 0;
|
|
||||||
initial = true;
|
initial = true;
|
||||||
devicesIndex = -1;
|
devicesIndex = -1;
|
||||||
lastSignalStrength = NULL;
|
lastSignalStrength = NULL;
|
||||||
lastSignalQuality = NULL;
|
lastSignalQuality = NULL;
|
||||||
recDevices = NULL;
|
recDevices = NULL;
|
||||||
|
lastRecDevices = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cVeDevices::~cVeDevices(void) {
|
cVeDevices::~cVeDevices(void) {
|
||||||
@ -176,6 +176,8 @@ cVeDevices::~cVeDevices(void) {
|
|||||||
lastSignalQuality = NULL;
|
lastSignalQuality = NULL;
|
||||||
delete[] recDevices;
|
delete[] recDevices;
|
||||||
recDevices = NULL;
|
recDevices = NULL;
|
||||||
|
delete[] lastRecDevices;
|
||||||
|
lastRecDevices = NULL;
|
||||||
mutexDevices.Unlock();
|
mutexDevices.Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,11 +195,13 @@ void cVeDevices::Init(void) {
|
|||||||
lastSignalStrength = new int[numDevices];
|
lastSignalStrength = new int[numDevices];
|
||||||
lastSignalQuality = new int[numDevices];
|
lastSignalQuality = new int[numDevices];
|
||||||
recDevices = new bool[numDevices];
|
recDevices = new bool[numDevices];
|
||||||
|
lastRecDevices = new bool[numDevices];
|
||||||
mutexDevices.Lock();
|
mutexDevices.Lock();
|
||||||
for (int i=0; i<numDevices; i++) {
|
for (int i=0; i<numDevices; i++) {
|
||||||
lastSignalStrength[i] = 0;
|
lastSignalStrength[i] = 0;
|
||||||
lastSignalQuality[i] = 0;
|
lastSignalQuality[i] = 0;
|
||||||
recDevices[i] = false;
|
recDevices[i] = false;
|
||||||
|
lastRecDevices[i] = false;
|
||||||
}
|
}
|
||||||
mutexDevices.Unlock();
|
mutexDevices.Unlock();
|
||||||
}
|
}
|
||||||
@ -205,7 +209,6 @@ void cVeDevices::Init(void) {
|
|||||||
void cVeDevices::Close(void) {
|
void cVeDevices::Close(void) {
|
||||||
devices.clear();
|
devices.clear();
|
||||||
initial = true;
|
initial = true;
|
||||||
lastRefresh = 0;
|
|
||||||
numDevices = 0;
|
numDevices = 0;
|
||||||
mutexDevices.Lock();
|
mutexDevices.Lock();
|
||||||
delete[] lastSignalStrength;
|
delete[] lastSignalStrength;
|
||||||
@ -214,6 +217,8 @@ void cVeDevices::Close(void) {
|
|||||||
lastSignalQuality = NULL;
|
lastSignalQuality = NULL;
|
||||||
delete[] recDevices;
|
delete[] recDevices;
|
||||||
recDevices = NULL;
|
recDevices = NULL;
|
||||||
|
delete[] lastRecDevices;
|
||||||
|
lastRecDevices = NULL;
|
||||||
mutexDevices.Unlock();
|
mutexDevices.Unlock();
|
||||||
cViewElement::Close();
|
cViewElement::Close();
|
||||||
}
|
}
|
||||||
@ -243,17 +248,17 @@ void cVeDevices::SetTokenContainer(void) {
|
|||||||
bool cVeDevices::Parse(bool forced) {
|
bool cVeDevices::Parse(bool forced) {
|
||||||
if (!cViewElement::Parse(forced))
|
if (!cViewElement::Parse(forced))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
bool changed = false;
|
||||||
if (initial) {
|
if (initial) {
|
||||||
Init();
|
Init();
|
||||||
initial = false;
|
initial = false;
|
||||||
|
changed = true;
|
||||||
} else {
|
} else {
|
||||||
//in light modus content is static
|
//in light modus content is static
|
||||||
if (light)
|
if (light)
|
||||||
return false;
|
return false;
|
||||||
//check if drawing is necessary
|
|
||||||
if (cTimeMs::Now() - lastRefresh < 500)
|
|
||||||
return false;
|
|
||||||
bool changed = false;
|
|
||||||
for (int i = 0; i < numDevices; i++) {
|
for (int i = 0; i < numDevices; i++) {
|
||||||
const cDevice *device = cDevice::GetDevice(devices[i]);
|
const cDevice *device = cDevice::GetDevice(devices[i]);
|
||||||
if (!device || !device->NumProvidedSystems()) {
|
if (!device || !device->NumProvidedSystems()) {
|
||||||
@ -274,20 +279,13 @@ bool cVeDevices::Parse(bool forced) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!changed) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//check device which currently displays live tv
|
// reset recording devices
|
||||||
int deviceLiveTV = -1;
|
for (int i = 0; i < numDevices; i++) {
|
||||||
cDevice *primaryDevice = cDevice::PrimaryDevice();
|
recDevices[i] = false;
|
||||||
if (primaryDevice) {
|
|
||||||
if (!primaryDevice->Replaying() || primaryDevice->Transferring())
|
|
||||||
deviceLiveTV = cDevice::ActualDevice()->DeviceNumber();
|
|
||||||
else
|
|
||||||
deviceLiveTV = primaryDevice->DeviceNumber();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check currently recording devices
|
// check currently recording devices
|
||||||
// BLOCK for LOCK_TIMERS_READ scope !!
|
// BLOCK for LOCK_TIMERS_READ scope !!
|
||||||
{
|
{
|
||||||
@ -305,8 +303,7 @@ bool cVeDevices::Parse(bool forced) {
|
|||||||
const cDevice *recDevice = RecordControl->Device();
|
const cDevice *recDevice = RecordControl->Device();
|
||||||
if (recDevice) {
|
if (recDevice) {
|
||||||
mutexDevices.Lock();
|
mutexDevices.Lock();
|
||||||
if (recDevices)
|
if (recDevices) {
|
||||||
{
|
|
||||||
int d = recDevice->DeviceNumber();
|
int d = recDevice->DeviceNumber();
|
||||||
for (int i = 0; i < numDevices; i++) {
|
for (int i = 0; i < numDevices; i++) {
|
||||||
if (devices[i] == d) {
|
if (devices[i] == d) {
|
||||||
@ -319,6 +316,27 @@ bool cVeDevices::Parse(bool forced) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} // LOCK_TIMERS_READ
|
||||||
|
|
||||||
|
for (int i = 0; i < numDevices; i++) {
|
||||||
|
if (recDevices[i] != lastRecDevices[i]) {
|
||||||
|
lastRecDevices[i] = recDevices[i];
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!changed) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//check device which currently displays live tv
|
||||||
|
int deviceLiveTV = -1;
|
||||||
|
cDevice *primaryDevice = cDevice::PrimaryDevice();
|
||||||
|
if (primaryDevice) {
|
||||||
|
if (!primaryDevice->Replaying() || primaryDevice->Transferring())
|
||||||
|
deviceLiveTV = cDevice::ActualDevice()->DeviceNumber();
|
||||||
|
else
|
||||||
|
deviceLiveTV = primaryDevice->DeviceNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
//create loop container
|
//create loop container
|
||||||
@ -356,13 +374,7 @@ bool cVeDevices::Parse(bool forced) {
|
|||||||
tokenContainer->AddLoopToken(devicesIndex, i, (int)eDevicesLT::signalstrength, *cString::sprintf("%d", signalStrength));
|
tokenContainer->AddLoopToken(devicesIndex, i, (int)eDevicesLT::signalstrength, *cString::sprintf("%d", signalStrength));
|
||||||
tokenContainer->AddLoopToken(devicesIndex, i, (int)eDevicesLT::signalquality, *cString::sprintf("%d", signalQuality));
|
tokenContainer->AddLoopToken(devicesIndex, i, (int)eDevicesLT::signalquality, *cString::sprintf("%d", signalQuality));
|
||||||
tokenContainer->AddLoopToken(devicesIndex, i, (int)eDevicesLT::livetv, devices[i] == deviceLiveTV ? "1" : "0");
|
tokenContainer->AddLoopToken(devicesIndex, i, (int)eDevicesLT::livetv, devices[i] == deviceLiveTV ? "1" : "0");
|
||||||
|
tokenContainer->AddLoopToken(devicesIndex, i, (int)eDevicesLT::recording, (recDevices && recDevices[i]) ? "1" : "0");
|
||||||
bool isRecording = false;
|
|
||||||
mutexDevices.Lock();
|
|
||||||
if (recDevices && recDevices[i])
|
|
||||||
isRecording = true;
|
|
||||||
mutexDevices.Unlock();
|
|
||||||
tokenContainer->AddLoopToken(devicesIndex, i, (int)eDevicesLT::recording, isRecording ? "1" : "0");
|
|
||||||
|
|
||||||
const cChannel *channel = device->GetCurrentlyTunedTransponder();
|
const cChannel *channel = device->GetCurrentlyTunedTransponder();
|
||||||
const cSource *source = (channel) ? Sources.Get(channel->Source()) : NULL;
|
const cSource *source = (channel) ? Sources.Get(channel->Source()) : NULL;
|
||||||
@ -388,7 +400,6 @@ bool cVeDevices::Parse(bool forced) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetDirty();
|
SetDirty();
|
||||||
lastRefresh = cTimeMs::Now();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
|
@ -51,7 +51,6 @@ public:
|
|||||||
class cVeDevices : public cViewElement {
|
class cVeDevices : public cViewElement {
|
||||||
private:
|
private:
|
||||||
bool light;
|
bool light;
|
||||||
time_t lastRefresh;
|
|
||||||
vector<int> devices;
|
vector<int> devices;
|
||||||
bool initial;
|
bool initial;
|
||||||
int devicesIndex;
|
int devicesIndex;
|
||||||
@ -60,6 +59,7 @@ private:
|
|||||||
int* lastSignalStrength;
|
int* lastSignalStrength;
|
||||||
int* lastSignalQuality;
|
int* lastSignalQuality;
|
||||||
bool* recDevices;
|
bool* recDevices;
|
||||||
|
bool* lastRecDevices;
|
||||||
void Init(void);
|
void Init(void);
|
||||||
public:
|
public:
|
||||||
cVeDevices(void);
|
cVeDevices(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user