From 67de16ab9156921e0f6aecca51cdeb73fd2bdf32 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Fri, 10 Aug 2018 18:20:38 +0200 Subject: [PATCH] Attempt to fix video loop problems on RPi --- src/Sources/VideoSource.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/Sources/VideoSource.cpp b/src/Sources/VideoSource.cpp index 687f536..acdc771 100644 --- a/src/Sources/VideoSource.cpp +++ b/src/Sources/VideoSource.cpp @@ -41,11 +41,7 @@ void VideoSource::loadVideo(std::string & filePath){ void VideoSource::setLoop(bool loop){ _loop = loop; - #ifdef TARGET_RASPBERRY_PI - if(_omxPlayer == 0) return; - if(loop) _omxPlayer->enableLooping(); - else _omxPlayer->disableLooping(); - #else + #ifndef TARGET_RASPBERRY_PI if(_videoPlayer == 0) return; if(loop) _videoPlayer->setLoopState(OF_LOOP_NORMAL); else _videoPlayer->setLoopState(OF_LOOP_NONE); @@ -54,15 +50,17 @@ void VideoSource::setLoop(bool loop){ void VideoSource::clear(){ texture = 0; + #ifdef TARGET_RASPBERRY_PI OMXPlayerCache::instance()->unload(path); #else - ofRemoveListener(ofEvents().update, this, &VideoSource::update); _videoPlayer->stop(); _videoPlayer->close(); _videoPlayer.reset(); _videoPlayer = 0; #endif + + ofRemoveListener(ofEvents().update, this, &VideoSource::update); loaded = false; } @@ -100,11 +98,6 @@ void VideoSource::stop(){ if(_omxPlayer->getCurrentFrame() >= _omxPlayer->getTotalNumFrames() - 1){ _omxPlayer->setPaused(true); } - - // Make it double safe and pause for sure - if((float)_omxPlayer->getMediaTime() >= (float)_omxPlayer->getDurationInSeconds()){ - _omxPlayer->setPaused(true); - } } } #endif