Exemplo n.º 1
0
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;
    }
    
    
    
}
Exemplo n.º 2
0
void DXTencoderApp::update()
{
    
    bool hasNewFrame = false;
        
    if( mMovie && isStarted){
        
        //scaledSize.x= 196;
        scaledSize.x=mMovie->getWidth();

        
        hasNewFrame = mMovie->stepForward();
        
        
        scaledSize.y = mMovie->getSize().y * scaledSize.x / mMovie->getSize().x;

        
        correctedSize = scaledSize;
        correctedSize.y = correctedSize.y  - (correctedSize.y % 4);

        
        mDxtCreator.w = correctedSize.x;
        mDxtCreator.h = correctedSize.y;
        
        
        mSurface = mMovie->getSurface();
        if (mSurface) {

            if (currentFrame == 0) {
                movieLoadedSetParameters();
                isStarted = true;
            }
            
            if(currentFrame  < endFrame){
                                
                
                scaledSurface = ip::resizeCopy(*mSurface, Area(0, 0, mMovie->getSize().x, mMovie->getSize().y), scaledSize);
                
//                // make a copy but crop some pixels.
                correctedSurface = Surface(correctedSize.x, correctedSize.y, true);
                correctedSurface.copyFrom(scaledSurface, Area(0,0,correctedSize.x,correctedSize.y));

                mDxtCreator.writePixels(correctedSurface.getData(),currentFrame);
                currentFrame++;
            }else if(currentFrame == endFrame){
                mDxtCreator.close();
                mMovie->stop();
                isStarted = false;


            }
            
            
            
        }    }
}
Exemplo n.º 3
0
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;
	}	
}