本文整理汇总了C++中CFileItemPtr::GetPVRRecordingInfoTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemPtr::GetPVRRecordingInfoTag方法的具体用法?C++ CFileItemPtr::GetPVRRecordingInfoTag怎么用?C++ CFileItemPtr::GetPVRRecordingInfoTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemPtr
的用法示例。
在下文中一共展示了CFileItemPtr::GetPVRRecordingInfoTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetContextButtons
void CGUIWindowPVRRecordings::GetContextButtons(int itemNumber, CContextButtons &buttons) const
{
if (itemNumber < 0 || itemNumber >= m_parent->m_vecItems->Size())
return;
CFileItemPtr pItem = m_parent->m_vecItems->Get(itemNumber);
if (pItem->HasPVRRecordingInfoTag())
{
buttons.Add(CONTEXT_BUTTON_INFO, 19053); /* Get Information of this recording */
buttons.Add(CONTEXT_BUTTON_FIND, 19003); /* Find similar program */
buttons.Add(CONTEXT_BUTTON_PLAY_ITEM, 12021); /* Play this recording */
CStdString resumeString = GetResumeString(*pItem);
if (!resumeString.IsEmpty())
{
buttons.Add(CONTEXT_BUTTON_RESUME_ITEM, resumeString);
}
}
if (pItem->m_bIsFolder)
{
// Have both options for folders since we don't know whether all childs are watched/unwatched
buttons.Add(CONTEXT_BUTTON_MARK_UNWATCHED, 16104); /* Mark as UnWatched */
buttons.Add(CONTEXT_BUTTON_MARK_WATCHED, 16103); /* Mark as Watched */
}
if (pItem->HasPVRRecordingInfoTag())
{
if (pItem->GetPVRRecordingInfoTag()->m_playCount > 0)
buttons.Add(CONTEXT_BUTTON_MARK_UNWATCHED, 16104); /* Mark as UnWatched */
else
buttons.Add(CONTEXT_BUTTON_MARK_WATCHED, 16103); /* Mark as Watched */
buttons.Add(CONTEXT_BUTTON_RENAME, 118); /* Rename this recording */
buttons.Add(CONTEXT_BUTTON_DELETE, 117); /* Delete this recording */
}
buttons.Add(CONTEXT_BUTTON_SORTBY_NAME, 103); /* sort by name */
buttons.Add(CONTEXT_BUTTON_SORTBY_DATE, 104); /* sort by date */
if (pItem->HasPVRRecordingInfoTag() &&
g_PVRClients->HasMenuHooks(pItem->GetPVRRecordingInfoTag()->m_iClientId, PVR_MENUHOOK_RECORDING))
buttons.Add(CONTEXT_BUTTON_MENU_HOOKS, 19195); /* PVR client specific action */
// Update sort by button
//if (m_guiState->GetSortMethod()!=SORT_METHOD_NONE)
//{
// CStdString sortLabel;
// sortLabel.Format(g_localizeStrings.Get(550).c_str(), g_localizeStrings.Get(m_guiState->GetSortMethodLabel()).c_str());
// buttons.Add(CONTEXT_BUTTON_SORTBY, sortLabel); /* Sort method */
//
// if (m_guiState->GetDisplaySortOrder()==SORT_ORDER_ASC)
// buttons.Add(CONTEXT_BUTTON_SORTASC, 584); /* Sort up or down */
// else
// buttons.Add(CONTEXT_BUTTON_SORTASC, 585); /* Sort up or down */
//}
}
示例2: OnPlaybackStarted
void CPVRManager::OnPlaybackStarted(const CFileItemPtr item)
{
m_playingChannel.reset();
m_playingRecording.reset();
m_playingEpgTag.reset();
if (item->HasPVRChannelInfoTag())
{
const CPVRChannelPtr channel(item->GetPVRChannelInfoTag());
m_playingChannel = channel;
SetPlayingGroup(channel);
UpdateLastWatched(channel);
}
else if (item->HasPVRRecordingInfoTag())
{
m_playingRecording = item->GetPVRRecordingInfoTag();
}
else if (item->HasEPGInfoTag())
{
m_playingEpgTag = item->GetEPGInfoTag();
}
m_guiActions->OnPlaybackStarted(item);
}
示例3: Open
bool CPVRFile::Open(const CURL& url)
{
Close();
if (!g_PVRManager.IsStarted())
return false;
std::string strURL = url.Get();
if (StringUtils::StartsWith(strURL, "pvr://channels/tv/") ||
StringUtils::StartsWith(strURL, "pvr://channels/radio/"))
{
CFileItemPtr tag = g_PVRChannelGroups->GetByPath(strURL);
if (tag && tag->HasPVRChannelInfoTag())
{
if (!g_PVRManager.OpenLiveStream(*tag))
return false;
m_isPlayRecording = false;
CLog::Log(LOGDEBUG, "PVRFile - %s - playback has started on filename %s", __FUNCTION__, strURL.c_str());
}
else
{
CLog::Log(LOGERROR, "PVRFile - %s - channel not found with filename %s", __FUNCTION__, strURL.c_str());
return false;
}
}
else if (StringUtils::StartsWith(strURL, "pvr://recordings/active"))
{
CFileItemPtr tag = g_PVRRecordings->GetByPath(strURL);
if (tag && tag->HasPVRRecordingInfoTag())
{
if (!g_PVRManager.OpenRecordedStream(tag->GetPVRRecordingInfoTag()))
return false;
m_isPlayRecording = true;
CLog::Log(LOGDEBUG, "%s - playback has started on recording %s (%s)", __FUNCTION__, strURL.c_str(), tag->GetPVRRecordingInfoTag()->m_strIconPath.c_str());
}
else
{
CLog::Log(LOGERROR, "PVRFile - Recording not found with filename %s", strURL.c_str());
return false;
}
}
else if (StringUtils::StartsWith(strURL, "pvr://recordings/deleted/"))
{
CLog::Log(LOGNOTICE, "PVRFile - Playback of deleted recordings is not possible (%s)", strURL.c_str());
return false;
}
else
{
CLog::Log(LOGERROR, "%s - invalid path specified %s", __FUNCTION__, strURL.c_str());
return false;
}
return true;
}
示例4: OnContextButton
bool CGUIWindowPVRBase::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
{
bool bReturn = false;
switch(button)
{
case CONTEXT_BUTTON_MENU_HOOKS:
if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
{
CFileItemPtr item = m_vecItems->Get(itemNumber);
if (item->IsEPG() && item->GetEPGInfoTag()->HasPVRChannel())
g_PVRClients->ProcessMenuHooks(item->GetEPGInfoTag()->ChannelTag()->ClientID(), PVR_MENUHOOK_EPG, item.get());
else if (item->IsPVRChannel())
g_PVRClients->ProcessMenuHooks(item->GetPVRChannelInfoTag()->ClientID(), PVR_MENUHOOK_CHANNEL, item.get());
else if (item->IsDeletedPVRRecording())
g_PVRClients->ProcessMenuHooks(item->GetPVRRecordingInfoTag()->m_iClientId, PVR_MENUHOOK_DELETED_RECORDING, item.get());
else if (item->IsUsablePVRRecording())
g_PVRClients->ProcessMenuHooks(item->GetPVRRecordingInfoTag()->m_iClientId, PVR_MENUHOOK_RECORDING, item.get());
else if (item->IsPVRTimer())
g_PVRClients->ProcessMenuHooks(item->GetPVRTimerInfoTag()->m_iClientId, PVR_MENUHOOK_TIMER, item.get());
bReturn = true;
}
break;
case CONTEXT_BUTTON_FIND:
{
int windowSearchId = m_bRadio ? WINDOW_RADIO_SEARCH : WINDOW_TV_SEARCH;
CGUIWindowPVRBase *windowSearch = (CGUIWindowPVRBase*) g_windowManager.GetWindow(windowSearchId);
if (windowSearch && itemNumber >= 0 && itemNumber < m_vecItems->Size())
{
CFileItemPtr item = m_vecItems->Get(itemNumber);
g_windowManager.ActivateWindow(windowSearchId);
bReturn = windowSearch->OnContextButton(*item.get(), button);
}
break;
}
default:
bReturn = false;
}
return bReturn || CGUIMediaWindow::OnContextButton(itemNumber, button);
}
示例5: OnPlaybackStarted
void CPVRManager::OnPlaybackStarted(const CFileItemPtr item)
{
m_playingChannel.reset();
m_playingRecording.reset();
m_playingEpgTag.reset();
m_playingClientId = -1;
m_strPlayingClientName.clear();
if (item->HasPVRChannelInfoTag())
{
const CPVRChannelPtr channel(item->GetPVRChannelInfoTag());
m_playingChannel = channel;
m_playingClientId = m_playingChannel->ClientID();
SetPlayingGroup(channel);
int iLastWatchedDelay = m_settings.GetIntValue(CSettings::SETTING_PVRPLAYBACK_DELAYMARKLASTWATCHED) * 1000;
if (iLastWatchedDelay > 0)
{
// Insert new / replace existing last watched update timer
if (m_lastWatchedUpdateTimer)
m_lastWatchedUpdateTimer->Stop(true);
m_lastWatchedUpdateTimer.reset(new CLastWatchedUpdateTimer(*this, channel, CDateTime::GetUTCDateTime()));
m_lastWatchedUpdateTimer->Start(iLastWatchedDelay);
}
else
{
// Store last watched timestamp immediately
UpdateLastWatched(channel, CDateTime::GetUTCDateTime());
}
}
else if (item->HasPVRRecordingInfoTag())
{
m_playingRecording = item->GetPVRRecordingInfoTag();
m_playingClientId = m_playingRecording->m_iClientId;
}
else if (item->HasEPGInfoTag())
{
m_playingEpgTag = item->GetEPGInfoTag();
m_playingClientId = m_playingEpgTag->ClientID();
}
if (m_playingClientId != -1)
{
const CPVRClientPtr client = GetClient(m_playingClientId);
if (client)
m_strPlayingClientName = client->GetFriendlyName();
}
m_guiActions->OnPlaybackStarted(item);
m_epgContainer.OnPlaybackStarted(item);
}
示例6: ConfirmDeleteRecording
bool CPVRGUIActions::ConfirmDeleteRecording(const CFileItemPtr &item) const
{
return CGUIDialogYesNo::ShowAndGetInput(CVariant{122}, // "Confirm delete"
item->m_bIsFolder
? CVariant{19113} // "Delete all recordings in this folder?"
: item->GetPVRRecordingInfoTag()->IsDeleted()
? CVariant{19294} // "Remove this deleted recording from trash? This operation cannot be reverted."
: CVariant{19112}, // "Delete this recording?"
CVariant{""},
CVariant{item->GetLabel()});
}
示例7: GetContextButtons
void CGUIWindowPVRRecordings::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
if (itemNumber < 0 || itemNumber >= m_vecItems->Size())
return;
CFileItemPtr pItem = m_vecItems->Get(itemNumber);
if (pItem->HasPVRRecordingInfoTag())
{
buttons.Add(CONTEXT_BUTTON_INFO, 19053); /* Get Information of this recording */
buttons.Add(CONTEXT_BUTTON_FIND, 19003); /* Find similar program */
buttons.Add(CONTEXT_BUTTON_PLAY_ITEM, 12021); /* Play this recording */
CStdString resumeString = GetResumeString(*pItem);
if (!resumeString.empty())
{
buttons.Add(CONTEXT_BUTTON_RESUME_ITEM, resumeString);
}
}
if (pItem->m_bIsFolder)
{
// Have both options for folders since we don't know whether all childs are watched/unwatched
buttons.Add(CONTEXT_BUTTON_MARK_UNWATCHED, 16104); /* Mark as UnWatched */
buttons.Add(CONTEXT_BUTTON_MARK_WATCHED, 16103); /* Mark as Watched */
}
if (pItem->HasPVRRecordingInfoTag())
{
if (pItem->GetPVRRecordingInfoTag()->m_playCount > 0)
buttons.Add(CONTEXT_BUTTON_MARK_UNWATCHED, 16104); /* Mark as UnWatched */
else
buttons.Add(CONTEXT_BUTTON_MARK_WATCHED, 16103); /* Mark as Watched */
buttons.Add(CONTEXT_BUTTON_RENAME, 118); /* Rename this recording */
}
// Add delete button for all items except the All recordings directory
if (!g_PVRRecordings->IsAllRecordingsDirectory(*pItem.get()))
buttons.Add(CONTEXT_BUTTON_DELETE, 117);
if (pItem->HasPVRRecordingInfoTag() &&
g_PVRClients->HasMenuHooks(pItem->GetPVRRecordingInfoTag()->m_iClientId, PVR_MENUHOOK_RECORDING))
buttons.Add(CONTEXT_BUTTON_MENU_HOOKS, 19195); /* PVR client specific action */
}
示例8: Delete
bool CPVRFile::Delete(const CURL& url)
{
if (!g_PVRManager.IsStarted())
return false;
std::string path(url.GetFileName());
if (StringUtils::StartsWith(path, "recordings/") && path[path.size()-1] != '/')
{
std::string strURL = url.Get();
CFileItemPtr tag = g_PVRRecordings->GetByPath(strURL);
if (tag && tag->HasPVRRecordingInfoTag())
return tag->GetPVRRecordingInfoTag()->Delete();
}
return false;
}
示例9: OnPlaybackStopped
void CPVRManager::OnPlaybackStopped(const CFileItemPtr item)
{
// Playback ended due to user interaction
if (item->HasPVRChannelInfoTag() && item->GetPVRChannelInfoTag() == m_playingChannel)
{
bool bUpdateLastWatched = true;
if (m_lastWatchedUpdateTimer)
{
if (m_lastWatchedUpdateTimer->IsRunning())
{
// If last watched timer is still running, cancel it. Channel was not watched long enough to store the value.
m_lastWatchedUpdateTimer->Stop(true);
bUpdateLastWatched = false;
}
m_lastWatchedUpdateTimer.reset();
}
if (bUpdateLastWatched)
{
// If last watched timer is not running (any more), channel was watched long enough to store the value.
UpdateLastWatched(m_playingChannel, CDateTime::GetUTCDateTime());
}
SetChanged();
NotifyObservers(ObservableMessageChannelPlaybackStopped);
m_playingChannel.reset();
m_playingClientId = -1;
m_strPlayingClientName.clear();
}
else if (item->HasPVRRecordingInfoTag() && item->GetPVRRecordingInfoTag() == m_playingRecording)
{
m_playingRecording.reset();
m_playingClientId = -1;
m_strPlayingClientName.clear();
}
else if (item->HasEPGInfoTag() && item->GetEPGInfoTag() == m_playingEpgTag)
{
m_playingEpgTag.reset();
m_playingClientId = -1;
m_strPlayingClientName.clear();
}
m_guiActions->OnPlaybackStopped(item);
m_epgContainer.OnPlaybackStopped(item);
}
示例10: RenameRecording
bool CPVRGUIActions::RenameRecording(const CFileItemPtr &item) const
{
const CPVRRecordingPtr recording(item->GetPVRRecordingInfoTag());
if (!recording)
return false;
std::string strNewName(recording->m_strTitle);
if (!CGUIKeyboardFactory::ShowAndGetInput(strNewName, CVariant{g_localizeStrings.Get(19041)}, false))
return false;
if (!g_PVRRecordings->RenameRecording(*item, strNewName))
return false;
g_PVRManager.TriggerRecordingsUpdate();
return true;
}
示例11: OnPlaybackStopped
void CPVRManager::OnPlaybackStopped(const CFileItemPtr item)
{
// Playback ended due to user interaction
if (item->HasPVRChannelInfoTag() && item->GetPVRChannelInfoTag() == m_playingChannel)
{
UpdateLastWatched(item->GetPVRChannelInfoTag());
m_playingChannel.reset();
}
else if (item->HasPVRRecordingInfoTag() && item->GetPVRRecordingInfoTag() == m_playingRecording)
{
m_playingRecording.reset();
}
else if (item->HasEPGInfoTag() && item->GetEPGInfoTag() == m_playingEpgTag)
{
m_playingEpgTag.reset();
}
m_guiActions->OnPlaybackStopped(item);
}
示例12: Rename
bool CPVRFile::Rename(const CURL& url, const CURL& urlnew)
{
if (!g_PVRManager.IsStarted())
return false;
std::string path(url.GetFileName());
std::string newname(urlnew.GetFileName());
size_t found = newname.find_last_of("/");
if (found != std::string::npos)
newname = newname.substr(found+1);
if (StringUtils::StartsWith(path, "recordings/") && path[path.size()-1] != '/')
{
std::string strURL = url.Get();
CFileItemPtr tag = g_PVRRecordings->GetByPath(strURL);
if (tag && tag->HasPVRRecordingInfoTag())
return tag->GetPVRRecordingInfoTag()->Rename(newname);
}
return false;
}
示例13: GetContextButtons
void CGUIWindowPVRRecordings::GetContextButtons(int itemNumber, CContextButtons &buttons)
{
if (itemNumber < 0 || itemNumber >= m_vecItems->Size())
return;
CFileItemPtr pItem = m_vecItems->Get(itemNumber);
bool isDeletedRecording = false;
CPVRRecordingPtr recording(pItem->GetPVRRecordingInfoTag());
if (recording)
{
isDeletedRecording = recording->IsDeleted();
buttons.Add(CONTEXT_BUTTON_INFO, 19053); /* Recording Information */
if (!isDeletedRecording)
{
buttons.Add(CONTEXT_BUTTON_FIND, 19003); /* Find similar */
buttons.Add(CONTEXT_BUTTON_PLAY_ITEM, 12021); /* Start from beginning */
std::string resumeString = GetResumeString(*pItem);
if (!resumeString.empty())
buttons.Add(CONTEXT_BUTTON_RESUME_ITEM, resumeString);
}
else
{
buttons.Add(CONTEXT_BUTTON_UNDELETE, 19290); /* Undelete */
buttons.Add(CONTEXT_BUTTON_DELETE, 19291); /* Delete permanently */
if (m_vecItems->GetObjectCount() > 1)
buttons.Add(CONTEXT_BUTTON_DELETE_ALL, 19292); /* Delete all permanently */
}
}
if (!isDeletedRecording)
{
if (pItem->m_bIsFolder)
{
// Have both options for folders since we don't know whether all children are watched/unwatched
buttons.Add(CONTEXT_BUTTON_MARK_UNWATCHED, 16104); /* Mark as unwatched */
buttons.Add(CONTEXT_BUTTON_MARK_WATCHED, 16103); /* Mark as watched */
}
if (recording)
{
if (recording->m_playCount > 0)
buttons.Add(CONTEXT_BUTTON_MARK_UNWATCHED, 16104); /* Mark as unwatched */
else
buttons.Add(CONTEXT_BUTTON_MARK_WATCHED, 16103); /* Mark as watched */
buttons.Add(CONTEXT_BUTTON_RENAME, 118); /* Rename */
}
buttons.Add(CONTEXT_BUTTON_DELETE, 117); /* Delete */
}
if (CServiceBroker::GetADSP().IsProcessing())
buttons.Add(CONTEXT_BUTTON_ACTIVE_ADSP_SETTINGS, 15047); /* Audio DSP settings */
if (recording)
{
if ((!isDeletedRecording && g_PVRClients->HasMenuHooks(recording->m_iClientId, PVR_MENUHOOK_RECORDING)) ||
(isDeletedRecording && g_PVRClients->HasMenuHooks(recording->m_iClientId, PVR_MENUHOOK_DELETED_RECORDING)))
buttons.Add(CONTEXT_BUTTON_MENU_HOOKS, 19195); /* PVR client specific action */
}
if (!isDeletedRecording)
CGUIWindowPVRBase::GetContextButtons(itemNumber, buttons);
}
示例14: HandleFileItem
void CFileItemHandler::HandleFileItem(const char *ID, bool allowFile, const char *resultname, CFileItemPtr item, const CVariant ¶meterObject, const std::set<std::string> &validFields, CVariant &result, bool append /* = true */, CThumbLoader *thumbLoader /* = NULL */)
{
CVariant object;
std::set<std::string> fields(validFields.begin(), validFields.end());
if (item.get())
{
std::set<std::string>::const_iterator fileField = fields.find("file");
if (fileField != fields.end())
{
if (allowFile)
{
if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->GetPath().empty())
object["file"] = item->GetVideoInfoTag()->GetPath().c_str();
if (item->HasMusicInfoTag() && !item->GetMusicInfoTag()->GetURL().empty())
object["file"] = item->GetMusicInfoTag()->GetURL().c_str();
if (item->HasPVRRecordingInfoTag() && !item->GetPVRRecordingInfoTag()->GetPath().empty())
object["file"] = item->GetPVRRecordingInfoTag()->GetPath().c_str();
if (item->HasPVRTimerInfoTag() && !item->GetPVRTimerInfoTag()->m_strFileNameAndPath.empty())
object["file"] = item->GetPVRTimerInfoTag()->m_strFileNameAndPath.c_str();
if (!object.isMember("file"))
object["file"] = item->GetPath().c_str();
}
fields.erase(fileField);
}
if (ID)
{
if (item->HasPVRChannelInfoTag() && item->GetPVRChannelInfoTag()->ChannelID() > 0)
object[ID] = item->GetPVRChannelInfoTag()->ChannelID();
else if (item->HasEPGInfoTag() && item->GetEPGInfoTag()->UniqueBroadcastID() > 0)
object[ID] = item->GetEPGInfoTag()->UniqueBroadcastID();
else if (item->HasPVRRecordingInfoTag() && item->GetPVRRecordingInfoTag()->m_iRecordingId > 0)
object[ID] = item->GetPVRRecordingInfoTag()->m_iRecordingId;
else if (item->HasPVRTimerInfoTag() && item->GetPVRTimerInfoTag()->m_iTimerId > 0)
object[ID] = item->GetPVRTimerInfoTag()->m_iTimerId;
else if (item->HasMusicInfoTag() && item->GetMusicInfoTag()->GetDatabaseId() > 0)
object[ID] = (int)item->GetMusicInfoTag()->GetDatabaseId();
else if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_iDbId > 0)
object[ID] = item->GetVideoInfoTag()->m_iDbId;
if (stricmp(ID, "id") == 0)
{
if (item->HasPVRChannelInfoTag())
object["type"] = "channel";
else if (item->HasMusicInfoTag())
{
std::string type = item->GetMusicInfoTag()->GetType();
if (type == MediaTypeAlbum || type == MediaTypeSong || type == MediaTypeArtist)
object["type"] = type;
else if (!item->m_bIsFolder)
object["type"] = MediaTypeSong;
}
else if (item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_type.empty())
{
std::string type = item->GetVideoInfoTag()->m_type;
if (type == MediaTypeMovie || type == MediaTypeTvShow || type == MediaTypeEpisode || type == MediaTypeMusicVideo)
object["type"] = type;
}
else if (item->HasPictureInfoTag())
object["type"] = "picture";
if (!object.isMember("type"))
object["type"] = "unknown";
if (fields.find("filetype") != fields.end())
{
if (item->m_bIsFolder)
object["filetype"] = "directory";
else
object["filetype"] = "file";
}
}
}
bool deleteThumbloader = false;
if (thumbLoader == NULL)
{
if (item->HasVideoInfoTag())
thumbLoader = new CVideoThumbLoader();
else if (item->HasMusicInfoTag())
thumbLoader = new CMusicThumbLoader();
if (thumbLoader != NULL)
{
deleteThumbloader = true;
thumbLoader->OnLoaderStart();
}
}
if (item->HasPVRChannelInfoTag())
FillDetails(item->GetPVRChannelInfoTag().get(), item, fields, object, thumbLoader);
if (item->HasEPGInfoTag())
FillDetails(item->GetEPGInfoTag().get(), item, fields, object, thumbLoader);
if (item->HasPVRRecordingInfoTag())
FillDetails(item->GetPVRRecordingInfoTag().get(), item, fields, object, thumbLoader);
if (item->HasPVRTimerInfoTag())
FillDetails(item->GetPVRTimerInfoTag().get(), item, fields, object, thumbLoader);
if (item->HasVideoInfoTag())
//.........这里部分代码省略.........
示例15: Open
bool CDVDInputStreamPVRManager::Open()
{
if (!CDVDInputStream::Open())
return false;
CURL url(m_item.GetPath());
std::string strURL = url.Get();
if (StringUtils::StartsWith(strURL, "pvr://channels/tv/") ||
StringUtils::StartsWith(strURL, "pvr://channels/radio/"))
{
CFileItemPtr tag = g_PVRChannelGroups->GetByPath(strURL);
if (tag && tag->HasPVRChannelInfoTag())
{
if (!g_PVRManager.OpenLiveStream(*tag))
return false;
m_isRecording = false;
CLog::Log(LOGDEBUG, "CDVDInputStreamPVRManager - %s - playback has started on filename %s", __FUNCTION__, strURL.c_str());
}
else
{
CLog::Log(LOGERROR, "CDVDInputStreamPVRManager - %s - channel not found with filename %s", __FUNCTION__, strURL.c_str());
return false;
}
}
else if (CPVRRecordingsPath(strURL).IsActive())
{
CFileItemPtr tag = g_PVRRecordings->GetByPath(strURL);
if (tag && tag->HasPVRRecordingInfoTag())
{
if (!g_PVRManager.OpenRecordedStream(tag->GetPVRRecordingInfoTag()))
return false;
m_isRecording = true;
CLog::Log(LOGDEBUG, "%s - playback has started on recording %s (%s)", __FUNCTION__, strURL.c_str(), tag->GetPVRRecordingInfoTag()->m_strIconPath.c_str());
}
else
{
CLog::Log(LOGERROR, "CDVDInputStreamPVRManager - Recording not found with filename %s", strURL.c_str());
return false;
}
}
else if (CPVRRecordingsPath(strURL).IsDeleted())
{
CLog::Log(LOGNOTICE, "CDVDInputStreamPVRManager - Playback of deleted recordings is not possible (%s)", strURL.c_str());
return false;
}
else
{
CLog::Log(LOGERROR, "%s - invalid path specified %s", __FUNCTION__, strURL.c_str());
return false;
}
m_eof = false;
/*
* Translate the "pvr://....." entry.
* The PVR Client can use http or whatever else is supported by VideoPlayer.
* to access streams.
* If after translation the file protocol is still "pvr://" use this class
* to read the stream data over the CPVRFile class and the PVR Library itself.
* Otherwise call CreateInputStream again with the translated filename and looks again
* for the right protocol stream handler and swap every call to this input stream
* handler.
*/
m_isOtherStreamHack = false;
std::string transFile = ThisIsAHack(m_item.GetPath());
if(transFile.substr(0, 6) != "pvr://")
{
m_isOtherStreamHack = true;
m_item.SetPath(transFile);
m_item.SetMimeTypeForInternetFile();
m_pOtherStream = CDVDFactoryInputStream::CreateInputStream(m_pPlayer, m_item);
if (!m_pOtherStream)
{
CLog::Log(LOGERROR, "CDVDInputStreamPVRManager::Open - unable to create input stream for [%s]", CURL::GetRedacted(transFile).c_str());
return false;
}
if (!m_pOtherStream->Open())
{
CLog::Log(LOGERROR, "CDVDInputStreamPVRManager::Open - error opening [%s]", CURL::GetRedacted(transFile).c_str());
delete m_pOtherStream;
m_pOtherStream = NULL;
return false;
}
}
else
{
if (URIUtils::IsPVRChannel(url.Get()))
{
std::shared_ptr<CPVRClient> client;
if (g_PVRClients->GetPlayingClient(client) &&
client->HandlesDemuxing())
m_demuxActive = true;
}
//.........这里部分代码省略.........