diff options
| author | Tim Redfern <tim@herge.(none)> | 2013-04-26 18:40:39 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@herge.(none)> | 2013-04-26 18:40:39 +0100 |
| commit | f09e12889c4ebfa3db21fa30955698171a22757b (patch) | |
| tree | b6cdfea066c94300325c9163fbe813acef467c31 /rotord/rendercontext.cpp | |
| parent | e9320eb83115f66e99bd98e76c8c9ff78ca043d4 (diff) | |
tinkering gstreamer loader
Diffstat (limited to 'rotord/rendercontext.cpp')
| -rw-r--r-- | rotord/rendercontext.cpp | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/rotord/rendercontext.cpp b/rotord/rendercontext.cpp index 948ef31..d6469bd 100644 --- a/rotord/rendercontext.cpp +++ b/rotord/rendercontext.cpp @@ -48,6 +48,11 @@ void Render_context::add_queue(int item) { Command_response Render_context::session_command(const std::vector<std::string>& command){ //method,id,command1,{command2,}{body} //here we allow the controlling server to communicate with running tasks + string ems=""; + for (auto i:command) ems=ems+i+":"; + + cerr<<"Rotor: session command with "<<command.size()<<" arguments- "<<ems<<endl; + Command_response response; response.status=HTTPResponse::HTTP_BAD_REQUEST; if (command[2]=="audio") { @@ -184,18 +189,24 @@ Command_response Render_context::session_command(const std::vector<std::string>& response.description+="<progress>45.2</progress>\n"; } if (command[0]=="PUT") { //get vide file location and initiate analysis - if (command.size()>2) { + if (command.size()>4) { //there should be a filename + a destination node if (state==IDLE) { //check file exists - Poco::File f=Poco::File(command[3]); + Poco::File f=Poco::File(command[4]); if (f.exists()) { + if (load_video(command[3],command[4])) { //pass to worker thread ??if engine is ready?? ??what if engine has finished but results aren't read?? //DUMMY RESPONSE - response.description="<status context='"+command[1]+"'>DUMMY RESPONSE Starting video analysis: "+command[3]+"</status>\n"; + response.description="<status context='"+command[1]+"'>Rotor: succesfully loaded "+command[4]+" into video node "+command[3]+"</status>\n"; + } + else { + response.status=HTTPResponse::HTTP_INTERNAL_SERVER_ERROR; + response.description="<status context='"+command[1]+"'>Rotor: could not load "+command[4]+" into video node "+command[3]+"</status>\n"; + } } - else { + else { response.status=HTTPResponse::HTTP_NOT_FOUND; - response.description="<status context='"+command[1]+"'>File "+command[3]+" not found</status>\n"; + response.description="<status context='"+command[1]+"'>File '"+command[4]+"' not found</status>\n"; } } else { @@ -203,10 +214,14 @@ Command_response Render_context::session_command(const std::vector<std::string>& response.description="<status context='"+command[1]+"'>Rotor: session busy</status>\n"; } } + else { + response.status=HTTPResponse::HTTP_BAD_REQUEST; + response.description="<status context='"+command[1]+"''>Rotor: bad request</status>\n"; + } } if (command[0]=="DELETE") { //DUMMY RESPONSE - response.description="<status>DUMMY RESPONSE 1</status>\n"; + response.description="<status context='"+command[1]+"''>DUMMY RESPONSE 1</status>\n"; response.status=HTTPResponse::HTTP_OK; } @@ -410,8 +425,8 @@ bool Render_context::load_audio(const string &filename,vector<Base_audio_process return true; } -bool Render_context::load_video(string nodeID,string &filename){ - //this is a good standard example of how to find +bool Render_context::load_video(const string &nodeID,const string &filename){ + //this is a good standard example of how to find //a node of a specific type by ID and do something if (graph.nodes.find(nodeID)!=graph.nodes.end()){ if (graph.nodes[nodeID]->type=="video_input") { |
