本文整理汇总了C++中CPVRChannel::IsRadio方法的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannel::IsRadio方法的具体用法?C++ CPVRChannel::IsRadio怎么用?C++ CPVRChannel::IsRadio使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPVRChannel
的用法示例。
在下文中一共展示了CPVRChannel::IsRadio方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Persist
bool CPVRDatabase::Persist(CPVRChannel &channel, bool bQueueWrite /* = false */)
{
bool bReturn(false);
/* invalid channel */
if (channel.UniqueID() <= 0)
{
CLog::Log(LOGERROR, "PVR - %s - invalid channel uid: %d", __FUNCTION__, channel.UniqueID());
return bReturn;
}
CStdString strQuery;
if (channel.ChannelID() <= 0)
{
/* new channel */
strQuery = FormatSQL("INSERT INTO channels ("
"iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsLocked, "
"sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, "
"iClientChannelNumber, sInputFormat, sStreamURL, iEncryptionSystem, idEpg) "
"VALUES (%i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, '%s', '%s', %i, %i)",
channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsLocked() ? 1 : 0),
channel.IconPath().c_str(), channel.ChannelName().c_str(), (channel.IsVirtual() ? 1 : 0), (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(),
channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem(),
channel.EpgID());
}
else
{
/* update channel */
strQuery = FormatSQL("REPLACE INTO channels ("
"iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsLocked, "
"sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, "
"iClientChannelNumber, sInputFormat, sStreamURL, iEncryptionSystem, idChannel, idEpg) "
"VALUES (%i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, '%s', '%s', %i, %i, %i)",
channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsLocked() ? 1 : 0),
channel.IconPath().c_str(), channel.ChannelName().c_str(), (channel.IsVirtual() ? 1 : 0), (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(),
channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem(), channel.ChannelID(),
channel.EpgID());
}
if (bQueueWrite)
{
QueueInsertQuery(strQuery);
bReturn = true;
}
else if (ExecuteQuery(strQuery))
{
CSingleLock lock(channel.m_critSection);
if (channel.m_iChannelId <= 0)
channel.m_iChannelId = (int)m_pDS->lastinsertid();
bReturn = true;
}
return bReturn;
}
示例2: Persist
bool CPVRDatabase::Persist(CPVRChannel &channel, bool bCommit)
{
bool bReturn(false);
/* invalid channel */
if (channel.UniqueID() <= 0)
{
CLog::LogF(LOGERROR, "Invalid channel uid: %d", channel.UniqueID());
return bReturn;
}
CSingleLock lock(m_critSection);
// Note: Do not use channel.ChannelID value to check presence of channel in channels table. It might not yet be set correctly.
std::string strQuery = PrepareSQL("iUniqueId = %u AND iClientId = %u", channel.UniqueID(), channel.ClientID());
const std::string strValue = GetSingleValue("channels", "idChannel", strQuery);
if (strValue.empty())
{
/* new channel */
strQuery = PrepareSQL("INSERT INTO channels ("
"iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsUserSetName, bIsLocked, "
"sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, "
"idEpg) "
"VALUES (%i, %i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i)",
channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsUserSetName() ? 1 : 0), (channel.IsLocked() ? 1 : 0),
channel.IconPath().c_str(), channel.ChannelName().c_str(), 0, (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), static_cast<unsigned int>(channel.LastWatched()), channel.ClientID(),
channel.EpgID());
}
else
{
/* update channel */
strQuery = PrepareSQL("REPLACE INTO channels ("
"iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsUserSetName, bIsLocked, "
"sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, "
"idChannel, idEpg) "
"VALUES (%i, %i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %s, %i)",
channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsUserSetName() ? 1 : 0), (channel.IsLocked() ? 1 : 0),
channel.IconPath().c_str(), channel.ChannelName().c_str(), 0, (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), static_cast<unsigned int>(channel.LastWatched()), channel.ClientID(),
strValue.c_str(),
channel.EpgID());
}
if (QueueInsertQuery(strQuery))
{
bReturn = true;
if (bCommit)
bReturn = CommitInsertQueries();
}
return bReturn;
}
示例3: UpdateChannel
long CPVRDatabase::UpdateChannel(const CPVRChannel &channel, bool bQueueWrite /* = false */)
{
long iReturn = -1;
/* invalid channel */
if (channel.UniqueID() <= 0)
{
CLog::Log(LOGERROR, "PVRDB - %s - invalid channel uid: %d",
__FUNCTION__, channel.UniqueID());
return iReturn;
}
CStdString strQuery;
if (channel.ChannelID() <= 0)
{
/* new channel */
strQuery = FormatSQL("INSERT INTO Channels ("
"UniqueId, ChannelNumber, GroupId, IsRadio, IsHidden, "
"IconPath, ChannelName, IsVirtual, EPGEnabled, EPGScraper, ClientId, "
"ClientChannelNumber, InputFormat, StreamURL, EncryptionSystem) "
"VALUES (%i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %i, %i, '%s', '%s', %i)\n",
channel.UniqueID(), channel.ChannelNumber(), channel.GroupID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0),
channel.IconPath().c_str(), channel.ChannelName().c_str(), (channel.IsVirtual() ? 1 : 0), (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.ClientID(),
channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem());
}
else
{
/* update channel */
strQuery = FormatSQL("REPLACE INTO Channels ("
"UniqueId, ChannelNumber, GroupId, IsRadio, IsHidden, "
"IconPath, ChannelName, IsVirtual, EPGEnabled, EPGScraper, ClientId, "
"ClientChannelNumber, InputFormat, StreamURL, EncryptionSystem, ChannelId) "
"VALUES (%i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %i, %i, '%s', '%s', %i, %i)\n",
channel.UniqueID(), channel.ChannelNumber(), channel.GroupID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0),
channel.IconPath().c_str(), channel.ChannelName().c_str(), (channel.IsVirtual() ? 1 : 0), (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.ClientID(),
channel.ClientChannelNumber(), channel.InputFormat().c_str(), channel.StreamURL().c_str(), channel.EncryptionSystem(), channel.ChannelID());
}
if (bQueueWrite)
{
QueueInsertQuery(strQuery);
iReturn = 0;
}
else if (ExecuteQuery(strQuery))
{
iReturn = (channel.ChannelID() <= 0) ? (long) m_pDS->lastinsertid() : channel.ChannelID();
}
return iReturn;
}
示例4: Persist
bool CPVRDatabase::Persist(CPVRChannel &channel)
{
bool bReturn(false);
/* invalid channel */
if (channel.UniqueID() <= 0)
{
CLog::Log(LOGERROR, "PVR - %s - invalid channel uid: %d", __FUNCTION__, channel.UniqueID());
return bReturn;
}
std::string strQuery;
if (channel.ChannelID() <= 0)
{
/* new channel */
strQuery = PrepareSQL("INSERT INTO channels ("
"iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsUserSetName, bIsLocked, "
"sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, "
"idEpg) "
"VALUES (%i, %i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i)",
channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsUserSetName() ? 1 : 0), (channel.IsLocked() ? 1 : 0),
channel.IconPath().c_str(), channel.ChannelName().c_str(), 0, (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(),
channel.EpgID());
}
else
{
/* update channel */
strQuery = PrepareSQL("REPLACE INTO channels ("
"iUniqueId, bIsRadio, bIsHidden, bIsUserSetIcon, bIsUserSetName, bIsLocked, "
"sIconPath, sChannelName, bIsVirtual, bEPGEnabled, sEPGScraper, iLastWatched, iClientId, "
"idChannel, idEpg) "
"VALUES (%i, %i, %i, %i, %i, %i, '%s', '%s', %i, %i, '%s', %u, %i, %i, %i)",
channel.UniqueID(), (channel.IsRadio() ? 1 :0), (channel.IsHidden() ? 1 : 0), (channel.IsUserSetIcon() ? 1 : 0), (channel.IsUserSetName() ? 1 : 0), (channel.IsLocked() ? 1 : 0),
channel.IconPath().c_str(), channel.ChannelName().c_str(), 0, (channel.EPGEnabled() ? 1 : 0), channel.EPGScraper().c_str(), channel.LastWatched(), channel.ClientID(),
channel.ChannelID(),
channel.EpgID());
}
if (QueueInsertQuery(strQuery))
{
/* update the channel ID for new channels */
if (channel.ChannelID() <= 0)
channel.SetChannelID((int)m_pDS->lastinsertid());
bReturn = true;
}
return bReturn;
}
示例5: OnContextButtonHide
bool CGUIWindowPVRChannels::OnContextButtonHide(CFileItem *item, CONTEXT_BUTTON button)
{
bool bReturn = false;
if (button == CONTEXT_BUTTON_HIDE)
{
CPVRChannel *channel = item->GetPVRChannelInfoTag();
if (!channel || channel->IsRadio() != m_bRadio)
return bReturn;
CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
if (!pDialog)
return bReturn;
pDialog->SetHeading(19039);
pDialog->SetLine(0, "");
pDialog->SetLine(1, channel->ChannelName());
pDialog->SetLine(2, "");
pDialog->DoModal();
if (!pDialog->IsConfirmed())
return bReturn;
g_PVRManager.GetPlayingGroup(m_bRadio)->RemoveFromGroup(*channel);
UpdateData();
bReturn = true;
}
return bReturn;
}
示例6: PlayFile
bool CGUIWindowPVRCommon::PlayFile(CFileItem *item, bool bPlayMinimized /* = false */)
{
if (item->m_bIsFolder)
{
return false;
}
if (item->GetPath() == g_application.CurrentFile())
{
CGUIMessage msg(GUI_MSG_FULLSCREEN, 0, m_parent->GetID());
g_windowManager.SendMessage(msg);
return true;
}
CMediaSettings::Get().SetVideoStartWindowed(bPlayMinimized);
if (item->HasPVRRecordingInfoTag())
{
return PlayRecording(item, bPlayMinimized);
}
else
{
bool bSwitchSuccessful(false);
CPVRChannel *channel = item->HasPVRChannelInfoTag() ? item->GetPVRChannelInfoTag() : NULL;
if (channel && 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)
{
CStdString msg;
CStdString channelName = g_localizeStrings.Get(19029); // Channel
if (channel)
channelName = channel->ChannelName();
msg.Format(g_localizeStrings.Get(19035).c_str(), channelName.c_str()); // CHANNELNAME could not be played. Check the log for details.
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error,
g_localizeStrings.Get(19166), // PVR information
msg);
return false;
}
}
return true;
}
示例7: ActionDeleteChannel
bool CGUIWindowPVRCommon::ActionDeleteChannel(CFileItem *item)
{
CPVRChannel *channel = item->GetPVRChannelInfoTag();
/* check if the channel tag is valid */
if (!channel || channel->ChannelNumber() <= 0)
return false;
/* show a confirmation dialog */
CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*) g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
if (pDialog)
return false;
pDialog->SetHeading(19039);
pDialog->SetLine(0, "");
pDialog->SetLine(1, channel->ChannelName());
pDialog->SetLine(2, "");
pDialog->DoModal();
/* prompt for the user's confirmation */
if (!pDialog->IsConfirmed())
return false;
g_PVRChannelGroups->GetGroupAll(channel->IsRadio())->RemoveFromGroup(*channel);
UpdateData();
return true;
}
示例8: Update
void CGUIDialogPVRChannelsOSD::Update()
{
// lock our display, as this window is rendered from the player thread
g_graphicsContext.Lock();
if (!IsObserving(g_infoManager))
g_infoManager.RegisterObserver(this);
m_viewControl.SetCurrentView(DEFAULT_VIEW_LIST);
// empty the list ready for population
Clear();
CPVRChannel channel;
g_PVRManager.GetCurrentChannel(channel);
const CPVRChannelGroup *group = g_PVRManager.GetPlayingGroup(channel.IsRadio());
if (group)
{
group->GetMembers(*m_vecItems);
m_viewControl.SetItems(*m_vecItems);
m_viewControl.SetSelectedItem(group->GetIndex(channel));
}
g_graphicsContext.Unlock();
}
示例9: 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;
}
示例10: OnContextButtonMove
bool CGUIWindowPVRChannels::OnContextButtonMove(CFileItem *item, CONTEXT_BUTTON button)
{
bool bReturn = false;
if (button == CONTEXT_BUTTON_MOVE)
{
CPVRChannel *channel = item->GetPVRChannelInfoTag();
if (!channel || channel->IsRadio() != m_bRadio)
return bReturn;
CStdString strIndex;
strIndex.Format("%i", channel->ChannelNumber());
CGUIDialogNumeric::ShowAndGetNumber(strIndex, g_localizeStrings.Get(19052));
int newIndex = atoi(strIndex.c_str());
if (newIndex != channel->ChannelNumber())
{
g_PVRManager.GetPlayingGroup()->MoveChannel(channel->ChannelNumber(), newIndex);
UpdateData();
}
bReturn = true;
}
return bReturn;
}
示例11: ChannelUpDown
bool CPVRManager::ChannelUpDown(unsigned int *iNewChannelNumber, bool bPreview, bool bUp)
{
bool bReturn = false;
if (IsPlayingTV() || IsPlayingRadio())
{
CFileItem currentFile(g_application.CurrentFileItem());
CPVRChannel *currentChannel = currentFile.GetPVRChannelInfoTag();
CPVRChannelGroupPtr group = GetPlayingGroup(currentChannel->IsRadio());
if (group)
{
CFileItemPtr newChannel = bUp ?
group->GetByChannelUp(*currentChannel) :
group->GetByChannelDown(*currentChannel);
if (newChannel && newChannel->HasPVRChannelInfoTag() &&
PerformChannelSwitch(*newChannel->GetPVRChannelInfoTag(), bPreview))
{
*iNewChannelNumber = newChannel->GetPVRChannelInfoTag()->ChannelNumber();
bReturn = true;
}
}
}
return bReturn;
}
示例12: ChannelSwitch
JSON_STATUS CPVROperations::ChannelSwitch(const CStdString &method, ITransportLayer *transport, IClient *client, const CVariant ¶meterObject, CVariant &result)
{
if (!g_PVRManager.IsStarted())
{
CLog::Log(LOGDEBUG, "JSONRPC: PVR not started");
return FailedToExecute;
}
int iChannelId = (int)parameterObject["channelid"].asInteger();
if (iChannelId <= 0)
return InvalidParams;
CLog::Log(LOGDEBUG, "JSONRPC: switch to channel '%d'", iChannelId);
const CPVRChannel *channel = g_PVRChannelGroups->GetByChannelIDFromAll(iChannelId);
if (channel == NULL)
return InternalError;
CPVRChannel currentChannel;
if (g_PVRManager.GetCurrentChannel(currentChannel) && currentChannel.IsRadio() == channel->IsRadio())
g_application.getApplicationMessenger().SendAction(CAction(ACTION_CHANNEL_SWITCH, (float)channel->ChannelNumber()));
else
g_application.getApplicationMessenger().MediaPlay(CFileItem(*channel));
return ACK;
}
示例13: DeleteTimersOnChannel
bool CPVRTimers::DeleteTimersOnChannel(const CPVRChannel &channel, bool bDeleteRepeating /* = true */, bool bCurrentlyActiveOnly /* = false */)
{
bool bReturn = false;
CSingleLock lock(m_critSection);
for (unsigned int ptr = 0; ptr < size(); ptr++)
{
CPVRTimerInfoTag *timer = at(ptr);
if (bCurrentlyActiveOnly &&
(CDateTime::GetCurrentDateTime() < timer->StartAsLocalTime() ||
CDateTime::GetCurrentDateTime() > timer->EndAsLocalTime()))
continue;
if (!bDeleteRepeating && timer->m_bIsRepeating)
continue;
if (timer->ChannelNumber() == channel.ChannelNumber() && timer->m_bIsRadio == channel.IsRadio())
{
bReturn = timer->DeleteFromClient(true) || bReturn;
erase(begin() + ptr);
ptr--;
}
}
return bReturn;
}
示例14: UpdateViewTimeline
void CGUIWindowPVRGuide::UpdateViewTimeline(void)
{
CPVRChannel CurrentChannel;
bool bGotCurrentChannel = g_PVRManager.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);
UpdateEpgCache(bRadio, false);
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 = g_PVREpg->GetFirstEPGDate(bRadio);
CDateTime lastDate = g_PVREpg->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);
}
示例15: SwitchChannel
bool CPVRClients::SwitchChannel(const CPVRChannel &channel)
{
{
CSingleLock lock(m_critSection);
if (m_bIsSwitchingChannels)
{
CLog::Log(LOGDEBUG, "PVRClients - %s - can't switch to channel '%s'. waiting for the previous switch to complete", __FUNCTION__, channel.ChannelName().c_str());
return false;
}
m_bIsSwitchingChannels = true;
}
bool bSwitchSuccessful(false);
CPVRChannelPtr currentChannel;
if (// no channel is currently playing
!GetPlayingChannel(currentChannel) ||
// different backend
currentChannel->ClientID() != channel.ClientID() ||
// different type
currentChannel->IsRadio() != channel.IsRadio() ||
// stream URL should always be opened as a new file
!channel.StreamURL().IsEmpty() || !currentChannel->StreamURL().IsEmpty())
{
if (channel.StreamURL().IsEmpty())
{
CloseStream();
bSwitchSuccessful = OpenStream(channel, true);
}
else
{
CFileItem m_currentFile(channel);
CApplicationMessenger::Get().PlayFile(m_currentFile, false);
bSwitchSuccessful = true;
}
}
// same channel
else if (currentChannel.get() && *currentChannel == channel)
{
bSwitchSuccessful = true;
}
else
{
PVR_CLIENT client;
if (GetConnectedClient(channel.ClientID(), client))
bSwitchSuccessful = client->SwitchChannel(channel);
}
{
CSingleLock lock(m_critSection);
m_bIsSwitchingChannels = false;
if (bSwitchSuccessful)
m_bIsValidChannelSettings = false;
}
if (!bSwitchSuccessful)
CLog::Log(LOGERROR, "PVR - %s - cannot switch to channel '%s' on client '%d'",__FUNCTION__, channel.ChannelName().c_str(), channel.ClientID());
return bSwitchSuccessful;
}