本文整理汇总了C++中AssetPtr::DiskSource方法的典型用法代码示例。如果您正苦于以下问题:C++ AssetPtr::DiskSource方法的具体用法?C++ AssetPtr::DiskSource怎么用?C++ AssetPtr::DiskSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssetPtr
的用法示例。
在下文中一共展示了AssetPtr::DiskSource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMediaLoaded
void EC_MediaPlayer::OnMediaLoaded(AssetPtr asset)
{
pendingMediaDownload_ = false;
// Double check that same source finished as we have in the attribute.
if (asset->Name() != getsourceRef().ref.trimmed())
return;
// Load media from local file
QString diskSource = asset->DiskSource();
if (!diskSource.isEmpty())
{
// Feed native separators for VLC
if (!mediaPlayer_->LoadMedia(QDir::toNativeSeparators(diskSource)))
LogError("EC_MediaPlayer: Source not supported: " + asset->Name());
else
{
LogInfo("EC_MediaPlayer: Loaded source media after download '" + asset->Name() + "'");
emit MediaDownloaded(true, asset->Name());
mediaPlayer_->ForceUpdateImage();
}
}
else
LogError("EC_MediaPlayer: Downloaded media '" + asset->Name() + "' disk source is empty! Broken/disabled asset cache?");
}
示例2: GetRefReplacedAssetData
QByteArray QtUiAsset::GetRefReplacedAssetData() const
{
if (originalData.size() == 0)
return QByteArray();
QByteArray refRewrittenData((const char *)&originalData[0], originalData.size());
// The AssetRef indices need to be adjusted with an offset after rewriting each ref, since the lengths of the refs change in the file.
// This variable tracks the accumulated byte offset that takes this into account.
int indexAdjustment = 0;
for(size_t i = 0; i < refs.size(); ++i)
{
QString assetDiskSource = "";
AssetPtr asset = assetAPI->GetAsset(refs[i].parsedRef);
if (!asset.get())
{
LogError("ReplaceAssetReferences: Asset not found from asset system even when it was marked as a dependency earlier, skipping: " + refs[i].parsedRef.toStdString());
}
else
{
assetDiskSource = asset->DiskSource();
if (assetDiskSource.isEmpty())
LogWarning("ReplaceAssetReferences: Asset disk source empty, skipping: " + refs[i].parsedRef.toStdString());
}
assetDiskSource = assetDiskSource.trimmed();
if (!assetDiskSource.isEmpty() && QFile::exists(assetDiskSource))
{
QByteArray refAsByteArray = (QString("\"") + assetDiskSource + QString("\"")).toUtf8();
refRewrittenData.replace(refs[i].index + indexAdjustment, refs[i].length, refAsByteArray);
indexAdjustment += refAsByteArray.length() - refs[i].length;
}
else
{
LogWarning("ReplaceAssetReferences: Asset disk source does not exist, skipping: " + refs[i].parsedRef.toStdString());
}
}
return refRewrittenData;
}