本文整理汇总了C++中CPVRChannel类的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannel类的具体用法?C++ CPVRChannel怎么用?C++ CPVRChannel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CPVRChannel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
bool CPVRChannelGroupInternal::AddToGroup(CPVRChannel &channel, int iChannelNumber /* = 0 */)
{
CSingleLock lock(m_critSection);
bool bReturn(false);
/* get the actual channel since this is called from a fileitemlist copy */
CPVRChannelPtr realChannel = GetByChannelID(channel.ChannelID());
if (!realChannel)
return bReturn;
/* switch the hidden flag */
if (realChannel->IsHidden())
{
realChannel->SetHidden(false);
m_iHiddenChannels--;
SortAndRenumber();
}
/* move this channel and persist */
bReturn = (iChannelNumber > 0l) ?
MoveChannel(realChannel->ChannelNumber(), iChannelNumber, true) :
MoveChannel(realChannel->ChannelNumber(), m_members.size() - m_iHiddenChannels, true);
if (m_bLoaded)
realChannel->Persist();
return bReturn;
}
示例2: at
int CPVREpgs::GetEPGAll(CFileItemList* results, bool bRadio /* = false */)
{
int iInitialSize = results->Size();
for (unsigned int iEpgPtr = 0; iEpgPtr < size(); iEpgPtr++)
{
CPVREpg *epg = at(iEpgPtr);
CPVRChannel *channel = at(iEpgPtr)->Channel();
if (!channel || channel->IsRadio() != bRadio)
continue;
epg->Get(results);
}
return results->Size() - iInitialSize;
}
示例3: ChannelHasTimers
bool CPVRTimers::ChannelHasTimers(const CPVRChannel &channel)
{
CSingleLock lock(m_critSection);
for (map<CDateTime, vector<CPVRTimerInfoTag *>* >::iterator it = m_tags.begin(); it != m_tags.end(); it++)
{
for (unsigned int iTimerPtr = 0; iTimerPtr < it->second->size(); iTimerPtr++)
{
CPVRTimerInfoTag *timer = it->second->at(iTimerPtr);
if (timer->ChannelNumber() == channel.ChannelNumber() && timer->m_bIsRadio == channel.IsRadio())
return true;
}
}
return false;
}
示例4: Clear
void CGUIDialogPVRGuideOSD::Update()
{
// lock our display, as this window is rendered from the player thread
g_graphicsContext.Lock();
m_viewControl.SetCurrentView(DEFAULT_VIEW_LIST);
// empty the list ready for population
Clear();
CPVRChannel CurrentChannel;
if (g_PVRManager.GetCurrentChannel(&CurrentChannel))
CurrentChannel.GetEPG(m_vecItems);
m_viewControl.SetItems(*m_vecItems);
g_graphicsContext.Unlock();
}
示例5: lock
bool CPVRChannelGroup::ToggleChannelLocked(const CFileItem &item)
{
if (!item.HasPVRChannelInfoTag())
return false;
CSingleLock lock(m_critSection);
/* get the real channel from the group */
CPVRChannel *channel = GetByUniqueID(item.GetPVRChannelInfoTag()->UniqueID());
if (!channel)
return false;
channel->SetLocked(!channel->IsLocked());
return true;
}
示例6: DeleteChannelSettings
bool CPVRDatabase::DeleteChannelSettings(const CPVRChannel &channel)
{
bool bReturn(false);
/* invalid channel */
if (channel.ChannelID() <= 0)
{
CLog::Log(LOGERROR, "PVR - %s - invalid channel id: %i", __FUNCTION__, channel.ChannelID());
return bReturn;
}
Filter filter;
filter.AppendWhere(PrepareSQL("idChannel = %u", channel.ChannelID()));
return DeleteValues("channelsettings", filter);
}
示例7: bSwitched
bool CPVRClient::SwitchChannel(const CPVRChannel &channel)
{
bool bSwitched(false);
if (IsPlayingLiveStream() && CanPlayChannel(channel))
{
PVR_CHANNEL tag;
WriteClientChannelInfo(channel, tag);
try
{
bSwitched = m_pStruct->SwitchChannel(tag);
}
catch (std::exception &e) { LogException(e, __FUNCTION__); }
}
if (bSwitched)
{
CPVRChannelPtr currentChannel = g_PVRChannelGroups->GetByUniqueID(channel.UniqueID(), channel.ClientID());
CSingleLock lock(m_critSection);
ResetQualityData(m_qualityInfo);
m_playingChannel = currentChannel;
}
return bSwitched;
}
示例8: Clear
void CGUIDialogPVRChannelsOSD::Update()
{
// lock our display, as this window is rendered from the player thread
g_graphicsContext.Lock();
m_viewControl.SetCurrentView(DEFAULT_VIEW_LIST);
// empty the list ready for population
Clear();
CPVRChannel channel;
CPVRManager::Get()->GetCurrentChannel(&channel);
CPVRManager::Get()->GetPlayingGroup(channel.IsRadio())->GetMembers(m_vecItems);
m_viewControl.SetItems(*m_vecItems);
m_viewControl.SetSelectedItem(channel.ChannelNumber() - 1);
g_graphicsContext.Unlock();
}
示例9: bGrabSuccess
bool CEpg::Update(const time_t start, const time_t end, int iUpdateTime, bool bForceUpdate /* = false */)
{
bool bGrabSuccess(true);
bool bUpdate(false);
/* load the entries from the db first */
if (!m_bLoaded && !g_EpgContainer.IgnoreDB())
Load();
/* clean up if needed */
if (m_bLoaded)
Cleanup();
/* get the last update time from the database */
CDateTime lastScanTime = GetLastScanTime();
if (!bForceUpdate)
{
/* check if we have to update */
time_t iNow = 0;
time_t iLastUpdate = 0;
CDateTime::GetCurrentDateTime().GetAsUTCDateTime().GetAsTime(iNow);
lastScanTime.GetAsTime(iLastUpdate);
bUpdate = (iNow > iLastUpdate + iUpdateTime);
}
else
bUpdate = true;
if (bUpdate)
bGrabSuccess = LoadFromClients(start, end);
if (bGrabSuccess)
{
CPVRChannel channel;
if (g_PVRManager.GetCurrentChannel(channel))
if (channel.EpgID() == m_iEpgID)
g_PVRManager.ResetPlayingTag();
m_bLoaded = true;
}
else
CLog::Log(LOGERROR, "EPG - %s - failed to update table '%s'", __FUNCTION__, Name().c_str());
CSingleLock lock(m_critSection);
m_bUpdatePending = false;
return bGrabSuccess;
}
示例10: UpdateViewTimeline
void CGUIWindowPVRGuide::UpdateViewTimeline(void)
{
CPVRChannel CurrentChannel;
bool bGotCurrentChannel = CPVRManager::Get()->GetCurrentChannel(&CurrentChannel);
bool bRadio = bGotCurrentChannel ? CurrentChannel.IsRadio() : false;
m_parent->SetLabel(m_iControlButton, g_localizeStrings.Get(19222) + ": " + g_localizeStrings.Get(19032));
m_parent->SetLabel(CONTROL_LABELGROUP, g_localizeStrings.Get(19032));
CSingleLock lock(m_critSection);
/* start observing the EPG for changes, so our cache becomes updated in the background */
if (!m_bObservingEpg)
{
CPVRManager::GetEpg()->AddObserver(this);
m_bObservingEpg = true;
}
if (!m_bGotInitialEpg)
InitializeEpgCache(bRadio);
if (bRadio != m_bLastEpgView)
{
m_epgData->Clear();
CPVRManager::GetEpg()->GetEPGAll(m_epgData, bRadio);
}
m_bLastEpgView = bRadio;
if (m_epgData->Size() <= 0)
return;
m_parent->m_guideGrid = (CGUIEPGGridContainer*) m_parent->GetControl(CONTROL_LIST_TIMELINE);
if (m_parent->m_guideGrid)
{
CDateTime gridStart = CDateTime::GetCurrentDateTime();
CDateTime firstDate = CPVRManager::GetEpg()->GetFirstEPGDate(bRadio);
CDateTime lastDate = CPVRManager::GetEpg()->GetLastEPGDate(bRadio);
/* copy over the cached epg data */
for (int iEpgPtr = 0; iEpgPtr < m_epgData->Size(); iEpgPtr++)
m_parent->m_vecItems->Add(m_epgData->Get(iEpgPtr));
m_parent->m_guideGrid->SetStartEnd(firstDate > gridStart ? firstDate : gridStart, lastDate);
m_parent->m_viewControl.SetCurrentView(CONTROL_LIST_TIMELINE);
}
//m_viewControl.SetSelectedItem(m_iSelected_GUIDE);
}
示例11: msg
bool CGUIWindowPVRCommon::PlayFile(CFileItem *item, bool bPlayMinimized /* = false */)
{
if (item->GetPath() == g_application.CurrentFile())
{
CGUIMessage msg(GUI_MSG_FULLSCREEN, 0, m_parent->GetID());
g_windowManager.SendMessage(msg);
return true;
}
g_settings.m_bStartVideoWindowed = bPlayMinimized;
if (item->GetPath().Left(17) == "pvr://recordings/")
{
return PlayRecording(item, bPlayMinimized);
}
else
{
bool bSwitchSuccessful(false);
CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
if (g_PVRManager.CheckParentalLock(*channel))
{
/* try a fast switch */
if (channel && (g_PVRManager.IsPlayingTV() || g_PVRManager.IsPlayingRadio()) &&
(channel->IsRadio() == g_PVRManager.IsPlayingRadio()) && g_application.m_pPlayer)
{
if (channel->StreamURL().IsEmpty())
bSwitchSuccessful = g_application.m_pPlayer->SwitchChannel(*channel);
}
if (!bSwitchSuccessful)
{
CApplicationMessenger::Get().PlayFile(*item, false);
return true;
}
}
if (!bSwitchSuccessful)
{
CGUIDialogOK::ShowAndGetInput(19033,0,19035,0);
return false;
}
}
return true;
}
示例12: IsRecordingOnChannel
bool CPVRTimers::IsRecordingOnChannel(const CPVRChannel &channel) const
{
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)
{
if ((*timerIt)->IsRecording() &&
(*timerIt)->m_iClientChannelUid == channel.UniqueID() &&
(*timerIt)->m_iClientId == channel.ClientID())
return true;
}
}
return false;
}
示例13: at
void CPVRChannelGroup::RemoveInvalidChannels(void)
{
for (unsigned int ptr = 0; ptr < size(); ptr--)
{
CPVRChannel *channel = at(ptr).channel;
if (channel->IsVirtual())
continue;
if (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());
erase(begin() + ptr);
ptr--;
m_bChanged = true;
continue;
}
if (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());
erase(begin() + ptr);
ptr--;
m_bChanged = true;
continue;
}
}
}
示例14: tempChannels
void CPVRChannels::MoveChannel(unsigned int iOldIndex, unsigned int iNewIndex)
{
if (iNewIndex == iOldIndex || iNewIndex == 0)
return;
CPVRDatabase *database = g_PVRManager.GetTVDatabase();
database->Open();
CPVRChannels tempChannels(m_bRadio);
/* move the channel */
tempChannels.push_back(at(iOldIndex - 1));
erase(begin() + iOldIndex - 1);
if (iNewIndex < size())
insert(begin() + iNewIndex - 1, tempChannels[0]);
else
push_back(tempChannels[0]);
/* update the channel numbers */
for (unsigned int ptr = 0; ptr < size(); ptr++)
{
CPVRChannel *channel = at(ptr);
if (channel->ChannelNumber() != (int) ptr + 1)
{
channel->SetChannelNumber(ptr + 1, true);
}
}
CLog::Log(LOGNOTICE, "%s - %s channel '%d' moved to '%d'",
__FUNCTION__, (m_bRadio ? "radio" : "tv"), iOldIndex, iNewIndex);
database->Close();
/* update the timers with the new channel numbers */
for (unsigned int ptr = 0; ptr < PVRTimers.size(); ptr++)
{
CPVRTimerInfoTag timer = PVRTimers[ptr];
CPVRChannel *tag = GetByClient(timer.Number(), timer.ClientID());
if (tag)
timer.SetNumber(tag->ChannelNumber());
}
m_bIsSorted = false;
}
示例15: CPVRTimerInfoTag
CPVRTimerInfoTag *CPVRTimerInfoTag::CreateFromEpg(const CEpgInfoTag &tag)
{
/* create a new timer */
CPVRTimerInfoTag *newTag = new CPVRTimerInfoTag();
if (!newTag)
{
CLog::Log(LOGERROR, "%s - couldn't create new timer", __FUNCTION__);
return NULL;
}
/* check if a valid channel is set */
CPVRChannel *channel = (CPVRChannel *) tag.ChannelTag();
if (channel == NULL)
{
CLog::Log(LOGERROR, "%s - no channel set", __FUNCTION__);
return NULL;
}
/* check if the epg end date is in the future */
if (tag.EndAsLocalTime() < CDateTime::GetCurrentDateTime())
{
CLog::Log(LOGERROR, "%s - end time is in the past", __FUNCTION__);
return NULL;
}
/* set the timer data */
CDateTime newStart = tag.StartAsUTC();
CDateTime newEnd = tag.EndAsUTC();
newTag->m_iClientIndex = -1;
newTag->m_strTitle = tag.Title().IsEmpty() ? channel->ChannelName() : tag.Title();
newTag->m_iChannelNumber = channel->ChannelNumber();
newTag->m_iClientChannelUid = channel->UniqueID();
newTag->m_iClientId = channel->ClientID();
newTag->m_bIsRadio = channel->IsRadio();
newTag->SetStartFromUTC(newStart);
newTag->SetEndFromUTC(newEnd);
if (tag.Plot().IsEmpty())
{
newTag->m_strSummary.Format("%s %s %s %s %s",
newTag->StartAsLocalTime().GetAsLocalizedDate(),
g_localizeStrings.Get(19159),
newTag->StartAsLocalTime().GetAsLocalizedTime("", false),
g_localizeStrings.Get(19160),
newTag->EndAsLocalTime().GetAsLocalizedTime("", false));
}
else
{
newTag->m_strSummary = tag.Plot();
}
/* we might have a copy of the tag here, so get the real one from the pvrmanager */
const CEpg *epgTable = channel->GetEPG();
newTag->m_epgInfo = epgTable ? epgTable->GetTag(tag.UniqueBroadcastID(), tag.StartAsUTC()) : NULL;
/* unused only for reference */
newTag->m_strFileNameAndPath = "pvr://timers/new";
return newTag;
}