本文整理汇总了C++中CPVRChannelGroupPtr::GetByIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannelGroupPtr::GetByIndex方法的具体用法?C++ CPVRChannelGroupPtr::GetByIndex怎么用?C++ CPVRChannelGroupPtr::GetByIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPVRChannelGroupPtr
的用法示例。
在下文中一共展示了CPVRChannelGroupPtr::GetByIndex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
for (int iChannelPtr = 0; iChannelPtr < channels->Size(); iChannelPtr++)
{
CFileItemPtr channelFile = channels->GetByIndex(iChannelPtr);
if (!channelFile || !channelFile->HasPVRChannelInfoTag())
continue;
const CPVRChannel *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()));
if (channel->IsVirtual())
{
channelFile->SetProperty("Virtual", true);
channelFile->SetProperty("StreamURL", channel->StreamURL());
}
CStdString clientName;
if (channel->ClientID() == PVR_VIRTUAL_CLIENT_ID) /* XBMC internal */
clientName = g_localizeStrings.Get(19209);
else
g_PVRClients->GetClientName(channel->ClientID(), clientName);
channelFile->SetProperty("ClientName", clientName);
m_channelItems->Add(channelFile);
}
CGUISpinControlEx *pSpin = (CGUISpinControlEx *)GetControl(SPIN_EPGSOURCE_SELECTION);
if (pSpin)
{
pSpin->Clear();
pSpin->AddLabel(g_localizeStrings.Get(19210), 0);
/// TODO: Add Labels for EPG scrapers here
}
Renumber();
m_viewControl.SetItems(*m_channelItems);
m_viewControl.SetSelectedItem(m_iSelected);
g_graphicsContext.Unlock();
}
示例2: UpdateChannelSpin
void CGUIDialogPVRGuideSearch::UpdateChannelSpin(void)
{
CGUISpinControlEx *pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_CHANNELS);
CGUISpinControlEx *pSpinGroups = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_GROUPS);
if (!pSpin || !pSpinGroups)
return;
int iChannelGroup = pSpin->GetValue();
pSpin->Clear();
pSpin->AddLabel(g_localizeStrings.Get(19217), EPG_SEARCH_UNSET);
int iGroupId = (iChannelGroup == EPG_SEARCH_UNSET) ?
XBMC_INTERNAL_GROUP_TV :
iChannelGroup;
CPVRChannelGroupPtr group = g_PVRChannelGroups->GetByIdFromAll(iGroupId);
if (!group)
group = g_PVRChannelGroups->GetGroupAllTV();
for (int iChannelPtr = 0; iChannelPtr < group->Size(); iChannelPtr++)
{
CFileItemPtr channel = group->GetByIndex(iChannelPtr);
if (!channel || !channel->HasPVRChannelInfoTag())
continue;
int iChannelNumber = group->GetChannelNumber(*channel->GetPVRChannelInfoTag());
pSpin->AddLabel(channel->GetPVRChannelInfoTag()->ChannelName().c_str(), iChannelNumber);
}
}
示例3: UpdateChannelSpin
void CGUIDialogPVRGuideSearch::UpdateChannelSpin(void)
{
int iChannelGroup = GetSpinValue(CONTROL_SPIN_GROUPS);
std::vector< std::pair<std::string, int> > labels;
labels.push_back(std::make_pair(g_localizeStrings.Get(19217), EPG_SEARCH_UNSET));
CPVRChannelGroupPtr group;
if (iChannelGroup == EPG_SEARCH_UNSET)
group = g_PVRChannelGroups->GetGroupAll(m_searchFilter->m_bIsRadio);
else
group = g_PVRChannelGroups->GetByIdFromAll(iChannelGroup);
if (!group)
group = g_PVRChannelGroups->GetGroupAll(m_searchFilter->m_bIsRadio);
for (int iChannelPtr = 0; iChannelPtr < group->Size(); iChannelPtr++)
{
CFileItemPtr channel = group->GetByIndex(iChannelPtr);
if (!channel || !channel->HasPVRChannelInfoTag())
continue;
int iChannelNumber = group->GetChannelNumber(*channel->GetPVRChannelInfoTag());
labels.push_back(std::make_pair(channel->GetPVRChannelInfoTag()->ChannelName(), iChannelNumber));
}
SET_CONTROL_LABELS(CONTROL_SPIN_CHANNELS, m_searchFilter->m_iChannelNumber, &labels);
}
示例4: 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;
}