[pvr] handle channel settings save/load when switching channels
authorSam Stenvall <neggelandia@gmail.com>
Sat, 24 May 2014 11:50:13 +0000 (14:50 +0300)
committerSam Stenvall <neggelandia@gmail.com>
Sun, 13 Jul 2014 08:35:41 +0000 (11:35 +0300)
xbmc/pvr/PVRManager.cpp

index b03bb61..352336b 100644 (file)
 #include "guilib/Key.h"
 #include "dialogs/GUIDialogPVRChannelManager.h"
 
+#ifdef HAS_VIDEO_PLAYBACK
+#include "cores/VideoRenderers/RenderManager.h"
+#endif
+
 using namespace std;
 using namespace MUSIC_INFO;
 using namespace PVR;
@@ -1056,6 +1060,9 @@ void CPVRManager::CloseStream(void)
       m_channelGroups->SetLastPlayedGroup(group);
 
       bPersistChanges = true;
+      
+      // store channel settings
+      g_application.SaveFileState();
     }
 
     m_addons->CloseStream();
@@ -1265,9 +1272,6 @@ bool CPVRManager::PerformChannelSwitch(const CPVRChannel &channel, bool bPreview
     m_channelGroups->SetLastPlayedGroup(GetPlayingGroup(currentChannel->IsRadio()));
   }
 
-  // store channel settings
-  SaveCurrentChannelSettings();
-
   // will be deleted by CPVRChannelSwitchJob::DoWork()
   CFileItem* previousFile = m_currentFile;
   m_currentFile = NULL;
@@ -1293,6 +1297,13 @@ bool CPVRManager::PerformChannelSwitch(const CPVRChannel &channel, bool bPreview
     // switch successful
     bSwitched = true;
 
+    // save previous and load new channel's settings
+    g_application.SaveFileState();
+    g_application.LoadVideoSettings(channel.Path());
+    
+    // reload the render manager so view mode gets changed
+    g_renderManager.PreInit();
+    
     CSingleLock lock(m_critSection);
     m_currentFile = new CFileItem(channel);
     m_bIsSwitchingChannels = false;