summaryrefslogtreecommitdiff
path: root/rotord/src
diff options
context:
space:
mode:
authorComment <tim@gray.(none)>2013-09-09 22:21:45 +0100
committerComment <tim@gray.(none)>2013-09-09 22:21:45 +0100
commit695d389eb125cbbd469a8de53616579b18a1bfba (patch)
treedb1f12b6a2a6818d65ff3892e3ef0e489912ab6d /rotord/src
parent5606479f9ef49f11a39c52cbad925edbb8709c76 (diff)
parent79af8bf904b9ddb50b11ac231a2db517f1bdd55b (diff)
Merge branch 'master' of eclectronics.org@eclectronics.org:rotor
Diffstat (limited to 'rotord/src')
-rw-r--r--rotord/src/ffmpeg-fas_wrapper.h15
-rw-r--r--rotord/src/ffmpeg_fas.h5
-rw-r--r--rotord/src/graph.cpp15
-rw-r--r--rotord/src/graph.h7
-rw-r--r--rotord/src/rendercontext.cpp2
-rw-r--r--rotord/src/rotor.h7
6 files changed, 43 insertions, 8 deletions
diff --git a/rotord/src/ffmpeg-fas_wrapper.h b/rotord/src/ffmpeg-fas_wrapper.h
index b70cd2d..dedff62 100644
--- a/rotord/src/ffmpeg-fas_wrapper.h
+++ b/rotord/src/ffmpeg-fas_wrapper.h
@@ -1,5 +1,16 @@
-#ifndef ffmpeg-fas_wrapper_H
-#define ffmpeg-fas_wrapper_H
+#ifndef ffmpeg_fas_wrapper_H
+#define ffmpeg_fas_wrapper_H
+#include <string>
+#include "ffmpeg_fas.h"
+
+namespace ffmpeg_fas {
+ class decoder
+ {
+ public:
+ bool open(std::string& fileName);
+ fas_raw_image_type frame;
+ };
+}
#endif
diff --git a/rotord/src/ffmpeg_fas.h b/rotord/src/ffmpeg_fas.h
index 953c8b4..0c51103 100644
--- a/rotord/src/ffmpeg_fas.h
+++ b/rotord/src/ffmpeg_fas.h
@@ -29,6 +29,11 @@
#define __extern extern
#endif
+
+#ifndef UINT64_C
+#define UINT64_C(c) (c ## ULL)
+#endif
+
#include "seek_indices.h"
#include <libswscale/swscale.h>
diff --git a/rotord/src/graph.cpp b/rotord/src/graph.cpp
index 313df2a..03d0a4b 100644
--- a/rotord/src/graph.cpp
+++ b/rotord/src/graph.cpp
@@ -277,10 +277,10 @@ bool Graph::parseJson(string &data,string &media_path){
return false;
}
//we know the json validates so clear the existing graph
- nodes.clear();
+ clear();
check_audio(root["audio"].asString(),media_path);
init(root["ID"].asString(),root["description"].asString());
- Json::Value jnodes = root["nodes"];
+ Json::Value jnodes = root["nodeDefinitions"];
for ( int i = 0; i < jnodes.size(); ++i ) {
//cerr<<"json found node: "<<jnodes[i]["type"].asString()<<endl;
map<string,string> settings;
@@ -348,7 +348,10 @@ bool Graph::parseJson(string &data,string &media_path){
if (nodes[nodeID]->parameters.find(parameter)!=nodes[nodeID]->parameters.end()) {
float val=jnodes[i]["parameters"][l]["value"].asFloat();
- nodes[nodeID]->parameters.find(parameter)->second->value=val;
+ if (val!=nodes[nodeID]->parameters.find(parameter)->second->value){
+ nodes[nodeID]->parameters.find(parameter)->second->value=val;
+ cerr << "Rotor: set parameter '"<<parameter<<"' of "<<nodeID<<" to "<<val<<endl;
+ }
string fromID=jnodes[i]["parameters"][l]["from"].asString();
if (nodes.find(fromID)!=nodes.end()) {
if (!nodes[nodeID]->parameters[parameter]->connect(nodes[fromID])){
@@ -367,6 +370,10 @@ bool Graph::parseJson(string &data,string &media_path){
string attribute=jnodes[i]["attributes"][m]["name"].asString();
if (nodes[nodeID]->attributes.find(attribute)!=nodes[nodeID]->attributes.end()) {
string val=jnodes[i]["attributes"][m]["value"].asString();
+ if (val!=nodes[nodeID]->attributes.find(attribute)->second->value){
+ nodes[nodeID]->attributes.find(attribute)->second->value=val;
+ cerr << "Rotor: set attribute '"<<attribute<<"' of "<<nodeID<<" to "<<val<<endl;
+ }
nodes[nodeID]->attributes.find(attribute)->second->value=val;
}
else cerr << "Rotor: cannot find attribute '" << attribute << "' of "<<settings["type"]<<" "<< nodeID << endl;
@@ -385,7 +392,7 @@ bool Graph::parseJson(string &data,string &media_path){
return true;
}
bool Graph::parseXml(string media_path){
- nodes.clear();
+ clear();
check_audio(xml.getAttribute("patchbay","audio","",0),media_path);
init(xml.getAttribute("patchbay","ID","",0),xml.getValue("patchbay","",0));
if(xml.pushTag("patchbay")) {
diff --git a/rotord/src/graph.h b/rotord/src/graph.h
index 231d784..4c68eab 100644
--- a/rotord/src/graph.h
+++ b/rotord/src/graph.h
@@ -24,6 +24,13 @@ namespace Rotor {
framerate=25.0f;
cancelled=false;
};
+ ~Graph(){ clear(); };
+ void clear(){
+ for (auto n: nodes) {
+ delete n.second;
+ }
+ nodes.clear();
+ }
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;
diff --git a/rotord/src/rendercontext.cpp b/rotord/src/rendercontext.cpp
index aacc692..62c60c0 100644
--- a/rotord/src/rendercontext.cpp
+++ b/rotord/src/rendercontext.cpp
@@ -224,7 +224,7 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H
}
if (command.method=="DELETE") {
//for now
- graph=Graph();
+ graph.clear();
logger.information("graph deleted");
XML.addValue("status","graph deleted");
status=HTTPResponse::HTTP_OK;
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h
index b2f50e6..a247c66 100644
--- a/rotord/src/rotor.h
+++ b/rotord/src/rotor.h
@@ -167,6 +167,9 @@ namespace Rotor {
Node(){duplicate_inputs=false;};
virtual Node* clone(map<string,string> &_settings)=0; //pure virtual
virtual ~Node(){
+ for (auto a: attributes) delete a.second;
+ for (auto p: parameters) delete p.second;
+ for (auto s: inputs) delete s;
};
vector<Signal_input*> inputs; //simple node can have signal inputs, output depends on node type
unordered_map<string,Parameter*> parameters; //linked parameters can convert from settings to inputs
@@ -234,7 +237,9 @@ namespace Rotor {
};
class Image_node: public Node{
public:
- virtual ~Image_node(){};
+ virtual ~Image_node(){
+ for (auto i: image_inputs) delete i;
+ };
vector<Image_input*> image_inputs; //image node also has image inputs and outputs
void create_image_input(const string &_title,const string &_desc,Node* _connect=nullptr) {
image_inputs.push_back(new Image_input(_desc,_title,_connect));