void DXTencoderApp::loadMovieFile( const fs::path &moviePath ) { try { mMovie = qtime::MovieSurface::create( 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() << "Has audio: " << mMovie->hasAudio() << " Has visuals: " << mMovie->hasVisuals() << std::endl; mMovie->setLoop( false ); mMovie->seekToStart(); //mMovie->play(); isStarted = true; currentFrame = 0; std::string basePath = moviePath.parent_path().string(); string newFilename = moviePath.filename().string(); strReplace(newFilename, moviePath.extension().string(), ".dxt5"); mDxtCreator.open(basePath + "/" + newFilename); } catch( ci::Exception &exc ) { console() << "Exception caught trying to load the movie from path: " << moviePath << ", what: " << exc.what() << std::endl; } }
void QTimeIterApp::loadMovieFile( const fs::path &moviePath ) { try { mMovie = qtime::MovieSurface::create( 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() << "Has audio: " << mMovie->hasAudio() << " Has visuals: " << mMovie->hasVisuals() << std::endl; mMovie->setLoop( true, true ); mMovie->seekToStart(); mMovie->play(); } catch( ci::Exception &exc ) { console() << "Exception caught trying to load the movie from path: " << moviePath << ", what: " << exc.what() << std::endl; } }
void QTimeIterApp::keyDown( KeyEvent event ) { if( event.getChar() == 'f' ) { setFullScreen( ! isFullScreen() ); } else if( event.getChar() == 'o' ) { fs::path 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 ) { fs::path 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(); } } }