#ifndef RENDERCONTEXT_H #define RENDERCONTEXT_H #include "Poco/Task.h" #include "Poco/StringTokenizer.h" #include "rotor.h" #include "graph.h" /*------------------------ Render context packages the management of a rotor graph as a web service -------------------------*/ namespace Rotor { #define IDLE 0 #define ANALYSING_AUDIO 1 #define AUDIO_READY 2 #define CREATING_PREVIEW 3 #define PREVIEW_READY 4 #define RENDERING 5 #define RENDER_READY 6 #define FAILED 7 #define NOT_FOUND 8 #define CANCELLED 9 #define LOADING_GRAPH 10 #define ANALYSE_AUDIO 1 #define PREVIEW 2 #define RENDER 3 #define LOAD_GRAPH 4 class Session_command { public: Session_command(){body="";}; string uid,method,id,body; vector commands; }; class Session_task { public: Session_task():uid(""),task(0){}; Session_task(const string &_uid,int _task):uid(_uid),task(_task) {}; string uid; int task; }; class Render_status { public: Render_status():status(0),progress(0.0f){}; Render_status(int _status):status(_status),progress(0.0f){}; int status; float progress; }; class Render_context: public Poco::Task { //Poco task object //manages a 'patchbay' //high level interfaces for the wizard //and low level interface onto the graph public: Render_context(const std::string& name): Task(name) { audio_thumb=new Audio_thumbnailer(); state=IDLE; output_framerate=25.0f; xmlIO xml; if(xml.loadFile("settings.xml") ){ graph_dir=xml.getAttribute("Rotor","graph_dir","",0); media_dir=xml.getAttribute("Rotor","media_dir","",0); output_dir=xml.getAttribute("Rotor","output_dir","",0); } else cerr<<"Rotor: settings.xml not found, using defaults"< work_queue; std::unordered_map renders; Poco::Mutex mutex; //lock for access from parent thread std::string output_filename; std::string graph_dir; std::string media_dir; std::string output_dir; std::string graph_filename; std::string graph_body; Audio_thumbnailer *audio_thumb; Graph graph; float output_framerate; }; } #endif