diff options
Diffstat (limited to 'rotord')
| -rw-r--r-- | rotord/Makefile | 3 | ||||
| -rwxr-xr-x | rotord/rotor.cpp | 12 | ||||
| -rwxr-xr-x | rotord/rotor.h | 20 |
3 files changed, 19 insertions, 16 deletions
diff --git a/rotord/Makefile b/rotord/Makefile index 4735e7a..245a0dd 100644 --- a/rotord/Makefile +++ b/rotord/Makefile @@ -3,7 +3,8 @@ #http://docs.gstreamer.com/display/GstSDK/Installing+on+Linux #MY_CFLAGS = -fpermissive -std=c++11 -Wno-error -I /opt/gstreamer-sdk/include/gstreamer-0.10/ -I /opt/gstreamer-sdk/include/glib-2.0 -I /opt/gstreamer-sdk/lib/glib-2.0/include -I /opt/gstreamer-sdk/include/libxml2 $(shell pkg-config gstreamer-0.10 gstreamer-video-0.10 gstreamer-base-0.10 --cflags) -MY_CFLAGS = -fpermissive -std=c++11 -Wno-error $(shell pkg-config gstreamer-0.10 gstreamer-video-0.10 gstreamer-base-0.10 --cflags) +MY_CFLAGS = -fpermissive -std=c++11 +#-Wno-error $(shell pkg-config gstreamer-0.10 gstreamer-video-0.10 gstreamer-base-0.10 --cflags) # -I ../ffmpeg diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp index 1768b8b..00fd465 100755 --- a/rotord/rotor.cpp +++ b/rotord/rotor.cpp @@ -18,7 +18,7 @@ Node_factory::Node_factory(){ add_type("video_cycler",new Video_cycler()); add_type("luma_levels",new Luma_levels()); add_type("echo_trails",new Echo_trails()); - add_type("track_time",new Track_time()); + add_type("track_time",new Track_time()); add_type("comparison",new Comparison()); //TODO: alias to symbols add_type("arithmetic",new Arithmetic()); //TODO: alias to symbols } @@ -45,7 +45,7 @@ bool Image_input::connect(Image_node* source) { void Node::update_params(const Time_spec& time){ //compute connected parameters for (auto p:parameter_inputs){ p->update(time); - } + } } bool Signal_output::render(const float duration, const float framerate,string &xml_out){ //testing signal routes @@ -239,12 +239,12 @@ bool Video_loader::load(const string &filename){ */ Poco::Path path; string uri="file://"+path.current()+filename; - - if (player.open(uri)){ + isLoaded=player.open(uri); + if (isLoaded){ cerr<<"Rotor::Video_loader: "<<filename<<", "<<player.getNumberOfFrames()<<" frames "<<", "<<player.getWidth()<<"x"<<player.getHeight()<<endl; return true; } - + cerr<<"Rotor::Video_loader: failed to load "<<filename<<endl; return false; } Image* Video_loader::output(const Frame_spec &frame){ @@ -278,7 +278,7 @@ Image* Video_loader::output(const Frame_spec &frame){ } */ - if (player.isOpen){ + if (isLoaded){ int wanted=((int) (frame.time*frame.framerate))%(player.getNumberOfFrames()-2); //-2?? player.fetchFrame(wanted); image.setup_fromRGB(frame.w,frame.h,player.pFrameRGB->data[0]); diff --git a/rotord/rotor.h b/rotord/rotor.h index c3886d8..186d25b 100755 --- a/rotord/rotor.h +++ b/rotord/rotor.h @@ -63,7 +63,6 @@ extern "C" { #include "xmlIO.h" #include "libavaudioloader.h" #include "libavexporter.h" -#include "gstvideoloader.h" #include "utils.h" //fequal #include "libavwrapper.h" @@ -594,22 +593,23 @@ namespace Rotor { if (inputs[0]->connection) { if (fgreater_or_equal(1.0f,(((Signal_node*)inputs[0]->connection)->get_output((Time_spec)frame)))) { Image *in=(((Image_node*)image_inputs[0]->connection)->get_output(frame)); - image->setup(frame.w,frame.h); - for (int i=0;i<in->w*in->h*3;i++) { - image->RGBdata[i]=255-in->RGBdata[i]; + if (in){ + image->setup(frame.w,frame.h); + for (int i=0;i<in->w*in->h*3;i++) { + image->RGBdata[i]=255-in->RGBdata[i]; + } + return image; } - return image; - } } return (((Image_node*)image_inputs[0]->connection)->get_output(frame)); } - return nullptr; + } if (image_inputs[0]->connection) { - + return image; } - return image; + return nullptr; } private: Image *image; //is an image generator @@ -647,6 +647,7 @@ namespace Rotor { base_settings(settings); //player=new ofGstVideoPlayer(); //image=new Image(); + isLoaded=false; }; ~Video_loader(){}; bool load(const string &filename); @@ -656,6 +657,7 @@ namespace Rotor { //ofGstVideoPlayer *player; libav::decoder player; Image image; + bool isLoaded; }; class Video_cycler: public Image_node { //cycles through video inputs in order |
