本文整理汇总了C++中Media::valid方法的典型用法代码示例。如果您正苦于以下问题:C++ Media::valid方法的具体用法?C++ Media::valid怎么用?C++ Media::valid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Media
的用法示例。
在下文中一共展示了Media::valid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PlayFile
void Player::PlayFile(const Media& entry, bool play_file)
{
media_.clearQueue();
if (entry.valid())
{
if (play_file || file_active_)
{
LOG("Player") << "Play: " << entry;
media_.setCurrentSource(entry.path());
media_.play();
file_active_ = true;
}
}
else
{
Stop();
}
}
示例2: it
void MediaCollection::Private::listDirectory( boost::filesystem::path path, shared_ptr< MediaDirectory > rootDirectory )
{
vector<fs::directory_entry> v;
try
{
fs::recursive_directory_iterator it( path, fs::symlink_option::recurse );
while(it != fs::recursive_directory_iterator()) {
if(it.level() > 20)
it.pop();
try {
v.push_back(*it++);
} catch(std::exception &e) {
log("notice") << "Error scanning for path " << *it << ": " << e.what();
it.pop();
}
}
//copy( fs::recursive_directory_iterator( path, fs::symlink_option::recurse, ec ), fs::recursive_directory_iterator(), back_inserter( v ) );
// sort( v.begin(), v.end() ); // TODO: not needed?
for( fs::directory_entry entry : v )
{
Media media = resolveMedia( entry.path() );
if( media.valid() && isAllowed( entry.path() ) )
{
Media media {entry.path()};
collection[media.uid()] = media;
rootDirectory->add(media);
}
}
}
catch
( std::exception &e )
{
log( "error" ) << "Error trying to add path " << path << ": " << e.what();
}
}