Skip to content

Commit

Permalink
[pvrfortherecord] Added configurable delay in milliseconds after tuni…
Browse files Browse the repository at this point in the history
…ng a new channel
  • Loading branch information
fred authored and margro committed May 2, 2012
1 parent 387ab14 commit 721c945
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
<string id="30003">Verbindingstimeout (s)</string>
<string id="30004">Windows gebruikersaccount</string>
<string id="30005">Wachtwoord</string>
<string id="30010">Wachttijd na afstemmen (ms)</string>
</strings>
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
<string id="30003">Connect timeout (s)</string>
<string id="30004">Windows user account</string>
<string id="30005">Password</string>
<string id="30010">Delay after tuning (ms)</string>
</strings>
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
<string id="30003">Timeout per la connessione (s)</string>
<string id="30004">Windows user account</string>
<string id="30005">Password</string>
<string id="30010">Delay after tuning (ms)</string>
</strings>
1 change: 1 addition & 0 deletions addons/pvr.fortherecord.argus/resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
<setting id="timeout" type="enum" label="30003" values="0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15" default="6"/>
<setting id="user" type="text" label="30004" default="Guest" />
<setting id="pass" type="text" label="30005" option="hidden" default="" />
<setting id="delay" type="number" label="30010" default="200" />
</settings>
9 changes: 9 additions & 0 deletions xbmc/pvrclients/ForTheRecord/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ bool g_bRadioEnabled = DEFAULT_RADIO; ///< Send also Radio
std::string g_szUser = DEFAULT_USER; ///< Windows user account used to access share
std::string g_szPass = DEFAULT_PASS; ///< Windows user password used to access share
///< Leave empty to use current user when running on Windows
int g_iTuneDelay = DEFAULT_TUNEDELAY; ///< Number of milliseconds to delay after tuning a channel

std::string g_szBaseURL;

Expand Down Expand Up @@ -151,6 +152,14 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props)
else
g_szPass = "";

/* Read setting "delay" from settings.xml */
if (!XBMC->GetSetting("delay", &g_iTuneDelay))
{
/* If setting is unknown fallback to defaults */
XBMC->Log(LOG_ERROR, "Couldn't get 'delay' setting, falling back to '200' as default");
g_iTuneDelay = DEFAULT_TUNEDELAY;
}

/* Connect to ForTheRecord */
if (!g_client->Connect())
{
Expand Down
2 changes: 2 additions & 0 deletions xbmc/pvrclients/ForTheRecord/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#define DEFAULT_TIMEOUT 10
#define DEFAULT_USER "Guest"
#define DEFAULT_PASS ""
#define DEFAULT_TUNEDELAY 200

extern bool g_bCreated; ///< Shows that the Create function was successfully called
extern int g_iClientID; ///< The PVR client ID used by XBMC for this driver
Expand All @@ -46,6 +47,7 @@ extern int g_iConnectTimeout;
extern bool g_bRadioEnabled;
extern std::string g_szUser;
extern std::string g_szPass;
extern int g_iTuneDelay;

extern std::string g_szBaseURL;

Expand Down
18 changes: 8 additions & 10 deletions xbmc/pvrclients/ForTheRecord/pvrclient-fortherecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1215,17 +1215,15 @@ bool cPVRClientForTheRecord::_OpenLiveStream(const PVR_CHANNEL &channelinfo)
XBMC->Log(LOG_DEBUG, "Close existing and open new TsReader...");
m_tsreader->Close();
SAFE_DELETE(m_tsreader);
m_tsreader = new CTsReader();
m_tsreader->Open(filename.c_str());
m_tsreader->OnZap();
} else {
m_tsreader = new CTsReader();
// Open Timeshift buffer
// TODO: rtsp support
XBMC->Log(LOG_DEBUG, "Open TsReader");
m_tsreader->Open(filename.c_str());
//usleep(200000);
}
// Open Timeshift buffer
// TODO: rtsp support
m_tsreader = new CTsReader();
XBMC->Log(LOG_DEBUG, "Open TsReader");
m_tsreader->Open(filename.c_str());
m_tsreader->OnZap();
XBMC->Log(LOG_DEBUG, "Delaying %ld milliseconds.", (1000 * g_iTuneDelay));
usleep(1000 * g_iTuneDelay);

#endif
return true;
Expand Down

0 comments on commit 721c945

Please sign in to comment.