diff options
Diffstat (limited to 'rotord/src')
| -rw-r--r-- | rotord/src/graph.cpp | 15 | ||||
| -rw-r--r-- | rotord/src/nodes_maths.h | 10 | ||||
| -rw-r--r-- | rotord/src/rendercontext.cpp | 4 | ||||
| -rwxr-xr-x | rotord/src/rotor.h | 20 |
4 files changed, 36 insertions, 13 deletions
diff --git a/rotord/src/graph.cpp b/rotord/src/graph.cpp index 8b85113..60af1c8 100644 --- a/rotord/src/graph.cpp +++ b/rotord/src/graph.cpp @@ -55,21 +55,23 @@ bool Graph::set_resolution(int w,int h){ } else return false; } -bool Graph::load(string data){ +bool Graph::load(string data,string media_path){ if (xml.loadFromBuffer(data)){ - return parseXml(); + return parseXml(media_path); } + cerr<<"Rotor: failed to load graph from string"<<endl; return false; } -bool Graph::loadFile(string &filename){ - loaded=false; +bool Graph::loadFile(string &filename,string media_path){ + if (loaded) printf("loading graph: %s\n",filename.c_str()); if(xml.loadFile(filename) ){ - return parseXml(); + return parseXml(media_path); } else return false; } -bool Graph::parseXml(){ +bool Graph::parseXml(string media_path){ + if (loaded) nodes.clear(); init(xml.getAttribute("patchbay","ID","",0),xml.getValue("patchbay","",0)); if(xml.pushTag("patchbay")) { int n1=xml.getNumTags("node"); @@ -82,6 +84,7 @@ bool Graph::parseXml(){ //cerr << "Got attribute: " << attr << ":" << xml.getAttribute("node",attr,"",i1) << endl; } settings["description"]=xml.getValue("node","",i1); + settings["media_path"]=media_path; Node* node=factory.create(settings); if (node) { string nodeID=xml.getAttribute("node","ID","",i1); diff --git a/rotord/src/nodes_maths.h b/rotord/src/nodes_maths.h new file mode 100644 index 0000000..f8b6cd9 --- /dev/null +++ b/rotord/src/nodes_maths.h @@ -0,0 +1,10 @@ +#ifndef ROTOR_MATHS +#define ROTOR_MATHS + +#include "rotor.h" + +namespace Rotor { + +} + +#endif
\ No newline at end of file diff --git a/rotord/src/rendercontext.cpp b/rotord/src/rendercontext.cpp index 7362d64..62343ac 100644 --- a/rotord/src/rendercontext.cpp +++ b/rotord/src/rendercontext.cpp @@ -155,7 +155,7 @@ void Render_context::session_command(const std::vector<std::string>& command,xml //should interrupt whatever is happening? //before begining to load from xml if (state==IDLE) { //eventually not like this - if (graph.load(command[3])) { + if (graph.load(command[3],media_dir)) { status=HTTPResponse::HTTP_OK; logger.information("Loaded graph from http PUT body"); XML.addValue("status","Loaded graph from PUT body"); @@ -170,7 +170,7 @@ void Render_context::session_command(const std::vector<std::string>& command,xml string graph_filename=graph_dir+command[3]; Poco::File f=Poco::File(graph_filename); if (f.exists()) { - if (graph.loadFile(graph_filename)) { + if (graph.loadFile(graph_filename,media_dir)) { status=HTTPResponse::HTTP_OK; //XML.addValue("patchbay",graph.toString()); //XML.loadFromBuffer(graph.toString()); diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h index c42460c..f704a1d 100755 --- a/rotord/src/rotor.h +++ b/rotord/src/rotor.h @@ -1258,6 +1258,10 @@ namespace Rotor { Video_loader(map<string,string> &settings) { base_settings(settings); isLoaded=false; + string filename=find_setting(settings,"filename",""); + if (filename!="") { + load(find_setting(settings,"media_path","")+filename); + } }; ~Video_loader(){}; bool load(const string &filename); @@ -1341,8 +1345,14 @@ namespace Rotor { class Graph{ public: Graph(){duration=20.0f;loaded = false;outW=640;outH=360;}; - Graph(const string& _uid,const string& _desc){init(_uid,_desc);}; - void init(const string& _uid,const string& _desc){ uid=_uid;description=_desc;duration=20.0f;}; + Graph(const string& _uid,const string& _desc){ + init(_uid,_desc); + }; + void init(const string& _uid,const string& _desc){ + uid=_uid; + description=_desc; + duration=20.0f; + }; string uid; //every version of a graph has a UUID, no particular need to actually read its data(?) //?? is it faster than using strings?? string description; @@ -1352,9 +1362,9 @@ namespace Rotor { bool signal_render(string &signal_xml,const float framerate); bool video_render(const string &output_filename,const string &audio_filename,const float framerate,float& progress); int load(Poco::UUID uid); - bool load(string data); - bool loadFile(string &filename); - bool parseXml(); + bool load(string data,string media_path); + bool loadFile(string &filename,string media_path); + bool parseXml(string media_path); bool set_resolution(int w,int h); UUID save(); //save to DB, returns UUID of saved graph bool loaded; |
