Beispiel #1
0
bool Scene::setProfile( Profile &p )
{
	bool ok = true;
	double duration = profile.getVideoFrameDuration();
	profile = p;
	double margin = profile.getVideoFrameDuration() / 4.0;
	
	if ( duration != profile.getVideoFrameDuration() ) {
		duration = profile.getVideoFrameDuration();
		for ( int i = 0; i < tracks.count(); ++i ) {
			Track *t = tracks[i];
			for ( int j = 0; j < t->clipCount(); ++j ) {
				Clip *c = t->clipAt( j );
				c->setFrameDuration( duration );
				double newPos = nearestPTS( c->position(), duration );
				if ( !c->getTransition() && j > 0 ) {
					Clip *prev = t->clipAt( j - 1 );
					if ( newPos < prev->position() + prev->length() - margin )
						newPos = prev->position() + prev->length();
					c->setPosition( newPos );
				}
				else if ( canMove( c, c->length(), newPos, i ) )
					move( c, i, newPos, i );
				else
					ok = false;
			}
		}
	}
	
	return ok;
}
Beispiel #2
0
Clip* Scene::duplicateClip(Clip *c)
{
	Clip *nc = createClip( c->getSource(), c->position(), c->start(), c->length() );
	nc->setFrameDuration( profile.getVideoFrameDuration() );
	nc->setSpeed( c->getSpeed() );
	Transition *t = c->getTransition();
	nc->setTransition( t ? new Transition(t) : NULL );
	
	FilterCollection *fc = FilterCollection::getGlobalInstance();
	for ( int i = 0; i < c->videoFilters.count(); ++i ) {
		QSharedPointer<GLFilter> f = c->videoFilters.at( i );
		for ( int j = 0; j < fc->videoFilters.count(); ++j ) {
			if ( fc->videoFilters[ j ].identifier == f->getIdentifier() ) {
				QSharedPointer<Filter> nf = fc->videoFilters[ j ].create();
				f->duplicateFilter( nf );
				GLFilter *gf = (GLFilter*)nf.data();
				if ( nf->getIdentifier() == "GLCustom" ) {
					GLCustom *gc = (GLCustom*)gf;
					gc->setCustomParams( f->getParameters().last()->value.toString() );
				}
				else if ( nf->getIdentifier() == "GLStabilize"  ) {
					GLStabilize *gs = (GLStabilize*)gf;
					gs->setSource( nc->getSource() );
				}
				nc->videoFilters.append( nf.staticCast<GLFilter>() );
				break;
			}
		}
	}
	for ( int i = 0; i < c->audioFilters.count(); ++i ) {
		QSharedPointer<AudioFilter> f = c->audioFilters.at( i );
		for ( int j = 0; j < fc->audioFilters.count(); ++j ) {
			if ( fc->audioFilters[ j ].identifier == f->getIdentifier() ) {
				QSharedPointer<Filter> nf = fc->audioFilters[ j ].create();
				f->duplicateFilter( nf );
				nc->audioFilters.append( nf.staticCast<AudioFilter>() );
				break;
			}
		}
	}
	
	return nc;
}
Beispiel #3
0
Clip* Scene::createClip( Source *src, double posInTrackPTS, double strt, double len )
{
	Clip *clip = new Clip( src, posInTrackPTS, strt, len );
	clip->setFrameDuration( profile.getVideoFrameDuration() );
	return clip;
}