From dce75c2b7fac2b5017ffc2d9d4d98786f7a82e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matti=20Lehtim=C3=A4ki?= Date: Tue, 17 Apr 2018 00:30:29 +0300 Subject: Add support for VDR >= 2.3.1. --- history.c | 10 +++++++++- logger.c | 10 +++++++++- menu.c | 33 +++++++++++++++++++++++++++++++-- menu.h | 3 +++ 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: -- cgit v1.2.3