本文整理汇总了C++中DataSourceRef::getFilePathHint方法的典型用法代码示例。如果您正苦于以下问题:C++ DataSourceRef::getFilePathHint方法的具体用法?C++ DataSourceRef::getFilePathHint怎么用?C++ DataSourceRef::getFilePathHint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataSourceRef
的用法示例。
在下文中一共展示了DataSourceRef::getFilePathHint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadImage
ImageSourceRef loadImage( DataSourceRef dataSource, ImageSource::Options options, string extension )
{
#if defined( CINDER_COCOA )
cocoa::SafeNsAutoreleasePool autorelease;
#endif
if( extension.empty() )
extension = getPathExtension( dataSource->getFilePathHint() );
return ImageIoRegistrar::createSource( dataSource, options, extension );
}
示例2: defined
// static
unique_ptr<SourceFile> SourceFile::create( const DataSourceRef &dataSource, size_t sampleRate )
{
unique_ptr<SourceFile> result;
#if ! defined( CINDER_WINRT ) || ( _MSC_VER > 1800 )
if( dataSource->getFilePathHint().extension().string() == ".ogg" )
#else
if( dataSource->getFilePathHint().extension() == ".ogg" )
#endif
result.reset( new SourceFileOggVorbis( dataSource, sampleRate ) );
else {
#if defined( CINDER_COCOA )
result.reset( new cocoa::SourceFileCoreAudio( dataSource, sampleRate ) );
#elif defined( CINDER_MSW )
result.reset( new msw::SourceFileMediaFoundation( dataSource, sampleRate ) );
#endif
}
if( result )
result->setupSampleRateConversion();
return result;
}
示例3: initFromDataSource
void MovieBase::initFromDataSource( DataSourceRef dataSourceRef, const std::string &mimeTypeHint )
{
startQuickTime();
if( dataSourceRef->isFilePath() ) { // try to use quicktime's native file handling if possible
getObj()->mMovie = openMovieFromPath( dataSourceRef->getFilePath() );
// no need to retain the data source
}
else if( dataSourceRef->isUrl() ) { // try to use quicktime's native Url handling if possible
// Create a loader for this Url and then wait on it
MovieLoader loader( dataSourceRef->getUrl() );
loader.waitForLoaded();
getObj()->mMovie = loader.transferMovieHandle();
// no need to retain the data source
}
else { // we'll need to load from memory; and we'll rer to the data source to make sure it doesn't go away before the movie does
Buffer buffer( dataSourceRef->getBuffer() );
getObj()->mMovie = openMovieFromMemory( buffer.getData(), buffer.getDataSize(), dataSourceRef->getFilePathHint(), mimeTypeHint );
getObj()->mDataSource = dataSourceRef; // retain a reference to the dataSource so that it doesn't go away before we do
}
init();
}
示例4: loadXML
void ConfigDict::loadXML(DataSourceRef source)
{
XmlTree doc;
try {
doc = XmlTree(source);
} catch(rapidxml::parse_error &e) {
LOG_ERROR("ConfigDict::loadXML - couldnt parse XML data ("<<
"error: "<< e.what() <<" "<<
"file: "<< source->getFilePathHint() <<
")");
}
XmlTree root = *doc.begin();
for(XmlTree::ConstIter setting = root.begin(); setting != root.end(); ++setting)
{
string key = setting->getTag();
string value = setting->getValue();
settings.insert(std::pair<string,string>(key, value) );
}
}