/* PVR related include Files */
#include "pvr/PVRManager.h"
#include "pvr/timers/PVRTimers.h"
-#include "pvr/windows/GUIWindowPVR.h"
+#include "pvr/windows/GUIWindowPVRChannels.h"
+#include "pvr/windows/GUIWindowPVRRecordings.h"
+#include "pvr/windows/GUIWindowPVRGuide.h"
+#include "pvr/windows/GUIWindowPVRTimers.h"
+#include "pvr/windows/GUIWindowPVRSearch.h"
#include "pvr/dialogs/GUIDialogPVRChannelManager.h"
#include "pvr/dialogs/GUIDialogPVRChannelsOSD.h"
#include "pvr/dialogs/GUIDialogPVRCutterOSD.h"
extern "C" void __stdcall init_emu_environ();
extern "C" void __stdcall update_emu_environ();
+extern "C" void __stdcall cleanup_emu_environ();
//
// Utility function used to copy files from the application bundle
{
// need to copy it across
CStdString srcPath = URIUtils::AddFileToFolder("special://xbmc/userdata/", file);
- CFile::Cache(srcPath, destPath);
+ CFile::Copy(srcPath, destPath);
}
}
CProfilesManager::Get().Load();
CLog::Log(LOGNOTICE, "-----------------------------------------------------------------------");
- CLog::Log(LOGNOTICE, "Starting XBMC (%s). Platform: %s %s %d-bit", g_infoManager.GetVersion().c_str(), g_sysinfo.GetBuildTargetPlatformName().c_str(),
+ CLog::Log(LOGNOTICE, "Starting Kodi (%s). Platform: %s %s %d-bit", g_infoManager.GetVersion().c_str(), g_sysinfo.GetBuildTargetPlatformName().c_str(),
g_sysinfo.GetBuildTargetCpuFamily().c_str(), g_sysinfo.GetXbmcBitness());
std::string buildType;
//#elif defined(some_ID) // uncomment for special version/fork
// specialVersion = " (version for XXXX)";
#endif
- CLog::Log(LOGNOTICE, "Using %s XBMC x%d build%s", buildType.c_str(), g_sysinfo.GetXbmcBitness(), specialVersion.c_str());
- CLog::Log(LOGNOTICE, "XBMC compiled " __DATE__ " by %s for %s %s %d-bit %s (%s)", g_sysinfo.GetUsedCompilerNameAndVer().c_str(), g_sysinfo.GetBuildTargetPlatformName().c_str(),
+ CLog::Log(LOGNOTICE, "Using Kodi %s x%d build%s", buildType.c_str(), g_sysinfo.GetXbmcBitness(), specialVersion.c_str());
+ CLog::Log(LOGNOTICE, "Kodi compiled " __DATE__ " by %s for %s %s %d-bit %s (%s)", g_sysinfo.GetUsedCompilerNameAndVer().c_str(), g_sysinfo.GetBuildTargetPlatformName().c_str(),
g_sysinfo.GetBuildTargetCpuFamily().c_str(), g_sysinfo.GetXbmcBitness(), g_sysinfo.GetBuildTargetPlatformVersionDecoded().c_str(),
g_sysinfo.GetBuildTargetPlatformVersion().c_str());
/* Load PVR related Windows and Dialogs */
g_windowManager.Add(new CGUIDialogTeletext);
- g_windowManager.Add(new CGUIWindowPVR);
+ g_windowManager.Add(new CGUIWindowPVRChannels(false));
+ g_windowManager.Add(new CGUIWindowPVRRecordings(false));
+ g_windowManager.Add(new CGUIWindowPVRGuide(false));
+ g_windowManager.Add(new CGUIWindowPVRTimers(false));
+ g_windowManager.Add(new CGUIWindowPVRSearch(false));
+ g_windowManager.Add(new CGUIWindowPVRChannels(true));
+ g_windowManager.Add(new CGUIWindowPVRRecordings(true));
+ g_windowManager.Add(new CGUIWindowPVRGuide(true));
+ g_windowManager.Add(new CGUIWindowPVRTimers(true));
+ g_windowManager.Add(new CGUIWindowPVRSearch(true));
g_windowManager.Add(new CGUIDialogPVRGuideInfo);
g_windowManager.Add(new CGUIDialogPVRRecordingInfo);
g_windowManager.Add(new CGUIDialogPVRTimerSettings);
CJSONRPC::Initialize();
#endif
ADDON::CAddonMgr::Get().StartServices(false);
- if (g_SkinInfo->GetFirstWindow() == WINDOW_PVR)
- {
- g_windowManager.ActivateWindow(WINDOW_HOME);
- StartPVRManager(true);
- }
- else
- {
- StartPVRManager(false);
+
+ // let's start the PVR manager and decide if the PVR manager handle the startup window activation
+ if (!StartPVRManager())
g_windowManager.ActivateWindow(g_SkinInfo->GetFirstWindow());
- }
CStereoscopicsManager::Get().Initialize();
}
return ret;
}
-void CApplication::StartPVRManager(bool bOpenPVRWindow /* = false */)
+bool CApplication::StartPVRManager()
{
- if (CSettings::Get().GetBool("pvrmanager.enabled"))
- g_PVRManager.Start(true, bOpenPVRWindow);
+ if (!CSettings::Get().GetBool("pvrmanager.enabled"))
+ return false;
+
+ int firstWindowId = 0;
+ if (g_PVRManager.IsPVRWindow(g_SkinInfo->GetStartWindow()))
+ firstWindowId = g_SkinInfo->GetFirstWindow();
+
+ g_PVRManager.Start(true, firstWindowId);
+
+ return (firstWindowId > 0);
}
void CApplication::StopPVRManager()
if (CAddonMgr::Get().GetAddon(CSettings::Get().GetString("screensaver.mode"), addon, ADDON_SCREENSAVER))
CGUIDialogAddonSettings::ShowAndGetInput(addon);
}
+ else if (settingId == "audiocds.settings")
+ {
+ AddonPtr addon;
+ if (CAddonMgr::Get().GetAddon(CSettings::Get().GetString("audiocds.encoder"), addon, ADDON_AUDIOENCODER))
+ CGUIDialogAddonSettings::ShowAndGetInput(addon);
+ }
else if (settingId == "videoscreen.guicalibration")
g_windowManager.ActivateWindow(WINDOW_SCREEN_CALIBRATION);
else if (settingId == "videoscreen.testpattern")
usestagefright->SetValue(false);
}
#endif
+#if defined(TARGET_DARWIN_OSX)
+ else if (settingId == "audiooutput.audiodevice")
+ {
+ CSettingString *audioDevice = (CSettingString*)setting;
+ // Gotham and older didn't enumerate audio devices per stream on osx
+ // add stream0 per default which should be ok for all old settings.
+ if (!StringUtils::EqualsNoCase(audioDevice->GetValue(), "DARWINOSX:default") &&
+ StringUtils::FindWords(audioDevice->GetValue().c_str(), ":stream") == std::string::npos)
+ {
+ std::string newSetting = audioDevice->GetValue();
+ newSetting += ":stream0";
+ return audioDevice->SetValue(newSetting);
+ }
+ }
+#endif
return false;
}
bool CApplication::LoadUserWindows()
{
// Start from wherever home.xml is
- std::vector<CStdString> vecSkinPath;
+ std::vector<std::string> vecSkinPath;
g_SkinInfo->GetSkinPaths(vecSkinPath);
for (unsigned int i = 0;i < vecSkinPath.size();++i)
{
return 0;
if (!m_screenSaver->GetSetting("level").empty())
- return 100.0f - (float)atof(m_screenSaver->GetSetting("level"));
+ return 100.0f - (float)atof(m_screenSaver->GetSetting("level").c_str());
return 100.0f;
}
g_windowManager.Delete(WINDOW_DIALOG_SUBTITLES);
/* Delete PVR related windows and dialogs */
- g_windowManager.Delete(WINDOW_PVR);
+ g_windowManager.Delete(WINDOW_TV_CHANNELS);
+ g_windowManager.Delete(WINDOW_TV_RECORDINGS);
+ g_windowManager.Delete(WINDOW_TV_GUIDE);
+ g_windowManager.Delete(WINDOW_TV_TIMERS);
+ g_windowManager.Delete(WINDOW_TV_SEARCH);
+ g_windowManager.Delete(WINDOW_RADIO_CHANNELS);
+ g_windowManager.Delete(WINDOW_RADIO_RECORDINGS);
+ g_windowManager.Delete(WINDOW_RADIO_GUIDE);
+ g_windowManager.Delete(WINDOW_RADIO_TIMERS);
+ g_windowManager.Delete(WINDOW_RADIO_SEARCH);
g_windowManager.Delete(WINDOW_DIALOG_PVR_GUIDE_INFO);
g_windowManager.Delete(WINDOW_DIALOG_PVR_RECORDING_INFO);
g_windowManager.Delete(WINDOW_DIALOG_PVR_TIMER_SETTING);
// we may not get to finish the run cycle but exit immediately after a call to g_application.Stop()
// so we may never get to Destroy() in CXBApplicationEx::Run(), we call it here.
Destroy();
+ cleanup_emu_environ();
+ CTimeUtils::Close();
//
Sleep(200);
if (item.IsSmartPlayList())
{
CFileItemList items;
- CUtil::GetRecursiveListing(item.GetPath(), items, "");
+ CUtil::GetRecursiveListing(item.GetPath(), items, "", DIR_FLAG_NO_FILE_DIRS);
if (items.Size())
{
CSmartPlaylist smartpl;
//get name and type of smartplaylist, this will always succeed as GetDirectory also did this.
- smartpl.OpenAndReadName(item.GetPath());
+ smartpl.OpenAndReadName(item.GetURL());
CPlayList playlist;
playlist.Add(items);
return ProcessAndStartPlaylist(smartpl.GetName(), playlist, (smartpl.GetType() == "songs" || smartpl.GetType() == "albums") ? PLAYLIST_MUSIC:PLAYLIST_VIDEO);
{
CStackDirectory dir;
CFileItemList movieList;
- dir.GetDirectory(item.GetPath(), movieList);
+ dir.GetDirectory(item.GetURL(), movieList);
// first assume values passed to the stack
int selectedFile = item.m_lStartPartNumber;
// case 2: all other stacks
else
{
+ LoadVideoSettings(item.GetPath());
+
// see if we have the info in the database
// TODO: If user changes the time speed (FPS via framerate conversion stuff)
// then these times will be wrong.
CVideoDatabase dbs;
if (dbs.Open())
{
- dbs.GetVideoSettings(item.GetPath(), CMediaSettings::Get().GetCurrentVideoSettings());
haveTimes = dbs.GetStackTimes(item.GetPath(), times);
dbs.Close();
}
// calculate the total time of the stack
CStackDirectory dir;
- dir.GetDirectory(item.GetPath(), *m_currentStack);
+ dir.GetDirectory(item.GetURL(), *m_currentStack);
long totalTime = 0;
for (int i = 0; i < m_currentStack->Size(); i++)
{
if (!bRestart)
{
- SaveCurrentFileSettings();
+ SaveFileState(true);
OutputDebugString("new file set audiostream:0\n");
// Switch to default options
if (URIUtils::IsUPnP(item.GetPath()))
{
CFileItem item_new(item);
- if (XFILE::CUPnPDirectory::GetResource(item.GetPath(), item_new))
+ if (XFILE::CUPnPDirectory::GetResource(item.GetURL(), item_new))
return PlayFile(item_new, false);
return PLAYBACK_FAIL;
}
else
{
options.starttime = item.m_lStartOffset / 75.0;
+ LoadVideoSettings(item.GetPath());
if (item.IsVideo())
{
// open the d/b and retrieve the bookmarks for the current movie
CVideoDatabase dbs;
dbs.Open();
- dbs.GetVideoSettings(item.GetPath(), CMediaSettings::Get().GetCurrentVideoSettings());
if( item.m_lStartOffset == STARTOFFSET_RESUME )
{
void CApplication::SaveFileState(bool bForeground /* = false */)
{
- if (m_progressTrackingItem->IsPVRChannel() || !CProfilesManager::Get().GetCurrentProfile().canWriteDatabases())
+ if (!CProfilesManager::Get().GetCurrentProfile().canWriteDatabases())
return;
+ CJob* job = new CSaveFileStateJob(*m_progressTrackingItem,
+ *m_stackFileItemToUpdate,
+ m_progressTrackingVideoResumeBookmark,
+ m_progressTrackingPlayCountUpdate,
+ CMediaSettings::Get().GetCurrentVideoSettings());
+
if (bForeground)
{
- CSaveFileStateJob job(*m_progressTrackingItem,
- *m_stackFileItemToUpdate,
- m_progressTrackingVideoResumeBookmark,
- m_progressTrackingPlayCountUpdate);
-
// Run job in the foreground to make sure it finishes
- job.DoWork();
+ job->DoWork();
+ delete job;
}
else
- {
- CJob* job = new CSaveFileStateJob(*m_progressTrackingItem,
- *m_stackFileItemToUpdate,
- m_progressTrackingVideoResumeBookmark,
- m_progressTrackingPlayCountUpdate);
CJobManager::GetInstance().AddJob(job, NULL, CJob::PRIORITY_NORMAL);
- }
}
void CApplication::UpdateFileState()
// Did the file change?
if (m_progressTrackingItem->GetPath() != "" && m_progressTrackingItem->GetPath() != CurrentFile())
{
- SaveFileState();
+ // Ignore for PVR channels, PerformChannelSwitch takes care of this
+ if (!m_progressTrackingItem->IsPVRChannel())
+ SaveFileState();
// Reset tracking item
m_progressTrackingItem->Reset();
}
}
+void CApplication::LoadVideoSettings(const std::string &path)
+{
+ CVideoDatabase dbs;
+ if (dbs.Open())
+ {
+ CLog::Log(LOGDEBUG, "Loading settings for %s", path.c_str());
+
+ // Load stored settings if they exist, otherwise use default
+ if (!dbs.GetVideoSettings(path, CMediaSettings::Get().GetCurrentVideoSettings()))
+ CMediaSettings::Get().GetCurrentVideoSettings() = CMediaSettings::Get().GetDefaultVideoSettings();
+
+ dbs.Close();
+ }
+}
+
void CApplication::StopPlaying()
{
int iWin = g_windowManager.GetActiveWindow();
m_pKaraokeMgr->Stop();
#endif
- if (g_PVRManager.IsPlayingTV() || g_PVRManager.IsPlayingRadio())
- g_PVRManager.SaveCurrentChannelSettings();
-
m_pPlayer->CloseFile();
// turn off visualisation window when stopping
CFileItem file(*playlist[iNext]);
// handle plugin://
CURL url(file.GetPath());
- if (url.GetProtocol() == "plugin")
+ if (url.IsProtocol("plugin"))
XFILE::CPluginDirectory::GetPluginResult(url.Get(), file);
#ifdef HAS_UPNP
if (URIUtils::IsUPnP(file.GetPath()))
{
- if (!XFILE::CUPnPDirectory::GetResource(file.GetPath(), file))
+ if (!XFILE::CUPnPDirectory::GetResource(file.GetURL(), file))
return true;
}
#endif
//We don't know if there is unsecure information in this yet, so we
//postpone any logging
const std::string in_actionStr(actionStr);
- CGUIInfoLabel info(actionStr, "");
- actionStr = info.GetLabel(0);
+ actionStr = CGUIInfoLabel::GetLabel(actionStr);
// user has asked for something to be executed
if (CBuiltins::HasCommand(actionStr))
m_pPlayer->SetPlayerState(state);
}
-const CStdString& CApplication::CurrentFile()
+const std::string& CApplication::CurrentFile()
{
return m_itemCurrentFile->GetPath();
}
return false;
}
-void CApplication::SaveCurrentFileSettings()
-{
- // don't store settings for PVR in video database
- if (m_itemCurrentFile->IsVideo() && !m_itemCurrentFile->IsPVRChannel())
- {
- // save video settings
- if (CMediaSettings::Get().GetCurrentVideoSettings() != CMediaSettings::Get().GetDefaultVideoSettings())
- {
- CVideoDatabase dbs;
- dbs.Open();
- dbs.SetVideoSettings(m_itemCurrentFile->GetPath(), CMediaSettings::Get().GetCurrentVideoSettings());
- dbs.Close();
- }
- }
- else if (m_itemCurrentFile->IsPVRChannel())
- {
- g_PVRManager.SaveCurrentChannelSettings();
- }
-}
-
bool CApplication::AlwaysProcess(const CAction& action)
{
// check if this button is mapped to a built-in function
if (!action.GetName().empty())
{
CStdString builtInFunction;
- vector<CStdString> params;
+ vector<string> params;
CUtil::SplitExecFunction(action.GetName(), builtInFunction, params);
StringUtils::ToLower(builtInFunction);