mirror of
https://github.com/kr15h/ofxPiMapper.git
synced 2026-06-16 12:31:49 +02:00
Add loading and saving video loop state
This commit is contained in:
@@ -86,6 +86,13 @@ bool SettingsLoader::load(
|
||||
|
||||
// Load media by using full path
|
||||
source = mediaServer.loadMedia(sourcePath, typeEnum);
|
||||
|
||||
if(typeEnum == SourceType::SOURCE_TYPE_VIDEO){
|
||||
// Attempt to set loop for this type of source
|
||||
bool loop = xmlSettings->getValue("source-loop", true);
|
||||
VideoSource * vid = dynamic_cast<VideoSource *>(source);
|
||||
vid->setLoop(loop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,6 +219,12 @@ bool SettingsLoader::save(SurfaceManager & surfaceManager, std::string fileName)
|
||||
xmlSettings->addValue("source-type", sourceTypeName);
|
||||
std::string sourceName = surface->getSource()->getName();
|
||||
xmlSettings->addValue("source-name", (sourceName == "") ? "none" : sourceName);
|
||||
|
||||
if(surface->getSource()->getType() == SOURCE_TYPE_VIDEO){
|
||||
VideoSource * vid = dynamic_cast<VideoSource *>(surface->getSource());
|
||||
xmlSettings->addValue("source-loop", vid->getLoop());
|
||||
}
|
||||
|
||||
xmlSettings->popTag(); // source
|
||||
|
||||
// Save surface options
|
||||
|
||||
@@ -48,6 +48,10 @@ void VideoSource::setLoop(bool loop){
|
||||
#endif
|
||||
}
|
||||
|
||||
bool VideoSource::getLoop(){
|
||||
return _loop;
|
||||
}
|
||||
|
||||
void VideoSource::clear(){
|
||||
texture = 0;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ class VideoSource : public BaseSource {
|
||||
std::string & getPath();
|
||||
void loadVideo(std::string & path);
|
||||
void setLoop(bool loop);
|
||||
bool getLoop();
|
||||
void clear();
|
||||
void togglePause();
|
||||
void stop();
|
||||
|
||||
Reference in New Issue
Block a user