mirror of
https://github.com/kr15h/ofxPiMapper.git
synced 2026-06-16 12:31:49 +02:00
Attempt to fix VideoSource looping on RPi
This commit is contained in:
@@ -9,6 +9,7 @@ bool VideoSource::useHDMIForAudio = false;
|
||||
VideoSource::VideoSource(){
|
||||
loadable = true;
|
||||
loaded = false;
|
||||
_loop = true;
|
||||
type = SourceType::SOURCE_TYPE_VIDEO;
|
||||
#ifdef TARGET_RASPBERRY_PI
|
||||
_omxPlayer = 0;
|
||||
@@ -37,6 +38,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();
|
||||
@@ -90,6 +92,14 @@ void VideoSource::stop(){
|
||||
_videoPlayer->update();
|
||||
}
|
||||
}
|
||||
#else
|
||||
void VideoSource::update(ofEventArgs & args){
|
||||
if(!_loop && _omxPlayer != 0){
|
||||
if(_omxPlayer->getGurrentFrame() >= _omxPlayer->getTotalNumFrames() - 1){
|
||||
_omxPlayer->setPaused(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace piMapper
|
||||
|
||||
@@ -41,6 +41,8 @@ class VideoSource : public BaseSource {
|
||||
unique_ptr<ofVideoPlayer> _videoPlayer;
|
||||
bool _initialVolumeSet;
|
||||
#endif
|
||||
|
||||
bool _loop;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user