diff --git a/lib/cppmyth/src/mythlivetvplayback.cpp b/lib/cppmyth/src/mythlivetvplayback.cpp
index 8443684a..d0a5e1e3 100644
--- a/lib/cppmyth/src/mythlivetvplayback.cpp
+++ b/lib/cppmyth/src/mythlivetvplayback.cpp
@@ -48,6 +48,7 @@ LiveTVPlayback::LiveTVPlayback(EventHandler& handler)
, m_eventHandler(handler)
, m_eventSubscriberId(0)
, m_tuneDelay(MIN_TUNE_DELAY)
+, m_limitTuneAttempts(true)
, m_recorder()
, m_signal()
, m_chain()
@@ -132,6 +133,13 @@ void LiveTVPlayback::SetTuneDelay(unsigned delay)
m_tuneDelay = delay;
}
+void LiveTVPlayback::SetLimitTuneAttempts(bool limit)
+{
+ // true : Try first tunable card in prefered order
+ // false: Try all tunable cards in prefered order
+ m_limitTuneAttempts = limit;
+}
+
bool LiveTVPlayback::SpawnLiveTV(const std::string& chanNum, const ChannelList& channels)
{
// Begin critical section
@@ -176,6 +184,12 @@ bool LiveTVPlayback::SpawnLiveTV(const std::string& chanNum, const ChannelList&
m_recorder->StopLiveTV();
}
ClearChain();
+ // Check if we need to stop after first attempt at tuning
+ if (m_limitTuneAttempts)
+ {
+ DBG(MYTH_DBG_DEBUG, "%s: limiting tune attempts to first tunable card\n", __FUNCTION__);
+ break;
+ }
// Retry the next preferred card
++card;
}
diff --git a/lib/cppmyth/src/mythlivetvplayback.h b/lib/cppmyth/src/mythlivetvplayback.h
index fd0443bd..66b193ed 100644
--- a/lib/cppmyth/src/mythlivetvplayback.h
+++ b/lib/cppmyth/src/mythlivetvplayback.h
@@ -45,6 +45,7 @@ namespace Myth
void Close();
bool IsOpen() { return ProtoMonitor::IsOpen(); }
void SetTuneDelay(unsigned delay);
+ void SetLimitTuneAttempts(bool limit);
bool SpawnLiveTV(const std::string& chanNum, const ChannelList& channels);
bool SpawnLiveTV(const ChannelPtr& thisChannel);
void StopLiveTV();
@@ -73,6 +74,7 @@ namespace Myth
unsigned m_eventSubscriberId;
unsigned m_tuneDelay;
+ bool m_limitTuneAttempts;
ProtoRecorderPtr m_recorder;
SignalStatusPtr m_signal;
diff --git a/pvr.mythtv/resources/language/resource.language.en_gb/strings.po b/pvr.mythtv/resources/language/resource.language.en_gb/strings.po
index cc7c49c5..5eb9bf3a 100644
--- a/pvr.mythtv/resources/language/resource.language.en_gb/strings.po
+++ b/pvr.mythtv/resources/language/resource.language.en_gb/strings.po
@@ -201,7 +201,11 @@ msgctxt "#30064"
msgid "Enable recording fanart/thumbnails"
msgstr ""
-#empty strings from id 30065 to 30099
+msgctxt "#30065"
+msgid "Limit channel tuning attempts"
+msgstr ""
+
+#empty strings from id 30066 to 30099
# Systeminformation labels
msgctxt "#30100"
diff --git a/pvr.mythtv/resources/language/resource.language.fr_fr/strings.po b/pvr.mythtv/resources/language/resource.language.fr_fr/strings.po
index f6bf03bc..6c8d33ff 100644
--- a/pvr.mythtv/resources/language/resource.language.fr_fr/strings.po
+++ b/pvr.mythtv/resources/language/resource.language.fr_fr/strings.po
@@ -192,6 +192,10 @@ msgctxt "#30064"
msgid "Enable recording fanart/thumbnails"
msgstr "Afficher les vignettes des enregistrements"
+msgctxt "#30065"
+msgid "Limit channel tuning attempts"
+msgstr "Limiter les tentatives de syntonisation"
+
msgctxt "#30100"
msgid "Protocol version: %i - Database version: %i"
msgstr "Version du protocole: %i - Version de la base de données: %i"
diff --git a/pvr.mythtv/resources/settings.xml b/pvr.mythtv/resources/settings.xml
index 425fdc38..5314c124 100644
--- a/pvr.mythtv/resources/settings.xml
+++ b/pvr.mythtv/resources/settings.xml
@@ -28,6 +28,7 @@
+
diff --git a/src/client.cpp b/src/client.cpp
index 30944e62..857706a6 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -57,6 +57,7 @@ int g_iTuneDelay = DEFAULT_TUNE_DELAY;
int g_iGroupRecordings = GROUP_RECORDINGS_ALWAYS;
int g_iEnableEDL = ENABLE_EDL_ALWAYS;
bool g_bBlockMythShutdown = DEFAULT_BLOCK_SHUTDOWN;
+bool g_bLimitTuneAttempts = DEFAULT_LIMIT_TUNE_ATTEMPTS;
///* Client member variables */
ADDON_STATUS m_CurStatus = ADDON_STATUS_UNKNOWN;
@@ -301,6 +302,14 @@ ADDON_STATUS ADDON_Create(void *hdl, void *props)
g_bRecordingIcons = DEFAULT_RECORDING_ICONS;
}
+ /* Read setting "limit_tune_attempts" from settings.xml */
+ if (!XBMC->GetSetting("limit_tune_attempts", &g_bLimitTuneAttempts))
+ {
+ /* If setting is unknown fallback to defaults */
+ XBMC->Log(LOG_ERROR, "Couldn't get 'limit_tune_attempts' setting, falling back to '%b' as default", DEFAULT_LIMIT_TUNE_ATTEMPTS);
+ g_bLimitTuneAttempts = DEFAULT_LIMIT_TUNE_ATTEMPTS;
+ }
+
free (buffer);
XBMC->Log(LOG_DEBUG, "Loading settings...done");
@@ -615,6 +624,12 @@ ADDON_STATUS ADDON_SetSetting(const char *settingName, const void *settingValue)
g_bBlockMythShutdown ? g_client->BlockBackendShutdown() : g_client->AllowBackendShutdown();
}
}
+ else if (str == "limit_tune_attempts")
+ {
+ XBMC->Log(LOG_INFO, "Changed Setting 'limit_tune_attempts' from %u to %u", g_bLimitTuneAttempts, *(bool*)settingValue);
+ if (g_bLimitTuneAttempts != *(bool*)settingValue)
+ g_bLimitTuneAttempts = *(bool*)settingValue;
+ }
return ADDON_STATUS_OK;
}
diff --git a/src/client.h b/src/client.h
index aa7b03ad..c784acc4 100644
--- a/src/client.h
+++ b/src/client.h
@@ -62,6 +62,7 @@
#define ENABLE_EDL_DIALOG 1
#define ENABLE_EDL_NEVER 2
#define DEFAULT_BLOCK_SHUTDOWN true
+#define DEFAULT_LIMIT_TUNE_ATTEMPTS true
/*!
* @brief PVR macros for string exchange
@@ -106,6 +107,7 @@ extern int g_iTuneDelay;
extern int g_iGroupRecordings;
extern int g_iEnableEDL;
extern bool g_bBlockMythShutdown;
+extern bool g_bLimitTuneAttempts; ///< Limit channel tuning attempts to first card
extern ADDON::CHelper_libXBMC_addon *XBMC;
extern CHelper_libXBMC_pvr *PVR;
diff --git a/src/pvrclient-mythtv.cpp b/src/pvrclient-mythtv.cpp
index 4ffcf610..34283fb0 100644
--- a/src/pvrclient-mythtv.cpp
+++ b/src/pvrclient-mythtv.cpp
@@ -1946,8 +1946,9 @@ bool PVRClientMythTV::OpenLiveStream(const PVR_CHANNEL &channel)
// Suspend fileOps to avoid connection hang
if (m_fileOps)
m_fileOps->Suspend();
- // Set tuning delay
+ // Configure tuning of channel
m_liveStream->SetTuneDelay(g_iTuneDelay);
+ m_liveStream->SetLimitTuneAttempts(g_bLimitTuneAttempts);
// Try to open
if (m_liveStream->SpawnLiveTV(chanset[0]->chanNum, chanset))
{