summaryrefslogtreecommitdiff
path: root/rotord/src/rendercontext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/src/rendercontext.cpp')
-rw-r--r--rotord/src/rendercontext.cpp73
1 files changed, 48 insertions, 25 deletions
diff --git a/rotord/src/rendercontext.cpp b/rotord/src/rendercontext.cpp
index 53c7c64..1beb6cc 100644
--- a/rotord/src/rendercontext.cpp
+++ b/rotord/src/rendercontext.cpp
@@ -36,7 +36,7 @@ void Render_context::runTask() {
if(cmd.task==RENDER) {
state=RENDERING;
renders[cmd.uid]=Render_status(RENDERING);
- if(graph.video_render(output_filename,output_framerate)){
+ if(graph.video_render(output_filename,output_framerate,start,stop)){
state=IDLE;
if (graph.cancelled) renders[cmd.uid].status=CANCELLED;
else renders[cmd.uid].status=RENDER_READY;
@@ -373,28 +373,35 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H
if (command.method=="PUT") { //get vide file location and initiate analysis
if (command.body!="") { //there should be a filename + a destination node
if (state!=RENDERING) {
- string video_filename=media_dir+command.body;
- //check file exists
- Poco::File f=Poco::File(video_filename);
- if (f.exists()) {
- if (graph.load_video(command.commands[2],video_filename)) {
- //pass to worker thread ??if engine is ready?? ??what if engine has finished but results aren't read??
- //DUMMY RESPONSE
- status=HTTPResponse::HTTP_OK;
- logger.information("Succesfully loaded "+command.body+" into video node "+command.commands[2]);
- XML.addValue("status","Succesfully loaded "+command.body+" into video node "+command.commands[2]);
+ if (command.commands.size()>2) {
+ string video_filename=media_dir+command.body;
+ //check file exists
+ Poco::File f=Poco::File(video_filename);
+ if (f.exists()) {
+ if (graph.load_video(command.commands[2],video_filename)) {
+ //pass to worker thread ??if engine is ready?? ??what if engine has finished but results aren't read??
+ //DUMMY RESPONSE
+ status=HTTPResponse::HTTP_OK;
+ logger.information("Succesfully loaded "+command.body+" into video node "+command.commands[2]);
+ XML.addValue("status","Succesfully loaded "+command.body+" into video node "+command.commands[2]);
+ }
+ else {
+ status=HTTPResponse::HTTP_INTERNAL_SERVER_ERROR;
+ logger.error("ERROR: could not load "+command.body+" into video node "+command.commands[2]);
+ XML.addValue("error","could not load "+command.body+" into video node "+command.commands[2]);
+ }
}
else {
- status=HTTPResponse::HTTP_INTERNAL_SERVER_ERROR;
- logger.error("ERROR: could not load "+command.body+" into video node "+command.commands[2]);
- XML.addValue("error","could not load "+command.body+" into video node "+command.commands[2]);
- }
- }
- else {
status=HTTPResponse::HTTP_NOT_FOUND;
logger.error("ERROR: "+command.body+" not found");
XML.addValue("error",command.body+" not found");
}
+ }
+ else {
+ status=HTTPResponse::HTTP_NOT_FOUND;
+ logger.error("ERROR: video loader node not specified");
+ XML.addValue("error","video loader node not specified");
+ }
}
else {
status=HTTPResponse::HTTP_BAD_REQUEST;
@@ -495,15 +502,31 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H
if (command.method=="PUT") {
if (command.body!="") {
if (state==IDLE) {
- output_filename=output_dir+command.body;
- if (command.body!="") {
-// output_framerate=toFloat(command.body);
+ Poco::StringTokenizer t1(command.body,",");
+ if (t1.count()>1){
+ output_filename=output_dir+t1[0];
+ start=toInt(t1[1]);
+ if (t1.count()>2){
+ stop=toInt(t1[2]);
+ if (t1.count()>3){
+ float framerate=toFloat(t1[3]);
+ if (framerate>0.0f) {
+ output_framerate=framerate;
+ }
+ }
}
- add_queue(Session_task(command.uid,RENDER));
- status=HTTPResponse::HTTP_OK;
- logger.information("Starting render: "+command.body);
- XML.addValue("status","Starting render: "+command.body);
- XML.addValue("render_id",command.uid);
+ }
+ else {
+ start=0;
+ stop=999999;
+ output_filename=output_dir+command.body;
+ }
+ add_queue(Session_task(command.uid,RENDER));
+ status=HTTPResponse::HTTP_OK;
+ logger.information("Starting render: "+command.body);
+ XML.addValue("status","Starting render: "+command.body);
+ XML.addValue("render_id",command.uid);
+ XML.addValue("path",output_filename);
}
else {
status=HTTPResponse::HTTP_BAD_REQUEST;