本文整理汇总了C++中CDVDInputStream::GetFileName方法的典型用法代码示例。如果您正苦于以下问题:C++ CDVDInputStream::GetFileName方法的具体用法?C++ CDVDInputStream::GetFileName怎么用?C++ CDVDInputStream::GetFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDVDInputStream
的用法示例。
在下文中一共展示了CDVDInputStream::GetFileName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExtractThumb
bool CDVDFileInfo::ExtractThumb(const std::string &strPath,
CTextureDetails &details,
CStreamDetails *pStreamDetails, int pos)
{
std::string redactPath = CURL::GetRedacted(strPath);
unsigned int nTime = XbmcThreads::SystemClockMillis();
CDVDInputStream *pInputStream = CDVDFactoryInputStream::CreateInputStream(NULL, strPath, "");
if (!pInputStream)
{
CLog::Log(LOGERROR, "InputStream: Error creating stream for %s", redactPath.c_str());
return false;
}
if (pInputStream->IsStreamType(DVDSTREAM_TYPE_DVD)
|| pInputStream->IsStreamType(DVDSTREAM_TYPE_BLURAY))
{
CLog::Log(LOGDEBUG, "%s: disc streams not supported for thumb extraction, file: %s", __FUNCTION__, redactPath.c_str());
delete pInputStream;
return false;
}
if (pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER))
{
SAFE_DELETE(pInputStream);
return false;
}
if (!pInputStream->Open(strPath.c_str(), "", true))
{
CLog::Log(LOGERROR, "InputStream: Error opening, %s", redactPath.c_str());
if (pInputStream)
SAFE_DELETE(pInputStream);
return false;
}
CDVDDemux *pDemuxer = NULL;
try
{
pDemuxer = CDVDFactoryDemuxer::CreateDemuxer(pInputStream, true);
if(!pDemuxer)
{
SAFE_DELETE(pInputStream);
CLog::Log(LOGERROR, "%s - Error creating demuxer", __FUNCTION__);
return false;
}
}
catch(...)
{
CLog::Log(LOGERROR, "%s - Exception thrown when opening demuxer", __FUNCTION__);
if (pDemuxer)
SAFE_DELETE(pDemuxer);
SAFE_DELETE(pInputStream);
return false;
}
if (pStreamDetails)
{
DemuxerToStreamDetails(pInputStream, pDemuxer, *pStreamDetails, strPath);
//extern subtitles
std::vector<std::string> filenames;
std::string video_path;
if (strPath.empty())
video_path = pInputStream->GetFileName();
else
video_path = strPath;
CUtil::ScanForExternalSubtitles(video_path, filenames);
for(unsigned int i=0;i<filenames.size();i++)
{
// if vobsub subtitle:
if (URIUtils::GetExtension(filenames[i]) == ".idx")
{
std::string strSubFile;
if ( CUtil::FindVobSubPair(filenames, filenames[i], strSubFile) )
AddExternalSubtitleToDetails(video_path, *pStreamDetails, filenames[i], strSubFile);
}
else
{
if ( !CUtil::IsVobSub(filenames, filenames[i]) )
{
AddExternalSubtitleToDetails(video_path, *pStreamDetails, filenames[i]);
}
}
}
}
int nVideoStream = -1;
for (int i = 0; i < pDemuxer->GetNrOfStreams(); i++)
{
CDemuxStream* pStream = pDemuxer->GetStream(i);
if (pStream)
{
// ignore if it's a picture attachment (e.g. jpeg artwork)
if(pStream->type == STREAM_VIDEO && !(pStream->flags & AV_DISPOSITION_ATTACHED_PIC))
nVideoStream = i;
else
pStream->SetDiscard(AVDISCARD_ALL);
//.........这里部分代码省略.........
示例2: ExtractThumb
bool CDVDFileInfo::ExtractThumb(const std::string &strPath,
CTextureDetails &details,
CStreamDetails *pStreamDetails, int pos)
{
std::string redactPath = CURL::GetRedacted(strPath);
unsigned int nTime = XbmcThreads::SystemClockMillis();
CFileItem item(strPath, false);
item.SetMimeTypeForInternetFile();
CDVDInputStream *pInputStream = CDVDFactoryInputStream::CreateInputStream(NULL, item);
if (!pInputStream)
{
CLog::Log(LOGERROR, "InputStream: Error creating stream for %s", redactPath.c_str());
return false;
}
if (!pInputStream->Open())
{
CLog::Log(LOGERROR, "InputStream: Error opening, %s", redactPath.c_str());
if (pInputStream)
delete pInputStream;
return false;
}
CDVDDemux *pDemuxer = NULL;
try
{
pDemuxer = CDVDFactoryDemuxer::CreateDemuxer(pInputStream, true);
if(!pDemuxer)
{
delete pInputStream;
CLog::Log(LOGERROR, "%s - Error creating demuxer", __FUNCTION__);
return false;
}
}
catch(...)
{
CLog::Log(LOGERROR, "%s - Exception thrown when opening demuxer", __FUNCTION__);
if (pDemuxer)
delete pDemuxer;
delete pInputStream;
return false;
}
if (pStreamDetails)
{
DemuxerToStreamDetails(pInputStream, pDemuxer, *pStreamDetails, strPath);
//extern subtitles
std::vector<std::string> filenames;
std::string video_path;
if (strPath.empty())
video_path = pInputStream->GetFileName();
else
video_path = strPath;
CUtil::ScanForExternalSubtitles(video_path, filenames);
for(unsigned int i=0;i<filenames.size();i++)
{
// if vobsub subtitle:
if (URIUtils::GetExtension(filenames[i]) == ".idx")
{
std::string strSubFile;
if ( CUtil::FindVobSubPair(filenames, filenames[i], strSubFile) )
AddExternalSubtitleToDetails(video_path, *pStreamDetails, filenames[i], strSubFile);
}
else
{
if ( !CUtil::IsVobSub(filenames, filenames[i]) )
{
AddExternalSubtitleToDetails(video_path, *pStreamDetails, filenames[i]);
}
}
}
}
int nVideoStream = -1;
int64_t demuxerId = -1;
for (CDemuxStream* pStream : pDemuxer->GetStreams())
{
if (pStream)
{
// ignore if it's a picture attachment (e.g. jpeg artwork)
if (pStream->type == STREAM_VIDEO && !(pStream->flags & AV_DISPOSITION_ATTACHED_PIC))
{
nVideoStream = pStream->uniqueId;
demuxerId = pStream->demuxerId;
}
else
pDemuxer->EnableStream(pStream->demuxerId, pStream->uniqueId, false);
}
}
bool bOk = false;
int packetsTried = 0;
if (nVideoStream != -1)
{
//.........这里部分代码省略.........