From 91fc82efa40513a52002cd8ef5cb4d16f270ff03 Mon Sep 17 00:00:00 2001
From: Sascha Hinck <SHinck@web.de>
Date: Wed, 15 Aug 2012 05:08:05 +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 | 17 ++++++++++++++++-
mythtv/libs/libmythtv/tv_play.h | 1 +
mythtv/programs/mythfrontend/guidegrid.cpp | 8 +++-----
3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp
index bbd10de..b039781 100644
a
|
b
|
QSet<uint> TV::IsTunableOn( |
7844 | 7844 | excluded_cards.push_back(ctx->GetCardID()); |
7845 | 7845 | |
7846 | 7846 | uint sourceid = ChannelUtil::GetSourceIDForChannel(chanid); |
7847 | | vector<uint> connected = RemoteRequestFreeRecorderList(excluded_cards); |
| 7847 | vector<uint> connected; |
| 7848 | if (use_cache) |
| 7849 | { |
| 7850 | QMutexLocker locker(&is_tunable_cache_lock); |
| 7851 | if (is_tunable_cache_recorder.empty()) |
| 7852 | is_tunable_cache_recorder = RemoteRequestFreeRecorderList(excluded_cards); |
| 7853 | |
| 7854 | connected = is_tunable_cache_recorder; |
| 7855 | } |
| 7856 | else |
| 7857 | connected = RemoteRequestFreeRecorderList(excluded_cards); |
| 7858 | |
7848 | 7859 | vector<uint> interesting = CardUtil::GetCardIDs(sourceid); |
7849 | 7860 | |
7850 | 7861 | // filter disconnected cards |
… |
… |
void TV::ClearTunableCache(void) |
7938 | 7952 | QMutexLocker locker(&is_tunable_cache_lock); |
7939 | 7953 | LOG(VB_CHANNEL, LOG_INFO, LOC + "ClearTunableCache()"); |
7940 | 7954 | is_tunable_cache_inputs.clear(); |
| 7955 | is_tunable_cache_recorder.clear(); |
7941 | 7956 | } |
7942 | 7957 | |
7943 | 7958 | bool TV::StartEmbedding(const QRect &embedRect) |
diff --git a/mythtv/libs/libmythtv/tv_play.h b/mythtv/libs/libmythtv/tv_play.h
index d7b22ab..a1f806f 100644
a
|
b
|
class MTV_PUBLIC TV : public QObject |
777 | 777 | // IsTunable() cache, used by embedded program guide |
778 | 778 | mutable QMutex is_tunable_cache_lock; |
779 | 779 | QMap< uint,vector<InputInfo> > is_tunable_cache_inputs; |
| 780 | vector<uint> is_tunable_cache_recorder; |
780 | 781 | |
781 | 782 | // Channel group stuff |
782 | 783 | /// \brief Lock necessary when modifying channel group variables. |
diff --git a/mythtv/programs/mythfrontend/guidegrid.cpp b/mythtv/programs/mythfrontend/guidegrid.cpp
index de83c42..5106304 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) |
1510 | 1513 | |
1511 | 1514 | DBChannel *chinfo = GetChannelInfo(m_currentStartChannel); |
1512 | 1515 | |
1513 | | if (m_player) |
1514 | | m_player->ClearTunableCache(); |
1515 | | |
1516 | 1516 | for (unsigned int y = 0; (y < (unsigned int)m_channelCount) && chinfo; ++y) |
1517 | 1517 | { |
1518 | 1518 | unsigned int chanNumber = y + m_currentStartChannel; |
… |
… |
void GuideGrid::cursorDown() |
1823 | 1823 | fillProgramRowInfos(m_currentRow); |
1824 | 1824 | m_guideGrid->SetRedraw(); |
1825 | 1825 | updateInfo(); |
1826 | | updateChannels(); |
1827 | 1826 | } |
1828 | 1827 | } |
1829 | 1828 | |
… |
… |
void GuideGrid::cursorUp() |
1841 | 1840 | fillProgramRowInfos(m_currentRow); |
1842 | 1841 | m_guideGrid->SetRedraw(); |
1843 | 1842 | updateInfo(); |
1844 | | updateChannels(); |
1845 | 1843 | } |
1846 | 1844 | } |
1847 | 1845 | |