diff options
Diffstat (limited to 'rotord/src/rendercontext.cpp')
| -rw-r--r-- | rotord/src/rendercontext.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/rotord/src/rendercontext.cpp b/rotord/src/rendercontext.cpp index 47113c1..cebe003 100644 --- a/rotord/src/rendercontext.cpp +++ b/rotord/src/rendercontext.cpp @@ -11,6 +11,7 @@ void Render_context::runTask() { if (work_queue.size()){ cmd=work_queue[0]; work_queue.pop_front(); + graph.cancelled=false; } mutex.unlock(); if(cmd.task==ANALYSE_AUDIO) { @@ -37,7 +38,8 @@ void Render_context::runTask() { renders[cmd.uid]=Render_status(RENDERING); if(graph.video_render(output_filename,output_framerate,progress)){ state=IDLE; - renders[cmd.uid].status=RENDER_READY; + if (graph.cancelled) renders[cmd.uid].status=CANCELLED; + else renders[cmd.uid].status=RENDER_READY; } else { //an error occurred: TODO have to clean up allocated data. autoptr? @@ -416,6 +418,25 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H XML.addValue("status","DUMMY RESPONSE: cancelling render"); } } + if (command.commands[1]=="cancel") { + if (command.method=="PUT") { + if (state==RENDERING||state==ANALYSING_AUDIO){ + graph.cancelled=true; + logger.information("Render cancelled."); + XML.addValue("status","render cancelled"); + } + else { + status=HTTPResponse::HTTP_BAD_REQUEST; + logger.error("ERROR: no process to cancel"); + XML.addValue("error","No process to cancel"); + } + } + else { + status=HTTPResponse::HTTP_BAD_REQUEST; + logger.error("ERROR: Bad request"); + XML.addValue("error","Bad request"); + } + } } bool Render_context::load_audio(const string &filename,vector<Audio_processor*> processors){ |
