summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Lehtimäki <matti.lehtimaki@gmail.com>2018-04-17 00:30:29 +0300
committerMatti Lehtimäki <matti.lehtimaki@gmail.com>2018-04-17 00:30:29 +0300
commitdce75c2b7fac2b5017ffc2d9d4d98786f7a82e40 (patch)
tree48d4209793db798e98c442decf12d50ff33d5a81
parent1f4b15851bac522e45056ce7e5055458f28c7206 (diff)
downloadvdr-plugin-history-dce75c2b7fac2b5017ffc2d9d4d98786f7a82e40.tar.gz
vdr-plugin-history-dce75c2b7fac2b5017ffc2d9d4d98786f7a82e40.tar.bz2
Add support for VDR >= 2.3.1.HEADmaster
-rw-r--r--history.c10
-rw-r--r--logger.c10
-rw-r--r--menu.c33
-rw-r--r--menu.h3
4 files changed, 52 insertions, 4 deletions
diff --git a/history.c b/history.c
index 9795e82..ac15c92 100644
--- a/history.c
+++ b/history.c
@@ -163,8 +163,16 @@ cString cPluginHistory::SVDRPCommand(const char *Command, const char *Option, in
char *time = item->GetReplayTimeString();
string = cString::sprintf("%s%s\n", *string, time);
free(time);
+ const cRecording *recording;
+#if VDRVERSNUM >= 20301
+ {
+ LOCK_RECORDINGS_READ;
+ recording = Recordings->GetByName(item->GetFilename());
+ }
+#else
cThreadLock RecordingsLock(&Recordings);
- cRecording *recording = Recordings.GetByName(item->GetFilename());
+ recording = Recordings.GetByName(item->GetFilename());
+#endif
if (recording)
string = cString::sprintf("%s%s\n", *string, recording->Title(' '));
item = (cHistoryRecordingItem *)item->Next();
diff --git a/logger.c b/logger.c
index abd8188..f60834f 100644
--- a/logger.c
+++ b/logger.c
@@ -71,8 +71,16 @@ void cHistoryLogger::Replaying(const cControl *Control, const char *Name, const
if (On) {
if (FileName) {
// Check if file is a VDR recording
+ const cRecording *recording;
+#if VDRVERSNUM >= 20301
+ {
+ LOCK_RECORDINGS_READ;
+ recording = Recordings->GetByName(FileName);
+ }
+#else
cThreadLock RecordingsLock(&Recordings);
- cRecording *recording = Recordings.GetByName(FileName);
+ recording = Recordings.GetByName(FileName);
+#endif
// Use name only if not a VDR recording
replay_history->Ins(new cHistoryRecordingItem(!recording ? Name : NULL, FileName));
if (replay_history->Count() > HistorySetup.replay_history_size)
diff --git a/menu.c b/menu.c
index 640fede..3548116 100644
--- a/menu.c
+++ b/menu.c
@@ -86,8 +86,16 @@ cHistoryRecordingMenuItem::cHistoryRecordingMenuItem(const char *Name, const cha
name = Name ? strdup(Name) : NULL;
if (filename) {
if (!name) {
+ const cRecording *recording;
+#if VDRVERSNUM >= 20301
+ {
+ LOCK_RECORDINGS_READ;
+ recording = Recordings->GetByName(filename);
+ }
+#else
cThreadLock RecordingsLock(&Recordings);
- cRecording *recording = Recordings.GetByName(filename);
+ recording = Recordings.GetByName(filename);
+#endif
if (recording) {
active = true;
SetText(recording->Title('\t'));
@@ -151,10 +159,26 @@ void cHistoryMainMenu::SetMenu()
}
}
+#if VDRVERSNUM >= 20301
+const cRecording *cHistoryMainMenu::GetRecordingRead(cHistoryRecordingMenuItem *Item)
+{
+ LOCK_RECORDINGS_READ;
+ const cRecording *recording = Recordings->GetByName(Item->GetFilename());
+ if (!recording)
+ Skins.Message(mtError, trVDR("Error while accessing recording!"));
+ return recording;
+}
+#endif
+
cRecording *cHistoryMainMenu::GetRecording(cHistoryRecordingMenuItem *Item)
{
+#if VDRVERSNUM >= 20301
+ LOCK_RECORDINGS_WRITE;
+ cRecording *recording = Recordings->GetByName(Item->GetFilename());
+#else
cThreadLock RecordingsLock(&Recordings);
cRecording *recording = Recordings.GetByName(Item->GetFilename());
+#endif
if (!recording)
Skins.Message(mtError, trVDR("Error while accessing recording!"));
return recording;
@@ -181,7 +205,12 @@ eOSState cHistoryMainMenu::Info()
{
cHistoryRecordingMenuItem *ri = (cHistoryRecordingMenuItem *)Get(Current());
if (ri) {
- cRecording *recording = GetRecording(ri);
+ const cRecording *recording;
+#if VDRVERSNUM >= 20301
+ recording = GetRecordingRead(ri);
+#else
+ recording = GetRecording(ri);
+#endif
if (recording && recording->Info()->Title())
return AddSubMenu(new cHistoryRecordingMenu(recording));
}
diff --git a/menu.h b/menu.h
index 9811467..ee84005 100644
--- a/menu.h
+++ b/menu.h
@@ -24,6 +24,9 @@ private:
eOSState Info();
eOSState Play();
eOSState Rewind();
+#if VDRVERSNUM >= 20301
+ const cRecording *GetRecordingRead(cHistoryRecordingMenuItem *Item);
+#endif
cRecording *GetRecording(cHistoryRecordingMenuItem *Item);
public: