当前位置: 首页>>代码示例>>C++>>正文


C++ AssetPtr::DiskSource方法代码示例

本文整理汇总了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?");
}
开发者ID:katik,项目名称:naali,代码行数:25,代码来源:EC_MediaPlayer.cpp

示例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;
}
开发者ID:jarmovh,项目名称:naali,代码行数:38,代码来源:QtUiAsset.cpp


注:本文中的AssetPtr::DiskSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。