From c2237c2116ca551c0755821beadae3fac54547e7 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 30 Jul 2013 13:52:22 +0100 Subject: perfecting draw node --- rotord/src/rotor.cpp | 77 ++++++++++++---------------------------------------- 1 file changed, 17 insertions(+), 60 deletions(-) (limited to 'rotord/src/rotor.cpp') diff --git a/rotord/src/rotor.cpp b/rotord/src/rotor.cpp index 8b72c50..77433ac 100755 --- a/rotord/src/rotor.cpp +++ b/rotord/src/rotor.cpp @@ -268,22 +268,7 @@ bool Video_output::render(const float duration, const float framerate,const stri } bool Video_loader::load(const string &filename){ - /* - //gstreamer needs absolute paths ALWAYS - //string uri="file:///home/tim/workspace/rotor/rotord/"+filename; - Poco::Path path; - string uri="file://"+path.current()+filename; - //cerr << "video input: loading "<loadMovie(uri)){ - player->play(); - player->setPaused(true); - player->setFrameByFrame(true); - player->update(); - cerr<<"Rotor::Video_loader: "<getDuration()<<" seconds "<<", "<getWidth()<<"x"<getHeight()<setup_fromRGB(player->getWidth(),player->getHeight(),(uint8_t*) player->getPixels()); - return true; - } - */ + if (isLoaded) { player.cleanup(); ///should be in decoder class? isLoaded=false; @@ -299,63 +284,35 @@ bool Video_loader::load(const string &filename){ return false; } Image* Video_loader::output(const Frame_spec &frame){ - //wonder about the actual mechanism used by gstreamer - //have to implment callback when seek is ready? - //presume gstreamer caches a loaded frame? - - - //deal with reolution: swscale from avcodec or put scaler in pipeline? - //can image node point to buffer in gst rather than copying the pixels? - - //to test using fp time to seek: need a short movie with synced audio - - //fix actual duration and audio file - //trace frame that is being read - /* - if (player->isLoaded()){ - //player->setPosition(frame.time); - int wanted=((int) (frame.time*frame.framerate))%(player->getTotalNumFrames()-2); //-2?? - player->setFrame(wanted); - //while (player->getCurrentFrame()!=wanted){ - // cerr << "seeking to "<getCurrentFrame()<setFrame(wanted); - //player->update(); - // sleep(.001); - //} - player->update(); - image->RGBdata=player->getPixels(); //don't really know why this is needed every frame - //cerr<<"Video_loader: retrieving frame "<<((int) (frame.time*frame.framerate))<0) return ℑ //just return the previous frame if possible else return nullptr; }; - //cerr<<"Video_loader: setting up frame: lineoffset="<<(player.pFrameRGB->linesize[0]-(frame.w*3))<data[0],player.pFrameRGB->linesize[0]-(frame.w*3)); return ℑ } + return nullptr; +}; +/* +bool CVideo_loader::load(const string &filename){ - //confusingly, crashes with files not made with short files? - //seems to be on last frame? - returns nullptr - still tries to clone? - //can't really return 1st frame instead, should get # of frames right 1st? - //think about what echo trails does on the last frame + Poco::Path path; + string uri="file://"+filename; + isLoaded=player.open(filename); + if (isLoaded){ + cerr<<"Rotor::Video_loader: "<