Add ofxPiMapper::setVideoSource(fileName)

This commit is contained in:
Krisjanis Rijnieks
2018-08-02 13:51:47 +03:00
parent ca47482cb1
commit 0ef4e1f8b5
4 changed files with 29 additions and 0 deletions
+23
View File
@@ -482,6 +482,29 @@ void Application::setFboSource(std::string sourceId){
}
}
void Application::setVideoSource(std::string fileName){
vector<std::string> loadedVideos = getMediaServer()->getVideoNames();
for(auto i = 0; i < loadedVideos.size(); i++){
if(ofIsStringInString(loadedVideos[i], fileName)){
if(getSurfaceManager()->getSelectedSurface() != 0){
BaseSource * source = getSurfaceManager()->getSelectedSurface()->getSource();
VideoSource * video = dynamic_cast<VideoSource *>(source);
video->stop();
getCmdManager()->exec(
new SetSourceCmd(
SourceType::SOURCE_TYPE_VIDEO,
getMediaServer()->getVideoPaths()[i],
getSurfaceManager()->getSelectedSurface(),
&Gui::instance()->getSourcesEditorWidget()));
}else{
getCmdManager()->exec(new SelNextSurfaceCmd(getSurfaceManager()));
}
break;
}
}
}
void Application::addGridRow(){
if(getSurfaceManager()->getSelectedSurface() != 0){
if(getSurfaceManager()->getSelectedSurface()->getType() ==
+1
View File
@@ -130,6 +130,7 @@ class Application {
void duplicateSurface();
void setNextSource();
void setFboSource(std::string sourceId);
void setVideoSource(std::string fileName);
void addGridRow();
void addGridColumn();
void removeGridRow();
+4
View File
@@ -186,6 +186,10 @@ void ofxPiMapper::setFboSource(std::string sourceId){
_application.setFboSource(sourceId);
}
void ofxPiMapper::setVideoSource(std::string fileName){
_application.setVideoSource(fileName);
}
void ofxPiMapper::reboot(){
_application.reboot();
}
+1
View File
@@ -86,6 +86,7 @@ class ofxPiMapper {
// Sources, selected surface
void setNextSource();
void setFboSource(std::string sourceId);
void setVideoSource(std::string fileName);
// System commands
void reboot();