diff options
| -rw-r--r-- | NT/src/rendercontext.cpp | 10 | ||||
| -rw-r--r-- | NT/src/rendercontext.h | 10 |
2 files changed, 13 insertions, 7 deletions
diff --git a/NT/src/rendercontext.cpp b/NT/src/rendercontext.cpp index a03723f..631f4b8 100644 --- a/NT/src/rendercontext.cpp +++ b/NT/src/rendercontext.cpp @@ -17,15 +17,15 @@ void Render_context::runTask() { mutex.unlock(); if(cmd.task==ANALYSE_AUDIO) { state=ANALYSING_AUDIO; - graph.load_audio(cmd.body); + graph.load_audio(cmd.message); state=IDLE; } if(cmd.task==RENDER) { state=RENDERING; renders[cmd.uid]=Render_status(RENDERING); - if(graph.video_render(output_filename,output_framerate,start,stop)){ + if(video_render(cmd.message)){ state=IDLE; - if (graph.cancelled) renders[cmd.uid].status=CANCELLED; + if (cancelled) renders[cmd.uid].status=CANCELLED; else renders[cmd.uid].status=RENDER_READY; } else { @@ -38,7 +38,7 @@ void Render_context::runTask() { if(cmd.task==LOAD_GRAPH) { state=LOADING_GRAPH; if (graph_filename!="") { - if (!graph.loadFile(graph_filename,media_dir)){ + if (!graph.loadFile(cmd.message,media_path)){ cerr<<"Rotor: failed to load graph from "<<graph_filename<<endl; } } @@ -499,4 +499,4 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H XML.addValue("error","Bad request"); } } -}
\ No newline at end of file +} diff --git a/NT/src/rendercontext.h b/NT/src/rendercontext.h index d1acf55..3ac9c08 100644 --- a/NT/src/rendercontext.h +++ b/NT/src/rendercontext.h @@ -42,7 +42,8 @@ namespace Rotor { #define ANALYSE_AUDIO 1 #define PREVIEW 2 #define RENDER 3 - #define LOAD_GRAPH 4 + #define LOAD_GRAPH_FILE 4 + #define LOAD_GRAPH_STRING 5 class Session_command { public: @@ -50,11 +51,12 @@ namespace Rotor { string uid,method,id,body; vector<string> commands; }; - class Session_task { + class Session_task { public: Session_task(const string &_uid="",int _task=0):uid(_uid),task(_task) {}; string uid; int task; + string message; }; class Render_status { public: @@ -92,6 +94,7 @@ namespace Rotor { cancel(); logger.information("stopped thread"); } + void runTask(); void add_queue(Session_task item); bool set_profile(const std::string& _profile){ if (profiles.find(_profile)==profiles.end()) return false; @@ -109,8 +112,11 @@ namespace Rotor { return Render_status(NOT_FOUND); }; std::string text_render(std::string node_id=""); + bool video_render(std::string output_filename,std::string node_id=""); Graph graph; private: + bool cancelled; + double progress; int state; std::string id; std::unordered_map<std::string,Render_status> renders; |
