Skip to content

Commit

Permalink
[pvr] Improve pvr manager start/stop way
Browse files Browse the repository at this point in the history
  • Loading branch information
AlwinEsch committed Feb 25, 2015
1 parent e6d3734 commit 90a900f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
14 changes: 14 additions & 0 deletions xbmc/ApplicationMessenger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,13 @@ void CApplicationMessenger::ProcessMessage(ThreadMessage *pMsg)
#endif
break;
}
case TMSG_SETPVRMANAGERSTATE:
{
if (pMsg->param1 != 0)
g_application.StartPVRManager();
else
g_application.StopPVRManager();
}
}
}

Expand Down Expand Up @@ -1412,3 +1419,10 @@ void CApplicationMessenger::CECStandby()
ThreadMessage tMsg = {TMSG_CECSTANDBY};
SendMessage(tMsg, false);
}

void CApplicationMessenger::SetPVRManagerState(bool onOff)
{
ThreadMessage tMsg = {TMSG_SETPVRMANAGERSTATE};
tMsg.param1 = onOff ? 1 : 0;
SendMessage(tMsg, false);
}
6 changes: 6 additions & 0 deletions xbmc/ApplicationMessenger.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ namespace MUSIC_INFO
#define TMSG_CECACTIVATESOURCE 317
#define TMSG_CECSTANDBY 318
#define TMSG_SETVIDEORESOLUTION 319
#define TMSG_SETPVRMANAGERSTATE 320

#define TMSG_NETWORKMESSAGE 500

Expand Down Expand Up @@ -251,6 +252,11 @@ class CApplicationMessenger

void SetSplashMessage(const std::string& message);
void SetSplashMessage(int stringID);

/*! \brief Used to enable/disable PVR system without waiting.
\param onOff if true it becomes switched on otherwise off
*/
void SetPVRManagerState(bool onOff);

bool SetupDisplay();
bool DestroyDisplay();
Expand Down
7 changes: 2 additions & 5 deletions xbmc/pvr/PVRManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,7 @@ void CPVRManager::OnSettingChanged(const CSetting *setting)
const std::string &settingId = setting->GetId();
if (settingId == "pvrmanager.enabled")
{
if (((CSettingBool*)setting)->GetValue())
CApplicationMessenger::Get().ExecBuiltIn("StartPVRManager", false);
else
CApplicationMessenger::Get().ExecBuiltIn("StopPVRManager", false);
CApplicationMessenger::Get().SetPVRManagerState(((CSettingBool*)setting)->GetValue());
}
else if (settingId == "pvrparental.enabled")
{
Expand Down Expand Up @@ -553,7 +550,7 @@ void CPVRManager::Process(void)
if (IsStarted())
{
CLog::Log(LOGNOTICE, "PVRManager - %s - no add-ons enabled anymore. restarting the pvrmanager", __FUNCTION__);
CApplicationMessenger::Get().ExecBuiltIn("StartPVRManager", false);
CApplicationMessenger::Get().SetPVRManagerState(true);
}
else
{
Expand Down

0 comments on commit 90a900f

Please sign in to comment.