From 8022d45fedd72f69a0c96ea4b651817321baddf8 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 2 Aug 2013 11:18:38 +0100 Subject: load video media from graph --- rotord/src/graph.cpp | 15 +++++++++------ rotord/src/nodes_maths.h | 10 ++++++++++ rotord/src/rendercontext.cpp | 4 ++-- rotord/src/rotor.h | 20 +++++++++++++++----- 4 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 rotord/src/nodes_maths.h 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"<& 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& 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 &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; -- cgit v1.2.3