void QuickTimeSampleApp::loadMovieFile( const fs::path &moviePath ) { try { // load up the movie, set it to loop, and begin playing mMovie = qtime::MovieGl::create( moviePath ); mMovie->setLoop(); mMovie->play(); // create a texture for showing some info about the movie TextLayout infoText; infoText.clear( ColorA( 0.2f, 0.2f, 0.2f, 0.5f ) ); infoText.setColor( Color::white() ); infoText.addCenteredLine( moviePath.filename().string() ); infoText.addLine( toString( mMovie->getWidth() ) + " x " + toString( mMovie->getHeight() ) + " pixels" ); infoText.addLine( toString( mMovie->getDuration() ) + " seconds" ); infoText.addLine( toString( mMovie->getNumFrames() ) + " frames" ); infoText.addLine( toString( mMovie->getFramerate() ) + " fps" ); infoText.setBorder( 4, 2 ); mInfoTexture = gl::Texture::create( infoText.render( true ) ); } catch( ci::Exception &exc ) { console() << "Exception caught trying to load the movie from path: " << moviePath << ", what: " << exc.what() << std::endl; mMovie.reset(); mInfoTexture.reset(); } mFrameTexture.reset(); }
void FaceOff::update() { #ifdef QUICKTIME_ENABLED if (MOVIE_MODE) { if (!mMovie) { fs::path moviePath = getAssetPath(MOVIE_PATH); try { // load up the movie, set it to loop, and begin playing mMovie = qtime::MovieSurface::create(moviePath); mMovie->setLoop(); mMovie->play(); mOfflineFaceTex.reset(); } catch (ci::Exception &exc) { console() << "Exception caught trying to load the movie from path: " << MOVIE_PATH << ", what: " << exc.what() << std::endl; mMovie.reset(); } } else { if (mMovie->checkNewFrame()) { auto surface = mMovie->getSurface(); if (!mOfflineFaceTex) { mOfflineFaceTex = gl::Texture2d::create(*surface, gl::Texture::Format().loadTopDown()); } else { mOfflineFaceTex->update(*surface); } } } } else { mMovie.reset(); mOfflineFaceTex = mPhotoTex; } #endif if (mDeviceId != DEVICE_ID) { mDeviceId = DEVICE_ID; mCapture.setup(CAM_W, CAM_H, mDevices[DEVICE_ID]); mDoesCaptureNeedsInit = true; } if (mCapture.isBackCamera) mCapture.flip = false; else mCapture.flip = CAM_FLIP; }
void ImageSequenceLoaderApp::setupAE() { //the selected AV layer's source must be an image sequence. loader_.load(getSourcePath()); texture_.reset(); }