本文整理汇总了C++中PVR_CLIENT类的典型用法代码示例。如果您正苦于以下问题:C++ PVR_CLIENT类的具体用法?C++ PVR_CLIENT怎么用?C++ PVR_CLIENT使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PVR_CLIENT类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SupportsRecordingPlayCount
bool CPVRClients::SupportsRecordingPlayCount(int iClientId) const
{
PVR_CLIENT client;
return GetConnectedClient(iClientId, client) && client->SupportsRecordingPlayCount();
}
示例2: SupportsTV
bool CPVRClients::SupportsTV(int iClientId) const
{
PVR_CLIENT client;
return GetConnectedClient(iClientId, client) && client->SupportsTV();
}
示例3: GetConnectedClients
void CPVRClients::ProcessMenuHooks(int iClientID, PVR_MENUHOOK_CAT cat, const CFileItem *item)
{
// get client id
if (iClientID < 0 && cat == PVR_MENUHOOK_SETTING)
{
PVR_CLIENTMAP clients;
GetConnectedClients(clients);
if (clients.size() == 1)
{
iClientID = clients.begin()->first;
}
else if (clients.size() > 1)
{
// have user select client
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetHeading(CVariant{19196});
PVR_CLIENTMAP_CITR itrClients;
for (itrClients = clients.begin(); itrClients != clients.end(); itrClients++)
{
pDialog->Add(itrClients->second->GetBackendName());
}
pDialog->Open();
int selection = pDialog->GetSelectedLabel();
if (selection >= 0)
{
itrClients = clients.begin();
for (int i = 0; i < selection; i++)
itrClients++;
iClientID = itrClients->first;
}
}
}
if (iClientID < 0)
iClientID = GetPlayingClientID();
PVR_CLIENT client;
if (GetConnectedClient(iClientID, client) && client->HaveMenuHooks(cat))
{
PVR_MENUHOOKS *hooks = client->GetMenuHooks();
std::vector<int> hookIDs;
int selection = 0;
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetHeading(CVariant{19196});
for (unsigned int i = 0; i < hooks->size(); i++)
if (hooks->at(i).category == cat || hooks->at(i).category == PVR_MENUHOOK_ALL)
{
pDialog->Add(client->GetString(hooks->at(i).iLocalizedStringId));
hookIDs.push_back(i);
}
if (hookIDs.size() > 1)
{
pDialog->Open();
selection = pDialog->GetSelectedLabel();
}
if (selection >= 0)
client->CallMenuHook(hooks->at(hookIDs.at(selection)), item);
}
}
示例4: SupportsLastPlayedPosition
bool CPVRClients::SupportsLastPlayedPosition(int iClientId) const
{
PVR_CLIENT client;
return GetConnectedClient(iClientId, client) && client->SupportsLastPlayedPosition();
}
示例5: ConnectionStateChange
void CPVRClients::ConnectionStateChange(int clientId, std::string &strConnectionString, PVR_CONNECTION_STATE newState,
std::string &strMessage)
{
PVR_CLIENT client;
if (!GetClient(clientId, client))
{
CLog::Log(LOGDEBUG, "PVR - %s - invalid client id", __FUNCTION__);
return;
}
if (strConnectionString.empty())
{
CLog::Log(LOGERROR, "PVR - %s - invalid handler data", __FUNCTION__);
return;
}
int iMsg(-1);
bool bError(true);
bool bNotify(true);
switch (newState)
{
case PVR_CONNECTION_STATE_SERVER_UNREACHABLE:
iMsg = 35505; // Server is unreachable
break;
case PVR_CONNECTION_STATE_SERVER_MISMATCH:
iMsg = 35506; // Server does not respond properly
break;
case PVR_CONNECTION_STATE_VERSION_MISMATCH:
iMsg = 35507; // Server version is not compatible
break;
case PVR_CONNECTION_STATE_ACCESS_DENIED:
iMsg = 35508; // Access denied
break;
case PVR_CONNECTION_STATE_CONNECTED:
bError = false;
iMsg = 36034; // Connection established
if (client->GetPreviousConnectionState() == PVR_CONNECTION_STATE_UNKNOWN ||
client->GetPreviousConnectionState() == PVR_CONNECTION_STATE_CONNECTING)
bNotify = false;
break;
case PVR_CONNECTION_STATE_DISCONNECTED:
iMsg = 36030; // Connection lost
break;
case PVR_CONNECTION_STATE_CONNECTING:
bError = false;
iMsg = 35509; // Connecting
bNotify = false;
break;
default:
CLog::Log(LOGERROR, "PVR - %s - unknown connection state", __FUNCTION__);
return;
}
// Use addon-supplied message, if present
std::string strMsg;
if (!strMessage.empty())
strMsg = strMessage;
else
strMsg = g_localizeStrings.Get(iMsg);
// Notify user.
if (bNotify && !CSettings::GetInstance().GetBool(CSettings::SETTING_PVRMANAGER_HIDECONNECTIONLOSTWARNING))
CGUIDialogKaiToast::QueueNotification(bError ? CGUIDialogKaiToast::Error : CGUIDialogKaiToast::Info, client->Name().c_str(),
strMsg, 5000, true);
// Write event log entry.
CEventLog::GetInstance().Add(EventPtr(new CNotificationEvent(client->Name(), strMsg, client->Icon(),
bError ? EventLevel::Error : EventLevel::Information)));
if (newState == PVR_CONNECTION_STATE_CONNECTED)
{
// update properties on connect
if (!client->GetAddonProperties())
{
CLog::Log(LOGERROR, "PVR - %s - error reading properties", __FUNCTION__);
}
g_PVRManager.Start();
}
}
示例6: GetPlayingRecording
CPVRRecordingPtr CPVRClients::GetPlayingRecording(void) const
{
PVR_CLIENT client;
return GetPlayingClient(client) ? client->GetPlayingRecording() : CPVRRecordingPtr();
}
示例7: bReturn
bool CPVRClients::UpdateAndInitialiseClients(bool bInitialiseAllClients /* = false */)
{
bool bReturn(true);
VECADDONS map;
VECADDONS disableAddons;
{
CSingleLock lock(m_critSection);
map = m_addons;
}
if (map.empty())
return false;
for (VECADDONS::iterator it = map.begin(); it != map.end(); ++it)
{
bool bEnabled = (*it)->Enabled() &&
!CAddonMgr::GetInstance().IsAddonDisabled((*it)->ID());
if (!bEnabled && IsKnownClient(*it))
{
CSingleLock lock(m_critSection);
/* stop the client and remove it from the db */
StopClient(*it, false);
disableAddons.push_back(*it);
}
else if (bEnabled && (bInitialiseAllClients || !IsKnownClient(*it) || !IsConnectedClient(*it)))
{
bool bDisabled(false);
// register the add-on in the pvr db, and create the CPVRClient instance
int iClientId = RegisterClient(*it);
if (iClientId <= 0)
{
// failed to register or create the add-on, disable it
CLog::Log(LOGWARNING, "%s - failed to register add-on %s, disabling it", __FUNCTION__, (*it)->Name().c_str());
disableAddons.push_back(*it);
bDisabled = true;
}
else
{
ADDON_STATUS status(ADDON_STATUS_UNKNOWN);
PVR_CLIENT addon;
{
CSingleLock lock(m_critSection);
if (!GetClient(iClientId, addon))
{
CLog::Log(LOGWARNING, "%s - failed to find add-on %s, disabling it", __FUNCTION__, (*it)->Name().c_str());
disableAddons.push_back(*it);
bDisabled = true;
}
}
// throttle connection attempts, no more than 1 attempt per 5 seconds
if (!bDisabled && addon->Enabled())
{
time_t now;
CDateTime::GetCurrentDateTime().GetAsTime(now);
std::map<int, time_t>::iterator it = m_connectionAttempts.find(iClientId);
if (it != m_connectionAttempts.end() && now < it->second)
continue;
m_connectionAttempts[iClientId] = now + 5;
}
// re-check the enabled status. newly installed clients get disabled when they're added to the db
if (!bDisabled && addon->Enabled() && (status = addon->Create(iClientId)) != ADDON_STATUS_OK)
{
CLog::Log(LOGWARNING, "%s - failed to create add-on %s, status = %d", __FUNCTION__, (*it)->Name().c_str(), status);
if (!addon.get() || !addon->DllLoaded() || status == ADDON_STATUS_PERMANENT_FAILURE)
{
// failed to load the dll of this add-on, disable it
CLog::Log(LOGWARNING, "%s - failed to load the dll for add-on %s, disabling it", __FUNCTION__, (*it)->Name().c_str());
disableAddons.push_back(*it);
bDisabled = true;
}
}
}
if (bDisabled && (g_PVRManager.IsStarted() || g_PVRManager.IsInitialising()))
CGUIDialogOK::ShowAndGetInput(CVariant{24070}, CVariant{16029});
}
}
// disable add-ons that failed to initialise
if (!disableAddons.empty())
{
CSingleLock lock(m_critSection);
for (VECADDONS::iterator it = disableAddons.begin(); it != disableAddons.end(); ++it)
{
// disable in the add-on db
CAddonMgr::GetInstance().DisableAddon((*it)->ID());
// remove from the pvr add-on list
VECADDONS::iterator addonPtr = std::find(m_addons.begin(), m_addons.end(), *it);
if (addonPtr != m_addons.end())
m_addons.erase(addonPtr);
}
}
return bReturn;
//.........这里部分代码省略.........
示例8: GetConnectedClient
bool CPVRClients::GetConnectedClient(int iClientId, PVR_CLIENT &addon) const
{
if (GetClient(iClientId, addon))
return addon->ReadyToUse();
return false;
}
示例9: GetConnectedClients
void CPVRClients::ProcessMenuHooks(int iClientID, PVR_MENUHOOK_CAT cat)
{
PVR_MENUHOOKS *hooks = NULL;
// get client id
if (iClientID < 0 && cat == PVR_MENUHOOK_SETTING)
{
PVR_CLIENTMAP clients;
GetConnectedClients(clients);
if (clients.size() == 1)
{
iClientID = clients.begin()->first;
}
else if (clients.size() > 1)
{
// have user select client
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetHeading(19196);
PVR_CLIENTMAP_ITR itrClients;
for (itrClients = clients.begin(); itrClients != clients.end(); itrClients++)
{
pDialog->Add(itrClients->second->GetBackendName());
}
pDialog->DoModal();
int selection = pDialog->GetSelectedLabel();
if (selection >= 0)
{
itrClients = clients.begin();
for (int i = 0; i < selection; i++)
itrClients++;
iClientID = itrClients->first;
}
}
}
if (iClientID < 0)
iClientID = GetPlayingClientID();
PVR_CLIENT client;
if (GetConnectedClient(iClientID, client) && client->HaveMenuHooks(cat))
{
hooks = client->GetMenuHooks();
int selection = 0;
if (hooks->size() > 1)
{
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetHeading(19196);
for (unsigned int i = 0; i < hooks->size(); i++)
pDialog->Add(client->GetString(hooks->at(i).iLocalizedStringId));
pDialog->DoModal();
selection = pDialog->GetSelectedLabel();
}
if (selection >= 0)
client->CallMenuHook(hooks->at(selection));
}
}
示例10: SupportsChannelSwitch
bool CDVDInputStreamPVRManager::SupportsChannelSwitch(void)
{
PVR_CLIENT client;
return g_PVRClients->GetPlayingClient(client) &&
client->HandlesInputStream();
}
示例11: SupportsTimers
bool CPVRClients::SupportsTimers(int iClientId) const
{
PVR_CLIENT client;
return GetCreatedClient(iClientId, client) && client->SupportsTimers();
}
示例12: SupportsRecordingEdl
bool CPVRClients::SupportsRecordingEdl(int iClientId) const
{
PVR_CLIENT client;
return GetCreatedClient(iClientId, client) && client->SupportsRecordingEdl();
}
示例13: SupportsChannelScan
bool CPVRClients::SupportsChannelScan(int iClientId) const
{
PVR_CLIENT client;
return GetCreatedClient(iClientId, client) && client->SupportsChannelScan();
}
示例14: HandlesDemuxing
bool CPVRClients::HandlesDemuxing(int iClientId) const
{
PVR_CLIENT client;
return GetConnectedClient(iClientId, client) && client->HandlesDemuxing();
}
示例15: HandlesInputStream
bool CPVRClients::HandlesInputStream(int iClientId) const
{
PVR_CLIENT client;
return GetConnectedClient(iClientId, client) && client->HandlesInputStream();
}