diff options
| -rw-r--r-- | rotord/03.xml | 2 | ||||
| -rwxr-xr-x | rotord/rotor.cpp | 19 | ||||
| -rwxr-xr-x | rotord/rotor.h | 10 |
3 files changed, 19 insertions, 12 deletions
diff --git a/rotord/03.xml b/rotord/03.xml index f723ee7..c6fab6e 100644 --- a/rotord/03.xml +++ b/rotord/03.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="ISO-8859-1"?> <patchbay ID="0f7aa258-7c2f-11e2-abbd-133252267708">testcard ©Rotor 2013 - <node ID="01" type="testcard" >testcard + <node ID="01" type="testcard" output="image">testcard </node> <node ID="02" type="video_output">renders the video <image_input from="01">video to output</image_input> diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp index cffb929..ab02298 100755 --- a/rotord/rotor.cpp +++ b/rotord/rotor.cpp @@ -54,15 +54,20 @@ void Render_context::add_queue(int item) { work_queue.push_back(item); mutex.unlock(); } - bool Signal_input::connect(Signal_node* source) { if (source->output_type=="signal") { connection=(Node*)source; return true; } else return false; -}; - +} +bool Image_input::connect(Image_node* source) { + if (source->output_type=="image") { + connection=(Node*)source; + return true; + } + else return false; +} bool Signal_output::render(const float duration, const float framerate,string &xml_out){ //testing signal routes cerr << "Rotor: Signal_output rendering " << duration << " seconds at " << framerate << " frames per second" << endl; @@ -488,11 +493,11 @@ bool Graph::load(string &filename){ } int n3=xml.getNumTags("image_input"); for (int i3=0;i3<n3;i3++){ - nodes[nodeID]->create_image_input(xml.getValue("image_input","",i3)); - string fromID=xml.getAttribute("image_input","from","",i2); + ((Image_node*)nodes[nodeID])->create_image_input(xml.getValue("image_input","",i3)); + string fromID=xml.getAttribute("image_input","from","",i3); if (nodes.find(fromID)!=nodes.end()) { - if (!nodes[nodeID]->inputs[i3]->connect((Image_node*)nodes[fromID])){ - cerr << "Rotor: graph loader cannot connect input " << i3 << " of node '" << nodeID << "' to node '" << fromID << "'" << endl; + if (!(((Image_node*)nodes[nodeID])->image_inputs[i3]->connect((Image_node*)nodes[fromID]))){ + cerr << "Rotor: graph loader cannot connect image input " << i3 << " of node '" << nodeID << "' to node '" << fromID << "'" << endl; return false; } else cerr << "Rotor: linked input " << i3 << " of node '" << nodeID << "' to node '" << fromID << "'" << endl; diff --git a/rotord/rotor.h b/rotord/rotor.h index 4a6c8d3..e5b4085 100755 --- a/rotord/rotor.h +++ b/rotord/rotor.h @@ -115,6 +115,7 @@ namespace Rotor { //forward declaration class Node; class Signal_node; + class Image_node; //http://blog.tomaka17.com/2012/03/libavcodeclibavformat-tutorial/ struct Packet { @@ -187,12 +188,12 @@ namespace Rotor { }; class Image_input: public Input{ public: - bool connect(Image_node* source); + bool connect(Image_node *source); Image_input(const string &_desc): Input(_desc){}; }; class Signal_input: public Input{ public: - bool connect(Signal_node* source); + bool connect(Signal_node *source); Signal_input(const string &_desc): Input(_desc){}; }; @@ -263,11 +264,12 @@ namespace Rotor { }; class Image_node: public Node{ public: - vector<Image_input> image_inputs; //image node also has image inputs and outputs + vector<Image_input*> image_inputs; //image node also has image inputs and outputs + void create_image_input(const string &description) {image_inputs.push_back(new Image_input(description));}; Image *get_output(const Frame_spec &frame){ //sample implementation //do something with the inputs //and then - return ((Image_node*)image_inputs[0].connection)->get_output(frame); + return ((Image_node*)(image_inputs[0]->connection))->get_output(frame); } Image *get_preview(const Frame_spec &frame); Image *image; //this can be privately allocated or just passed on as the node see fit |
