コード例 #1
0
void ocvOpticalFlowApp::loadMovieFile( const fs::path &moviePath )
{
	try {
		// load up the movie, set it to loop, and begin playing
    	mMovie = qtime::MovieSurface( 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( infoText.render( true ) );
	}
	catch( ... ) {
		console() << "Unable to load the movie." << std::endl;
		mMovie.reset();
		mInfoTexture.reset();
	}
    
	mFrameTexture.reset();
}
コード例 #2
0
void PostProcessingApp::play( const fs::path &path ) 
{
	try {
		// try loading QuickTime movie
		mMovie = qtime::MovieSurface( path );
		mMovie.play();
	}
	catch(...) {}

	// keep track of file
	mFile = path;
}
コード例 #3
0
ファイル: EnhanceApp.cpp プロジェクト: mdunkley/Enhance
void EnhanceApp::keyDown( KeyEvent event )
{
	if( event.getChar() == 'f' ) {
		setFullScreen( ! isFullScreen() );
	}
	else if( event.getChar() == 'o' ) {
		string moviePath = getOpenFilePath();
		if( ! moviePath.empty() )
			loadMovieFile( moviePath );
	}

	
	// these keys only make sense if there is an active movie
	if( mMovie ) {


		if( event.getCode() == KeyEvent::KEY_LEFT ) {
			mMovie.stepBackward();
		}
		if( event.getCode() == KeyEvent::KEY_RIGHT ) {
			mMovie.stepForward();
		}
		else if( event.getChar() == 's' ) {
			if( mSurface ) {
				string savePath = getSaveFilePath();
				if( ! savePath.empty() ) {
					writeImage( savePath, mSurface );
				}
			}
		}
		else if( event.getChar() == 'm' ) {
			// jump to the middle frame
			mMovie.seekToTime( mMovie.getDuration() / 2 );
		}
		else if( event.getChar() == ' ' ) {
			if( mMovie.isPlaying() )
				mMovie.stop();
			else
				mMovie.play();
		}
	}
}
コード例 #4
0
ファイル: EnhanceApp.cpp プロジェクト: mdunkley/Enhance
void EnhanceApp::loadMovieFile( const string &moviePath )
{
	try {
		mMovie = qtime::MovieSurface( moviePath );
        
		console() << "Dimensions:" << mMovie.getWidth() << " x " << mMovie.getHeight() << std::endl;
		console() << "Duration:  " << mMovie.getDuration() << " seconds" << std::endl;
		console() << "Frames:    " << mMovie.getNumFrames() << std::endl;
		console() << "Framerate: " << mMovie.getFramerate() << std::endl;
		console() << "Alpha channel: " << mMovie.hasAlpha() << std::endl;		
		console() << "Has audio: " << mMovie.hasAudio() << " Has visuals: " << mMovie.hasVisuals() << std::endl;
		mMovie.setLoop( true, true );
        mMovie.setVolume(0);
		mMovie.seekToStart();
		mMovie.play();
	}
	catch( ... ) {
		console() << "Unable to load the movie." << std::endl;
	}	
}