本文整理汇总了C++中CPVRChannelPtr类的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannelPtr类的具体用法?C++ CPVRChannelPtr怎么用?C++ CPVRChannelPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CPVRChannelPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: bReturn
bool CPVRChannelGroup::AddAndUpdateChannels(const CPVRChannelGroup &channels, bool bUseBackendChannelNumbers)
{
bool bReturn(false);
bool bPreventSortAndRenumber(PreventSortAndRenumber());
CSingleLock lock(m_critSection);
SetPreventSortAndRenumber();
/* go through the channel list and check for new channels.
channels will only by updated in CPVRChannelGroupInternal to prevent dupe updates */
for (unsigned int iChannelPtr = 0; iChannelPtr < channels.m_members.size(); iChannelPtr++)
{
PVRChannelGroupMember member = channels.m_members.at(iChannelPtr);
if (!member.channel)
continue;
/* check whether this channel is known in the internal group */
CPVRChannelPtr existingChannel = g_PVRChannelGroups->GetGroupAll(m_bRadio)->GetByClient(member.channel->UniqueID(), member.channel->ClientID());
if (!existingChannel)
continue;
/* if it's found, add the channel to this group */
if (!IsGroupMember(*existingChannel))
{
int iChannelNumber = bUseBackendChannelNumbers ? member.channel->ClientChannelNumber() : 0;
AddToGroup(*existingChannel, iChannelNumber);
bReturn = true;
CLog::Log(LOGINFO,"PVRChannelGroup - %s - added %s channel '%s' at position %d in group '%s'",
__FUNCTION__, m_bRadio ? "radio" : "TV", existingChannel->ChannelName().c_str(), iChannelNumber, GroupName().c_str());
}
}
SetPreventSortAndRenumber(bPreventSortAndRenumber);
SortAndRenumber();
return bReturn;
}
示例3: UpdateFromClient
CPVRChannelPtr CPVRChannelGroupInternal::UpdateFromClient(const CPVRChannelPtr &channel, unsigned int iChannelNumber /* = 0 */)
{
assert(channel.get());
CSingleLock lock(m_critSection);
const PVRChannelGroupMember& realChannel(GetByUniqueID(channel->StorageId()));
if (realChannel.channel)
{
realChannel.channel->UpdateFromClient(channel);
return realChannel.channel;
}
else
{
PVRChannelGroupMember newMember = { channel, iChannelNumber > 0l ? iChannelNumber : (int)m_sortedMembers.size() + 1 };
channel->UpdatePath(this);
m_sortedMembers.push_back(newMember);
m_members.insert(std::make_pair(channel->StorageId(), newMember));
m_bChanged = true;
SortAndRenumber();
}
return channel;
}
示例4: GetPVRClient
void CAddonCallbacksPVR::PVRTriggerEpgUpdate(void *addonData, unsigned int iChannelUid)
{
// get the client
CPVRClient *client = GetPVRClient(addonData);
if (!client)
{
CLog::Log(LOGERROR, "PVR - %s - invalid handler data", __FUNCTION__);
return;
}
// get the channel
CPVRChannelPtr channel = g_PVRChannelGroups->GetByUniqueID(iChannelUid, client->GetID());
CEpg* epg(NULL);
// get the EPG for the channel
if (!channel || (epg = channel->GetEPG()) == NULL)
{
CLog::Log(LOGERROR, "PVR - %s - invalid channel or channel doesn't have an EPG", __FUNCTION__);
return;
}
// force an update
epg->ForceUpdate();
}
示例5: ActionPlayEpg
bool CGUIWindowPVRCommon::ActionPlayEpg(CFileItem *item)
{
bool bReturn = false;
CEpgInfoTag *epgTag = item->GetEPGInfoTag();
if (!epgTag)
return bReturn;
CPVRChannelPtr channel = epgTag->ChannelTag();
if (!channel || channel->ChannelNumber() > 0 ||
!g_PVRManager.CheckParentalLock(*channel))
return bReturn;
bReturn = g_application.PlayFile(CFileItem(*channel));
if (!bReturn)
{
/* cannot play file */
CGUIDialogOK::ShowAndGetInput(19033,0,19035,0);
}
return bReturn;
}
示例6: timer
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() == epgTag ||
(timer->m_iClientChannelUid == channel->UniqueID() &&
timer->m_bIsRadio == channel->IsRadio() &&
timer->StartAsUTC() <= epgTag->StartAsUTC() &&
timer->EndAsUTC() >= epgTag->EndAsUTC())))
{
return timer;
}
}
}
}
}
return CPVRTimerInfoTagPtr();
}
示例7: Close
bool CGUIDialogPVRGuideInfo::OnClickButtonPlay(CGUIMessage &message)
{
bool bReturn = false;
if (message.GetSenderId() == CONTROL_BTN_SWITCH || message.GetSenderId() == CONTROL_BTN_PLAY_RECORDING)
{
Close();
PlayBackRet ret = PLAYBACK_CANCELED;
CEpgInfoTagPtr epgTag(m_progItem->GetEPGInfoTag());
if (epgTag)
{
if (message.GetSenderId() == CONTROL_BTN_PLAY_RECORDING && epgTag->HasRecording())
ret = g_application.PlayFile(CFileItem(epgTag->Recording()), "videoplayer");
else if (epgTag->HasPVRChannel())
{
CPVRChannelPtr channel = epgTag->ChannelTag();
// try a fast switch
bool bSwitchSuccessful = false;
if ((g_PVRManager.IsPlayingTV() || g_PVRManager.IsPlayingRadio()) &&
(channel->IsRadio() == g_PVRManager.IsPlayingRadio()))
{
if (channel->StreamURL().empty())
bSwitchSuccessful = g_application.m_pPlayer->SwitchChannel(channel);
}
if (!bSwitchSuccessful)
{
CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, 0, 0, static_cast<void*>(new CFileItem(channel)), "videoplayer");
}
}
}
bReturn = true;
}
return bReturn;
}
示例8: CloseStream
void CPVRManager::CloseStream(void)
{
CPVRChannelPtr channel;
CPVRChannelGroupPtr group;
bool bPersistChanges(false);
{
CSingleLock lock(m_critSection);
if (m_addons->GetPlayingChannel(channel))
{
time_t tNow;
CDateTime::GetCurrentDateTime().GetAsTime(tNow);
/* update last watched timestamp for channel */
channel->SetLastWatched(tNow);
/* update last watched timestamp for group */
group = g_PVRManager.GetPlayingGroup(channel->IsRadio());
group->SetLastWatched(tNow);
/* update last played group */
m_channelGroups->SetLastPlayedGroup(group);
bPersistChanges = true;
}
m_addons->CloseStream();
SAFE_DELETE(m_currentFile);
}
if (bPersistChanges)
{
channel->Persist();
group->Persist();
}
}
示例9: bReturn
bool CPVRManager::OpenLiveStream(const CFileItem &channel)
{
bool bReturn(false);
if (!channel.HasPVRChannelInfoTag())
return bReturn;
CLog::Log(LOGDEBUG,"PVRManager - %s - opening live stream on channel '%s'",
__FUNCTION__, channel.GetPVRChannelInfoTag()->ChannelName().c_str());
// check if we're allowed to play this file
if (IsParentalLocked(*channel.GetPVRChannelInfoTag()))
return bReturn;
CPVRChannelPtr playingChannel;
bool bPersistChannel(false);
if ((bReturn = m_addons->OpenStream(*channel.GetPVRChannelInfoTag(), false)) != false)
{
CSingleLock lock(m_critSection);
if(m_currentFile)
delete m_currentFile;
m_currentFile = new CFileItem(channel);
if (m_addons->GetPlayingChannel(playingChannel))
{
/* store current time in iLastWatched */
time_t tNow;
CDateTime::GetCurrentDateTime().GetAsTime(tNow);
playingChannel->SetLastWatched(tNow);
bPersistChannel = true;
}
}
if (bPersistChannel)
playingChannel->Persist();
return bReturn;
}
示例10: bReturn
bool CPVRDatabase::PersistChannels(CPVRChannelGroup &group)
{
bool bReturn(true);
CPVRChannelPtr channel;
for (const auto& groupMember : group.m_members)
{
channel = groupMember.second.channel;
if (channel->IsChanged() || channel->IsNew())
{
if (Persist(*channel, false))
{
groupMember.second.channel->Persisted();
bReturn = true;
}
}
}
bReturn &= CommitInsertQueries();
if (bReturn)
{
std::string strQuery;
std::string strValue;
for (const auto& groupMember : group.m_members)
{
channel = groupMember.second.channel;
strQuery = PrepareSQL("iUniqueId = %u AND iClientId = %u", channel->UniqueID(), channel->ClientID());
strValue = GetSingleValue("channels", "idChannel", strQuery);
if (!strValue.empty() && StringUtils::IsInteger(strValue))
channel->SetChannelID(atoi(strValue.c_str()));
}
}
return bReturn;
}
示例11: lock
void CPVRTimers::UpdateEpgEvent(CPVRTimerInfoTagPtr timer)
{
CSingleLock lock(timer->m_critSection);
/* repeating timers have no epg event */
if (timer->IsRepeating())
return;
/* already got an epg event set */
if (timer->m_epgTag)
return;
/* try to get the channel */
CPVRChannelPtr channel = g_PVRChannelGroups->GetByUniqueID(timer->m_iClientChannelUid, timer->m_iClientId);
if (!channel)
return;
/* try to get the EPG table */
CEpgPtr epg = channel->GetEPG();
if (!epg)
return;
/* try to set the timer on the epg tag that matches with a 2 minute margin */
CEpgInfoTagPtr epgTag = epg->GetTagBetween(timer->StartAsUTC() - CDateTimeSpan(0, 0, 2, 0), timer->EndAsUTC() + CDateTimeSpan(0, 0, 2, 0));
if (!epgTag)
epgTag = epg->GetTagAround(timer->StartAsUTC());
if (epgTag)
{
timer->m_epgTag = epgTag;
timer->m_genre = epgTag->Genre();
timer->m_iGenreType = epgTag->GenreType();
timer->m_iGenreSubType = epgTag->GenreSubType();
epgTag->SetTimer(timer);
}
}
示例12: GetBroadcasts
JSONRPC_STATUS CPVROperations::GetBroadcasts(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
if (!g_PVRManager.IsStarted())
return FailedToExecute;
CPVRChannelGroupsContainer *channelGroupContainer = g_PVRManager.ChannelGroups();
if (channelGroupContainer == NULL)
return FailedToExecute;
CPVRChannelPtr channel = channelGroupContainer->GetChannelById((int)parameterObject["channelid"].asInteger());
if (channel == NULL)
return InvalidParams;
CEpg *channelEpg = channel->GetEPG();
if (channelEpg == NULL)
return InternalError;
CFileItemList programFull;
channelEpg->Get(programFull);
HandleFileItemList("broadcastid", false, "broadcasts", programFull, parameterObject, result, programFull.Size(), true);
return OK;
}
示例13: lock
bool CPVRChannelGroupInternal::RemoveFromGroup(const CPVRChannelPtr &channel)
{
CSingleLock lock(m_critSection);
assert(channel.get());
if (!IsGroupMember(channel))
return false;
/* check if this channel is currently playing if we are hiding it */
CPVRChannelPtr currentChannel(g_PVRManager.GetCurrentChannel());
if (currentChannel && currentChannel == channel)
{
CGUIDialogOK::ShowAndGetInput(CVariant{19098}, CVariant{19102});
return false;
}
/* switch the hidden flag */
if (!channel->IsHidden())
{
channel->SetHidden(true);
++m_iHiddenChannels;
}
else
{
channel->SetHidden(false);
if (m_iHiddenChannels > 0)
--m_iHiddenChannels;
}
/* renumber this list */
SortAndRenumber();
/* and persist */
return channel->Persist() &&
Persist();
}
示例14: CloseStream
void CPVRManager::CloseStream(void)
{
CPVRChannelPtr channel;
bool bPersistChannel(false);
{
CSingleLock lock(m_critSection);
if (m_addons->GetPlayingChannel(channel))
{
/* store current time in iLastWatched */
time_t tNow;
CDateTime::GetCurrentDateTime().GetAsTime(tNow);
channel->SetLastWatched(tNow);
bPersistChannel = true;
}
m_addons->CloseStream();
SAFE_DELETE(m_currentFile);
}
if (bPersistChannel)
channel->Persist();
}
示例15: CreateChannelEpg
CEpgPtr CEpgContainer::CreateChannelEpg(const CPVRChannelPtr &channel)
{
if (!channel)
return CEpgPtr();
WaitForUpdateFinish(true);
LoadFromDB();
CEpgPtr epg;
if (channel->EpgID() > 0)
epg = GetById(channel->EpgID());
if (!epg)
{
channel->SetEpgID(NextEpgId());
epg.reset(new CEpg(channel, false));
CSingleLock lock(m_critSection);
m_epgs.insert(std::make_pair((unsigned int)epg->EpgID(), epg));
SetChanged();
epg->RegisterObserver(this);
}
epg->SetChannel(channel);
{
CSingleLock lock(m_critSection);
m_bPreventUpdates = false;
CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(m_iNextEpgUpdate);
}
CSingleExit ex(m_critSection);
NotifyObservers(ObservableMessageEpgContainer);
return epg;
}