本文整理汇总了C++中CGUIWindowSlideShow::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIWindowSlideShow::Add方法的具体用法?C++ CGUIWindowSlideShow::Add怎么用?C++ CGUIWindowSlideShow::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIWindowSlideShow
的用法示例。
在下文中一共展示了CGUIWindowSlideShow::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnStart
//! @todo 2.0: Can this be removed, or should we run without the "special" file directories while
// in filemanager view.
void CGUIWindowFileManager::OnStart(CFileItem *pItem, const std::string &player)
{
// start playlists from file manager
if (pItem->IsPlayList())
{
std::string strPlayList = pItem->GetPath();
std::unique_ptr<CPlayList> pPlayList (CPlayListFactory::Create(strPlayList));
if (NULL != pPlayList.get())
{
if (!pPlayList->Load(strPlayList))
{
HELPERS::ShowOKDialogText(CVariant{6}, CVariant{477});
return;
}
}
g_application.ProcessAndStartPlaylist(strPlayList, *pPlayList, PLAYLIST_MUSIC);
return;
}
if (pItem->IsAudio() || pItem->IsVideo())
{
CServiceBroker::GetPlaylistPlayer().Play(std::make_shared<CFileItem>(*pItem), player);
return;
}
if (pItem->IsGame())
{
g_application.PlayFile(*pItem, player);
return ;
}
#ifdef HAS_PYTHON
if (pItem->IsPythonScript())
{
CScriptInvocationManager::GetInstance().ExecuteAsync(pItem->GetPath());
return ;
}
#endif
if (pItem->IsPicture())
{
CGUIWindowSlideShow *pSlideShow = g_windowManager.GetWindow<CGUIWindowSlideShow>(WINDOW_SLIDESHOW);
if (!pSlideShow)
return ;
if (g_application.m_pPlayer->IsPlayingVideo())
g_application.StopPlaying();
pSlideShow->Reset();
pSlideShow->Add(pItem);
pSlideShow->Select(pItem->GetPath());
g_windowManager.ActivateWindow(WINDOW_SLIDESHOW);
return;
}
if (pItem->IsType(".txt") || pItem->IsType(".xml"))
CGUIDialogTextViewer::ShowForFile(pItem->GetPath(), true);
}
示例2: ShowPicture
bool CGUIWindowPictures::ShowPicture(int iItem, bool startSlideShow)
{
if ( iItem < 0 || iItem >= (int)m_vecItems->Size() ) return false;
CFileItemPtr pItem = m_vecItems->Get(iItem);
CStdString strPicture = pItem->GetPath();
#ifdef HAS_DVD_DRIVE
if (pItem->IsDVD())
return MEDIA_DETECT::CAutorun::PlayDiscAskResume(m_vecItems->Get(iItem)->GetPath());
#endif
if (pItem->m_bIsShareOrDrive)
return false;
CGUIWindowSlideShow *pSlideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (!pSlideShow)
return false;
if (g_application.m_pPlayer->IsPlayingVideo())
g_application.StopPlaying();
pSlideShow->Reset();
for (int i = 0; i < (int)m_vecItems->Size();++i)
{
CFileItemPtr pItem = m_vecItems->Get(i);
if (!pItem->m_bIsFolder && !(URIUtils::IsRAR(pItem->GetPath()) ||
URIUtils::IsZIP(pItem->GetPath())) && (pItem->IsPicture() || (
CSettings::Get().GetBool("pictures.showvideos") &&
pItem->IsVideo())))
{
pSlideShow->Add(pItem.get());
}
}
if (pSlideShow->NumSlides() == 0)
return false;
pSlideShow->Select(strPicture);
if (startSlideShow)
pSlideShow->StartSlideShow();
else
{
CVariant param;
param["player"]["speed"] = 1;
param["player"]["playerid"] = PLAYLIST_PICTURE;
ANNOUNCEMENT::CAnnouncementManager::Get().Announce(ANNOUNCEMENT::Player, "xbmc", "OnPlay", pSlideShow->GetCurrentSlide(), param);
}
m_slideShowStarted = true;
g_windowManager.ActivateWindow(WINDOW_SLIDESHOW);
return true;
}
示例3: Add
JSONRPC_STATUS CPlaylistOperations::Add(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
int playlist = GetPlaylist(parameterObject["playlistid"]);
CFileItemList list;
CVariant params = parameterObject;
if (!CheckMediaParameter(playlist, parameterObject))
return InvalidParams;
CGUIWindowSlideShow *slideshow = NULL;
switch (playlist)
{
case PLAYLIST_VIDEO:
case PLAYLIST_MUSIC:
if (playlist == PLAYLIST_VIDEO)
params["item"]["media"] = "video";
else if (playlist == PLAYLIST_MUSIC)
params["item"]["media"] = "music";
if (!FillFileItemList(params["item"], list))
return InvalidParams;
CApplicationMessenger::Get().PlayListPlayerAdd(playlist, list);
break;
case PLAYLIST_PICTURE:
slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (!slideshow)
return FailedToExecute;
if (!parameterObject["item"].isMember("media"))
params["item"]["media"] = "pictures";
if (!FillFileItemList(params["item"], list))
return InvalidParams;
for (int index = 0; index < list.Size(); index++)
{
CPictureInfoTag picture = CPictureInfoTag();
if (!picture.Load(list[index]->GetPath()))
continue;
*list[index]->GetPictureInfoTag() = picture;
slideshow->Add(list[index].get());
}
break;
}
NotifyAll();
return ACK;
}
示例4: ShowPicture
bool CGUIWindowPictures::ShowPicture(int iItem, bool startSlideShow)
{
if ( iItem < 0 || iItem >= (int)m_vecItems->Size() ) return false;
CFileItemPtr pItem = m_vecItems->Get(iItem);
CStdString strPicture = pItem->GetPath();
#ifdef HAS_DVD_DRIVE
if (pItem->IsDVD())
return MEDIA_DETECT::CAutorun::PlayDiscAskResume(m_vecItems->Get(iItem)->GetPath());
#endif
if (pItem->m_bIsShareOrDrive)
return false;
CGUIWindowSlideShow *pSlideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (!pSlideShow)
return false;
if (g_application.IsPlayingVideo())
g_application.StopPlaying();
pSlideShow->Reset();
for (int i = 0; i < (int)m_vecItems->Size();++i)
{
CFileItemPtr pItem = m_vecItems->Get(i);
if (!pItem->m_bIsFolder && !(URIUtils::IsRAR(pItem->GetPath()) ||
URIUtils::IsZIP(pItem->GetPath())) && (pItem->IsPicture() || (
g_guiSettings.GetBool("pictures.showvideos") &&
pItem->IsVideo())))
{
pSlideShow->Add(pItem.get());
}
}
if (pSlideShow->NumSlides() == 0)
return false;
pSlideShow->Select(strPicture);
if (startSlideShow)
pSlideShow->StartSlideShow(false);
m_slideShowStarted = true;
g_windowManager.ActivateWindow(WINDOW_SLIDESHOW);
return true;
}
示例5: Add
JSONRPC_STATUS CPlaylistOperations::Add(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
int playlist = GetPlaylist(parameterObject["playlistid"]);
CGUIWindowSlideShow *slideshow = NULL;
if (playlist == PLAYLIST_PICTURE)
{
slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (slideshow == NULL)
return FailedToExecute;
}
CFileItemList list;
if (!HandleItemsParameter(playlist, parameterObject["item"], list))
return InvalidParams;
switch (playlist)
{
case PLAYLIST_VIDEO:
case PLAYLIST_MUSIC:
{
auto tmpList = new CFileItemList();
tmpList->Copy(list);
CApplicationMessenger::GetInstance().SendMsg(TMSG_PLAYLISTPLAYER_ADD, playlist, -1, static_cast<void*>(tmpList));
break;
}
case PLAYLIST_PICTURE:
for (int index = 0; index < list.Size(); index++)
{
CPictureInfoTag picture = CPictureInfoTag();
if (!picture.Load(list[index]->GetPath()))
continue;
*list[index]->GetPictureInfoTag() = picture;
slideshow->Add(list[index].get());
}
break;
default:
return InvalidParams;
}
NotifyAll();
return ACK;
}
示例6: OnStart
// TODO 2.0: Can this be removed, or should we run without the "special" file directories while
// in filemanager view.
void CGUIWindowFileManager::OnStart(CFileItem *pItem)
{
// start playlists from file manager
if (pItem->IsPlayList())
{
std::string strPlayList = pItem->GetPath();
std::unique_ptr<CPlayList> pPlayList (CPlayListFactory::Create(strPlayList));
if (NULL != pPlayList.get())
{
if (!pPlayList->Load(strPlayList))
{
CGUIDialogOK::ShowAndGetInput(CVariant{6}, CVariant{477});
return;
}
}
g_application.ProcessAndStartPlaylist(strPlayList, *pPlayList, PLAYLIST_MUSIC);
return;
}
if (pItem->IsAudio() || pItem->IsVideo())
{
g_application.PlayFile(*pItem);
return ;
}
#ifdef HAS_PYTHON
if (pItem->IsPythonScript())
{
CScriptInvocationManager::Get().ExecuteAsync(pItem->GetPath());
return ;
}
#endif
if (pItem->IsPicture())
{
CGUIWindowSlideShow *pSlideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (!pSlideShow)
return ;
if (g_application.m_pPlayer->IsPlayingVideo())
g_application.StopPlaying();
pSlideShow->Reset();
pSlideShow->Add(pItem);
pSlideShow->Select(pItem->GetPath());
g_windowManager.ActivateWindow(WINDOW_SLIDESHOW);
}
}
示例7: LoadPlayList
void CGUIWindowPictures::LoadPlayList(const CStdString& strPlayList)
{
CLog::Log(LOGDEBUG,"CGUIWindowPictures::LoadPlayList()... converting playlist into slideshow: %s", strPlayList.c_str());
auto_ptr<CPlayList> pPlayList (CPlayListFactory::Create(strPlayList));
if ( NULL != pPlayList.get())
{
if (!pPlayList->Load(strPlayList))
{
CGUIDialogOK::ShowAndGetInput(6, 0, 477, 0);
return ; //hmmm unable to load playlist?
}
}
CPlayList playlist = *pPlayList;
if (playlist.size() > 0)
{
// set up slideshow
CGUIWindowSlideShow *pSlideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (!pSlideShow)
return;
if (g_application.m_pPlayer->IsPlayingVideo())
g_application.StopPlaying();
// convert playlist items into slideshow items
pSlideShow->Reset();
for (int i = 0; i < (int)playlist.size(); ++i)
{
CFileItemPtr pItem = playlist[i];
//CLog::Log(LOGDEBUG,"-- playlist item: %s", pItem->GetPath().c_str());
if (pItem->IsPicture() && !(pItem->IsZIP() || pItem->IsRAR() || pItem->IsCBZ() || pItem->IsCBR()))
pSlideShow->Add(pItem.get());
}
// start slideshow if there are items
pSlideShow->StartSlideShow();
if (pSlideShow->NumSlides())
g_windowManager.ActivateWindow(WINDOW_SLIDESHOW);
}
}
示例8: LoadPlayList
void CGUIWindowPictures::LoadPlayList(const std::string& strPlayList)
{
CLog::Log(LOGDEBUG,"CGUIWindowPictures::LoadPlayList()... converting playlist into slideshow: %s", strPlayList.c_str());
std::unique_ptr<CPlayList> pPlayList (CPlayListFactory::Create(strPlayList));
if ( NULL != pPlayList.get())
{
if (!pPlayList->Load(strPlayList))
{
HELPERS::ShowOKDialogText(CVariant{6}, CVariant{477});
return ; //hmmm unable to load playlist?
}
}
CPlayList playlist = *pPlayList;
if (playlist.size() > 0)
{
// set up slideshow
CGUIWindowSlideShow *pSlideShow = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIWindowSlideShow>(WINDOW_SLIDESHOW);
if (!pSlideShow)
return;
if (g_application.GetAppPlayer().IsPlayingVideo())
g_application.StopPlaying();
// convert playlist items into slideshow items
pSlideShow->Reset();
for (int i = 0; i < (int)playlist.size(); ++i)
{
CFileItemPtr pItem = playlist[i];
//CLog::Log(LOGDEBUG,"-- playlist item: %s", pItem->GetPath().c_str());
if (pItem->IsPicture() && !(pItem->IsZIP() || pItem->IsRAR() || pItem->IsCBZ() || pItem->IsCBR()))
pSlideShow->Add(pItem.get());
}
// start slideshow if there are items
pSlideShow->StartSlideShow();
if (pSlideShow->NumSlides())
CServiceBroker::GetGUI()->GetWindowManager().ActivateWindow(WINDOW_SLIDESHOW);
}
}
示例9: ProcessMessage
//.........这里部分代码省略.........
//g_application.StopPlaying();
// play file
if(pMsg->lpVoid)
{
CFileItemList *list = (CFileItemList *)pMsg->lpVoid;
if (list->Size() > 0)
{
int playlist = PLAYLIST_MUSIC;
for (int i = 0; i < list->Size(); i++)
{
if ((*list)[i]->IsVideo())
{
playlist = PLAYLIST_VIDEO;
break;
}
}
g_playlistPlayer.ClearPlaylist(playlist);
g_playlistPlayer.SetCurrentPlaylist(playlist);
//For single item lists try PlayMedia. This covers some more cases where a playlist is not appropriate
//It will fall through to PlayFile
if (list->Size() == 1 && !(*list)[0]->IsPlayList())
g_application.PlayMedia(*((*list)[0]), playlist);
else
{
// Handle "shuffled" option if present
if (list->HasProperty("shuffled") && list->GetProperty("shuffled").isBoolean())
g_playlistPlayer.SetShuffle(playlist, list->GetProperty("shuffled").asBoolean(), false);
// Handle "repeat" option if present
if (list->HasProperty("repeat") && list->GetProperty("repeat").isInteger())
g_playlistPlayer.SetRepeat(playlist, (PLAYLIST::REPEAT_STATE)list->GetProperty("repeat").asInteger(), false);
g_playlistPlayer.Add(playlist, (*list));
g_playlistPlayer.Play(pMsg->param1);
}
}
delete list;
}
else if (pMsg->param1 == PLAYLIST_MUSIC || pMsg->param1 == PLAYLIST_VIDEO)
{
if (g_playlistPlayer.GetCurrentPlaylist() != pMsg->param1)
g_playlistPlayer.SetCurrentPlaylist(pMsg->param1);
PlayListPlayerPlay(pMsg->param2);
}
}
break;
case TMSG_MEDIA_RESTART:
g_application.Restart(true);
break;
case TMSG_PICTURE_SHOW:
{
CGUIWindowSlideShow *pSlideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (!pSlideShow) return ;
// stop playing file
if (g_application.m_pPlayer->IsPlayingVideo()) g_application.StopPlaying();
if (g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO)
g_windowManager.PreviousWindow();
g_application.ResetScreenSaver();
示例10: ProcessMessage
//.........这里部分代码省略.........
case TMSG_PICTURE_SHOW:
{
CGUIWindowSlideShow *pSlideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (!pSlideShow) return ;
// stop playing file
if (g_application.IsPlayingVideo()) g_application.StopPlaying();
if (g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO)
g_windowManager.PreviousWindow();
g_application.ResetScreenSaver();
g_application.WakeUpScreenSaverAndDPMS();
g_graphicsContext.Lock();
pSlideShow->Reset();
if (g_windowManager.GetActiveWindow() != WINDOW_SLIDESHOW)
g_windowManager.ActivateWindow(WINDOW_SLIDESHOW);
if (CUtil::IsZIP(pMsg->strParam) || CUtil::IsRAR(pMsg->strParam)) // actually a cbz/cbr
{
CFileItemList items;
CStdString strPath;
if (CUtil::IsZIP(pMsg->strParam))
CUtil::CreateArchivePath(strPath, "zip", pMsg->strParam.c_str(), "");
else
CUtil::CreateArchivePath(strPath, "rar", pMsg->strParam.c_str(), "");
CUtil::GetRecursiveListing(strPath, items, g_stSettings.m_pictureExtensions);
if (items.Size() > 0)
{
for (int i=0;i<items.Size();++i)
{
pSlideShow->Add(items[i].get());
}
pSlideShow->Select(items[0]->m_strPath);
}
}
else
{
CFileItem item(pMsg->strParam, false);
pSlideShow->Add(&item);
pSlideShow->Select(pMsg->strParam);
}
g_graphicsContext.Unlock();
}
break;
case TMSG_SLIDESHOW_SCREENSAVER:
case TMSG_PICTURE_SLIDESHOW:
{
CGUIWindowSlideShow *pSlideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (!pSlideShow) return ;
g_graphicsContext.Lock();
pSlideShow->Reset();
CFileItemList items;
CStdString strPath = pMsg->strParam;
if (pMsg->dwMessage == TMSG_SLIDESHOW_SCREENSAVER &&
g_guiSettings.GetString("screensaver.mode").Equals("Fanart Slideshow"))
{
CUtil::GetRecursiveListing(g_settings.GetVideoFanartFolder(), items, ".tbn");
CUtil::GetRecursiveListing(g_settings.GetMusicFanartFolder(), items, ".tbn");
}
else
示例11: Open
JSONRPC_STATUS CPlayerOperations::Open(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
CVariant optionShuffled = parameterObject["options"]["shuffled"];
CVariant optionRepeat = parameterObject["options"]["repeat"];
CVariant optionResume = parameterObject["options"]["resume"];
if (parameterObject["item"].isObject() && parameterObject["item"].isMember("playlistid"))
{
int playlistid = (int)parameterObject["item"]["playlistid"].asInteger();
if (playlistid < PLAYLIST_PICTURE)
{
// Apply the "shuffled" option if available
if (optionShuffled.isBoolean())
g_playlistPlayer.SetShuffle(playlistid, optionShuffled.asBoolean(), false);
// Apply the "repeat" option if available
if (!optionRepeat.isNull())
g_playlistPlayer.SetRepeat(playlistid, (REPEAT_STATE)ParseRepeatState(optionRepeat), false);
}
switch (playlistid)
{
case PLAYLIST_MUSIC:
case PLAYLIST_VIDEO:
CApplicationMessenger::Get().MediaPlay(playlistid, (int)parameterObject["item"]["position"].asInteger());
OnPlaylistChanged();
break;
case PLAYLIST_PICTURE:
return StartSlideshow("", false, optionShuffled.isBoolean() && optionShuffled.asBoolean());
break;
}
return ACK;
}
else if (parameterObject["item"].isObject() && parameterObject["item"].isMember("path"))
{
bool random = (optionShuffled.isBoolean() && optionShuffled.asBoolean()) ||
(!optionShuffled.isBoolean() && parameterObject["item"]["random"].asBoolean());
return StartSlideshow(parameterObject["item"]["path"].asString(), parameterObject["item"]["recursive"].asBoolean(), random);
}
else if (parameterObject["item"].isObject() && parameterObject["item"].isMember("partymode"))
{
if (g_partyModeManager.IsEnabled())
g_partyModeManager.Disable();
CApplicationMessenger::Get().ExecBuiltIn("playercontrol(partymode(" + parameterObject["item"]["partymode"].asString() + "))");
return ACK;
}
else if (parameterObject["item"].isObject() && parameterObject["item"].isMember("channelid"))
{
if (!g_PVRManager.IsStarted())
return FailedToExecute;
CPVRChannelGroupsContainer *channelGroupContainer = g_PVRChannelGroups;
if (channelGroupContainer == NULL)
return FailedToExecute;
CPVRChannelPtr channel = channelGroupContainer->GetChannelById((int)parameterObject["item"]["channelid"].asInteger());
if (channel == NULL)
return InvalidParams;
CApplicationMessenger::Get().MediaPlay(CFileItem(*channel.get()));
return ACK;
}
else
{
CFileItemList list;
if (FillFileItemList(parameterObject["item"], list) && list.Size() > 0)
{
bool slideshow = true;
for (int index = 0; index < list.Size(); index++)
{
if (!list[index]->IsPicture())
{
slideshow = false;
break;
}
}
if (slideshow)
{
CGUIWindowSlideShow *slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (!slideshow)
return FailedToExecute;
SendSlideshowAction(ACTION_STOP);
slideshow->Reset();
for (int index = 0; index < list.Size(); index++)
slideshow->Add(list[index].get());
return StartSlideshow("", false, optionShuffled.isBoolean() && optionShuffled.asBoolean());
}
else
{
// Handle "shuffled" option
if (optionShuffled.isBoolean())
list.SetProperty("shuffled", optionShuffled);
// Handle "repeat" option
if (!optionRepeat.isNull())
list.SetProperty("repeat", ParseRepeatState(optionRepeat));
//.........这里部分代码省略.........
示例12: ProcessMessage
//.........这里部分代码省略.........
g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO ||
g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION)
g_windowManager.PreviousWindow();
g_application.ResetScreenSaver();
g_application.WakeUpScreenSaverAndDPMS();
//g_application.StopPlaying();
// play file
if(pMsg->lpVoid)
{
CFileItemList *list = (CFileItemList *)pMsg->lpVoid;
if (list->Size() > 0)
{
int playlist = PLAYLIST_MUSIC;
for (int i = 0; i < list->Size(); i++)
{
if ((*list)[i]->IsVideo())
{
playlist = PLAYLIST_VIDEO;
break;
}
}
g_playlistPlayer.ClearPlaylist(playlist);
g_playlistPlayer.SetCurrentPlaylist(playlist);
//For single item lists try PlayMedia. This covers some more cases where a playlist is not appropriate
//It will fall through to PlayFile
if (list->Size() == 1 && !(*list)[0]->IsPlayList())
g_application.PlayMedia(*((*list)[0]), playlist);
else
{
g_playlistPlayer.Add(playlist, (*list));
g_playlistPlayer.Play(pMsg->dwParam1);
}
}
delete list;
}
else if (pMsg->dwParam1 == PLAYLIST_MUSIC || pMsg->dwParam1 == PLAYLIST_VIDEO)
{
if (g_playlistPlayer.GetCurrentPlaylist() != (int)pMsg->dwParam1)
g_playlistPlayer.SetCurrentPlaylist(pMsg->dwParam1);
PlayListPlayerPlay(pMsg->dwParam2);
}
}
break;
case TMSG_MEDIA_RESTART:
g_application.Restart(true);
break;
case TMSG_PICTURE_SHOW:
{
CGUIWindowSlideShow *pSlideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (!pSlideShow) return ;
// stop playing file
if (g_application.IsPlayingVideo()) g_application.StopPlaying();
if (g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO)
g_windowManager.PreviousWindow();
g_application.ResetScreenSaver();
示例13: Open
JSONRPC_STATUS CPlayerOperations::Open(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
CVariant options = parameterObject["options"];
CVariant optionShuffled = options["shuffled"];
CVariant optionRepeat = options["repeat"];
CVariant optionResume = options["resume"];
CVariant optionPlayer = options["playername"];
if (parameterObject["item"].isObject() && parameterObject["item"].isMember("playlistid"))
{
int playlistid = (int)parameterObject["item"]["playlistid"].asInteger();
if (playlistid < PLAYLIST_PICTURE)
{
// Apply the "shuffled" option if available
if (optionShuffled.isBoolean())
g_playlistPlayer.SetShuffle(playlistid, optionShuffled.asBoolean(), false);
// Apply the "repeat" option if available
if (!optionRepeat.isNull())
g_playlistPlayer.SetRepeat(playlistid, (REPEAT_STATE)ParseRepeatState(optionRepeat), false);
}
int playlistStartPosition = (int)parameterObject["item"]["position"].asInteger();
switch (playlistid)
{
case PLAYLIST_MUSIC:
case PLAYLIST_VIDEO:
CApplicationMessenger::GetInstance().SendMsg(TMSG_MEDIA_PLAY, playlistid, playlistStartPosition);
OnPlaylistChanged();
break;
case PLAYLIST_PICTURE:
{
std::string firstPicturePath;
if (playlistStartPosition > 0)
{
CGUIWindowSlideShow *slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (slideshow != NULL)
{
CFileItemList list;
slideshow->GetSlideShowContents(list);
if (playlistStartPosition < list.Size())
firstPicturePath = list.Get(playlistStartPosition)->GetPath();
}
}
return StartSlideshow("", false, optionShuffled.isBoolean() && optionShuffled.asBoolean(), firstPicturePath);
break;
}
}
return ACK;
}
else if (parameterObject["item"].isObject() && parameterObject["item"].isMember("path"))
{
bool random = (optionShuffled.isBoolean() && optionShuffled.asBoolean()) ||
(!optionShuffled.isBoolean() && parameterObject["item"]["random"].asBoolean());
return StartSlideshow(parameterObject["item"]["path"].asString(), parameterObject["item"]["recursive"].asBoolean(), random);
}
else if (parameterObject["item"].isObject() && parameterObject["item"].isMember("partymode"))
{
if (g_partyModeManager.IsEnabled())
g_partyModeManager.Disable();
CApplicationMessenger::GetInstance().SendMsg(TMSG_EXECUTE_BUILT_IN, -1, -1, nullptr, "playercontrol(partymode(" + parameterObject["item"]["partymode"].asString() + "))");
return ACK;
}
else if (parameterObject["item"].isObject() && parameterObject["item"].isMember("channelid"))
{
if (!g_PVRManager.IsStarted())
return FailedToExecute;
CPVRChannelGroupsContainer *channelGroupContainer = g_PVRChannelGroups;
if (channelGroupContainer == NULL)
return FailedToExecute;
CPVRChannelPtr channel = channelGroupContainer->GetChannelById((int)parameterObject["item"]["channelid"].asInteger());
if (channel == NULL)
return InvalidParams;
if ((g_PVRManager.IsPlayingRadio() && channel->IsRadio()) ||
(g_PVRManager.IsPlayingTV() && !channel->IsRadio()))
g_application.m_pPlayer->SwitchChannel(channel);
else
{
CFileItemList *l = new CFileItemList; //don't delete,
l->Add(std::make_shared<CFileItem>(channel));
CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, -1, -1, static_cast<void*>(l));
}
return ACK;
}
else if (parameterObject["item"].isObject() && parameterObject["item"].isMember("recordingid"))
{
if (!g_PVRManager.IsStarted())
return FailedToExecute;
CPVRRecordings *recordingsContainer = g_PVRRecordings;
if (recordingsContainer == NULL)
return FailedToExecute;
//.........这里部分代码省略.........
示例14: Open
JSON_STATUS CPlayerOperations::Open(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
if (parameterObject["item"].isObject() && parameterObject["item"].isMember("playlistid"))
{
int playlistid = (int)parameterObject["item"]["playlistid"].asInteger();
switch (playlistid)
{
case PLAYLIST_MUSIC:
case PLAYLIST_VIDEO:
if (g_playlistPlayer.GetCurrentPlaylist() != playlistid)
g_playlistPlayer.SetCurrentPlaylist(playlistid);
g_application.getApplicationMessenger().PlayListPlayerPlay((int)parameterObject["item"]["position"].asInteger());
OnPlaylistChanged();
break;
case PLAYLIST_PICTURE:
return StartSlideshow();
break;
}
return ACK;
}
else if (parameterObject["item"].isObject() && parameterObject["item"].isMember("path"))
{
CStdString exec = "slideShow(";
exec += parameterObject["item"]["path"].asString();
if (parameterObject["item"]["random"].asBoolean())
exec += ", random";
else
exec += ", notrandom";
if (parameterObject["item"]["recursive"].asBoolean())
exec += ", recursive";
exec += ")";
ThreadMessage msg = { TMSG_EXECUTE_BUILT_IN, (DWORD)0, (DWORD)0, exec };
g_application.getApplicationMessenger().SendMessage(msg);
return ACK;
}
else
{
CFileItemList list;
if (FillFileItemList(parameterObject["item"], list) && list.Size() > 0)
{
bool slideshow = true;
for (int index = 0; index < list.Size(); index++)
{
if (!list[index]->HasPictureInfoTag())
{
slideshow = false;
break;
}
}
if (slideshow)
{
CGUIWindowSlideShow *slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (!slideshow)
return FailedToExecute;
SendSlideshowAction(ACTION_STOP);
slideshow->Reset();
for (int index = 0; index < list.Size(); index++)
slideshow->Add(list[index].get());
return StartSlideshow();
}
else
g_application.getApplicationMessenger().MediaPlay(list);
return ACK;
}
else
return InvalidParams;
}
return InvalidParams;
}
示例15: Open
JSONRPC_STATUS CPlayerOperations::Open(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
CVariant optionShuffled = parameterObject["options"]["shuffled"];
CVariant optionRepeat = parameterObject["options"]["repeat"];
CVariant optionResume = parameterObject["options"]["resume"];
if (parameterObject["item"].isObject() && parameterObject["item"].isMember("playlistid"))
{
int playlistid = (int)parameterObject["item"]["playlistid"].asInteger();
if (playlistid < PLAYLIST_PICTURE)
{
// Apply the "shuffled" option if available
if (optionShuffled.isBoolean())
g_playlistPlayer.SetShuffle(playlistid, optionShuffled.asBoolean(), false);
// Apply the "repeat" option if available
if (!optionRepeat.isNull())
g_playlistPlayer.SetRepeat(playlistid, (REPEAT_STATE)ParseRepeatState(optionRepeat), false);
}
switch (playlistid)
{
case PLAYLIST_MUSIC:
case PLAYLIST_VIDEO:
g_application.getApplicationMessenger().MediaPlay(playlistid, (int)parameterObject["item"]["position"].asInteger());
OnPlaylistChanged();
break;
case PLAYLIST_PICTURE:
return StartSlideshow();
break;
}
return ACK;
}
else if (parameterObject["item"].isObject() && parameterObject["item"].isMember("path"))
{
CStdString exec = "slideShow(";
exec += parameterObject["item"]["path"].asString();
if ((optionShuffled.isBoolean() && optionShuffled.asBoolean()) ||
(!optionShuffled.isBoolean() && parameterObject["item"]["random"].asBoolean()))
exec += ", random";
else
exec += ", notrandom";
if (parameterObject["item"]["recursive"].asBoolean())
exec += ", recursive";
exec += ")";
ThreadMessage msg = { TMSG_EXECUTE_BUILT_IN, (DWORD)0, (DWORD)0, exec };
g_application.getApplicationMessenger().SendMessage(msg);
return ACK;
}
else
{
CFileItemList list;
if (FillFileItemList(parameterObject["item"], list) && list.Size() > 0)
{
bool slideshow = true;
for (int index = 0; index < list.Size(); index++)
{
if (!list[index]->IsPicture())
{
slideshow = false;
break;
}
}
if (slideshow)
{
CGUIWindowSlideShow *slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (!slideshow)
return FailedToExecute;
SendSlideshowAction(ACTION_STOP);
slideshow->Reset();
for (int index = 0; index < list.Size(); index++)
slideshow->Add(list[index].get());
if (optionShuffled.isBoolean() && optionShuffled.asBoolean())
slideshow->Shuffle();
return StartSlideshow();
}
else
{
// Handle "shuffled" option
if (optionShuffled.isBoolean())
list.SetProperty("shuffled", optionShuffled);
// Handle "repeat" option
if (!optionRepeat.isNull())
list.SetProperty("repeat", ParseRepeatState(optionRepeat));
// Handle "resume" option
if (list.Size() == 1)
{
if (optionResume.isBoolean() && optionResume.asBoolean())
list[0]->m_lStartOffset = STARTOFFSET_RESUME;
//.........这里部分代码省略.........