From 4083eb84989e4de7e6aa8d963c2f13a0f0976eeb Mon Sep 17 00:00:00 2001
From: Sascha Hinck <SHinck@web.de>
Date: Sat, 25 Aug 2012 18:24:48 +0200
Subject: [PATCH] EPG: Cache FreeRecorderList query to remote Backend
When the EPG during LiveTV shows up cache the result from the first query
of GetFreeRecorderList to the backend in a local vector because it takes
time and is repeated for each row and update of the guidegrid which is not
acceptable e.g. for a windows remote frontend.
---
mythtv/libs/libmythtv/tv_play.cpp | 14 +++++++++++++-
mythtv/libs/libmythtv/tv_play.h | 1 +
mythtv/programs/mythfrontend/guidegrid.cpp | 8 +++-----
3 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp
index 89e27df..f087fd6 100644
a
|
b
|
QSet<uint> TV::IsTunableOn( |
7991 | 7991 | excluded_cards.push_back(ctx->GetCardID()); |
7992 | 7992 | |
7993 | 7993 | uint sourceid = ChannelUtil::GetSourceIDForChannel(chanid); |
7994 | | vector<uint> connected = RemoteRequestFreeRecorderList(excluded_cards); |
| 7994 | vector<uint> connected; |
| 7995 | if (use_cache) |
| 7996 | { |
| 7997 | QMutexLocker locker(&is_tunable_cache_lock); |
| 7998 | if (is_tunable_cache_recorder.empty()) |
| 7999 | is_tunable_cache_recorder = RemoteRequestFreeRecorderList(excluded_cards); |
| 8000 | |
| 8001 | connected = is_tunable_cache_recorder; |
| 8002 | } |
| 8003 | else |
| 8004 | connected = RemoteRequestFreeRecorderList(excluded_cards); |
| 8005 | |
7995 | 8006 | vector<uint> interesting = CardUtil::GetCardIDs(sourceid); |
7996 | 8007 | |
7997 | 8008 | // filter disconnected cards |
… |
… |
void TV::ClearTunableCache(void) |
8085 | 8096 | QMutexLocker locker(&is_tunable_cache_lock); |
8086 | 8097 | LOG(VB_CHANNEL, LOG_INFO, LOC + "ClearTunableCache()"); |
8087 | 8098 | is_tunable_cache_inputs.clear(); |
| 8099 | is_tunable_cache_recorder.clear(); |
8088 | 8100 | } |
8089 | 8101 | |
8090 | 8102 | bool TV::StartEmbedding(const QRect &embedRect) |
diff --git a/mythtv/libs/libmythtv/tv_play.h b/mythtv/libs/libmythtv/tv_play.h
index 7041f9f..d732cba 100644
a
|
b
|
class MTV_PUBLIC TV : public QObject |
811 | 811 | // IsTunable() cache, used by embedded program guide |
812 | 812 | mutable QMutex is_tunable_cache_lock; |
813 | 813 | QMap< uint,vector<InputInfo> > is_tunable_cache_inputs; |
| 814 | vector<uint> is_tunable_cache_recorder; |
814 | 815 | |
815 | 816 | // Channel group stuff |
816 | 817 | /// \brief Lock necessary when modifying channel group variables. |
diff --git a/mythtv/programs/mythfrontend/guidegrid.cpp b/mythtv/programs/mythfrontend/guidegrid.cpp
index 1990c4e..0be4bba 100644
a
|
b
|
GuideGrid::GuideGrid(MythScreenStack *parent, |
260 | 260 | m_currentStartTime = m_originalStartTime.addSecs(secsoffset); |
261 | 261 | m_startChanID = chanid; |
262 | 262 | m_startChanNum = channum; |
| 263 | |
| 264 | if (m_player) |
| 265 | m_player->ClearTunableCache(); |
263 | 266 | } |
264 | 267 | |
265 | 268 | bool GuideGrid::Create() |
… |
… |
void GuideGrid::updateChannels(void) |
1511 | 1514 | |
1512 | 1515 | DBChannel *chinfo = GetChannelInfo(m_currentStartChannel); |
1513 | 1516 | |
1514 | | if (m_player) |
1515 | | m_player->ClearTunableCache(); |
1516 | | |
1517 | 1517 | for (unsigned int y = 0; (y < (unsigned int)m_channelCount) && chinfo; ++y) |
1518 | 1518 | { |
1519 | 1519 | unsigned int chanNumber = y + m_currentStartChannel; |
… |
… |
void GuideGrid::cursorDown() |
1824 | 1824 | fillProgramRowInfos(m_currentRow); |
1825 | 1825 | m_guideGrid->SetRedraw(); |
1826 | 1826 | updateInfo(); |
1827 | | updateChannels(); |
1828 | 1827 | } |
1829 | 1828 | } |
1830 | 1829 | |
… |
… |
void GuideGrid::cursorUp() |
1842 | 1841 | fillProgramRowInfos(m_currentRow); |
1843 | 1842 | m_guideGrid->SetRedraw(); |
1844 | 1843 | updateInfo(); |
1845 | | updateChannels(); |
1846 | 1844 | } |
1847 | 1845 | } |
1848 | 1846 | |