1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#ifndef GRAPH_H
#define GRAPH_H
/*
Represents a graph of rotor nodes and includes methods to manipulate nodes
TJR Jan 2014
*/
#include "factory.h"
#include "Poco/File.h"
#include "Poco/FileStream.h"
#include "Poco/CountingStream.h"
#include "Poco/StreamCopier.h"
namespace Rotor {
class Graph{
public:
Graph(){init();};
Graph(const std::string& _id){
init(_id);
};
void init(const std::string& _id=""){
id=_id;
loaded=false;
audio_loaded=false;
cancelled=false;
//audio_thumb=new Audio_thumbnailer();
//Log_name="";
};
~Graph(){
clear();
//delete audio_thumb;
};
void clear(){
for (auto n: nodes) {
delete n.second;
}
nodes.clear();
loaded=false;
}
//how to do output?
//think video_render should be part of render context
//graph should just encapsulate the manipulation of the graph
//specific nodes can be created as output targets
std::vector<Node*> find_nodes(const std::string &type);
Node* find_node(const std::string &type);
Node* get_node(const std::string &id);
//--context// Json::Value signal_render(const std::string &node,const double framerate);
//--context// bool video_render(const std::string &output_filename,const double framerate,int start, int end);
bool load_file(std::string filename,std::string media_path);
bool parse_json(std::string &data,std::string &media_path);
//--context// Json::Value preview(std::string &node ,std::string &format,int frame,int w,int h);
bool check_audio (std::string audio ,std::string path);
//--context// Json::Value print_features (std::string &node);
bool load_audio(const std::string &filename);
//bool load_video(const std::string &node_id,const std::string &filename);
//load audio and video should be methods of the nodes themselves?
bool loaded;
bool audio_loaded;
std::string audio_filename;
bool cancelled;
double progress;
//void set_log_name (std::string _Log_name){
//log name should be the same as the graph uid
//Log_name=_Log_name;
//}
//Audio_thumbnail *audio_thumb;
//how does audio thumbnail fit in with the new plan?
//a graph has A audio thumbnail to represent THE audio track?
//is this important any more? I don't think Josep uses it?
//also need to review workflow with audio
private:
std::string id;
std::unordered_map<std::string,Node*> nodes;
double duration;
};
}
#endif //GRAPH_H
|