本文整理汇总了C++中CPVRChannelPtr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ CPVRChannelPtr::get方法的具体用法?C++ CPVRChannelPtr::get怎么用?C++ CPVRChannelPtr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPVRChannelPtr
的用法示例。
在下文中一共展示了CPVRChannelPtr::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OpenStream
bool CPVRClients::OpenStream(const CPVRChannelPtr &channel, bool bIsSwitchingChannel)
{
assert(channel.get());
bool bReturn(false);
CloseStream();
/* try to open the stream on the client */
PVR_CLIENT client;
if (GetConnectedClient(channel->ClientID(), client) &&
client->OpenStream(channel, bIsSwitchingChannel))
{
CSingleLock lock(m_critSection);
m_playingClientId = channel->ClientID();
m_bIsPlayingLiveTV = true;
if (client.get())
m_strPlayingClientName = client->GetFriendlyName();
else
m_strPlayingClientName = g_localizeStrings.Get(13205);
bReturn = true;
}
return bReturn;
}
示例2: OpenLiveStream
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;
if ((bReturn = m_addons->OpenStream(*channel.GetPVRChannelInfoTag(), false)) != false)
{
CSingleLock lock(m_critSection);
if(m_currentFile)
delete m_currentFile;
m_currentFile = new CFileItem(channel);
// set channel as selected item
if (channel.HasPVRChannelInfoTag())
CGUIWindowPVRBase::SetSelectedItemPath(channel.GetPVRChannelInfoTag()->IsRadio(), channel.GetPVRChannelInfoTag()->Path());
CPVRChannelPtr playingChannel;
if (m_addons->GetPlayingChannel(playingChannel))
UpdateLastWatched(*playingChannel.get());
}
return bReturn;
}
示例3: UpdateFromClient
bool CPVRChannel::UpdateFromClient(const CPVRChannelPtr &channel)
{
assert(channel.get());
SetClientID(channel->ClientID());
SetStreamURL(channel->StreamURL());
CSingleLock lock(m_critSection);
if (m_iClientChannelNumber.channel != channel->ClientChannelNumber() ||
m_iClientChannelNumber.subchannel != channel->ClientSubChannelNumber() ||
m_strInputFormat != channel->InputFormat() ||
m_iClientEncryptionSystem != channel->EncryptionSystem() ||
m_strClientChannelName != channel->ClientChannelName())
{
m_iClientChannelNumber.channel = channel->ClientChannelNumber();
m_iClientChannelNumber.subchannel = channel->ClientSubChannelNumber();
m_strInputFormat = channel->InputFormat();
m_iClientEncryptionSystem = channel->EncryptionSystem();
m_strClientChannelName = channel->ClientChannelName();
UpdateEncryptionName();
SetChanged();
}
// only update the channel name and icon if the user hasn't changed them manually
if (m_strChannelName.empty() || !IsUserSetName())
SetChannelName(channel->ClientChannelName());
if (m_strIconPath.empty() || !IsUserSetIcon())
SetIconPath(channel->IconPath());
return m_bChanged;
}
示例4: 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;
}
示例5: CanPlayChannel
bool CPVRClient::CanPlayChannel(const CPVRChannelPtr &channel) const
{
assert(channel.get());
return (m_bReadyToUse &&
((m_addonCapabilities.bSupportsTV && !channel->IsRadio()) ||
(m_addonCapabilities.bSupportsRadio && channel->IsRadio())));
}
示例6: SwitchChannel
bool CPVRClients::SwitchChannel(const CPVRChannelPtr &channel)
{
assert(channel.get());
{
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(GetPlayingChannel());
if (// no channel is currently playing
!currentChannel ||
// different backend
currentChannel->ClientID() != channel->ClientID() ||
// stream URL should always be opened as a new file
!channel->StreamURL().empty() || !currentChannel->StreamURL().empty())
{
if (channel->StreamURL().empty())
{
CloseStream();
bSwitchSuccessful = OpenStream(channel, true);
}
else
{
CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, 0, 0, static_cast<void*>(new CFileItem(channel)));
bSwitchSuccessful = true;
}
}
// same channel
else if (currentChannel && 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)
CLog::Log(LOGERROR, "PVR - %s - cannot switch to channel '%s' on client '%d'",__FUNCTION__, channel->ChannelName().c_str(), channel->ClientID());
return bSwitchSuccessful;
}
示例7: UpdateViewChannel
void CGUIWindowPVRGuide::UpdateViewChannel()
{
CPVRChannelPtr currentChannel;
bool bGotCurrentChannel = g_PVRManager.GetCurrentChannel(currentChannel);
if (bGotCurrentChannel && currentChannel.get())
SET_CONTROL_LABEL(CONTROL_LABEL_HEADER1, currentChannel->ChannelName().c_str());
SET_CONTROL_LABEL(CONTROL_LABEL_HEADER2, GetGroup()->GroupName());
m_vecItems->Clear();
if ((!bGotCurrentChannel || g_PVRManager.GetCurrentEpg(*m_vecItems) == 0) && currentChannel.get())
{
CFileItemPtr item;
item.reset(new CFileItem("pvr://guide/" + currentChannel->ChannelName() + "/empty.epg", false));
item->SetLabel(g_localizeStrings.Get(19028));
item->SetLabelPreformated(true);
m_vecItems->Add(item);
}
m_viewControl.SetItems(*m_vecItems);
}
示例8: GetStreamURL
std::string CPVRClients::GetStreamURL(const CPVRChannelPtr &channel)
{
assert(channel.get());
std::string strReturn;
PVR_CLIENT client;
if (GetConnectedClient(channel->ClientID(), client))
strReturn = client->GetLiveStreamURL(channel);
else
CLog::Log(LOGERROR, "PVR - %s - cannot find client %d",__FUNCTION__, channel->ClientID());
return strReturn;
}
示例9: GetEPGForChannel
PVR_ERROR CPVRClients::GetEPGForChannel(const CPVRChannelPtr &channel, CEpg *epg, time_t start, time_t end)
{
assert(channel.get());
PVR_ERROR error(PVR_ERROR_UNKNOWN);
PVR_CLIENT client;
if (GetConnectedClient(channel->ClientID(), client))
error = client->GetEPGForChannel(channel, epg, start, end);
if (error != PVR_ERROR_NO_ERROR)
CLog::Log(LOGERROR, "PVR - %s - cannot get EPG for channel '%s' from client '%d': %s",__FUNCTION__, channel->ChannelName().c_str(), channel->ClientID(), CPVRClient::ToString(error));
return error;
}
示例10: 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;
}
示例11: CloseStream
void CPVRManager::CloseStream(void)
{
CSingleLock lock(m_critSection);
CPVRChannelPtr channel;
if (m_addons->GetPlayingChannel(channel))
{
UpdateLastWatched(*channel.get());
// store channel settings
g_application.SaveFileState();
}
m_addons->CloseStream();
SAFE_DELETE(m_currentFile);
}
示例12: UpdateLastWatched
void CPVRManager::UpdateLastWatched(const CPVRChannelPtr &channel)
{
assert(channel.get());
time_t tNow;
CDateTime::GetCurrentDateTime().GetAsTime(tNow);
channel->SetLastWatched(tNow);
// update last watched timestamp for group
CPVRChannelGroupPtr group(GetPlayingGroup(channel->IsRadio()));
group->SetLastWatched(tNow);
/* update last played group */
m_channelGroups->SetLastPlayedGroup(group);
}
示例13: 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;
}
示例14: 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;
}
示例15: 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);
}