本文整理汇总了C++中CFileItemPtr::HasPVRChannelInfoTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemPtr::HasPVRChannelInfoTag方法的具体用法?C++ CFileItemPtr::HasPVRChannelInfoTag怎么用?C++ CFileItemPtr::HasPVRChannelInfoTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemPtr
的用法示例。
在下文中一共展示了CFileItemPtr::HasPVRChannelInfoTag方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StartPlayback
bool CPVRManager::StartPlayback(PlaybackType type /* = PlaybackTypeAny */)
{
bool bIsRadio(false);
bool bReturn(false);
bool bIsPlaying(false);
CFileItemPtr channel;
// check if the desired PlaybackType is already playing,
// and if not, try to grab the last played channel of this type
switch (type)
{
case PlaybackTypeRadio:
if (IsPlayingRadio())
bIsPlaying = true;
else
channel = m_channelGroups->GetGroupAllRadio()->GetLastPlayedChannel();
bIsRadio = true;
break;
case PlaybackTypeTv:
if (IsPlayingTV())
bIsPlaying = true;
else
channel = m_channelGroups->GetGroupAllTV()->GetLastPlayedChannel();
break;
default:
if (IsPlaying())
bIsPlaying = true;
else
channel = m_channelGroups->GetLastPlayedChannel();
}
// we're already playing? Then nothing to do
if (bIsPlaying)
return true;
// if we have a last played channel, start playback
if (channel && channel->HasPVRChannelInfoTag())
{
bReturn = StartPlayback(channel->GetPVRChannelInfoTag(), false);
}
else
{
// if we don't, find the active channel group of the demanded type and play it's first channel
CPVRChannelGroupPtr channelGroup = GetPlayingGroup(bIsRadio);
if (channelGroup)
{
// try to start playback of first channel in this group
CFileItemPtr channel = channelGroup->GetByIndex(0);
if (channel && channel->HasPVRChannelInfoTag())
bReturn = StartPlayback(channel->GetPVRChannelInfoTag(), false);
}
}
if (!bReturn)
{
CLog::Log(LOGNOTICE, "PVRManager - %s - could not determine %s channel to start playback with. No last played channel found, and first channel of active group could also not be determined.", __FUNCTION__, bIsRadio ? "radio": "tv");
CStdString msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), g_localizeStrings.Get(bIsRadio ? 19021 : 19020).c_str()); // RADIO/TV could not be played. Check the log for details.
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error,
g_localizeStrings.Get(19166), // PVR information
msg);
}
return bReturn;
}
示例2: OnAction
bool CPVRActionListener::OnAction(const CAction &action)
{
switch (action.GetID())
{
case ACTION_PVR_PLAY:
case ACTION_PVR_PLAY_TV:
case ACTION_PVR_PLAY_RADIO:
{
// see if we're already playing a PVR stream and if not or the stream type
// doesn't match the demanded type, start playback of according type
bool isPlayingPvr(g_PVRManager.IsPlaying() && g_application.CurrentFileItem().HasPVRChannelInfoTag());
switch (action.GetID())
{
case ACTION_PVR_PLAY:
if (!isPlayingPvr)
g_PVRManager.StartPlayback(PlaybackTypeAny);
break;
case ACTION_PVR_PLAY_TV:
if (!isPlayingPvr || g_application.CurrentFileItem().GetPVRChannelInfoTag()->IsRadio())
g_PVRManager.StartPlayback(PlaybackTypeTv);
break;
case ACTION_PVR_PLAY_RADIO:
if (!isPlayingPvr || !g_application.CurrentFileItem().GetPVRChannelInfoTag()->IsRadio())
g_PVRManager.StartPlayback(PlaybackTypeRadio);
break;
}
return true;
}
case REMOTE_0:
case REMOTE_1:
case REMOTE_2:
case REMOTE_3:
case REMOTE_4:
case REMOTE_5:
case REMOTE_6:
case REMOTE_7:
case REMOTE_8:
case REMOTE_9:
{
if (g_application.IsFullScreen() && g_application.CurrentFileItem().IsLiveTV())
{
if(g_PVRManager.IsPlaying())
{
// pvr client addon
CPVRChannelPtr playingChannel(g_PVRManager.GetCurrentChannel());
if(!playingChannel)
return false;
if (action.GetID() == REMOTE_0)
{
CPVRChannelGroupPtr group = g_PVRChannelGroups->GetPreviousPlayedGroup();
if (group)
{
g_PVRManager.SetPlayingGroup(group);
CFileItemPtr fileItem = group->GetLastPlayedChannel(playingChannel->ChannelID());
if (fileItem && fileItem->HasPVRChannelInfoTag())
{
CLog::Log(LOGDEBUG, "%s - switch to channel number %d", __FUNCTION__, fileItem->GetPVRChannelInfoTag()->ChannelNumber());
CApplicationMessenger::Get().SendAction(CAction(ACTION_CHANNEL_SWITCH, (float) fileItem->GetPVRChannelInfoTag()->ChannelNumber()), WINDOW_INVALID, false);
}
}
}
else
{
int autoCloseTime = CSettings::Get().GetBool("pvrplayback.confirmchannelswitch") ? 0 : g_advancedSettings.m_iPVRNumericChannelSwitchTimeout;
std::string strChannel = StringUtils::Format("%i", action.GetID() - REMOTE_0);
if (CGUIDialogNumeric::ShowAndGetNumber(strChannel, g_localizeStrings.Get(19000), autoCloseTime) || autoCloseTime)
{
int iChannelNumber = atoi(strChannel.c_str());
if (iChannelNumber > 0 && iChannelNumber != playingChannel->ChannelNumber())
{
CPVRChannelGroupPtr selectedGroup = g_PVRManager.GetPlayingGroup(playingChannel->IsRadio());
CFileItemPtr channel = selectedGroup->GetByChannelNumber(iChannelNumber);
if (!channel || !channel->HasPVRChannelInfoTag())
return false;
CApplicationMessenger::Get().SendAction(CAction(ACTION_CHANNEL_SWITCH, (float)iChannelNumber), WINDOW_INVALID, false);
}
}
}
}
else
{
// filesystem provider like slingbox etc
int iChannelNumber = -1;
std::string strChannel = StringUtils::Format("%i", action.GetID() - REMOTE_0);
if (CGUIDialogNumeric::ShowAndGetNumber(strChannel, g_localizeStrings.Get(19000)))
iChannelNumber = atoi(strChannel.c_str());
if (iChannelNumber > 0)
CApplicationMessenger::Get().SendAction(CAction(ACTION_CHANNEL_SWITCH, (float)iChannelNumber), WINDOW_INVALID, false);
}
}
return true;
}
break;
}
return false;
}
示例3: Update
void CGUIDialogPVRChannelManager::Update()
{
// lock our display, as this window is rendered from the player thread
g_graphicsContext.Lock();
m_viewControl.SetCurrentView(CONTROL_LIST_CHANNELS);
// empty the lists ready for population
Clear();
CPVRChannelGroupPtr channels = g_PVRChannelGroups->GetGroupAll(m_bIsRadio);
// No channels available, nothing to do.
if(!channels)
return;
std::vector<PVRChannelGroupMember> groupMembers(channels->GetMembers());
CFileItemPtr channelFile;
for (std::vector<PVRChannelGroupMember>::const_iterator it = groupMembers.begin(); it != groupMembers.end(); ++it)
{
channelFile = CFileItemPtr(new CFileItem((*it).channel));
if (!channelFile || !channelFile->HasPVRChannelInfoTag())
continue;
const CPVRChannelPtr channel(channelFile->GetPVRChannelInfoTag());
channelFile->SetProperty("ActiveChannel", !channel->IsHidden());
channelFile->SetProperty("Name", channel->ChannelName());
channelFile->SetProperty("UseEPG", channel->EPGEnabled());
channelFile->SetProperty("Icon", channel->IconPath());
channelFile->SetProperty("EPGSource", (int)0);
channelFile->SetProperty("ParentalLocked", channel->IsLocked());
channelFile->SetProperty("Number", StringUtils::Format("%i", channel->ChannelNumber()));
std::string clientName;
g_PVRClients->GetClientName(channel->ClientID(), clientName);
channelFile->SetProperty("ClientName", clientName);
channelFile->SetProperty("SupportsSettings", g_PVRClients->SupportsChannelSettings(channel->ClientID()));
m_channelItems->Add(channelFile);
}
{
std::vector< std::pair<std::string, int> > labels;
labels.push_back(std::make_pair(g_localizeStrings.Get(19210), 0));
/// TODO: Add Labels for EPG scrapers here
SET_CONTROL_LABELS(SPIN_EPGSOURCE_SELECTION, 0, &labels);
}
m_clientsWithSettingsList = g_PVRClients->GetClientsSupportingChannelSettings(m_bIsRadio);
if (!m_clientsWithSettingsList.empty())
m_bAllowNewChannel = true;
if (m_bAllowNewChannel)
SET_CONTROL_VISIBLE(BUTTON_NEW_CHANNEL);
else
SET_CONTROL_HIDDEN(BUTTON_NEW_CHANNEL);
Renumber();
m_viewControl.SetItems(*m_channelItems);
m_viewControl.SetSelectedItem(m_iSelected);
g_graphicsContext.Unlock();
}
示例4: OnAction
//.........这里部分代码省略.........
pDialog->DoModal();
return true;
}
break;
}
case REMOTE_0:
case REMOTE_1:
case REMOTE_2:
case REMOTE_3:
case REMOTE_4:
case REMOTE_5:
case REMOTE_6:
case REMOTE_7:
case REMOTE_8:
case REMOTE_9:
{
if (g_application.CurrentFileItem().IsLiveTV())
{
if(CPVRManager::Get().IsPlaying())
{
// pvr client addon
CPVRChannelPtr playingChannel;
if(!g_PVRManager.GetCurrentChannel(playingChannel))
return false;
if (action.GetID() == REMOTE_0)
{
CPVRChannelGroupPtr group = g_PVRChannelGroups->GetPreviousPlayedGroup();
if (group)
{
g_PVRManager.SetPlayingGroup(group);
CFileItemPtr fileItem = group->GetLastPlayedChannel(playingChannel->ChannelID());
if (fileItem && fileItem->HasPVRChannelInfoTag())
{
CLog::Log(LOGDEBUG, "%s - switch to channel number %d", __FUNCTION__, fileItem->GetPVRChannelInfoTag()->ChannelNumber());
g_application.OnAction(CAction(ACTION_CHANNEL_SWITCH, (float) fileItem->GetPVRChannelInfoTag()->ChannelNumber()));
}
}
}
else
{
int autoCloseTime = CSettings::Get().GetBool("pvrplayback.confirmchannelswitch") ? 0 : g_advancedSettings.m_iPVRNumericChannelSwitchTimeout;
CStdString strChannel = StringUtils::Format("%i", action.GetID() - REMOTE_0);
if (CGUIDialogNumeric::ShowAndGetNumber(strChannel, g_localizeStrings.Get(19000), autoCloseTime) || autoCloseTime)
{
int iChannelNumber = atoi(strChannel.c_str());
if (iChannelNumber > 0 && iChannelNumber != playingChannel->ChannelNumber())
{
CPVRChannelGroupPtr selectedGroup = g_PVRManager.GetPlayingGroup(playingChannel->IsRadio());
CFileItemPtr channel = selectedGroup->GetByChannelNumber(iChannelNumber);
if (!channel || !channel->HasPVRChannelInfoTag())
return false;
g_application.OnAction(CAction(ACTION_CHANNEL_SWITCH, (float)iChannelNumber));
}
}
}
}
else
{
// filesystem provider like slingbox, cmyth, etc
int iChannelNumber = -1;
CStdString strChannel = StringUtils::Format("%i", action.GetID() - REMOTE_0);
if (CGUIDialogNumeric::ShowAndGetNumber(strChannel, g_localizeStrings.Get(19000)))
iChannelNumber = atoi(strChannel.c_str());
示例5: OnMessage
bool CGUIWindowFullScreen::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_INIT:
{
// check whether we've come back here from a window during which time we've actually
// stopped playing videos
if (message.GetParam1() == WINDOW_INVALID && !g_application.m_pPlayer->IsPlayingVideo())
{ // why are we here if nothing is playing???
g_windowManager.PreviousWindow();
return true;
}
g_infoManager.SetShowInfo(false);
g_infoManager.SetShowCodec(false);
m_bShowCurrentTime = false;
m_bGroupSelectShow = false;
g_infoManager.SetDisplayAfterSeek(0); // Make sure display after seek is off.
// switch resolution
g_graphicsContext.SetFullScreenVideo(true);
#ifdef HAS_VIDEO_PLAYBACK
// make sure renderer is uptospeed
g_renderManager.Update();
#endif
// now call the base class to load our windows
CGUIWindow::OnMessage(message);
m_bShowViewModeInfo = false;
return true;
}
case GUI_MSG_WINDOW_DEINIT:
{
CGUIDialog *pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_OSD_TELETEXT);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_SLIDER);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_OSD);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_FULLSCREEN_INFO);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_CHANNELS);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_GUIDE);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_DIRECTOR);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_CUTTER);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_SUBTITLES);
if (pDialog) pDialog->Close(true);
CGUIWindow::OnMessage(message);
CSettings::Get().Save();
CSingleLock lock (g_graphicsContext);
g_graphicsContext.SetFullScreenVideo(false);
lock.Leave();
#ifdef HAS_VIDEO_PLAYBACK
// make sure renderer is uptospeed
g_renderManager.Update();
#endif
return true;
}
case GUI_MSG_CLICKED:
{
unsigned int iControl = message.GetSenderId();
if (iControl == CONTROL_GROUP_CHOOSER && g_PVRManager.IsStarted())
{
// Get the currently selected label of the Select button
CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControl);
OnMessage(msg);
CStdString strLabel = msg.GetLabel();
CPVRChannelPtr playingChannel;
if (g_PVRManager.GetCurrentChannel(playingChannel))
{
CPVRChannelGroupPtr selectedGroup = g_PVRChannelGroups->Get(playingChannel->IsRadio())->GetByName(strLabel);
if (selectedGroup)
{
g_PVRManager.SetPlayingGroup(selectedGroup);
CLog::Log(LOGDEBUG, "%s - switched to group '%s'", __FUNCTION__, selectedGroup->GroupName().c_str());
if (!selectedGroup->IsGroupMember(*playingChannel))
{
CLog::Log(LOGDEBUG, "%s - channel '%s' is not a member of '%s', switching to channel 1 of the new group",
__FUNCTION__, playingChannel->ChannelName().c_str(), selectedGroup->GroupName().c_str());
CFileItemPtr switchChannel = selectedGroup->GetByChannelNumber(1);
if (switchChannel && switchChannel->HasPVRChannelInfoTag())
g_application.OnAction(CAction(ACTION_CHANNEL_SWITCH, (float) switchChannel->GetPVRChannelInfoTag()->ChannelNumber()));
else
{
CLog::Log(LOGERROR, "%s - cannot find channel '1' in group %s", __FUNCTION__, selectedGroup->GroupName().c_str());
CApplicationMessenger::Get().MediaStop(false);
}
//.........这里部分代码省略.........
示例6: OnAction
bool CPVRActionListener::OnAction(const CAction &action)
{
switch (action.GetID())
{
case ACTION_PVR_PLAY:
case ACTION_PVR_PLAY_TV:
case ACTION_PVR_PLAY_RADIO:
{
// see if we're already playing a PVR stream and if not or the stream type
// doesn't match the demanded type, start playback of according type
bool isPlayingPvr(g_PVRManager.IsPlaying() && g_application.CurrentFileItem().HasPVRChannelInfoTag());
switch (action.GetID())
{
case ACTION_PVR_PLAY:
if (!isPlayingPvr)
g_PVRManager.StartPlayback(PlaybackTypeAny);
break;
case ACTION_PVR_PLAY_TV:
if (!isPlayingPvr || g_application.CurrentFileItem().GetPVRChannelInfoTag()->IsRadio())
g_PVRManager.StartPlayback(PlaybackTypeTv);
break;
case ACTION_PVR_PLAY_RADIO:
if (!isPlayingPvr || !g_application.CurrentFileItem().GetPVRChannelInfoTag()->IsRadio())
g_PVRManager.StartPlayback(PlaybackTypeRadio);
break;
}
return true;
}
case REMOTE_0:
case REMOTE_1:
case REMOTE_2:
case REMOTE_3:
case REMOTE_4:
case REMOTE_5:
case REMOTE_6:
case REMOTE_7:
case REMOTE_8:
case REMOTE_9:
{
if (g_application.CurrentFileItem().IsLiveTV() &&
(g_windowManager.IsWindowActive(WINDOW_FULLSCREEN_VIDEO) ||
g_windowManager.IsWindowActive(WINDOW_VISUALISATION)))
{
// do not consume action if a python modal is the top most dialog
// as a python modal can't return that it consumed the action.
if (g_windowManager.IsPythonWindow(g_windowManager.GetTopMostModalDialogID()))
return false;
if(g_PVRManager.IsPlaying())
{
// pvr client addon
CPVRChannelPtr playingChannel(g_PVRManager.GetCurrentChannel());
if(!playingChannel)
return false;
if (action.GetID() == REMOTE_0)
{
CPVRChannelGroupPtr group = g_PVRChannelGroups->GetPreviousPlayedGroup();
if (group)
{
g_PVRManager.SetPlayingGroup(group);
CFileItemPtr fileItem = group->GetLastPlayedChannel(playingChannel->ChannelID());
if (fileItem && fileItem->HasPVRChannelInfoTag())
{
CLog::Log(LOGDEBUG, "%s - switch to channel number %d", __FUNCTION__, fileItem->GetPVRChannelInfoTag()->ChannelNumber());
CApplicationMessenger::GetInstance().SendMsg(TMSG_GUI_ACTION, WINDOW_INVALID, -1,static_cast<void*>(
new CAction(ACTION_CHANNEL_SWITCH, static_cast<float>(fileItem->GetPVRChannelInfoTag()->ChannelNumber()))));
}
}
}
else
{
int autoCloseTime = CServiceBroker::GetSettings().GetBool(CSettings::SETTING_PVRPLAYBACK_CONFIRMCHANNELSWITCH) ? 0 : g_advancedSettings.m_iPVRNumericChannelSwitchTimeout;
std::string strChannel = StringUtils::Format("%i", action.GetID() - REMOTE_0);
if (CGUIDialogNumeric::ShowAndGetNumber(strChannel, g_localizeStrings.Get(19000), autoCloseTime) || autoCloseTime)
{
int iChannelNumber = atoi(strChannel.c_str());
if (iChannelNumber > 0 && iChannelNumber != playingChannel->ChannelNumber())
{
CPVRChannelGroupPtr selectedGroup = g_PVRManager.GetPlayingGroup(playingChannel->IsRadio());
CFileItemPtr channel = selectedGroup->GetByChannelNumber(iChannelNumber);
if (!channel || !channel->HasPVRChannelInfoTag())
return false;
CApplicationMessenger::GetInstance().PostMsg(TMSG_GUI_ACTION, WINDOW_INVALID, -1, static_cast<void*>(
new CAction(ACTION_CHANNEL_SWITCH, static_cast<float>(iChannelNumber))));
}
}
}
}
}
return true;
}
break;
}
return false;
}
示例7: OnMessage
//.........这里部分代码省略.........
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_OSD);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_FULLSCREEN_INFO);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_CHANNELS);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_GUIDE);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_DIRECTOR);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_CUTTER);
if (pDialog) pDialog->Close(true);
CGUIWindow::OnMessage(message);
CSettings::Get().Save();
CSingleLock lock (g_graphicsContext);
g_graphicsContext.SetFullScreenVideo(false);
lock.Leave();
#ifdef HAS_VIDEO_PLAYBACK
// make sure renderer is uptospeed
g_renderManager.Update();
#endif
CSingleLock lockFont(m_fontLock);
if (m_subsLayout)
{
g_fontManager.Unload("__subtitle__");
g_fontManager.Unload("__subtitleborder__");
delete m_subsLayout;
m_subsLayout = NULL;
}
return true;
}
case GUI_MSG_CLICKED:
{
unsigned int iControl = message.GetSenderId();
if (iControl == CONTROL_GROUP_CHOOSER && g_PVRManager.IsStarted())
{
// Get the currently selected label of the Select button
CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControl);
OnMessage(msg);
CStdString strLabel = msg.GetLabel();
CPVRChannelPtr playingChannel;
if (g_PVRManager.GetCurrentChannel(playingChannel))
{
CPVRChannelGroupPtr selectedGroup = g_PVRChannelGroups->Get(playingChannel->IsRadio())->GetByName(strLabel);
if (selectedGroup)
{
g_PVRManager.SetPlayingGroup(selectedGroup);
CLog::Log(LOGDEBUG, "%s - switched to group '%s'", __FUNCTION__, selectedGroup->GroupName().c_str());
if (!selectedGroup->IsGroupMember(*playingChannel))
{
CLog::Log(LOGDEBUG, "%s - channel '%s' is not a member of '%s', switching to channel 1 of the new group",
__FUNCTION__, playingChannel->ChannelName().c_str(), selectedGroup->GroupName().c_str());
CFileItemPtr switchChannel = selectedGroup->GetByChannelNumber(1);
if (switchChannel && switchChannel->HasPVRChannelInfoTag())
OnAction(CAction(ACTION_CHANNEL_SWITCH, (float) switchChannel->GetPVRChannelInfoTag()->ChannelNumber()));
else
{
CLog::Log(LOGERROR, "%s - cannot find channel '1' in group %s", __FUNCTION__, selectedGroup->GroupName().c_str());
CApplicationMessenger::Get().MediaStop(false);
}
}
}
else
{
CLog::Log(LOGERROR, "%s - could not switch to group '%s'", __FUNCTION__, selectedGroup->GroupName().c_str());
CApplicationMessenger::Get().MediaStop(false);
}
}
else
{
CLog::Log(LOGERROR, "%s - cannot find the current channel", __FUNCTION__);
CApplicationMessenger::Get().MediaStop(false);
}
// hide the control and reset focus
m_bGroupSelectShow = false;
SET_CONTROL_HIDDEN(CONTROL_GROUP_CHOOSER);
// SET_CONTROL_FOCUS(0, 0);
return true;
}
break;
}
case GUI_MSG_SETFOCUS:
case GUI_MSG_LOSTFOCUS:
if (message.GetSenderId() != WINDOW_FULLSCREEN_VIDEO) return true;
break;
}
return CGUIWindow::OnMessage(message);
}
示例8: Open
bool CDVDInputStreamPVRManager::Open()
{
if (!CDVDInputStream::Open())
return false;
CURL url(m_item.GetDynPath());
std::string strURL = url.Get();
if (StringUtils::StartsWith(strURL, "pvr://channels/tv/") ||
StringUtils::StartsWith(strURL, "pvr://channels/radio/"))
{
CFileItemPtr tag = CServiceBroker::GetPVRManager().ChannelGroups()->GetByPath(strURL);
if (tag && tag->HasPVRChannelInfoTag())
{
if (!CServiceBroker::GetPVRManager().OpenLiveStream(*tag))
return false;
m_isRecording = false;
CLog::Log(LOGDEBUG, "CDVDInputStreamPVRManager - %s - playback has started on filename %s", __FUNCTION__, strURL.c_str());
}
else
{
CLog::Log(LOGERROR, "CDVDInputStreamPVRManager - %s - channel not found with filename %s", __FUNCTION__, strURL.c_str());
return false;
}
}
else if (CPVRRecordingsPath(strURL).IsActive())
{
CFileItemPtr tag = CServiceBroker::GetPVRManager().Recordings()->GetByPath(strURL);
if (tag && tag->HasPVRRecordingInfoTag())
{
if (!CServiceBroker::GetPVRManager().OpenRecordedStream(tag->GetPVRRecordingInfoTag()))
return false;
m_isRecording = true;
CLog::Log(LOGDEBUG, "%s - playback has started on recording %s (%s)", __FUNCTION__, strURL.c_str(), tag->GetPVRRecordingInfoTag()->m_strIconPath.c_str());
}
else
{
CLog::Log(LOGERROR, "CDVDInputStreamPVRManager - Recording not found with filename %s", strURL.c_str());
return false;
}
}
else if (CPVRRecordingsPath(strURL).IsDeleted())
{
CLog::Log(LOGNOTICE, "CDVDInputStreamPVRManager - Playback of deleted recordings is not possible (%s)", strURL.c_str());
return false;
}
else
{
CLog::Log(LOGERROR, "%s - invalid path specified %s", __FUNCTION__, strURL.c_str());
return false;
}
m_eof = false;
if (URIUtils::IsPVRChannel(url.Get()))
{
std::shared_ptr<CPVRClient> client;
if (CServiceBroker::GetPVRManager().Clients()->GetPlayingClient(client) &&
client->GetClientCapabilities().HandlesDemuxing())
m_demuxActive = true;
}
CLog::Log(LOGDEBUG, "CDVDInputStreamPVRManager::Open - stream opened: %s", CURL::GetRedacted(m_item.GetDynPath()).c_str());
m_StreamProps->iStreamCount = 0;
return true;
}
示例9: Announce
void CAnnouncementManager::Announce(AnnouncementFlag flag, const char *sender, const char *message, CFileItemPtr item, CVariant &data)
{
if (!item.get())
{
Announce(flag, sender, message, data);
return;
}
// Extract db id of item
CVariant object = data.isNull() || data.isObject() ? data : CVariant::VariantTypeObject;
std::string type;
int id = 0;
if(item->HasPVRChannelInfoTag())
{
const PVR::CPVRChannelPtr channel(item->GetPVRChannelInfoTag());
id = channel->ChannelID();
type = "channel";
object["item"]["title"] = channel->ChannelName();
object["item"]["channeltype"] = channel->IsRadio() ? "radio" : "tv";
if (data.isMember("player") && data["player"].isMember("playerid"))
object["player"]["playerid"] = channel->IsRadio() ? PLAYLIST_MUSIC : PLAYLIST_VIDEO;
}
else if (item->HasVideoInfoTag())
{
id = item->GetVideoInfoTag()->m_iDbId;
// TODO: Can be removed once this is properly handled when starting playback of a file
if (id <= 0 && !item->GetPath().empty() &&
(!item->HasProperty(LOOKUP_PROPERTY) || item->GetProperty(LOOKUP_PROPERTY).asBoolean()))
{
CVideoDatabase videodatabase;
if (videodatabase.Open())
{
std::string path = item->GetPath();
std::string videoInfoTagPath(item->GetVideoInfoTag()->m_strFileNameAndPath);
if (StringUtils::StartsWith(videoInfoTagPath, "removable://"))
path = videoInfoTagPath;
if (videodatabase.LoadVideoInfo(path, *item->GetVideoInfoTag(), VideoDbDetailsNone))
id = item->GetVideoInfoTag()->m_iDbId;
videodatabase.Close();
}
}
if (!item->GetVideoInfoTag()->m_type.empty())
type = item->GetVideoInfoTag()->m_type;
else
CVideoDatabase::VideoContentTypeToString((VIDEODB_CONTENT_TYPE)item->GetVideoContentType(), type);
if (id <= 0)
{
// TODO: Can be removed once this is properly handled when starting playback of a file
item->SetProperty(LOOKUP_PROPERTY, false);
std::string title = item->GetVideoInfoTag()->m_strTitle;
if (title.empty())
title = item->GetLabel();
object["item"]["title"] = title;
switch (item->GetVideoContentType())
{
case VIDEODB_CONTENT_MOVIES:
if (item->GetVideoInfoTag()->m_iYear > 0)
object["item"]["year"] = item->GetVideoInfoTag()->m_iYear;
break;
case VIDEODB_CONTENT_EPISODES:
if (item->GetVideoInfoTag()->m_iEpisode >= 0)
object["item"]["episode"] = item->GetVideoInfoTag()->m_iEpisode;
if (item->GetVideoInfoTag()->m_iSeason >= 0)
object["item"]["season"] = item->GetVideoInfoTag()->m_iSeason;
if (!item->GetVideoInfoTag()->m_strShowTitle.empty())
object["item"]["showtitle"] = item->GetVideoInfoTag()->m_strShowTitle;
break;
case VIDEODB_CONTENT_MUSICVIDEOS:
if (!item->GetVideoInfoTag()->m_strAlbum.empty())
object["item"]["album"] = item->GetVideoInfoTag()->m_strAlbum;
if (!item->GetVideoInfoTag()->m_artist.empty())
object["item"]["artist"] = StringUtils::Join(item->GetVideoInfoTag()->m_artist, " / ");
break;
}
}
}
else if (item->HasMusicInfoTag())
{
id = item->GetMusicInfoTag()->GetDatabaseId();
type = MediaTypeSong;
// TODO: Can be removed once this is properly handled when starting playback of a file
if (id <= 0 && !item->GetPath().empty() &&
(!item->HasProperty(LOOKUP_PROPERTY) || item->GetProperty(LOOKUP_PROPERTY).asBoolean()))
{
CMusicDatabase musicdatabase;
if (musicdatabase.Open())
{
CSong song;
if (musicdatabase.GetSongByFileName(item->GetPath(), song, item->m_lStartOffset))
{
//.........这里部分代码省略.........
示例10: HandleFileItem
void CFileItemHandler::HandleFileItem(const char *ID, bool allowFile, const char *resultname, CFileItemPtr item, const CVariant ¶meterObject, const std::set<std::string> &validFields, CVariant &result, bool append /* = true */, CThumbLoader *thumbLoader /* = NULL */)
{
CVariant object;
std::set<std::string> fields(validFields.begin(), validFields.end());
if (item.get())
{
std::set<std::string>::const_iterator fileField = fields.find("file");
if (fileField != fields.end())
{
if (allowFile)
{
if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->GetPath().IsEmpty())
object["file"] = item->GetVideoInfoTag()->GetPath().c_str();
if (item->HasMusicInfoTag() && !item->GetMusicInfoTag()->GetURL().IsEmpty())
object["file"] = item->GetMusicInfoTag()->GetURL().c_str();
if (!object.isMember("file"))
object["file"] = item->GetPath().c_str();
}
fields.erase(fileField);
}
if (ID)
{
if (item->HasPVRChannelInfoTag() && item->GetPVRChannelInfoTag()->ChannelID() > 0)
object[ID] = item->GetPVRChannelInfoTag()->ChannelID();
else if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetDatabaseId() > 0)
object[ID] = (int)item->GetMusicInfoTag()->GetDatabaseId();
else if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_iDbId > 0)
object[ID] = item->GetVideoInfoTag()->m_iDbId;
if (stricmp(ID, "id") == 0)
{
if (item->HasPVRChannelInfoTag())
object["type"] = "channel";
else if (item->HasMusicInfoTag())
{
if (item->m_bIsFolder && item->IsAlbum())
object["type"] = "album";
else
object["type"] = "song";
}
else if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_type.empty())
{
std::string type = item->GetVideoInfoTag()->m_type;
if (type == "movie" || type == "tvshow" || type == "episode" || type == "musicvideo")
object["type"] = type;
}
else if (item->HasPictureInfoTag())
object["type"] = "picture";
if (!object.isMember("type"))
object["type"] = "unknown";
}
}
bool deleteThumbloader = false;
if (thumbLoader == NULL)
{
if (item->HasVideoInfoTag())
thumbLoader = new CVideoThumbLoader();
else if (item->HasMusicInfoTag())
thumbLoader = new CMusicThumbLoader();
if (thumbLoader != NULL)
{
deleteThumbloader = true;
thumbLoader->Initialize();
}
}
if (item->HasPVRChannelInfoTag())
FillDetails(item->GetPVRChannelInfoTag(), item, fields, object, thumbLoader);
if (item->HasVideoInfoTag())
FillDetails(item->GetVideoInfoTag(), item, fields, object, thumbLoader);
if (item->HasMusicInfoTag())
FillDetails(item->GetMusicInfoTag(), item, fields, object, thumbLoader);
if (item->HasPictureInfoTag())
FillDetails(item->GetPictureInfoTag(), item, fields, object, thumbLoader);
FillDetails(item.get(), item, fields, object, thumbLoader);
if (deleteThumbloader)
delete thumbLoader;
object["label"] = item->GetLabel().c_str();
}
else
object = CVariant(CVariant::VariantTypeNull);
if (resultname)
{
if (append)
result[resultname].append(object);
else
result[resultname] = object;
}
}
示例11: Open
bool CDVDInputStreamPVRManager::Open()
{
if (!CDVDInputStream::Open())
return false;
CURL url(m_item.GetPath());
std::string strURL = url.Get();
if (StringUtils::StartsWith(strURL, "pvr://channels/tv/") ||
StringUtils::StartsWith(strURL, "pvr://channels/radio/"))
{
CFileItemPtr tag = g_PVRChannelGroups->GetByPath(strURL);
if (tag && tag->HasPVRChannelInfoTag())
{
if (!g_PVRManager.OpenLiveStream(*tag))
return false;
m_isRecording = false;
CLog::Log(LOGDEBUG, "CDVDInputStreamPVRManager - %s - playback has started on filename %s", __FUNCTION__, strURL.c_str());
}
else
{
CLog::Log(LOGERROR, "CDVDInputStreamPVRManager - %s - channel not found with filename %s", __FUNCTION__, strURL.c_str());
return false;
}
}
else if (CPVRRecordingsPath(strURL).IsActive())
{
CFileItemPtr tag = g_PVRRecordings->GetByPath(strURL);
if (tag && tag->HasPVRRecordingInfoTag())
{
if (!g_PVRManager.OpenRecordedStream(tag->GetPVRRecordingInfoTag()))
return false;
m_isRecording = true;
CLog::Log(LOGDEBUG, "%s - playback has started on recording %s (%s)", __FUNCTION__, strURL.c_str(), tag->GetPVRRecordingInfoTag()->m_strIconPath.c_str());
}
else
{
CLog::Log(LOGERROR, "CDVDInputStreamPVRManager - Recording not found with filename %s", strURL.c_str());
return false;
}
}
else if (CPVRRecordingsPath(strURL).IsDeleted())
{
CLog::Log(LOGNOTICE, "CDVDInputStreamPVRManager - Playback of deleted recordings is not possible (%s)", strURL.c_str());
return false;
}
else
{
CLog::Log(LOGERROR, "%s - invalid path specified %s", __FUNCTION__, strURL.c_str());
return false;
}
m_eof = false;
/*
* Translate the "pvr://....." entry.
* The PVR Client can use http or whatever else is supported by VideoPlayer.
* to access streams.
* If after translation the file protocol is still "pvr://" use this class
* to read the stream data over the CPVRFile class and the PVR Library itself.
* Otherwise call CreateInputStream again with the translated filename and looks again
* for the right protocol stream handler and swap every call to this input stream
* handler.
*/
m_isOtherStreamHack = false;
std::string transFile = ThisIsAHack(m_item.GetPath());
if(transFile.substr(0, 6) != "pvr://")
{
m_isOtherStreamHack = true;
m_item.SetPath(transFile);
m_item.SetMimeTypeForInternetFile();
m_pOtherStream = CDVDFactoryInputStream::CreateInputStream(m_pPlayer, m_item);
if (!m_pOtherStream)
{
CLog::Log(LOGERROR, "CDVDInputStreamPVRManager::Open - unable to create input stream for [%s]", CURL::GetRedacted(transFile).c_str());
return false;
}
if (!m_pOtherStream->Open())
{
CLog::Log(LOGERROR, "CDVDInputStreamPVRManager::Open - error opening [%s]", CURL::GetRedacted(transFile).c_str());
delete m_pOtherStream;
m_pOtherStream = NULL;
return false;
}
}
else
{
if (URIUtils::IsPVRChannel(url.Get()))
{
std::shared_ptr<CPVRClient> client;
if (g_PVRClients->GetPlayingClient(client) &&
client->HandlesDemuxing())
m_demuxActive = true;
}
//.........这里部分代码省略.........
示例12: HandleFileItem
void CFileItemHandler::HandleFileItem(const char *ID, bool allowFile, const char *resultname, CFileItemPtr item, const CVariant ¶meterObject, const std::set<std::string> &validFields, CVariant &result, bool append /* = true */, CThumbLoader *thumbLoader /* = NULL */)
{
CVariant object;
std::set<std::string> fields(validFields.begin(), validFields.end());
if (item.get())
{
std::set<std::string>::const_iterator fileField = fields.find("file");
if (fileField != fields.end())
{
if (allowFile)
{
if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->GetPath().empty())
object["file"] = item->GetVideoInfoTag()->GetPath().c_str();
if (item->HasMusicInfoTag() && !item->GetMusicInfoTag()->GetURL().empty())
object["file"] = item->GetMusicInfoTag()->GetURL().c_str();
if (item->HasPVRRecordingInfoTag() && !item->GetPVRRecordingInfoTag()->GetPath().empty())
object["file"] = item->GetPVRRecordingInfoTag()->GetPath().c_str();
if (item->HasPVRTimerInfoTag() && !item->GetPVRTimerInfoTag()->m_strFileNameAndPath.empty())
object["file"] = item->GetPVRTimerInfoTag()->m_strFileNameAndPath.c_str();
if (!object.isMember("file"))
object["file"] = item->GetPath().c_str();
}
fields.erase(fileField);
}
if (ID)
{
if (item->HasPVRChannelInfoTag() && item->GetPVRChannelInfoTag()->ChannelID() > 0)
object[ID] = item->GetPVRChannelInfoTag()->ChannelID();
else if (item->HasEPGInfoTag() && item->GetEPGInfoTag()->UniqueBroadcastID() > 0)
object[ID] = item->GetEPGInfoTag()->UniqueBroadcastID();
else if (item->HasPVRRecordingInfoTag() && item->GetPVRRecordingInfoTag()->m_iRecordingId > 0)
object[ID] = item->GetPVRRecordingInfoTag()->m_iRecordingId;
else if (item->HasPVRTimerInfoTag() && item->GetPVRTimerInfoTag()->m_iTimerId > 0)
object[ID] = item->GetPVRTimerInfoTag()->m_iTimerId;
else if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetDatabaseId() > 0)
object[ID] = (int)item->GetMusicInfoTag()->GetDatabaseId();
else if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_iDbId > 0)
object[ID] = item->GetVideoInfoTag()->m_iDbId;
if (stricmp(ID, "id") == 0)
{
if (item->HasPVRChannelInfoTag())
object["type"] = "channel";
else if (item->HasMusicInfoTag())
{
std::string type = item->GetMusicInfoTag()->GetType();
if (type == MediaTypeAlbum || type == MediaTypeSong || type == MediaTypeArtist)
object["type"] = type;
else if (!item->m_bIsFolder)
object["type"] = MediaTypeSong;
}
else if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_type.empty())
{
std::string type = item->GetVideoInfoTag()->m_type;
if (type == MediaTypeMovie || type == MediaTypeTvShow || type == MediaTypeEpisode || type == MediaTypeMusicVideo)
object["type"] = type;
}
else if (item->HasPictureInfoTag())
object["type"] = "picture";
if (!object.isMember("type"))
object["type"] = "unknown";
if (fields.find("filetype") != fields.end())
{
if (item->m_bIsFolder)
object["filetype"] = "directory";
else
object["filetype"] = "file";
}
}
}
bool deleteThumbloader = false;
if (thumbLoader == NULL)
{
if (item->HasVideoInfoTag())
thumbLoader = new CVideoThumbLoader();
else if (item->HasMusicInfoTag())
thumbLoader = new CMusicThumbLoader();
if (thumbLoader != NULL)
{
deleteThumbloader = true;
thumbLoader->OnLoaderStart();
}
}
if (item->HasPVRChannelInfoTag())
FillDetails(item->GetPVRChannelInfoTag().get(), item, fields, object, thumbLoader);
if (item->HasEPGInfoTag())
FillDetails(item->GetEPGInfoTag().get(), item, fields, object, thumbLoader);
if (item->HasPVRRecordingInfoTag())
FillDetails(item->GetPVRRecordingInfoTag().get(), item, fields, object, thumbLoader);
if (item->HasPVRTimerInfoTag())
FillDetails(item->GetPVRTimerInfoTag().get(), item, fields, object, thumbLoader);
if (item->HasVideoInfoTag())
//.........这里部分代码省略.........
示例13: OnSettingChanged
void CGUIDialogPVRTimerSettings::OnSettingChanged(SettingInfo &setting)
{
CPVRTimerInfoTag* tag = m_timerItem->GetPVRTimerInfoTag();
if (setting.id == CONTROL_TMR_NAME)
{
if (CGUIKeyboardFactory::ShowAndGetInput(tag->m_strTitle, g_localizeStrings.Get(19097), false))
{
UpdateSetting(CONTROL_TMR_NAME);
}
}
if (setting.id == CONTROL_TMR_DIR && CGUIKeyboardFactory::ShowAndGetInput(tag->m_strDirectory, g_localizeStrings.Get(19104), false))
UpdateSetting(CONTROL_TMR_DIR);
else if (setting.id == CONTROL_TMR_RADIO || setting.id == CONTROL_TMR_CHNAME_TV || setting.id == CONTROL_TMR_CHNAME_RADIO)
{
if (setting.id == CONTROL_TMR_RADIO)
{
EnableSettings(CONTROL_TMR_CHNAME_TV, !tag->m_bIsRadio);
EnableSettings(CONTROL_TMR_CHNAME_RADIO, tag->m_bIsRadio);
}
CFileItemPtr channel = g_PVRChannelGroups->GetGroupAll(tag->m_bIsRadio)->GetByChannelNumber(tag->m_iChannelNumber);
if (channel && channel->HasPVRChannelInfoTag())
{
tag->m_iClientChannelUid = channel->GetPVRChannelInfoTag()->UniqueID();
tag->m_iClientId = channel->GetPVRChannelInfoTag()->ClientID();
tag->m_bIsRadio = channel->GetPVRChannelInfoTag()->IsRadio();
tag->m_iChannelNumber = channel->GetPVRChannelInfoTag()->ChannelNumber();
}
}
else if (setting.id == CONTROL_TMR_DAY && m_tmp_day > 10)
{
CDateTime time = CDateTime::GetCurrentDateTime();
CDateTime timestart = timerStartTime;
CDateTime timestop = timerEndTime;
int m_tmp_diff;
tm time_cur;
tm time_tmr;
/* get diffence of timer in days between today and timer start date */
time.GetAsTm(time_cur);
timestart.GetAsTm(time_tmr);
m_tmp_diff = time_tmr.tm_yday - time_cur.tm_yday;
if (time_tmr.tm_yday - time_cur.tm_yday < 0)
m_tmp_diff = 365;
CDateTime newStart = timestart + CDateTimeSpan(m_tmp_day-11-m_tmp_diff, 0, 0, 0);
CDateTime newEnd = timestop + CDateTimeSpan(m_tmp_day-11-m_tmp_diff, 0, 0, 0);
tag->SetStartFromLocalTime(newStart);
tag->SetEndFromLocalTime(newEnd);
EnableSettings(CONTROL_TMR_FIRST_DAY, false);
tag->m_bIsRepeating = false;
tag->m_iWeekdays = 0;
}
else if (setting.id == CONTROL_TMR_DAY && m_tmp_day <= 10)
{
EnableSettings(CONTROL_TMR_FIRST_DAY, true);
SetTimerFromWeekdaySetting(*tag);
}
else if (setting.id == CONTROL_TMR_BEGIN)
{
if (CGUIDialogNumeric::ShowAndGetTime(timerStartTime, g_localizeStrings.Get(14066)))
{
CDateTime timestart = timerStartTime;
int start_day = tag->StartAsLocalTime().GetDay();
int start_month = tag->StartAsLocalTime().GetMonth();
int start_year = tag->StartAsLocalTime().GetYear();
int start_hour = timestart.GetHour();
int start_minute = timestart.GetMinute();
CDateTime newStart(start_year, start_month, start_day, start_hour, start_minute, 0);
tag->SetStartFromLocalTime(newStart);
timerStartTimeStr = tag->StartAsLocalTime().GetAsLocalizedTime("", false);
UpdateSetting(CONTROL_TMR_BEGIN);
}
}
else if (setting.id == CONTROL_TMR_END)
{
if (CGUIDialogNumeric::ShowAndGetTime(timerEndTime, g_localizeStrings.Get(14066)))
{
CDateTime timestop = timerEndTime;
int start_day = tag->EndAsLocalTime().GetDay();
int start_month = tag->EndAsLocalTime().GetMonth();
int start_year = tag->EndAsLocalTime().GetYear();
int start_hour = timestop.GetHour();
int start_minute = timestop.GetMinute();
CDateTime newEnd(start_year, start_month, start_day, start_hour, start_minute, 0);
tag->SetEndFromLocalTime(newEnd);
timerEndTimeStr = tag->EndAsLocalTime().GetAsLocalizedTime("", false);
UpdateSetting(CONTROL_TMR_END);
}
}
else if (setting.id == CONTROL_TMR_FIRST_DAY && m_tmp_day <= 10)
{
CDateTime newFirstDay;
if (m_tmp_iFirstDay > 0)
//.........这里部分代码省略.........