From 5f2df368b458b29c396a72dc0cd4479525d06e01 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Wed, 2 Mar 2016 18:50:27 +0100 Subject: [PATCH] Integrate `OMXPlayerCache` into `VideoSource` --- src/Sources/VideoSource.cpp | 13 ++----------- src/Sources/VideoSource.h | 1 + 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/Sources/VideoSource.cpp b/src/Sources/VideoSource.cpp index 3984ed8..1658627 100644 --- a/src/Sources/VideoSource.cpp +++ b/src/Sources/VideoSource.cpp @@ -23,14 +23,7 @@ void VideoSource::loadVideo(string & filePath){ path = filePath; setNameFromPath(filePath); #ifdef TARGET_RASPBERRY_PI - ofxOMXPlayerSettings settings; - settings.videoPath = filePath; - settings.useHDMIForAudio = true; - settings.enableTexture = true; - settings.enableLooping = true; - settings.enableAudio = VideoSource::enableAudio; - omxPlayer = new ofxOMXPlayer(); - omxPlayer->setup(settings); + omxPlayer = OMXPlayerCache::instance()->load(filePath); texture = &(omxPlayer->getTextureReference()); #else videoPlayer = new ofVideoPlayer(); @@ -47,9 +40,7 @@ void VideoSource::loadVideo(string & filePath){ void VideoSource::clear(){ texture = 0; #ifdef TARGET_RASPBERRY_PI - omxPlayer->close(); - delete omxPlayer; - omxPlayer = 0; + OMXPlayerCache::instance()->unload(path); #else ofRemoveListener(ofEvents().update, this, &VideoSource::update); videoPlayer->stop(); diff --git a/src/Sources/VideoSource.h b/src/Sources/VideoSource.h index a530c2d..39ab87e 100644 --- a/src/Sources/VideoSource.h +++ b/src/Sources/VideoSource.h @@ -5,6 +5,7 @@ #ifdef TARGET_RASPBERRY_PI #include "ofxOMXPlayer.h" + #include "OMXPlayerCache.h" #endif namespace ofx {