Browse Source

Improve indentation of `VideoSource`

master
Krisjanis Rijnieks 10 years ago
parent
commit
ffc2a54151
  1. 20
      src/Sources/VideoSource.cpp
  2. 20
      src/Sources/VideoSource.h

20
src/Sources/VideoSource.cpp

@ -6,7 +6,6 @@ namespace ofx {
bool VideoSource::enableAudio = false; bool VideoSource::enableAudio = false;
VideoSource::VideoSource() { VideoSource::VideoSource() {
//cout << "VideoSource constr" << endl;
loadable = true; loadable = true;
loaded = false; loaded = false;
type = SourceType::SOURCE_TYPE_VIDEO; type = SourceType::SOURCE_TYPE_VIDEO;
@ -14,7 +13,6 @@ namespace ofx {
omxPlayer = NULL; omxPlayer = NULL;
#else #else
videoPlayer = NULL; videoPlayer = NULL;
#endif #endif
} }
@ -22,22 +20,18 @@ namespace ofx {
void VideoSource::loadVideo(std::string & filePath) { void VideoSource::loadVideo(std::string & filePath) {
path = filePath; path = filePath;
//cout << "loading video: " << filePath << endl;
setNameFromPath(filePath); setNameFromPath(filePath);
#ifdef TARGET_RASPBERRY_PI #ifdef TARGET_RASPBERRY_PI
// Do things with the OMX player
ofxOMXPlayerSettings settings; ofxOMXPlayerSettings settings;
settings.videoPath = filePath; settings.videoPath = filePath;
settings.useHDMIForAudio = true; //default true settings.useHDMIForAudio = true;
settings.enableTexture = true; //default true settings.enableTexture = true;
settings.enableLooping = true; //default true settings.enableLooping = true;
settings.enableAudio = VideoSource::enableAudio; //default true, save resources by disabling settings.enableAudio = VideoSource::enableAudio
//settings.doFlipTexture = true; //default false
omxPlayer = new ofxOMXPlayer(); omxPlayer = new ofxOMXPlayer();
omxPlayer->setup(settings); omxPlayer->setup(settings);
texture = &(omxPlayer->getTextureReference()); texture = &(omxPlayer->getTextureReference());
#else #else
// regular ofVideoPlayer
videoPlayer = new ofVideoPlayer(); videoPlayer = new ofVideoPlayer();
videoPlayer->loadMovie(filePath); videoPlayer->loadMovie(filePath);
videoPlayer->setLoopState(OF_LOOP_NORMAL); videoPlayer->setLoopState(OF_LOOP_NORMAL);
@ -62,8 +56,6 @@ namespace ofx {
delete videoPlayer; delete videoPlayer;
videoPlayer = NULL; videoPlayer = NULL;
#endif #endif
//path = "";
//name = "";
loaded = false; loaded = false;
} }
@ -74,5 +66,5 @@ namespace ofx {
} }
} }
#endif #endif
} } // namespace piMapper
} } // namespace ofx

20
src/Sources/VideoSource.h

@ -2,23 +2,8 @@
#include "ofMain.h" #include "ofMain.h"
#include "BaseSource.h" #include "BaseSource.h"
#ifdef TARGET_RASPBERRY_PI
/*
Notice that if you get an error like this:
fatal error: libavcodec/opt.h: No such file or directory
Create a file opt.h in addons/ofxOMXPlayer/libs/ffmpeg/libavcodec/
with the following contents:
#ifndef AVCODEC_OPT_H
#define AVCODEC_OPT_H
#include "libavcodec/version.h"
#if FF_API_OPT_H
#include "libavutil/opt.h"
#endif
#endif // AVCODEC_OPT_H
More here: https://github.com/jvcleave/ofxOMXPlayer/issues/34 #ifdef TARGET_RASPBERRY_PI
*/
#include "ofxOMXPlayer.h" #include "ofxOMXPlayer.h"
#endif #endif
@ -33,14 +18,17 @@ namespace ofx {
VideoSource(); VideoSource();
~VideoSource(); ~VideoSource();
std::string & getPath(); std::string & getPath();
void loadVideo(std::string & path); void loadVideo(std::string & path);
void clear(); void clear();
#ifndef TARGET_RASPBERRY_PI #ifndef TARGET_RASPBERRY_PI
void update(ofEventArgs & args); void update(ofEventArgs & args);
#endif #endif
private: private:
#ifdef TARGET_RASPBERRY_PI #ifdef TARGET_RASPBERRY_PI
ofxOMXPlayer * omxPlayer; // Naming different for less confusion ofxOMXPlayer * omxPlayer; // Naming different for less confusion
#else #else

Loading…
Cancel
Save