diff options
Diffstat (limited to 'rotord/src/rotor.h')
| -rwxr-xr-x | rotord/src/rotor.h | 118 |
1 files changed, 82 insertions, 36 deletions
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h index f922fcf..ac11b9c 100755 --- a/rotord/src/rotor.h +++ b/rotord/src/rotor.h @@ -12,6 +12,14 @@ TODO - use try.. catch and dynamic_cast to verify node connections rather than c TODO - put the boilerplate code for checking inputs into the base class, finally call checked_output http://stackoverflow.com/questions/5261658/how-to-seek-in-ffmpeg-c-c + +300713 +trying to use opencv video loader for seeking +not so good - conflicts with included libav - seems to be incorrectly loaded + +would maybe need to do something like +http://stackoverflow.com/questions/12427928/configure-and-build-opencv-to-custom-ffmpeg-install + */ #include <unordered_map> @@ -70,10 +78,12 @@ extern "C" { #define AUDIO_INBUF_SIZE 20480 #define AUDIO_REFILL_THRESH 4096 +#include <highgui.h> //for opencv video IO + #include "xmlIO.h" #include "utils.h" //fequal -#include "libavwrapper.h" #include "cvimage.h" +#include "libavwrapper.h" namespace Rotor { #define IDLE 0 @@ -366,6 +376,12 @@ namespace Rotor { }; Arithmetic* clone(map<string,string> &_settings) { return new Arithmetic(_settings);}; const float output(const Time_spec &time) { + if (op==ARITHMETIC_divide||op==ARITHMETIC_modulo){ + if (value==0.0f) { + cerr<<"Arithmetic: caught division by zero"<<endl; + return 0.0f; + } + } if (inputs.size()) { //there should there be a way to specify number of inputs in the code rather than in xml if (inputs[0]->connection) { float in= (((Signal_node*)inputs[0]->connection)->get_output(time)); @@ -578,41 +594,6 @@ namespace Rotor { Image *image; //is an image generator //bool invert; }; - class Video_output: public Image_node { - public: - Video_output(){}; - Video_output(map<string,string> &settings) { - base_settings(settings); - }; - ~Video_output(){ }; - Image *output(const Frame_spec &frame){ - if (image_inputs[0]->connection) { - return ((Image_node*)(image_inputs[0]->connection))->get_output(frame); - } - else return nullptr; - }; - Video_output* clone(map<string,string> &_settings) { return new Video_output(_settings);}; - bool render(const float duration, const float framerate,const string &output_filename,const string &audio_filename,float& progress,int w,int h); - - private: - - }; - class Video_loader: public Image_node { - public: - Video_loader(){}; - Video_loader(map<string,string> &settings) { - base_settings(settings); - isLoaded=false; - }; - ~Video_loader(){}; - bool load(const string &filename); - Image *output(const Frame_spec &frame); - Video_loader* clone(map<string,string> &_settings) { return new Video_loader(_settings);}; - bool isLoaded; - private: - libav::decoder player; - Image image; - }; class Video_cycler: public Image_node { //cycles through video inputs in order public: @@ -1261,6 +1242,71 @@ namespace Rotor { private: Image *image; //is an image generator }; + class Video_loader: public Image_node { + public: + Video_loader(){}; + Video_loader(map<string,string> &settings) { + base_settings(settings); + isLoaded=false; + }; + ~Video_loader(){}; + bool load(const string &filename); + Image *output(const Frame_spec &frame); + Video_loader* clone(map<string,string> &_settings) { return new Video_loader(_settings);}; + bool isLoaded; + private: + libav::decoder player; + Image image; + }; + /* + class CVideo_loader: public Image_node { + + // attempt + + // /usr/bin/ld: warning: libavcodec.so.53, needed by /usr/lib/gcc/i686-linux-gnu/4.7/../../../../lib/libopencv_highgui.so, may conflict with libavcodec.so.55 + // /usr/bin/ld: warning: libavformat.so.53, needed by /usr/lib/gcc/i686-linux-gnu/4.7/../../../../lib/libopencv_highgui.so, may conflict with libavformat.so.55 + // /usr/bin/ld: warning: libavutil.so.51, needed by /usr/lib/gcc/i686-linux-gnu/4.7/../../../../lib/libopencv_highgui.so, may conflict with libavutil.so.52 + + // No URL Protocols are registered. Missing call to av_register_all()? + // libav::Error: file:///mnt/rotor/media/newsins1_360.mp4 Protocol not found + // Rotor::Video_loader: failed to load /mnt/rotor/media/newsins1_360.mp4 + // 30-07-2013 09:35:31 Rotor: ERROR: could not load newsins1_360.mp4 into video node 03 + + public: + CVideo_loader(){}; + CVideo_loader(map<string,string> &settings) { + base_settings(settings); + isLoaded=false; + }; + ~CVideo_loader(){}; + bool load(const string &filename); + Image *output(const Frame_spec &frame); + CVideo_loader* clone(map<string,string> &_settings) { return new CVideo_loader(_settings);}; + bool isLoaded; + private: + cv::VideoCapture player; + Image image; + }; + */ + class Video_output: public Image_node { + public: + Video_output(){}; + Video_output(map<string,string> &settings) { + base_settings(settings); + }; + ~Video_output(){ }; + Image *output(const Frame_spec &frame){ + if (image_inputs[0]->connection) { + return ((Image_node*)(image_inputs[0]->connection))->get_output(frame); + } + else return nullptr; + }; + Video_output* clone(map<string,string> &_settings) { return new Video_output(_settings);}; + bool render(const float duration, const float framerate,const string &output_filename,const string &audio_filename,float& progress,int w,int h); + + private: + + }; //------------------------------------------------------------------- class Node_factory{ public: |
