本文整理汇总了C++中CPVRChannelGroupPtr::GetByChannelNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannelGroupPtr::GetByChannelNumber方法的具体用法?C++ CPVRChannelGroupPtr::GetByChannelNumber怎么用?C++ CPVRChannelGroupPtr::GetByChannelNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPVRChannelGroupPtr
的用法示例。
在下文中一共展示了CPVRChannelGroupPtr::GetByChannelNumber方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChannelSwitch
bool CPVRManager::ChannelSwitch(unsigned int iChannelNumber)
{
CSingleLock lock(m_critSection);
CPVRChannelGroupPtr playingGroup = GetPlayingGroup(m_addons->IsPlayingRadio());
if (!playingGroup)
{
CLog::Log(LOGERROR, "PVRManager - %s - cannot get the selected group", __FUNCTION__);
return false;
}
CFileItemPtr channel = playingGroup->GetByChannelNumber(iChannelNumber);
if (!channel || !channel->HasPVRChannelInfoTag())
{
CLog::Log(LOGERROR, "PVRManager - %s - cannot find channel %d", __FUNCTION__, iChannelNumber);
return false;
}
return PerformChannelSwitch(*channel->GetPVRChannelInfoTag(), false);
}
示例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);
}
}
}
}
}
return true;
}
break;
}
return false;
}
示例3: OnMessage
//.........这里部分代码省略.........
CGUIDialogSlider *slider = (CGUIDialogSlider *)g_windowManager.GetWindow(WINDOW_DIALOG_SLIDER);
if (slider) slider->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);
FreeResources(true);
CSingleLock lock (g_graphicsContext);
g_graphicsContext.SetFullScreenVideo(false);
lock.Leave();
#ifdef HAS_VIDEO_PLAYBACK
// make sure renderer is uptospeed
g_renderManager.Update(false);
#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);
}
示例4: OnAction
//.........这里部分代码省略.........
case REMOTE_4:
case REMOTE_5:
case REMOTE_6:
case REMOTE_7:
case REMOTE_8:
case REMOTE_9:
{
if (g_application.CurrentFileItem().IsLiveTV())
{
CPVRChannelPtr channel;
int iChannelNumber = -1;
g_PVRManager.GetCurrentChannel(channel);
if (action.GetID() == REMOTE_0)
{
iChannelNumber = g_PVRManager.GetPreviousChannel();
if (iChannelNumber > 0)
CLog::Log(LOGDEBUG, "switch to channel number %d", iChannelNumber);
else
CLog::Log(LOGDEBUG, "no previous channel number found");
}
else
{
int autoCloseTime = g_guiSettings.GetBool("pvrplayback.switchautoclose") ? 1500 : 0;
CStdString strChannel;
strChannel.Format("%i", action.GetID() - REMOTE_0);
if (CGUIDialogNumeric::ShowAndGetNumber(strChannel, g_localizeStrings.Get(19000), autoCloseTime) || autoCloseTime)
iChannelNumber = atoi(strChannel.c_str());
}
if (iChannelNumber > 0 && iChannelNumber != channel->ChannelNumber())
{
CPVRChannelGroupPtr selectedGroup = g_PVRManager.GetPlayingGroup(channel->IsRadio());
CFileItemPtr channel = selectedGroup->GetByChannelNumber(iChannelNumber);
if (!channel || !channel->HasPVRChannelInfoTag())
return false;
OnAction(CAction(ACTION_CHANNEL_SWITCH, (float)iChannelNumber));
}
}
else
{
ChangetheTimeCode(action.GetID());
}
return true;
}
break;
case ACTION_ASPECT_RATIO:
{ // toggle the aspect ratio mode (only if the info is onscreen)
if (m_bShowViewModeInfo)
{
#ifdef HAS_VIDEO_PLAYBACK
g_renderManager.SetViewMode(++g_settings.m_currentVideoSettings.m_ViewMode);
#endif
}
m_bShowViewModeInfo = true;
m_dwShowViewModeTimeout = XbmcThreads::SystemClockMillis();
}
return true;
break;
case ACTION_SMALL_STEP_BACK:
if (m_timeCodePosition > 0)
SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_BACKWARD);
else
{
示例5: OnAction
//.........这里部分代码省略.........
case REMOTE_4:
case REMOTE_5:
case REMOTE_6:
case REMOTE_7:
case REMOTE_8:
case REMOTE_9:
{
if (g_application.CurrentFileItem().IsLiveTV())
{
CPVRChannelPtr channel;
int iChannelNumber = -1;
g_PVRManager.GetCurrentChannel(channel);
if (action.GetID() == REMOTE_0)
{
iChannelNumber = g_PVRManager.GetPreviousChannel();
if (iChannelNumber > 0)
CLog::Log(LOGDEBUG, "switch to channel number %d", iChannelNumber);
else
CLog::Log(LOGDEBUG, "no previous channel number found");
}
else
{
int autoCloseTime = CSettings::Get().GetBool("pvrplayback.confirmchannelswitch") ? 0 : g_advancedSettings.m_iPVRNumericChannelSwitchTimeout;
CStdString strChannel;
strChannel.Format("%i", action.GetID() - REMOTE_0);
if (CGUIDialogNumeric::ShowAndGetNumber(strChannel, g_localizeStrings.Get(19000), autoCloseTime) || autoCloseTime)
iChannelNumber = atoi(strChannel.c_str());
}
if (iChannelNumber > 0 && iChannelNumber != channel->ChannelNumber())
{
CPVRChannelGroupPtr selectedGroup = g_PVRManager.GetPlayingGroup(channel->IsRadio());
CFileItemPtr channel = selectedGroup->GetByChannelNumber(iChannelNumber);
if (!channel || !channel->HasPVRChannelInfoTag())
return false;
OnAction(CAction(ACTION_CHANNEL_SWITCH, (float)iChannelNumber));
}
}
else
{
ChangetheTimeCode(action.GetID());
}
return true;
}
break;
case ACTION_ASPECT_RATIO:
{ // toggle the aspect ratio mode (only if the info is onscreen)
if (m_bShowViewModeInfo)
{
#ifdef HAS_VIDEO_PLAYBACK
g_renderManager.SetViewMode(++CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode);
#endif
}
m_bShowViewModeInfo = true;
m_dwShowViewModeTimeout = XbmcThreads::SystemClockMillis();
}
return true;
break;
case ACTION_SMALL_STEP_BACK:
if (m_timeCodePosition > 0)
SeekToTimeCodeStamp(SEEK_RELATIVE, SEEK_BACKWARD);
else
{
示例6: 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);
}
//.........这里部分代码省略.........
示例7: 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;
}