Exemple #1
0
int mlt_field_plant_transition( mlt_field self, mlt_transition that, int a_track, int b_track )
{
	// Connect the transition to the last producer
	int result = mlt_transition_connect( that, self->producer, a_track, b_track );

	// If successful, then we'll use self for connecting in the future
	if ( result == 0 )
	{
		// This is now the new producer
		self->producer = MLT_TRANSITION_SERVICE( that );

		// Reconnect tractor to new producer
		mlt_tractor_connect( self->tractor, self->producer );

		// Fire an event
		mlt_events_fire( mlt_field_properties( self ), "service-changed", NULL );
	}

	return result;
}
Exemple #2
0
int mlt_field_plant_filter( mlt_field self, mlt_filter that, int track )
{
	// Connect the filter to the last producer
	int result = mlt_filter_connect( that, self->producer, track );

	// If successful, then we'll use this for connecting in the future
	if ( result == 0 )
	{
		// This is now the new producer
		self->producer = MLT_FILTER_SERVICE( that );

		// Reconnect tractor to new producer
		mlt_tractor_connect( self->tractor, self->producer );

		// Fire an event
		mlt_events_fire( mlt_field_properties( self ), "service-changed", NULL );
	}

	return result;
}
Exemple #3
0
mlt_field mlt_field_new( mlt_multitrack multitrack, mlt_tractor tractor )
{
	// Initialise the field
	mlt_field self = calloc( 1, sizeof( struct mlt_field_s ) );

	// Initialise it
	if ( self != NULL )
	{
		// Construct a multitrack
		self->multitrack = multitrack;

		// Construct a tractor
		self->tractor = tractor;

		// The first plant will be connected to the mulitrack
		self->producer = MLT_MULTITRACK_SERVICE( self->multitrack );

		// Connect the tractor to the multitrack
		mlt_tractor_connect( self->tractor, self->producer );
	}

	// Return self
	return self;
}
Exemple #4
0
void mlt_field_disconnect_service( mlt_field self, mlt_service service )
{
	mlt_service p = mlt_service_producer( service );
	mlt_service c = mlt_service_consumer( service);
	int i;
	switch ( mlt_service_identify(c) )
	{
		case filter_type:
			i = mlt_filter_get_track( MLT_FILTER(c) );
			mlt_service_connect_producer( c, p, i );
			break;
		case transition_type:
			i = mlt_transition_get_a_track ( MLT_TRANSITION(c) );
			mlt_service_connect_producer( c, p, i );
			MLT_TRANSITION(c)->producer = p;
			break;
		case tractor_type:
			self->producer = p;
			mlt_tractor_connect( MLT_TRACTOR(c), p );
		default:
			break;
	}
	mlt_events_fire( mlt_field_properties( self ), "service-changed", NULL );
}
Exemple #5
0
Fichier : luma.c Projet : Enlik/mlt
int main( int argc, char **argv )
{
	char temp[ 132 ];
	char *file1 = NULL;
	char *file2 = NULL;
	char *wipe = NULL;

	mlt_factory_init( "../modules" );

	if ( argc < 4 )
	{
		fprintf( stderr, "usage: luma file1.mpeg file2.mpeg wipe.pgm\n" );
		return 1;
	}
	else
	{
		file1 = argv[ 1 ];
		file2 = argv[ 2 ];
		wipe = argv[ 3 ];
	}

	// Start the consumer...
	mlt_consumer consumer = mlt_factory_consumer( "bluefish", "NTSC" );

	// Create the producer(s)
	mlt_producer dv1 = mlt_factory_producer( "mcmpeg", file1 );
	mlt_producer dv2 = mlt_factory_producer( "mcmpeg", file2 );

	mlt_playlist playlist1 = mlt_playlist_init();
	mlt_playlist_append_io( playlist1, dv1, 0.0, 5.0 );

	mlt_playlist playlist2 = mlt_playlist_init();
	mlt_playlist_blank( playlist2, 2.9 );
	mlt_playlist_append( playlist2, dv2 );
	
	// Register producers(s) with a multitrack object
	mlt_multitrack multitrack = mlt_multitrack_init( );
	mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist1 ), 0 );
	mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist2 ), 1 );

	// Define a transition
	mlt_transition transition = mlt_factory_transition( "luma", wipe );
	mlt_properties_set( mlt_transition_properties( transition ), "filename", wipe );
	mlt_properties_set_double( mlt_transition_properties( transition ), "softness", 0.1 );
	mlt_transition_connect( transition, mlt_multitrack_service( multitrack ), 0, 1 );
	mlt_transition_set_in_and_out( transition, 3.0, 5.0 );

	// Buy a tractor and connect it to the filter
	mlt_tractor tractor = mlt_tractor_init( );
	mlt_tractor_connect( tractor, mlt_transition_service( transition ) );

	// Connect the tractor to the consumer
	mlt_consumer_connect( consumer, mlt_tractor_service( tractor ) );

	// Do stuff until we're told otherwise...
	fprintf( stderr, "Press return to continue\n" );
	fgets( temp, 132, stdin );

	// Close everything...
	mlt_consumer_close( consumer );
	mlt_tractor_close( tractor );
	mlt_transition_close( transition );
	mlt_multitrack_close( multitrack );
	mlt_playlist_close( playlist1 );
	mlt_playlist_close( playlist2 );
	mlt_producer_close( dv1 );
	mlt_producer_close( dv2 );

	return 0;
}
Exemple #6
0
int main( int argc, char **argv )
{
	char temp[ 132 ];
	char *file1 = NULL;
	char *text = NULL;

	mlt_factory_init( "../modules" );

	if ( argc < 3 )
	{
		fprintf( stderr, "usage: pango file.mpeg  text_to_display\n" );
		return 1;
	}
	else
	{
		file1 = argv[ 1 ];
		text = argv[ 2 ];
	}

	// Start the consumer...
	mlt_consumer consumer = mlt_factory_consumer( "bluefish", "NTSC" );

	// Create the producer(s)
	mlt_playlist pl1 = mlt_playlist_init();
	mlt_producer dv1 = mlt_factory_producer( "mcmpeg", file1 );
	mlt_playlist_append( pl1, dv1 );

	mlt_playlist pl2 = mlt_playlist_init();
	mlt_producer title = mlt_factory_producer( "pango", NULL ); //"<span font_desc=\"Sans Bold 36\">Mutton <span font_desc=\"Luxi Serif Bold Oblique 36\">Lettuce</span> Tomato</span>" );
	mlt_playlist_append( pl2, title );
	mlt_properties_set( mlt_producer_properties( title ), "family", "Sans" );
	mlt_properties_set( mlt_producer_properties( title ), "size", "36" );
	mlt_properties_set( mlt_producer_properties( title ), "weight", "700" );
	mlt_properties_set( mlt_producer_properties( title ), "text", text );
	mlt_properties_set_int( mlt_producer_properties( title ), "bgcolor", 0x0000007f );
	mlt_properties_set_int( mlt_producer_properties( title ), "pad", 8 );
	mlt_properties_set_int( mlt_producer_properties( title ), "align", 1 );
	mlt_properties_set_int( mlt_producer_properties( title ), "x", 200 );
	mlt_properties_set_int( mlt_producer_properties( title ), "y", 40 );
	mlt_properties_set_double( mlt_producer_properties( title ), "mix", 0.8 );

	// Register producers(s) with a multitrack object
	mlt_multitrack multitrack = mlt_multitrack_init( );
	mlt_multitrack_connect( multitrack, mlt_playlist_producer( pl1 ), 0 );
	mlt_multitrack_connect( multitrack, mlt_playlist_producer( pl2 ), 1 );

	// Define a transition
	mlt_transition transition = mlt_factory_transition( "composite", NULL );
	mlt_transition_connect( transition, mlt_multitrack_service( multitrack ), 0, 1 );
	mlt_transition_set_in_and_out( transition, 0.0, 9999.0 );

	// Buy a tractor and connect it to the filter
	mlt_tractor tractor = mlt_tractor_init( );
	mlt_tractor_connect( tractor, mlt_transition_service( transition ) );

	// Connect the tractor to the consumer
	mlt_consumer_connect( consumer, mlt_tractor_service( tractor ) );

	// Do stuff until we're told otherwise...
	fprintf( stderr, "Press return to continue\n" );
	fgets( temp, 132, stdin );

	// Close everything...
	mlt_consumer_close( consumer );
	mlt_tractor_close( tractor );
	mlt_transition_close( transition );
	mlt_multitrack_close( multitrack );
	mlt_playlist_close( pl1 );
	mlt_playlist_close( pl2 );
	mlt_producer_close( dv1 );
	mlt_producer_close( title );

	return 0;
}