diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-08-28 13:42:34 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-08-28 13:42:34 +0100 |
| commit | d601a85b50bbac9fc9c46321af64f1137aaf5af7 (patch) | |
| tree | e5e8f6bca5abf9f3fdcbc5b804e1171c6d095a55 /rotord | |
| parent | c8d6dd7e23c5ccb9f6118c47cf02c306b180a592 (diff) | |
installer work
Diffstat (limited to 'rotord')
| -rw-r--r-- | rotord/src/graph.cpp | 6 | ||||
| -rw-r--r-- | rotord/src/rendercontext.cpp | 41 | ||||
| -rwxr-xr-x | rotord/src/rotor.h | 1 |
3 files changed, 47 insertions, 1 deletions
diff --git a/rotord/src/graph.cpp b/rotord/src/graph.cpp index 162232f..e67d6f3 100644 --- a/rotord/src/graph.cpp +++ b/rotord/src/graph.cpp @@ -33,6 +33,10 @@ bool Graph::signal_render(string &signal_xml,const float framerate) { return false; } */ +bool Graph::preview(xmlIO &XML,int w,int h){ + return true; +} + bool Graph::video_render(const string &output_filename,const string &audio_filename,const float framerate,float& progress) { vector<Node*> loaders=find_nodes("video_loader"); for (auto i:loaders){ @@ -89,7 +93,7 @@ bool Graph::loadFile(string &filename,string media_path){ } bool Graph::parseJson(string &data,string &media_path){ //cerr<<data<<endl; - cerr<<"Trying to load JSON"<<endl; + //cerr<<"Trying to load JSON"<<endl; Json::Value root; // will contains the root value after parsing. Json::Reader reader; bool parsingSuccessful = reader.parse( data, root ); diff --git a/rotord/src/rendercontext.cpp b/rotord/src/rendercontext.cpp index 47ff9c1..77adc71 100644 --- a/rotord/src/rendercontext.cpp +++ b/rotord/src/rendercontext.cpp @@ -295,6 +295,47 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H XML.addValue("error","Bad request"); } } + else { + status=HTTPResponse::HTTP_BAD_REQUEST; + logger.error("ERROR: Bad request"); + XML.addValue("error","Bad request"); + } + } + if (command.commands[1]=="preview") { + if (command.method=="GET") { + if(state==IDLE){ + //parse json to get preview spec, return XML? this is a mess + string preview_node=command.commands[2]; + Json::Value root; // will contains the root value after parsing. + Json::Reader reader; + if (reader.parse( command.body, root )) { + int frame=root["frame"].asInt(); + int width=root["width"].asInt(); + int height=root["height"].asInt(); + string resolution=root["resolution"].asString(); + cerr<<"preview: "<<frame<<" "<<width<<" "<<height<<" "<<resolution<<endl; + //if (graph.preview(XML,frame,resolution)) + status=HTTPResponse::HTTP_OK; + } + else { + std::cout << "Failed to parse preview request\n" + << reader.getFormattedErrorMessages(); + status=HTTPResponse::HTTP_BAD_REQUEST; + logger.error("ERROR: Bad preview request"); + XML.addValue("error","Bad preview request"); + } + } + else { + status=HTTPResponse::HTTP_BAD_REQUEST; + logger.error("ERROR: Session busy"); + XML.addValue("error","Session busy"); + } + } + else { + status=HTTPResponse::HTTP_BAD_REQUEST; + logger.error("ERROR: Bad request"); + XML.addValue("error","Bad request"); + } } if (command.commands[1]=="render") { if (command.method=="GET") { diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h index 616fb5d..85124ce 100755 --- a/rotord/src/rotor.h +++ b/rotord/src/rotor.h @@ -1213,6 +1213,7 @@ namespace Rotor { bool parseXml(string media_path); bool parseJson(string &data,string &media_path); bool set_resolution(int w,int h); + bool preview(xmlIO &XML,int w,int h); bool loaded; float duration; const string toString(); |
