Browse Source

Add RPi OMX player

master
Krisjanis Rijnieks 11 years ago
parent
commit
0c993d9870
  1. 37
      src/Sources/VideoSource.cpp
  2. 8
      src/Sources/VideoSource.h

37
src/Sources/VideoSource.cpp

@ -7,7 +7,12 @@ namespace ofx {
loadable = true; loadable = true;
loaded = false; loaded = false;
type = SourceType::SOURCE_TYPE_VIDEO; type = SourceType::SOURCE_TYPE_VIDEO;
#ifdef TARGET_RASPBERRY_PI
omxPlayer = NULL;
#else
videoPlayer = NULL; videoPlayer = NULL;
#endif
} }
VideoSource::~VideoSource() {} VideoSource::~VideoSource() {}
@ -17,10 +22,17 @@ namespace ofx {
//cout << "loading video: " << filePath << endl; //cout << "loading video: " << filePath << endl;
setNameFromPath(filePath); setNameFromPath(filePath);
#ifdef TARGET_RASPBERRY_PI #ifdef TARGET_RASPBERRY_PI
// TODO: do omx player // Do things with the OMX player
// ofxOMXPlayerSettings settings;
// settings.videoPath = filePath;
// settings.useHDMIForAudio = true; //default true
settings.enableTexture = true; //default true
settings.enableLooping = true; //default true
settings.enableAudio = false; //default true, save resources by disabling
//settings.doFlipTexture = true; //default false
omxPlayer = new ofxOMXPlayer();
omxPlayer->setup(settings);
texture = &(omxPlayer->getTextureReference());
#else #else
// regular ofVideoPlayer // regular ofVideoPlayer
videoPlayer = new ofVideoPlayer(); videoPlayer = new ofVideoPlayer();
@ -37,10 +49,10 @@ namespace ofx {
ofRemoveListener(ofEvents().update, this, &VideoSource::update); ofRemoveListener(ofEvents().update, this, &VideoSource::update);
texture = NULL; texture = NULL;
#ifdef TARGET_RASPBERRY_PI #ifdef TARGET_RASPBERRY_PI
// TODO: do omx player omxPlayer->stop();
// omxPlayer->close();
// delete omxPlayer;
// omxPlayer = NULL;
#else #else
videoPlayer->stop(); videoPlayer->stop();
videoPlayer->close(); videoPlayer->close();
@ -52,17 +64,12 @@ namespace ofx {
loaded = false; loaded = false;
} }
#ifndef TARGET_RASPBERRY_PI
void VideoSource::update(ofEventArgs &args) { void VideoSource::update(ofEventArgs &args) {
#ifdef TARGET_RASPBERRY_PI
// TODO: do omx player
//
// probably needs updating as well
//
#else
if (videoPlayer != NULL) { if (videoPlayer != NULL) {
videoPlayer->update(); videoPlayer->update();
} }
#endif
} }
#endif
} }
} }

8
src/Sources/VideoSource.h

@ -15,13 +15,13 @@ namespace ofx {
std::string& getPath(); std::string& getPath();
void loadVideo(std::string& path); void loadVideo(std::string& path);
void clear(); void clear();
#ifndef TARGET_RASPBERRY_PI
void update(ofEventArgs& args); void update(ofEventArgs& args);
#endif
private: private:
#ifdef TARGET_RASPBERRY_PI #ifdef TARGET_RASPBERRY_PI
// TODO: implement ofxOMXPlayer ofxOMXPlayer* omxPlayer; // Naming different for less confusion
//
//
//
#else #else
// Go with ofVideoPlayer or // Go with ofVideoPlayer or
// TODO: High Performance Video player on newer Macs // TODO: High Performance Video player on newer Macs

Loading…
Cancel
Save