summaryrefslogtreecommitdiff
path: root/rotord/rotor.h
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/rotor.h')
-rwxr-xr-xrotord/rotor.h92
1 files changed, 41 insertions, 51 deletions
diff --git a/rotord/rotor.h b/rotord/rotor.h
index 293d3fa..abba4cf 100755
--- a/rotord/rotor.h
+++ b/rotord/rotor.h
@@ -1,3 +1,5 @@
+#ifndef ROTOR_H
+#define ROTOR_H
/*
nodes can have many inputs but only 1 output
@@ -18,6 +20,7 @@ http://stackoverflow.com/questions/5261658/how-to-seek-in-ffmpeg-c-c
#include <memory>
#include <sys/time.h>
#include <iostream>
+//#include <cairo.h>
#include "Poco/Net/HTTPServer.h"
@@ -69,26 +72,23 @@ extern "C" {
#define AUDIO_INBUF_SIZE 20480
#define AUDIO_REFILL_THRESH 4096
-#include "vampHost.h"
#include "xmlIO.h"
#include "utils.h" //fequal
#include "libavwrapper.h"
#include "cvimage.h"
namespace Rotor {
-#define IDLE 0
-#define ANALYSING_AUDIO 1
-#define AUDIO_READY 2
-#define CREATING_PREVIEW 3
-#define PREVIEW_READY 4
-#define RENDERING 5
-#define RENDER_READY 6
-
-#define ANALYSE_AUDIO 1
-#define PREVIEW 2
-#define RENDER 3
-
+ #define IDLE 0
+ #define ANALYSING_AUDIO 1
+ #define AUDIO_READY 2
+ #define CREATING_PREVIEW 3
+ #define PREVIEW_READY 4
+ #define RENDERING 5
+ #define RENDER_READY 6
+ #define ANALYSE_AUDIO 1
+ #define PREVIEW 2
+ #define RENDER 3
//forward declaration
class Node;
@@ -97,7 +97,7 @@ namespace Rotor {
class Parameter_input;
//http://blog.tomaka17.com/2012/03/libavcodeclibavformat-tutorial/
- struct Packet {
+ /* struct Packet {
explicit Packet(AVFormatContext* ctxt = nullptr) {
av_init_packet(&packet);
packet.data = nullptr;
@@ -123,6 +123,7 @@ namespace Rotor {
AVPacket packet;
};
+ */
class Time_spec{
public:
Time_spec(){};
@@ -262,43 +263,6 @@ namespace Rotor {
int channels,bits,samples,rate;
};
//actual nodes-------------------------------------------------
- class Audio_analysis: public Base_audio_processor {
- public:
- Audio_analysis(){};
- Audio_analysis(map<string,string> &settings) {
- base_settings(settings);
- soname=find_setting(settings,"soname");
- id=find_setting(settings,"id");
- outputNo=find_setting(settings,"outputNo",0);
- };
- Audio_analysis* clone(map<string,string> &_settings) { return new Audio_analysis(_settings);};
- bool init(int _channels,int _bits,int _samples,int _rate);
- void cleanup();
- void set_parameter(const std::string &key,const std::string &value){params[key]=ofToFloat(value);};
- int process_frame(uint8_t *data,int samples_in_frame);
- const float output(const Time_spec &time) {
- if (analyser.features.size()) {
- auto i=analyser.features.upper_bound(time.time); //the first element in the container whose key is considered to go after k
- if (i!=analyser.features.end()){
- float uk=i->first;
- i--;
- float lk=i->first;
- int ln=i->second;
- return (((time.time-lk)/(uk-lk))+ln);
- }
- }
- return 0.0f;
- }
- void print_features();
- void print_summary(){
- cerr<<"vamp plugin "<<id<<" of library "<<soname<<" found "<<analyser.features.size()<<" features "<<endl;
- };
- private:
- string soname,id;
- int outputNo;
- vampHost::Analyser analyser;
- map <string,float> params;
- };
class Time: public Signal_node {
public:
Time(){};
@@ -1299,6 +1263,31 @@ namespace Rotor {
private:
Image *image; //is an image generator
};
+ class Draw: public Image_node {
+ public:
+ Draw(){image=nullptr;};
+ Draw(map<string,string> &settings) {
+ base_settings(settings);
+ };
+ ~Draw(){ if (image) delete image;};
+ Draw* clone(map<string,string> &_settings) { return new Draw(_settings);};
+ Image *output(const Frame_spec &frame){
+ if (image_inputs.size()) {
+ if (image_inputs[0]->connection){
+ //copy incoming image **writable
+ if (image) delete image;
+ image=(((Image_node*)image_inputs[0]->connection)->get_output(frame))->clone();
+ }
+ else image->setup(frame.w,frame.h);
+ }
+ else image->setup(frame.w,frame.h); //do this twice or use a goto
+ //draw onto new or input image
+
+ return image;
+ }
+ private:
+ Image *image; //is an image generator
+ };
//-------------------------------------------------------------------
class Node_factory{
public:
@@ -1426,3 +1415,4 @@ coding style
Types begin with capitals 'New_type'
variables/ instances use lower case with underscore as a seperator
*/
+#endif \ No newline at end of file