summaryrefslogtreecommitdiff
path: root/NT/src/graph.h
blob: c61d38500b1be6ed97f5cc4b2829d5bb57a179be (plain)
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
#ifndef GRAPH_H
#define GRAPH_H

/* 
Graph object manages a collection of nodes and provides the interface for rendering frames


*/

#include "rotor.h"


namespace Rotor {
	class Graph{
		public:
			Graph(){init();};
			Graph(const std::string& _uid,const std::string& _desc){
				init(_uid,_desc);
			};
			void init(const std::string& _uid="",const std::string& _desc=""){
				uid=_uid;
				description=_desc;
				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;
			}
			std::string uid;
			std::string description;
			std::unordered_map<std::string,Node*> nodes;
			std::vector<Node*> find_nodes(const std::string &type);
			Node* find_node(const std::string &type);
			Json::Value signal_render(const std::string &node,const double framerate);
			bool video_render(const std::string &output_filename,const double framerate,int start, int end);
			bool load(std::string data ,std::string media_path);
			bool loadFile(std::string &filename,std::string media_path);
			bool parseJson(std::string &data,std::string &media_path);
			Json::Value preview(std::string &node ,std::string &format,int frame,int w,int h);
			bool check_audio (std::string audio ,std::string path);
			Json::Value print_features (std::string &node);
			//bool load_audio(const std::string &filename, std::vector<Audio_processor*> processors);
			bool load_video(const std::string &node_id,const std::string &filename);
			bool loaded;
			bool audio_loaded;
			std::string audio_filename;
			bool cancelled;
			double progress;
			void set_log_name (std::string _Log_name){
				Log_name=_Log_name;
			}

			//Audio_thumbnailer *audio_thumb;
		private:
			int analysis_seed;
			std::string Log_name;

	};
}

#endif //GRAPH_H