Esempio n. 1
0
void VideoSource::loadVideo(std::string& filePath) {
    path = filePath;
    //cout << "loading video: " << filePath << endl;
    setNameFromPath(filePath);
#ifdef TARGET_RASPBERRY_PI
    // 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
    // regular ofVideoPlayer
    videoPlayer = new ofVideoPlayer();
    videoPlayer->loadMovie(filePath);
    videoPlayer->setLoopState(OF_LOOP_NORMAL);
    videoPlayer->play();
    texture = &(videoPlayer->getTextureReference());
    ofAddListener(ofEvents().update, this, &VideoSource::update);
#endif
    loaded = true;
}
Esempio n. 2
0
 void ImageSource::loadImage(std::string& filePath) {
   path = filePath;
   //cout << "loading image: " << filePath << endl;
   setNameFromPath(filePath);
   //cout << "path: " << path << endl;
   image = new ofImage();
   if (!image->loadImage(filePath)) {
     ofLogWarning("ImageSource") << "Could not load image";
     //std::exit(EXIT_FAILURE);
   }
   texture = &image->getTextureReference();
   loaded = true;
 }
Esempio n. 3
0
void VideoSource::loadVideo(string & filePath){
	path = filePath;
	setNameFromPath(filePath);
	#ifdef TARGET_RASPBERRY_PI
		omxPlayer = OMXPlayerCache::instance()->load(filePath);
		texture = &(omxPlayer->getTextureReference());
	#else
		videoPlayer = new ofVideoPlayer();
		videoPlayer->load(filePath);
		videoPlayer->setLoopState(OF_LOOP_NORMAL);
		videoPlayer->play();
		videoPlayer->setVolume(VideoSource::enableAudio ? 1.0f : 0.0f);
		texture = &(videoPlayer->getTexture());
		ofAddListener(ofEvents().update, this, &VideoSource::update);
	#endif
	loaded = true;
}