From eaa015874e3e494006d67260feaebe6377568ebb Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Sat, 1 Apr 2017 23:17:15 +0300 Subject: VDR-2.3.1 compatibility patch by Nachteule. http://www.vdr-portal.de/board16-video-disk-recorder/board55-vdr-plugins/p1280013-vdr-live-vdr-2-3-1/#post1280013 --- epg_events.cpp | 5 ++++ epg_events.h | 8 ++++++ epgsearch.cpp | 27 ++++++++++++++++++ epgsearch.h | 4 +++ pages/channels_widget.ecpp | 9 ++++++ pages/edit_timer.ecpp | 5 ++++ pages/epginfo.ecpp | 5 ++++ pages/ibox.ecpp | 23 ++++++++++++++++ pages/multischedule.ecpp | 28 +++++++++++++++++++ pages/recordings.ecpp | 5 ++++ pages/remote.ecpp | 16 +++++++++++ pages/schedule.ecpp | 29 ++++++++++++++++++++ pages/searchresults.ecpp | 7 +++++ pages/timerconflicts.ecpp | 12 ++++++++ pages/timers.ecpp | 7 +++++ pages/vlc.ecpp | 5 ++++ pages/whats_on.ecpp | 13 +++++++++ recman.cpp | 35 ++++++++++++++++++++++++ tasks.cpp | 9 ++++++ timers.cpp | 68 ++++++++++++++++++++++++++++++++++++++++++++++ timers.h | 4 +++ 21 files changed, 324 insertions(+) diff --git a/epg_events.cpp b/epg_events.cpp index 9e35f79..10e02e7 100644 --- a/epg_events.cpp +++ b/epg_events.cpp @@ -285,7 +285,12 @@ namespace vdrlive tChannelID channelId = tChannelID(); DecodeDomId(epgid, channelId, eventId); +#if VDRVERSNUM >= 20301 + LOCK_CHANNELS_READ; + cChannel const *channel = Channels->GetByChannelID(channelId); +#else cChannel const *channel = Channels.GetByChannelID(channelId); +#endif if (!channel) { return CreateEpgInfo(epgid, errorInfo, tr("Wrong channel id")); } diff --git a/epg_events.h b/epg_events.h index 3417f6a..3843bc1 100644 --- a/epg_events.h +++ b/epg_events.h @@ -170,7 +170,11 @@ namespace vdrlive virtual time_t GetEndTime() const { return m_event->EndTime(); } +#if VDRVERSNUM >= 20301 + virtual cChannel const * Channel() const { LOCK_CHANNELS_READ; return Channels->GetByChannelID(m_event->ChannelID());} +#else virtual cChannel const * Channel() const { return Channels.GetByChannelID(m_event->ChannelID());} +#endif private: cEvent const * m_event; @@ -198,7 +202,11 @@ namespace vdrlive virtual time_t GetEndTime() const { return 0; } +#if VDRVERSNUM >= 20301 + virtual cChannel const * Channel() const { LOCK_CHANNELS_READ; return Channels->GetByChannelID(m_channelID);} +#else virtual cChannel const * Channel() const { return Channels.GetByChannelID(m_channelID);} +#endif private: tChannelID m_channelID; diff --git a/epgsearch.cpp b/epgsearch.cpp index cd29a0b..7e92a10 100644 --- a/epgsearch.cpp +++ b/epgsearch.cpp @@ -190,8 +190,14 @@ std::string SearchTimer::ToText() if (m_useChannel==1) { +#if VDRVERSNUM >= 20301 + LOCK_CHANNELS_READ; + cChannel const* channelMin = Channels->GetByChannelID( m_channelMin ); + cChannel const* channelMax = Channels->GetByChannelID( m_channelMax ); +#else cChannel const* channelMin = Channels.GetByChannelID( m_channelMin ); cChannel const* channelMax = Channels.GetByChannelID( m_channelMax ); +#endif if (channelMax && channelMin->Number() < channelMax->Number()) tmp_chanSel = *m_channelMin.ToString() + std::string("|") + *m_channelMax.ToString(); @@ -284,7 +290,12 @@ void SearchTimer::ParseChannelIDs( string const& data ) vector< string > parts = StringSplit( data, '|' ); m_channelMin = lexical_cast< tChannelID >( parts[ 0 ] ); +#if VDRVERSNUM >= 20301 + LOCK_CHANNELS_READ; + cChannel const* channel = Channels->GetByChannelID( m_channelMin ); +#else cChannel const* channel = Channels.GetByChannelID( m_channelMin ); +#endif if ( channel != 0 ) m_channels = channel->Name(); @@ -293,7 +304,11 @@ void SearchTimer::ParseChannelIDs( string const& data ) m_channelMax = lexical_cast< tChannelID >( parts[ 1 ] ); +#if VDRVERSNUM >= 20301 + channel = Channels->GetByChannelID( m_channelMax ); +#else channel = Channels.GetByChannelID( m_channelMax ); +#endif if ( channel != 0 ) m_channels += string( " - " ) + channel->Name(); } @@ -352,7 +367,11 @@ bool SearchTimers::Reload() if ( !CheckEpgsearchVersion() || cPluginManager::CallFirstService(ServiceInterface, &service) == 0 ) throw HtmlError( tr("EPGSearch version outdated! Please update.") ); +#if VDRVERSNUM >= 20301 + LOCK_CHANNELS_READ; +#else ReadLock channelsLock( Channels, 0 ); +#endif list< string > timers = service.handler->SearchTimerList(); m_timers.assign( timers.begin(), timers.end() ); m_timers.sort(); @@ -366,7 +385,11 @@ bool SearchTimers::Save(SearchTimer* searchtimer) throw HtmlError( tr("EPGSearch version outdated! Please update.") ); if (!searchtimer) return false; +#if VDRVERSNUM >= 20301 + LOCK_CHANNELS_READ; +#else ReadLock channelsLock( Channels, 0 ); +#endif if (searchtimer->Id() >= 0) return service.handler->ModSearchTimer(searchtimer->ToText()); else @@ -556,7 +579,11 @@ SearchResult::SearchResult( string const& data ) const cEvent* SearchResult::GetEvent() { cSchedulesLock schedulesLock; +#if VDRVERSNUM >= 20301 + LOCK_SCHEDULES_READ; +#else const cSchedules* Schedules = cSchedules::Schedules(schedulesLock); +#endif if (!Schedules) return NULL; const cChannel *Channel = GetChannel(); if (!Channel) return NULL; diff --git a/epgsearch.h b/epgsearch.h index 67a9b99..f6fbd2f 100644 --- a/epgsearch.h +++ b/epgsearch.h @@ -341,7 +341,11 @@ public: int TimerMode() const { return m_timerMode; } bool operator<( SearchResult const& other ) const { return m_starttime < other.m_starttime; } const cEvent* GetEvent(); +#if VDRVERSNUM >= 20301 + const cChannel* GetChannel() { LOCK_CHANNELS_READ; return Channels->GetByChannelID(m_channel); } +#else const cChannel* GetChannel() { return Channels.GetByChannelID(m_channel); } +#endif private: int m_searchId; diff --git a/pages/channels_widget.ecpp b/pages/channels_widget.ecpp index fed7483..d4c06b4 100644 --- a/pages/channels_widget.ecpp +++ b/pages/channels_widget.ecpp @@ -20,12 +20,21 @@ bool logged_in(false); if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); }> <%cpp> +#if VDRVERSNUM >= 20301 + LOCK_CHANNELS_READ; + if (false) +#else ReadLock channelsLock( Channels ); if ( !channelsLock ) +#endif throw HtmlError( tr("Couldn't aquire access to channels, please try again later.") );