summaryrefslogtreecommitdiff
path: root/rotord/src/graph.cpp
diff options
context:
space:
mode:
authorTim Redfern <tim@herge.(none)>2013-08-02 11:18:38 +0100
committerTim Redfern <tim@herge.(none)>2013-08-02 11:18:38 +0100
commit8022d45fedd72f69a0c96ea4b651817321baddf8 (patch)
treefccb8d51b0da290cd1a3939c2adf3eebbae180a6 /rotord/src/graph.cpp
parent9c40fdc08e64fde94b4f041565be916ac479e483 (diff)
load video media from graph
Diffstat (limited to 'rotord/src/graph.cpp')
-rw-r--r--rotord/src/graph.cpp15
1 files changed, 9 insertions, 6 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);