diff options
Diffstat (limited to 'rotord/rotor.cpp')
| -rwxr-xr-x | rotord/rotor.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp index 52c76df..1768b8b 100755 --- a/rotord/rotor.cpp +++ b/rotord/rotor.cpp @@ -221,6 +221,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; @@ -235,16 +236,22 @@ bool Video_loader::load(const string &filename){ image->setup_fromRGB(player->getWidth(),player->getHeight(),(uint8_t*) player->getPixels()); return true; } + */ + Poco::Path path; + string uri="file://"+path.current()+filename; + + if (player.open(uri)){ + cerr<<"Rotor::Video_loader: "<<filename<<", "<<player.getNumberOfFrames()<<" frames "<<", "<<player.getWidth()<<"x"<<player.getHeight()<<endl; + return true; + } + 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? - //if (player->isLoaded()){ - // image.setup(player) - //} //deal with reolution: swscale from avcodec or put scaler in pipeline? //can image node point to buffer in gst rather than copying the pixels? @@ -253,6 +260,7 @@ Image* Video_loader::output(const Frame_spec &frame){ //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?? @@ -268,5 +276,15 @@ Image* Video_loader::output(const Frame_spec &frame){ //cerr<<"Video_loader: retrieving frame "<<((int) (frame.time*frame.framerate))<<endl; return image; } + */ + + if (player.isOpen){ + 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]); + return ℑ + } + + return nullptr; }; |
