summaryrefslogtreecommitdiff
path: root/rotord
diff options
context:
space:
mode:
Diffstat (limited to 'rotord')
-rw-r--r--rotord/src/graph.cpp17
-rw-r--r--rotord/src/rendercontext.cpp2
-rwxr-xr-xrotord/src/rotor.h4
3 files changed, 18 insertions, 5 deletions
diff --git a/rotord/src/graph.cpp b/rotord/src/graph.cpp
index dc3e13e..9536fdc 100644
--- a/rotord/src/graph.cpp
+++ b/rotord/src/graph.cpp
@@ -33,11 +33,22 @@ bool Graph::signal_render(string &signal_xml,const float framerate) {
return false;
}
*/
-bool Graph::preview(xmlIO &XML,string node,int w,int h){
+bool Graph::preview(xmlIO &XML,string node,int frame,int w,int h){
//
//bool imencode(const string& ext, InputArray img, vector<uchar>& buf, const vector<int>& params=vector<int>())
-
- return true;
+ //if (find_node_id)
+ if (nodes.find(node)!=nodes.end()){
+ float t=frame*framerate;
+ if (dynamic_cast<Signal_node*>(nodes[node])){
+ Time_spec ts=Time_spec(t,framerate,0.0f);
+ XML.addValue("signal",dynamic_cast<Signal_node*>(nodes[node])->get_output(ts));
+ return true;
+ }
+ if (dynamic_cast<Image_node*>(nodes[node])){
+ return true;
+ }
+ }
+ return false;
}
bool Graph::video_render(const string &output_filename,const string &audio_filename,const float framerate,float& progress) {
diff --git a/rotord/src/rendercontext.cpp b/rotord/src/rendercontext.cpp
index a5bb54f..b93f39d 100644
--- a/rotord/src/rendercontext.cpp
+++ b/rotord/src/rendercontext.cpp
@@ -312,7 +312,7 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H
int frame=root["frame"].asInt();
int width=root["width"].asInt();
int height=root["height"].asInt();
- if (graph.preview(XML,preview_node,width,height)) {
+ if (graph.preview(XML,preview_node,frame,width,height)) {
status=HTTPResponse::HTTP_OK;
}
else {
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h
index f52c212..299510a 100755
--- a/rotord/src/rotor.h
+++ b/rotord/src/rotor.h
@@ -1199,6 +1199,7 @@ namespace Rotor {
uid=_uid;
description=_desc;
duration=20.0f;
+ framerate=25.0f;
};
string uid; //every version of a graph has a UUID, no particular need to actually read its data(?)
//?? is it faster than using strings??
@@ -1213,9 +1214,10 @@ 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,string node,int w,int h);
+ bool preview(xmlIO &XML,string node,int frame,int w,int h);
bool loaded;
float duration;
+ float framerate;
const string toString();
xmlIO xml;
private: