Example #1
0
mlt_consumer consumer_sdl_preview_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
{
	consumer_sdl self = calloc( 1, sizeof( struct consumer_sdl_s ) );
	if ( self != NULL && mlt_consumer_init( &self->parent, self, profile ) == 0 )
	{
		// Get the parent consumer object
		mlt_consumer parent = &self->parent;

		// Get the properties
		mlt_properties properties = MLT_CONSUMER_PROPERTIES( parent );

		// Get the width and height
		int width = mlt_properties_get_int( properties, "width" );
		int height = mlt_properties_get_int( properties, "height" );

		// Process actual param
		if ( arg == NULL || sscanf( arg, "%dx%d", &width, &height ) == 2 )
		{
			mlt_properties_set_int( properties, "width", width );
			mlt_properties_set_int( properties, "height", height );
		}

		// Create child consumers
		self->play = mlt_factory_consumer( profile, "sdl", arg );
		self->still = mlt_factory_consumer( profile, "sdl_still", arg );
		mlt_properties_set( properties, "rescale", "nearest" );
		mlt_properties_set( properties, "deinterlace_method", "onefield" );
		mlt_properties_set_int( properties, "prefill", 1 );
		mlt_properties_set_int( properties, "top_field_first", -1 );

		parent->close = consumer_close;
		parent->start = consumer_start;
		parent->stop = consumer_stop;
		parent->is_stopped = consumer_is_stopped;
		parent->purge = consumer_purge;
		self->joined = 1;
		mlt_events_listen( MLT_CONSUMER_PROPERTIES( self->play ), self, "consumer-frame-show", ( mlt_listener )consumer_frame_show_cb );
		mlt_events_listen( MLT_CONSUMER_PROPERTIES( self->still ), self, "consumer-frame-show", ( mlt_listener )consumer_frame_show_cb );
		mlt_events_listen( MLT_CONSUMER_PROPERTIES( self->play ), self, "consumer-sdl-event", ( mlt_listener )consumer_sdl_event_cb );
		mlt_events_listen( MLT_CONSUMER_PROPERTIES( self->still ), self, "consumer-sdl-event", ( mlt_listener )consumer_sdl_event_cb );
		pthread_cond_init( &self->refresh_cond, NULL );
		pthread_mutex_init( &self->refresh_mutex, NULL );
		mlt_events_listen( MLT_CONSUMER_PROPERTIES( parent ), self, "property-changed", ( mlt_listener )consumer_refresh_cb );
		mlt_events_register( properties, "consumer-sdl-paused", NULL );
		return parent;
	}
	free( self );
	return NULL;
}
Example #2
0
static mlt_consumer create_consumer( mlt_profile profile, char *id )
{
	char *arg = id != NULL ? strchr( id, ':' ) : NULL;
	if ( arg != NULL )
		*arg ++ = '\0';
	mlt_consumer consumer = mlt_factory_consumer( profile, id, arg );
	if ( consumer != NULL )
	{
		mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer );
		mlt_properties_set_data( properties, "transport_callback", transport_action, 0, NULL, NULL );
	}
	return consumer;
}
Example #3
0
static mlt_consumer create_consumer( mlt_profile profile, char *id, char *arg )
{
    char *myid = id ? strdup( id ) : NULL;
    char *myarg = ( myid && !arg ) ? strchr( myid, ':' ) : NULL;
    if ( myarg )
        *myarg ++ = '\0';
    else
        myarg = arg;
    mlt_consumer consumer = mlt_factory_consumer( profile, myid, myarg );
    if ( myid )
        free( myid );
    return consumer;
}
Example #4
0
File: melt.c Project: hrshadhin/mlt
static void query_vcodecs( )
{
    mlt_consumer consumer = mlt_factory_consumer( NULL, "avformat", NULL );
    if ( consumer )
    {
        mlt_properties_set( MLT_CONSUMER_PROPERTIES(consumer), "vcodec", "list" );
        mlt_consumer_start( consumer );
        mlt_consumer_close( consumer );
    }
    else
    {
        fprintf( stdout, "# No video codecs - failed to load avformat consumer\n" );
    }
}
Example #5
0
File: charlie.c Project: Enlik/mlt
mlt_consumer create_consumer( char *id, mlt_producer producer )
{
	char *arg = strchr( id, ':' );
	if ( arg != NULL )
		*arg ++ = '\0';
	mlt_consumer consumer = mlt_factory_consumer( id, arg );
	if ( consumer != NULL )
	{
		mlt_properties properties = mlt_consumer_properties( consumer );
		mlt_properties_set_data( properties, "transport_callback", transport_action, 0, NULL, NULL );
		mlt_properties_set_data( properties, "transport_producer", producer, 0, NULL, NULL );
	}
	return consumer;
}
Example #6
0
void MltRuntime::run() throw (Exception)
{
	init();

	Lock lk(&run_lock);
	if (consumer)mlt_consumer_close(consumer);

	mlt_profile profile = mlt_profile_clone(MltLoader::global_profile);
#ifndef __ANDROID__
	consumer = mlt_factory_consumer(profile, "sdl", NULL); //todo
#else
	assert(0);
#endif

	mlt_consumer_connect(consumer, mlt_producer_service(producer));
	mlt_consumer_start(consumer);
	status = StatusRunning;
}
Example #7
0
void MltRuntime::run(const string& outpath) throw(Exception)
{
	init();

	Lock lk(&run_lock);
	if ( consumer) mlt_consumer_close(consumer);

	mlt_profile profile = mlt_profile_clone(MltLoader::global_profile);
	consumer = mlt_factory_consumer(profile, "avformat", outpath.c_str());

	if ( consumer ==  NULL) {
		mlt_profile_close(profile);
		throw_error_v(ErrorRuntimeLoadFailed, "consumer init failed");
	}

	mlt_consumer_connect(consumer, mlt_producer_service(producer));
	mlt_consumer_start(consumer);
	status = StatusRunning;
}
Example #8
0
File: hello.c Project: rayl/MLT
int main( int argc, char **argv )
{
	// Initialise the factory
	if ( mlt_factory_init( NULL ) == 0 )
	{
		// Create the default consumer
		mlt_consumer hello = mlt_factory_consumer( NULL, NULL );

		// Create a producer using the default normalising selecter
		mlt_producer world = create_tracks( argc, argv );

		// Connect the producer to the consumer
		mlt_consumer_connect( hello, mlt_producer_service( world ) );

		// Start the consumer
		mlt_consumer_start( hello );

		// Wait for the consumer to terminate
		while( !mlt_consumer_is_stopped( hello ) )
			sleep( 1 );

		// Close the consumer
		mlt_consumer_close( hello );

		// Close the producer
		mlt_producer_close( world );

		// Close the factory
		mlt_factory_close( );
	}
	else
	{
		// Report an error during initialisation
		fprintf( stderr, "Unable to locate factory modules\n" );
	}

	// End of program
	return 0;
}
Example #9
0
void MltRuntime::run(ANativeWindow* nw) throw(Exception)
{
	init();

	Lock lk(&run_lock);
	if ( consumer) mlt_consumer_close(consumer);

	mlt_profile profile = mlt_profile_clone(MltLoader::global_profile);
	consumer = mlt_factory_consumer(profile, "android_surface_preview", NULL);

	if ( consumer ==  NULL) {
		mlt_profile_close(profile);
		throw_error_v(ErrorRuntimeLoadFailed, "consumer init failed");
	}

	mlt_properties props = mlt_consumer_properties(consumer);
	ANativeWindow_acquire(nw);
	mlt_properties_set_data(props, "native_window", nw , sizeof(void*),release_native_window , NULL);

	mlt_consumer_connect(consumer, mlt_producer_service(producer));
	mlt_consumer_start(consumer);
	status = StatusRunning;
}
Example #10
0
static mvcp_response mvcp_remote_push( mvcp_remote remote, char *command, mlt_service service )
{
	(void) remote; // unused
	(void) command; // unused
	(void) service; // unused

	mvcp_response response = NULL;
#ifndef MVCP_EMBEDDED
	if ( service != NULL )
	{
		mlt_consumer consumer = mlt_factory_consumer( NULL, "xml", "buffer" );
		mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer );
		char *buffer = NULL;
		// Temporary hack
		mlt_properties_set( properties, "store", "nle_" );
		mlt_consumer_connect( consumer, service );
		mlt_consumer_start( consumer );
		buffer = mlt_properties_get( properties, "buffer" );
		response = mvcp_remote_receive( remote, command, buffer );
		mlt_consumer_close( consumer );
	}
#endif
	return response;
}
Example #11
0
File: luma.c Project: 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;
}
Example #12
0
File: pango.c Project: Enlik/mlt
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;
}