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 QuickTimeSampleApp::keyDown( KeyEvent event )
{
	if( event.getChar() == 'f' ) {
		setFullScreen( ! isFullScreen() );
	}
	else if( event.getChar() == 'o' ) {
		fs::path moviePath = getOpenFilePath();
		if( ! moviePath.empty() )
			loadMovieFile( moviePath );
	}
	else if( event.getChar() == '1' )
		mMovie->setRate( 0.5f );
	else if( event.getChar() == '2' )
		mMovie->setRate( 2 );
}
void QuickTimePlayer::update()
{
	if( mMovie )
		mFrameTexture = mMovie->getTexture();

	getWindow()->setTitle("(" + toString(floor(getAverageFps())) + " fps) Qtime");
}
Esempio n. 4
0
void MovieManager::addActiveMovie(qtime::MovieGlRef p_movie, float p_x, float p_y, float p_w, float p_h)  {
	p_movie->setLoop(true, false);

	m_movies.push_back(make_shared<orbz::Movie>(p_movie, p_x, p_y, p_w, p_h));
	p_movie->play();
}
void QuickTimeSampleApp::update()
{
	if( mMovie )
		mFrameTexture = mMovie->getTexture();
}