summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Neumann <fnu@yavdr.org>2017-05-21 21:31:57 +0200
committerFrank Neumann <fnu@yavdr.org>2017-05-21 21:31:57 +0200
commit627afe268e2ceaeca3d4d2dea51401019f7a10bf (patch)
tree84b0a82b4eb0745d12fcdeca2d0ee94166e3084c
parent8b83687aa11aabdf7e2c78bf22b48efe2bdd4403 (diff)
downloadvdr-plugin-text2skin-627afe268e2ceaeca3d4d2dea51401019f7a10bf.tar.gz
vdr-plugin-text2skin-627afe268e2ceaeca3d4d2dea51401019f7a10bf.tar.bz2
Add compatibility for VDR API >= 2.3.1.
-rw-r--r--HISTORY1
-rw-r--r--common.c20
-rw-r--r--display.c25
-rw-r--r--status.c16
4 files changed, 62 insertions, 0 deletions
diff --git a/HISTORY b/HISTORY
index f074d90..48ad02b 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3,6 +3,7 @@ VDR Plugin 'text2skin' Revision History
20xx-xx-xx: Version x.x.x
+- Add compatibility for VDR API >= 2.3.1.
2017-05-21: Version 1.3.3
diff --git a/common.c b/common.c
index dbe61f9..2b9059d 100644
--- a/common.c
+++ b/common.c
@@ -63,19 +63,34 @@ const char *EventType(uint Number)
bool StoppedTimer(const char *Name)
{
+#if APIVERSNUM < 20301
cTimer *timer = Timers.First();
+#else
+ LOCK_TIMERS_READ;
+ const cTimer *timer = Timers->First();
+#endif
while (timer) {
if (strcmp(Name, timer->File()) == 0)
break;
+#if APIVERSNUM < 20301
timer = Timers.Next(timer);
+#else
+ timer = Timers->Next(timer);
+#endif
}
return timer == NULL || !timer->Recording();
}
const cRecording *GetRecordingByName(const char *Name)
{
+#if APIVERSNUM < 20301
const cRecording *rec = Recordings.First();
for (; rec != NULL; rec = Recordings.Next(rec)) {
+#else
+ LOCK_RECORDINGS_READ;
+ const cRecording *rec = Recordings->First();
+ for (; rec != NULL; rec = Recordings->Next(rec)) {
+#endif
if (strcmp(rec->Name(), Name) == 0)
return rec;
}
@@ -84,7 +99,12 @@ const cRecording *GetRecordingByName(const char *Name)
const cRecording *GetRecordingByFileName(const char *FileName)
{
+#if APIVERSNUM < 20301
return (FileName) ? Recordings.GetByName(FileName) : NULL;
+#else
+ LOCK_RECORDINGS_READ;
+ return (FileName) ? Recordings->GetByName(FileName) : NULL;
+#endif
}
#if VDRVERSNUM < 20000
diff --git a/display.c b/display.c
index d29e36a..30f388e 100644
--- a/display.c
+++ b/display.c
@@ -1118,7 +1118,12 @@ cxType cText2SkinDisplayMenu::GetTokenData(const txToken &Token)
if (ExtPresentDescription == "") {
// find corresponding timer
const char *aux = NULL;
+#if APIVERSNUM < 20301
for (cTimer *tim = Timers.First(); tim; tim = Timers.Next(tim))
+#else
+ LOCK_TIMERS_READ;
+ for (const cTimer *tim = Timers->First(); tim; tim = Timers->Next(tim))
+#endif
if (tim->Event() == mEvent)
aux = tim->Aux();
ExtPresentDescription = AddExtInfoToDescription(mEvent->Title(), mEvent->ShortText(), mEvent->Description(), aux, Text2SkinSetup.StripAux);
@@ -1201,14 +1206,24 @@ cxType cText2SkinDisplayMenu::GetTokenData(const txToken &Token)
case tChannelName:
if (mEvent) { // extended EPG
+#if APIVERSNUM < 20301
cChannel *channel = Channels.GetByChannelID(mEvent->ChannelID(), true);
+#else
+ LOCK_CHANNELS_READ;
+ const cChannel *channel = Channels->GetByChannelID(mEvent->ChannelID(), true);
+#endif
return channel != NULL
? (cxType)ChannelName(channel, 0)
: (cxType)false;
}
else if (mRecording) { // recording Info
cRecordingInfo *recInfo = const_cast<cRecordingInfo*>(mRecording->Info());
+#if APIVERSNUM < 20301
cChannel *channel = Channels.GetByChannelID(recInfo->ChannelID(), true);
+#else
+ LOCK_CHANNELS_READ;
+ const cChannel *channel = Channels->GetByChannelID(recInfo->ChannelID(), true);
+#endif
return channel != NULL
? (cxType)ChannelName(channel, 0)
: (cxType)false;
@@ -1217,14 +1232,24 @@ cxType cText2SkinDisplayMenu::GetTokenData(const txToken &Token)
case tChannelShortName:
if (mEvent) { // extended EPG
+#if APIVERSNUM < 20301
cChannel *channel = Channels.GetByChannelID(mEvent->ChannelID(), true);
+#else
+ LOCK_CHANNELS_READ;
+ const cChannel *channel = Channels->GetByChannelID(mEvent->ChannelID(), true);
+#endif
return channel != NULL
? (cxType)ChannelShortName(channel, 0)
: (cxType)false;
}
else if (mRecording) { // recording Info
cRecordingInfo *recInfo = const_cast<cRecordingInfo*>(mRecording->Info());
+#if APIVERSNUM < 20301
cChannel *channel = Channels.GetByChannelID(recInfo->ChannelID(), true);
+#else
+ LOCK_CHANNELS_READ;
+ const cChannel *channel = Channels->GetByChannelID(recInfo->ChannelID(), true);
+#endif
return channel != NULL
? (cxType)ChannelShortName(channel, 0)
: (cxType)false;
diff --git a/status.c b/status.c
index 24328b8..14606cd 100644
--- a/status.c
+++ b/status.c
@@ -110,8 +110,14 @@ void cText2SkinStatus::Recording(const cDevice *Device, const char *Name,
mRecordingsLock.Lock();
mRecordings.clear();
+#if APIVERSNUM < 20301
cTimer *t = Timers.First();
for (; t != NULL; t = Timers.Next(t)) {
+#else
+ LOCK_TIMERS_READ;
+ const cTimer *t = Timers->First();
+ for (; t != NULL; t = Timers->Next(t)) {
+#endif
if (t->Recording())
mRecordings.push_back(t->File());
}
@@ -184,9 +190,17 @@ void cText2SkinStatus::UpdateEvents(void)
mRender->mUpdate.events = false;
mEvents.Clear();
+#if APIVERSNUM < 20301
Timers.IncBeingEdited();
+#else
+ LOCK_TIMERS_READ;
+#endif
+#if APIVERSNUM < 20301
for (cTimer *tim = Timers.First(); tim; tim = Timers.Next(tim)) {
+#else
+ for (const cTimer *tim = Timers->First(); tim; tim = Timers->Next(tim)) {
+#endif
if (tim->HasFlags(tfActive)) {
int i = 0;
cTimer dummy;
@@ -209,7 +223,9 @@ void cText2SkinStatus::UpdateEvents(void)
}
}
+#if APIVERSNUM < 20301
Timers.DecBeingEdited();
+#endif
mEvents.Sort();
}
}