本文整理汇总了C++中CPVRChannelPtr::UniqueID方法的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannelPtr::UniqueID方法的具体用法?C++ CPVRChannelPtr::UniqueID怎么用?C++ CPVRChannelPtr::UniqueID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPVRChannelPtr
的用法示例。
在下文中一共展示了CPVRChannelPtr::UniqueID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddToGroup
bool CPVRChannelGroup::AddToGroup(const CPVRChannelPtr &channel, int iChannelNumber /* = 0 */)
{
CSingleLock lock(m_critSection);
bool bReturn(false);
if (!CPVRChannelGroup::IsGroupMember(channel))
{
if (iChannelNumber <= 0 || iChannelNumber > (int) m_members.size() + 1)
iChannelNumber = m_members.size() + 1;
CPVRChannelPtr realChannel = (IsInternalGroup()) ?
GetByClient(channel->UniqueID(), channel->ClientID()) :
g_PVRChannelGroups->GetGroupAll(m_bRadio)->GetByClient(channel->UniqueID(), channel->ClientID());
if (realChannel)
{
PVRChannelGroupMember newMember = { realChannel, (unsigned int)iChannelNumber };
m_members.push_back(newMember);
m_bChanged = true;
SortAndRenumber();
// TODO notify observers
bReturn = true;
}
}
return bReturn;
}
示例2: RemoveDeletedChannels
bool CPVRChannelGroup::RemoveDeletedChannels(const CPVRChannelGroup &channels)
{
bool bReturn(false);
CSingleLock lock(m_critSection);
/* check for deleted channels */
for (int iChannelPtr = m_members.size() - 1; iChannelPtr >= 0; iChannelPtr--)
{
CPVRChannelPtr channel = m_members.at(iChannelPtr).channel;
if (!channel)
continue;
if (channels.GetByClient(channel->UniqueID(), channel->ClientID()) == NULL)
{
/* channel was not found */
CLog::Log(LOGINFO,"PVRChannelGroup - %s - deleted %s channel '%s' from group '%s'",
__FUNCTION__, m_bRadio ? "radio" : "TV", channel->ChannelName().c_str(), GroupName().c_str());
/* remove this channel from all non-system groups if this is the internal group */
if (IsInternalGroup())
{
g_PVRChannelGroups->Get(m_bRadio)->RemoveFromAllGroups(*channel);
/* since it was not found in the internal group, it was deleted from the backend */
channel->Delete();
}
m_members.erase(m_members.begin() + iChannelPtr);
m_bChanged = true;
bReturn = true;
}
}
return bReturn;
}
示例3: UpdateSummary
CPVRTimerInfoTag::CPVRTimerInfoTag(const PVR_TIMER &timer, const CPVRChannelPtr &channel, unsigned int iClientId) :
m_strTitle(timer.strTitle),
m_strDirectory(timer.strDirectory)
{
m_iClientId = iClientId;
m_iClientIndex = timer.iClientIndex;
m_iClientChannelUid = channel ? channel->UniqueID() : timer.iClientChannelUid;
m_iChannelNumber = channel ? g_PVRChannelGroups->GetGroupAll(channel->IsRadio())->GetChannelNumber(channel) : 0;
m_StartTime = timer.startTime + g_advancedSettings.m_iPVRTimeCorrection;
m_StopTime = timer.endTime + g_advancedSettings.m_iPVRTimeCorrection;
m_bIsRepeating = timer.bIsRepeating;
m_FirstDay = timer.firstDay + g_advancedSettings.m_iPVRTimeCorrection;
m_iWeekdays = timer.iWeekdays;
m_iPriority = timer.iPriority;
m_iLifetime = timer.iLifetime;
m_iMarginStart = timer.iMarginStart;
m_iMarginEnd = timer.iMarginEnd;
m_genre = StringUtils::Split(CEpg::ConvertGenreIdToString(timer.iGenreType, timer.iGenreSubType), g_advancedSettings.m_videoItemSeparator);
m_iGenreType = timer.iGenreType;
m_iGenreSubType = timer.iGenreSubType;
CEpgInfoTagPtr emptyTag;
m_epgTag = emptyTag;
m_channel = channel;
m_bIsRadio = channel && channel->IsRadio();
m_state = timer.state;
m_strFileNameAndPath = StringUtils::Format("pvr://client%i/timers/%i", m_iClientId, m_iClientIndex);
m_iTimerId = 0;
UpdateSummary();
}
示例4: GetTimerForEpgTag
CFileItemPtr CPVRTimers::GetTimerForEpgTag(const CFileItem *item) const
{
if (item && item->HasEPGInfoTag() && item->GetEPGInfoTag()->ChannelTag())
{
const CEpgInfoTagPtr epgTag(item->GetEPGInfoTag());
const CPVRChannelPtr channel(epgTag->ChannelTag());
CSingleLock lock(m_critSection);
for (MapTags::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it)
{
for (VecTimerInfoTag::const_iterator timerIt = it->second->begin(); timerIt != it->second->end(); ++timerIt)
{
CPVRTimerInfoTagPtr timer = *timerIt;
if (timer->GetEpgInfoTag() == epgTag ||
(timer->m_iClientChannelUid == channel->UniqueID() &&
timer->m_bIsRadio == channel->IsRadio() &&
timer->StartAsUTC() <= epgTag->StartAsUTC() &&
timer->EndAsUTC() >= epgTag->EndAsUTC()))
{
CFileItemPtr fileItem(new CFileItem(timer));
return fileItem;
}
}
}
}
CFileItemPtr fileItem;
return fileItem;
}
示例5: CreateInstantTimerTag
CPVRTimerInfoTagPtr CPVRTimerInfoTag::CreateInstantTimerTag(const CPVRChannelPtr &channel)
{
if (!channel)
{
CLog::Log(LOGERROR, "%s - no channel set", __FUNCTION__);
return CPVRTimerInfoTagPtr();
}
CEpgInfoTagPtr epgTag(channel->GetEPGNow());
CPVRTimerInfoTagPtr newTimer;
if (epgTag)
newTimer = CreateFromEpg(epgTag);
if (!newTimer)
{
newTimer.reset(new CPVRTimerInfoTag);
newTimer->m_iClientIndex = PVR_TIMER_NO_CLIENT_INDEX;
newTimer->m_iParentClientIndex = PVR_TIMER_NO_PARENT;
newTimer->m_channel = channel;
newTimer->m_strTitle = channel->ChannelName();
newTimer->m_iChannelNumber = channel->ChannelNumber();
newTimer->m_iClientChannelUid = channel->UniqueID();
newTimer->m_iClientId = channel->ClientID();
newTimer->m_bIsRadio = channel->IsRadio();
// timertype: manual one-shot timer for given client
CPVRTimerTypePtr timerType(CPVRTimerType::CreateFromAttributes(
PVR_TIMER_TYPE_IS_MANUAL, PVR_TIMER_TYPE_IS_REPEATING | PVR_TIMER_TYPE_FORBIDS_NEW_INSTANCES, channel->ClientID()));
if (!timerType)
{
CLog::Log(LOGERROR, "%s - unable to create one shot manual timer type", __FUNCTION__);
return CPVRTimerInfoTagPtr();
}
newTimer->SetTimerType(timerType);
}
// no matter the timer was created from an epg tag, set special instant timer start and end times.
CDateTime startTime(0);
newTimer->SetStartFromUTC(startTime);
newTimer->m_iMarginStart = 0; /* set the start margin to 0 for instant timers */
int iDuration = CSettings::GetInstance().GetInt(CSettings::SETTING_PVRRECORD_INSTANTRECORDTIME);
CDateTime endTime = CDateTime::GetUTCDateTime() + CDateTimeSpan(0, 0, iDuration ? iDuration : 120, 0);
newTimer->SetEndFromUTC(endTime);
/* update summary string according to changed start/end time */
newTimer->UpdateSummary();
/* set epg tag at timer & timer at epg tag */
newTimer->UpdateEpgInfoTag();
/* unused only for reference */
newTimer->m_strFileNameAndPath = CPVRTimersPath::PATH_NEW;
return newTimer;
}
示例6: InstantTimer
bool CPVRTimers::InstantTimer(const CPVRChannelPtr &channel)
{
assert(channel.get());
if (!g_PVRManager.CheckParentalLock(channel))
return false;
CEpgInfoTagPtr epgTag(channel->GetEPGNow());
CPVRTimerInfoTagPtr newTimer;
if (epgTag)
newTimer = CPVRTimerInfoTag::CreateFromEpg(epgTag);
if (!newTimer)
{
newTimer.reset(new CPVRTimerInfoTag);
/* set the timer data */
newTimer->m_iClientIndex = -1;
newTimer->m_strTitle = channel->ChannelName();
newTimer->m_strSummary = g_localizeStrings.Get(19056);
newTimer->m_iChannelNumber = channel->ChannelNumber();
newTimer->m_iClientChannelUid = channel->UniqueID();
newTimer->m_iClientId = channel->ClientID();
newTimer->m_bIsRadio = channel->IsRadio();
/* generate summary string */
newTimer->m_strSummary = StringUtils::Format("%s %s %s %s %s",
newTimer->StartAsLocalTime().GetAsLocalizedDate().c_str(),
g_localizeStrings.Get(19159).c_str(),
newTimer->StartAsLocalTime().GetAsLocalizedTime("", false).c_str(),
g_localizeStrings.Get(19160).c_str(),
newTimer->EndAsLocalTime().GetAsLocalizedTime("", false).c_str());
}
CDateTime startTime(0);
newTimer->SetStartFromUTC(startTime);
newTimer->m_iMarginStart = 0; /* set the start margin to 0 for instant timers */
int iDuration = CSettings::GetInstance().GetInt(CSettings::SETTING_PVRRECORD_INSTANTRECORDTIME);
CDateTime endTime = CDateTime::GetUTCDateTime() + CDateTimeSpan(0, 0, iDuration ? iDuration : 120, 0);
newTimer->SetEndFromUTC(endTime);
/* unused only for reference */
newTimer->m_strFileNameAndPath = CPVRTimersPath::PATH_NEW;
bool bReturn = newTimer->AddToClient();
if (!bReturn)
CLog::Log(LOGERROR, "PVRTimers - %s - unable to add an instant timer on the client", __FUNCTION__);
return bReturn;
}
示例7: OpenStream
bool CPVRClient::OpenStream(const CPVRChannelPtr &channel, bool bIsSwitchingChannel)
{
bool bReturn(false);
CloseStream();
if(!CanPlayChannel(channel))
{
CLog::Log(LOGDEBUG, "add-on '%s' can not play channel '%s'", GetFriendlyName().c_str(), channel->ChannelName().c_str());
}
else if (!channel->StreamURL().empty())
{
CLog::Log(LOGDEBUG, "opening live stream on url '%s'", channel->StreamURL().c_str());
bReturn = true;
// the Njoy N7 sometimes doesn't switch channels, but opens a stream to the previous channel
// when not waiting for a short period.
// added in 1.1.0
AddonVersion checkVersion("1.1.0");
if (m_apiVersion >= checkVersion)
{
unsigned int iWaitTimeMs = m_pStruct->GetChannelSwitchDelay();
if (iWaitTimeMs > 0)
XbmcThreads::ThreadSleep(iWaitTimeMs);
}
}
else
{
CLog::Log(LOGDEBUG, "opening live stream for channel '%s'", channel->ChannelName().c_str());
PVR_CHANNEL tag;
WriteClientChannelInfo(channel, tag);
try
{
bReturn = m_pStruct->OpenLiveStream(tag);
}
catch (std::exception &e) { LogException(e, __FUNCTION__); }
}
if (bReturn)
{
CPVRChannelPtr currentChannel(g_PVRChannelGroups->GetByUniqueID(channel->UniqueID(), channel->ClientID()));
CSingleLock lock(m_critSection);
m_playingChannel = currentChannel;
m_bIsPlayingTV = true;
m_bIsPlayingRecording = false;
}
return bReturn;
}
示例8: FindChannelAndBlockIndex
void CGUIEPGGridContainerModel::FindChannelAndBlockIndex(int channelUid, unsigned int broadcastUid, int eventOffset, int &newChannelIndex, int &newBlockIndex) const
{
const CDateTimeSpan blockDuration(0, 0, MINSPERBLOCK, 0);
bool bFoundPrevChannel = false;
for (size_t channel = 0; channel < m_channelItems.size(); ++channel)
{
CDateTime gridCursor(m_gridStart); //reset cursor for new channel
unsigned long progIdx = m_epgItemsPtr[channel].start;
unsigned long lastIdx = m_epgItemsPtr[channel].stop;
int iEpgId = m_programmeItems[progIdx]->GetEPGInfoTag()->EpgID();
CEpgInfoTagPtr tag;
CPVRChannelPtr chan;
for (int block = 0; block < m_blocks; ++block)
{
while (progIdx <= lastIdx)
{
tag = m_programmeItems[progIdx]->GetEPGInfoTag();
if (tag->EpgID() != iEpgId || gridCursor < tag->StartAsUTC() || m_gridEnd <= tag->StartAsUTC())
break; // next block
if (gridCursor < tag->EndAsUTC())
{
if (broadcastUid > 0 && tag->UniqueBroadcastID() == broadcastUid)
{
newChannelIndex = channel;
newBlockIndex = block + eventOffset;
return; // both found. done.
}
if (!bFoundPrevChannel && channelUid > -1)
{
chan = tag->ChannelTag();
if (chan && chan->UniqueID() == channelUid)
{
newChannelIndex = channel;
bFoundPrevChannel = true;
}
}
break; // next block
}
progIdx++;
}
gridCursor += blockDuration;
}
}
}
示例9: GetActiveTimerForChannel
CPVRTimerInfoTagPtr CPVRTimers::GetActiveTimerForChannel(const CPVRChannelPtr &channel) const
{
CSingleLock lock(m_critSection);
for (const auto &tagsEntry : m_tags)
{
for (const auto &timersEntry : *tagsEntry.second)
{
if (timersEntry->IsRecording() &&
timersEntry->m_iClientChannelUid == channel->UniqueID() &&
timersEntry->m_iClientId == channel->ClientID())
return timersEntry;
}
}
return CPVRTimerInfoTagPtr();
}
示例10: WriteClientChannelInfo
/*!
* @brief Copy over channel info from xbmcChannel to addonClient.
* @param xbmcChannel The channel on XBMC's side.
* @param addonChannel The channel on the addon's side.
*/
void CPVRClient::WriteClientChannelInfo(const CPVRChannelPtr &xbmcChannel, PVR_CHANNEL &addonChannel)
{
assert(xbmcChannel.get());
memset(&addonChannel, 0, sizeof(addonChannel));
addonChannel.iUniqueId = xbmcChannel->UniqueID();
addonChannel.iChannelNumber = xbmcChannel->ClientChannelNumber();
addonChannel.iSubChannelNumber = xbmcChannel->ClientSubChannelNumber();
strncpy(addonChannel.strChannelName, xbmcChannel->ClientChannelName().c_str(), sizeof(addonChannel.strChannelName) - 1);
strncpy(addonChannel.strIconPath, xbmcChannel->IconPath().c_str(), sizeof(addonChannel.strIconPath) - 1);
addonChannel.iEncryptionSystem = xbmcChannel->EncryptionSystem();
addonChannel.bIsRadio = xbmcChannel->IsRadio();
addonChannel.bIsHidden = xbmcChannel->IsHidden();
strncpy(addonChannel.strInputFormat, xbmcChannel->InputFormat().c_str(), sizeof(addonChannel.strInputFormat) - 1);
strncpy(addonChannel.strStreamURL, xbmcChannel->StreamURL().c_str(), sizeof(addonChannel.strStreamURL) - 1);
}
示例11: RemoveInvalidChannels
void CPVRChannelGroup::RemoveInvalidChannels(void)
{
CPVRChannelPtr channel;
CSingleLock lock(m_critSection);
for (PVR_CHANNEL_GROUP_SORTED_MEMBERS::iterator it = m_sortedMembers.begin(); it != m_sortedMembers.end();)
{
bool bDelete = false;
channel = (*it).channel;
if (channel->ClientChannelNumber() <= 0)
{
CLog::Log(LOGERROR, "PVRChannelGroup - %s - removing invalid channel '%s' from client '%i': no valid client channel number",
__FUNCTION__, channel->ChannelName().c_str(), channel->ClientID());
bDelete = true;
}
if (!bDelete && channel->UniqueID() <= 0)
{
CLog::Log(LOGERROR, "PVRChannelGroup - %s - removing invalid channel '%s' from client '%i': no valid unique ID",
__FUNCTION__, channel->ChannelName().c_str(), channel->ClientID());
bDelete = true;
}
/* remove this channel from all non-system groups if this is the internal group */
if (bDelete)
{
if (IsInternalGroup())
{
g_PVRChannelGroups->Get(m_bRadio)->RemoveFromAllGroups(channel);
channel->Delete();
}
else
{
m_members.erase(channel->StorageId());
it = m_sortedMembers.erase(it);
}
m_bChanged = true;
}
else
{
++it;
}
}
}
示例12: SwitchChannel
bool CPVRClient::SwitchChannel(const CPVRChannelPtr &channel)
{
bool bSwitched(false);
if (IsPlayingLiveStream() && CanPlayChannel(channel))
{
PVR_CHANNEL tag;
WriteClientChannelInfo(channel, tag);
bSwitched = m_struct.SwitchChannel(tag);
}
if (bSwitched)
{
CPVRChannelPtr currentChannel(g_PVRChannelGroups->GetByUniqueID(channel->UniqueID(), channel->ClientID()));
CSingleLock lock(m_critSection);
m_playingChannel = currentChannel;
}
return bSwitched;
}
示例13: RemoveInvalidChannels
void CPVRChannelGroup::RemoveInvalidChannels(void)
{
bool bDelete(false);
CSingleLock lock(m_critSection);
for (unsigned int ptr = 0; ptr < m_members.size(); ptr--)
{
bDelete = false;
CPVRChannelPtr channel = m_members.at(ptr).channel;
if (channel->IsVirtual())
continue;
if (m_members.at(ptr).channel->ClientChannelNumber() <= 0)
{
CLog::Log(LOGERROR, "PVRChannelGroup - %s - removing invalid channel '%s' from client '%i': no valid client channel number",
__FUNCTION__, channel->ChannelName().c_str(), channel->ClientID());
bDelete = true;
}
if (!bDelete && channel->UniqueID() <= 0)
{
CLog::Log(LOGERROR, "PVRChannelGroup - %s - removing invalid channel '%s' from client '%i': no valid unique ID",
__FUNCTION__, channel->ChannelName().c_str(), channel->ClientID());
bDelete = true;
}
/* remove this channel from all non-system groups if this is the internal group */
if (bDelete)
{
if (IsInternalGroup())
{
g_PVRChannelGroups->Get(m_bRadio)->RemoveFromAllGroups(*channel);
channel->Delete();
}
else
{
m_members.erase(m_members.begin() + ptr);
}
m_bChanged = true;
}
}
}
示例14: InitializeChannelsList
void CGUIDialogPVRTimerSettings::InitializeChannelsList()
{
m_channelEntries.clear();
CFileItemList channelsList;
g_PVRChannelGroups->GetGroupAll(m_bIsRadio)->GetMembers(channelsList);
for (int i = 0; i < channelsList.Size(); ++i)
{
const CPVRChannelPtr channel(channelsList[i]->GetPVRChannelInfoTag());
std::string channelDescription(
StringUtils::Format("%i %s", channel->ChannelNumber(), channel->ChannelName().c_str()));
m_channelEntries.insert(
std::make_pair(i, ChannelDescriptor(channel->UniqueID(), channel->ClientID(), channelDescription)));
}
// Add special "any channel" entry (used for epg-based repeating timers).
m_channelEntries.insert(
std::make_pair(
ENTRY_ANY_CHANNEL, ChannelDescriptor(PVR_CHANNEL_INVALID_UID, 0, g_localizeStrings.Get(809))));
}
示例15: GetTimerForEpgTag
CPVRTimerInfoTagPtr CPVRTimers::GetTimerForEpgTag(const CEpgInfoTagPtr &epgTag) const
{
if (epgTag)
{
// already a timer assigned to tag?
CPVRTimerInfoTagPtr timer(epgTag->Timer());
if (timer)
return timer;
// try to find a matching timer for the tag.
if (epgTag->ChannelTag())
{
const CPVRChannelPtr channel(epgTag->ChannelTag());
CSingleLock lock(m_critSection);
for (MapTags::const_iterator it = m_tags.begin(); it != m_tags.end(); ++it)
{
for (VecTimerInfoTag::const_iterator timerIt = it->second->begin(); timerIt != it->second->end(); ++timerIt)
{
timer = *timerIt;
if (!timer->IsRepeating() &&
(timer->GetEpgInfoTag(false) == epgTag ||
(timer->m_iEpgUid != EPG_TAG_INVALID_UID && timer->m_iEpgUid == epgTag->UniqueBroadcastID()) ||
(timer->m_iClientChannelUid == channel->UniqueID() &&
timer->m_bIsRadio == channel->IsRadio() &&
timer->StartAsUTC() <= epgTag->StartAsUTC() &&
timer->EndAsUTC() >= epgTag->EndAsUTC())))
{
return timer;
}
}
}
}
}
return CPVRTimerInfoTagPtr();
}