Skip to content

Commit

Permalink
Add setting to enable streaming conflict management
Browse files Browse the repository at this point in the history
  • Loading branch information
Glenn-1990 committed Oct 27, 2015
1 parent 34594b6 commit 021e77e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
5 changes: 3 additions & 2 deletions pvr.hts/resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,6 @@ msgctxt "#30557"
msgid "Interrupting service... %i%%"
msgstr ""



msgctxt "#30558"
msgid "Streaming conflict management"
msgstr ""
1 change: 1 addition & 0 deletions pvr.hts/resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

<setting label="30500" type="lsep"/>
<setting id="streaming_profile" type="text" label="30501" default="" />
<setting id="streaming_conflict" type="bool" label="30558" default="false"/>

<setting label="30400" type="lsep"/>
<setting id="pretuner_enabled" type="bool" label="30403" default="false" />
Expand Down
6 changes: 6 additions & 0 deletions src/tvheadend/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const int Settings::DEFAULT_PRETUNER_CLOSEDELAY = 10; // secs
const int Settings::DEFAULT_AUTOREC_MAXDIFF = 15; // mins. Maximum difference between real and approximate start time for auto recordings
const int Settings::DEFAULT_APPROX_TIME = 0; // mins
const std::string Settings::DEFAULT_STREAMING_PROFILE = "";
const bool Settings::DEFAULT_STREAMING_CONFLICT = false;

void Settings::ReadSettings()
{
Expand Down Expand Up @@ -70,6 +71,9 @@ void Settings::ReadSettings()

/* Streaming */
SetStreamingProfile(ReadStringSetting("streaming_profile", DEFAULT_STREAMING_PROFILE));

/* Subscription conflict management */
SetStreamingConflict(ReadBoolSetting("streaming_conflict", DEFAULT_STREAMING_CONFLICT));
}

ADDON_STATUS Settings::SetSetting(const std::string &key, const void *value)
Expand Down Expand Up @@ -115,6 +119,8 @@ ADDON_STATUS Settings::SetSetting(const std::string &key, const void *value)
/* Streaming */
else if (key == "streaming_profile")
return SetStringSetting(GetStreamingProfile(), value);
else if (key == "streaming_conflict")
return SetBoolSetting(GetStreamingConflict(), value);
else
{
tvherror("Settings::SetSetting - unknown setting '%s'", key.c_str());
Expand Down
4 changes: 4 additions & 0 deletions src/tvheadend/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace tvheadend {
static const int DEFAULT_AUTOREC_MAXDIFF; // mins. Maximum difference between real and approximate start time for auto recordings
static const int DEFAULT_APPROX_TIME; // mins
static const std::string DEFAULT_STREAMING_PROFILE;
static const bool DEFAULT_STREAMING_CONFLICT;

/**
* Singleton getter for the instance
Expand Down Expand Up @@ -86,6 +87,7 @@ namespace tvheadend {
bool GetAutorecApproxTime() const { return m_bAutorecApproxTime; }
int GetAutorecMaxDiff() const { return m_iPreTunerCloseDelay; }
std::string GetStreamingProfile() const { return m_strStreamingProfile; }
bool GetStreamingConflict() const { return m_bStreamingConflict; }

private:
Settings()
Expand Down Expand Up @@ -124,6 +126,7 @@ namespace tvheadend {
void SetAutorecApproxTime(bool value) { m_bAutorecApproxTime = value; }
void SetAutorecMaxDiff(int value) { m_iAutorecMaxDiff = value; }
void SetStreamingProfile(const std::string &value) { m_strStreamingProfile = value; }
void SetStreamingConflict(bool value) { m_bStreamingConflict = value; }

/**
* Read/Set values according to definition in settings.xml
Expand Down Expand Up @@ -151,6 +154,7 @@ namespace tvheadend {
bool m_bAutorecApproxTime;
int m_iAutorecMaxDiff;
std::string m_strStreamingProfile;
bool m_bStreamingConflict;
};

}
10 changes: 8 additions & 2 deletions src/tvheadend/Subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,14 @@ void Subscription::ParseSubscriptionStatus ( htsmsg_t *m )
SetState(SUBSCRIPTION_USERLIMIT);
else if (!strcmp("noFreeAdapter", error))
{
/* No free adapter, AKA subscription conflict */
HandleConflict();
/* If streaming conflict management enabled */
if (Settings::GetInstance().GetStreamingConflict())
{
/* No free adapter, AKA subscription conflict */
HandleConflict();
}
else
SetState(SUBSCRIPTION_NOFREEADAPTER);
}
else if (!strcmp("tuningFailed", error))
SetState(SUBSCRIPTION_TUNINGFAILED);
Expand Down

0 comments on commit 021e77e

Please sign in to comment.