本文整理汇总了C++中CPVRChannelPtr::ChannelID方法的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannelPtr::ChannelID方法的具体用法?C++ CPVRChannelPtr::ChannelID怎么用?C++ CPVRChannelPtr::ChannelID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPVRChannelPtr
的用法示例。
在下文中一共展示了CPVRChannelPtr::ChannelID方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetLastPlayedChannel
CFileItemPtr CPVRChannelGroup::GetLastPlayedChannel(int iCurrentChannel /* = -1 */) const
{
CSingleLock lock(m_critSection);
CPVRChannelPtr returnChannel;
for (std::vector<PVRChannelGroupMember>::const_iterator it = m_members.begin(); it != m_members.end(); ++it)
{
CPVRChannelPtr channel = (*it).channel;
if (channel->ChannelID() != iCurrentChannel &&
g_PVRClients->IsConnectedClient(channel->ClientID()) &&
channel->LastWatched() > 0 &&
(!returnChannel || channel->LastWatched() > returnChannel->LastWatched()))
{
returnChannel = channel;
}
}
if (returnChannel)
{
CFileItemPtr retVal = CFileItemPtr(new CFileItem(*returnChannel));
return retVal;
}
CFileItemPtr retVal = CFileItemPtr(new CFileItem);
return retVal;
}
示例2: GetPreviousChannel
int CPVRManager::GetPreviousChannel(void)
{
CPVRChannelPtr currentChannel;
if (GetCurrentChannel(currentChannel))
{
CPVRChannelGroupPtr selectedGroup = GetPlayingGroup(currentChannel->IsRadio());
CFileItemPtr channel = selectedGroup->GetLastPlayedChannel(currentChannel->ChannelID());
if (channel && channel->HasPVRChannelInfoTag())
return channel->GetPVRChannelInfoTag()->ChannelNumber();
}
return -1;
}
示例3: GetChannelNumber
unsigned int CPVRChannelGroup::GetChannelNumber(const CPVRChannelPtr &channel) const
{
unsigned int iReturn(0);
CSingleLock lock(m_critSection);
for (std::vector<PVRChannelGroupMember>::const_iterator it = m_members.begin(); iReturn == 0 && it != m_members.end(); ++it)
{
if ((*it).channel->ChannelID() == channel->ChannelID())
iReturn = (*it).iChannelNumber;
}
return iReturn;
}
示例4: SelectChannel
bool CDVDInputStreamPVRManager::SelectChannel(const CPVRChannelPtr &channel)
{
assert(channel.get());
PVR_CLIENT client;
if (IsOtherStreamHack())
{
CFileItem item(channel);
return CloseAndOpen(item.GetPath().c_str());
}
else if (m_pLiveTV)
{
return m_pLiveTV->SelectChannelById(channel->ChannelID());
}
return false;
}
示例5: SelectChannel
bool CDVDInputStreamPVRManager::SelectChannel(const CPVRChannelPtr &channel)
{
assert(channel.get());
PVR_CLIENT client;
if (IsOtherStreamHack())
{
CFileItem item(channel);
return CloseAndOpen(item.GetPath());
}
else if (!m_isRecording)
{
return g_PVRManager.ChannelSwitchById(channel->ChannelID());
}
return false;
}
示例6: Record
JSONRPC_STATUS CPVROperations::Record(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
if (!g_PVRManager.IsStarted())
return FailedToExecute;
CPVRChannelPtr pChannel;
CVariant channel = parameterObject["channel"];
if (channel.isString() && channel.asString() == "current")
{
pChannel = g_PVRManager.GetCurrentChannel();
if (!pChannel)
return InternalError;
}
else if (channel.isInteger())
{
CPVRChannelGroupsContainer *channelGroupContainer = g_PVRManager.ChannelGroups();
if (channelGroupContainer == NULL)
return FailedToExecute;
pChannel = channelGroupContainer->GetChannelById((int)channel.asInteger());
}
else
return InvalidParams;
if (pChannel == NULL)
return InvalidParams;
else if (!pChannel->CanRecord())
return FailedToExecute;
CVariant record = parameterObject["record"];
bool toggle = true;
if (record.isBoolean() && record.asBoolean() == pChannel->IsRecording())
toggle = false;
if (toggle)
{
if (!g_PVRManager.ToggleRecordingOnChannel(pChannel->ChannelID()))
return FailedToExecute;
}
return ACK;
}
示例7: Initialize
void CGUIEPGGridContainerModel::Initialize(const std::unique_ptr<CFileItemList> &items, const CDateTime &gridStart, const CDateTime &gridEnd, int iRulerUnit, int iBlocksPerPage, float fBlockSize)
{
if (!m_channelItems.empty())
{
CLog::LogF(LOGERROR, "Already initialized!");
return;
}
////////////////////////////////////////////////////////////////////////
// Create programme & channel items
m_programmeItems.reserve(items->Size());
CFileItemPtr fileItem;
int iLastChannelID = -1;
ItemsPtr itemsPointer;
itemsPointer.start = 0;
CPVRChannelPtr channel;
int j = 0;
for (int i = 0; i < items->Size(); ++i)
{
fileItem = items->Get(i);
if (!fileItem->HasEPGInfoTag() || !fileItem->GetEPGInfoTag()->HasChannel())
continue;
m_programmeItems.emplace_back(fileItem);
channel = fileItem->GetEPGInfoTag()->Channel();
if (!channel)
continue;
int iCurrentChannelID = channel->ChannelID();
if (iCurrentChannelID != iLastChannelID)
{
if (j > 0)
{
itemsPointer.stop = j - 1;
m_epgItemsPtr.emplace_back(itemsPointer);
itemsPointer.start = j;
}
iLastChannelID = iCurrentChannelID;
m_channelItems.emplace_back(CFileItemPtr(new CFileItem(channel)));
}
++j;
}
if (!m_programmeItems.empty())
{
itemsPointer.stop = m_programmeItems.size() - 1;
m_epgItemsPtr.emplace_back(itemsPointer);
}
/* check for invalid start and end time */
if (gridStart >= gridEnd)
{
// default to start "now minus GRID_START_PADDING minutes" and end "start plus one page".
m_gridStart = CDateTime::GetUTCDateTime() - CDateTimeSpan(0, 0, GetGridStartPadding(), 0);
m_gridEnd = m_gridStart + CDateTimeSpan(0, 0, iBlocksPerPage * MINSPERBLOCK, 0);
}
else if (gridStart > (CDateTime::GetUTCDateTime() - CDateTimeSpan(0, 0, GetGridStartPadding(), 0)))
{
// adjust to start "now minus GRID_START_PADDING minutes".
m_gridStart = CDateTime::GetUTCDateTime() - CDateTimeSpan(0, 0, GetGridStartPadding(), 0);
m_gridEnd = gridEnd;
}
else
{
m_gridStart = gridStart;
m_gridEnd = gridEnd;
}
// roundup
m_gridStart = CDateTime(m_gridStart.GetYear(), m_gridStart.GetMonth(), m_gridStart.GetDay(), m_gridStart.GetHour(), m_gridStart.GetMinute() >= 30 ? 30 : 0, 0);
m_gridEnd = CDateTime(m_gridEnd.GetYear(), m_gridEnd.GetMonth(), m_gridEnd.GetDay(), m_gridEnd.GetHour(), m_gridEnd.GetMinute() >= 30 ? 30 : 0, 0);
////////////////////////////////////////////////////////////////////////
// Create ruler items
CDateTime ruler;
ruler.SetFromUTCDateTime(m_gridStart);
CDateTime rulerEnd;
rulerEnd.SetFromUTCDateTime(m_gridEnd);
CFileItemPtr rulerItem(new CFileItem(ruler.GetAsLocalizedDate(true)));
rulerItem->SetProperty("DateLabel", true);
m_rulerItems.emplace_back(rulerItem);
const CDateTimeSpan unit(0, 0, iRulerUnit * MINSPERBLOCK, 0);
for (; ruler < rulerEnd; ruler += unit)
{
rulerItem.reset(new CFileItem(ruler.GetAsLocalizedTime("", false)));
rulerItem->SetLabel2(ruler.GetAsLocalizedDate(true));
m_rulerItems.emplace_back(rulerItem);
}
FreeItemsMemory();
////////////////////////////////////////////////////////////////////////
// Create epg grid
const CDateTimeSpan blockDuration(0, 0, MINSPERBLOCK, 0);
const CDateTimeSpan gridDuration(m_gridEnd - m_gridStart);
m_blocks = (gridDuration.GetDays() * 24 * 60 + gridDuration.GetHours() * 60 + gridDuration.GetMinutes()) / MINSPERBLOCK;
if (m_blocks >= MAXBLOCKS)
m_blocks = MAXBLOCKS;
else if (m_blocks < iBlocksPerPage)
//.........这里部分代码省略.........
示例8: OnAction
//.........这里部分代码省略.........
CFileItem item(g_application.CurrentFileItem());
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)))