From f09e12889c4ebfa3db21fa30955698171a22757b Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 26 Apr 2013 18:40:39 +0100 Subject: tinkering gstreamer loader --- rotord/rendercontext.cpp | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'rotord/rendercontext.cpp') 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& 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 "<& response.description+="45.2\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="DUMMY RESPONSE Starting video analysis: "+command[3]+"\n"; + response.description="Rotor: succesfully loaded "+command[4]+" into video node "+command[3]+"\n"; + } + else { + response.status=HTTPResponse::HTTP_INTERNAL_SERVER_ERROR; + response.description="Rotor: could not load "+command[4]+" into video node "+command[3]+"\n"; + } } - else { + else { response.status=HTTPResponse::HTTP_NOT_FOUND; - response.description="File "+command[3]+" not found\n"; + response.description="File '"+command[4]+"' not found\n"; } } else { @@ -203,10 +214,14 @@ Command_response Render_context::session_command(const std::vector& response.description="Rotor: session busy\n"; } } + else { + response.status=HTTPResponse::HTTP_BAD_REQUEST; + response.description="Rotor: bad request\n"; + } } if (command[0]=="DELETE") { //DUMMY RESPONSE - response.description="DUMMY RESPONSE 1\n"; + response.description="DUMMY RESPONSE 1\n"; response.status=HTTPResponse::HTTP_OK; } @@ -410,8 +425,8 @@ bool Render_context::load_audio(const string &filename,vectortype=="video_input") { -- cgit v1.2.3