#include <framework/mlt.h>
-static mlt_producer parse_inigo( char *file )
+mlt_producer producer_inigo_file_init( char *file )
{
FILE *input = fopen( file, "r" );
char **args = calloc( sizeof( char * ), 1000 );
}
mlt_producer result = producer_inigo_init( args );
+
if ( result != NULL )
{
mlt_properties properties = mlt_producer_properties( result );
- mlt_field field = mlt_properties_get_data( properties, "field", NULL );
mlt_properties_set( properties, "resource", file );
- mlt_properties_set( mlt_field_properties( field ), "resource", file );
}
while( count -- )
return result;
}
-static mlt_producer create_producer( char *file )
-{
- mlt_producer result = NULL;
-
- // 1st Line preferences
- if ( strstr( file, ".inigo" ) )
- result = parse_inigo( file );
- else if ( strstr( file, ".mpg" ) )
- result = mlt_factory_producer( "mcmpeg", file );
- else if ( strstr( file, ".mpeg" ) )
- result = mlt_factory_producer( "mcmpeg", file );
- else if ( strstr( file, ".dv" ) )
- result = mlt_factory_producer( "mcdv", file );
- else if ( strstr( file, ".dif" ) )
- result = mlt_factory_producer( "mcdv", file );
- else if ( strstr( file, ".jpg" ) )
- result = mlt_factory_producer( "pixbuf", file );
- else if ( strstr( file, ".JPG" ) )
- result = mlt_factory_producer( "pixbuf", file );
- else if ( strstr( file, ".jpeg" ) )
- result = mlt_factory_producer( "pixbuf", file );
- else if ( strstr( file, ".png" ) )
- result = mlt_factory_producer( "pixbuf", file );
- else if ( strstr( file, ".txt" ) )
- result = mlt_factory_producer( "pango", file );
-
- // 2nd Line fallbacks
- if ( result == NULL && strstr( file, ".dv" ) )
- result = mlt_factory_producer( "libdv", file );
- else if ( result == NULL && strstr( file, ".dif" ) )
- result = mlt_factory_producer( "libdv", file );
-
- // 3rd line fallbacks
- if ( result == NULL )
- result = mlt_factory_producer( "ffmpeg", file );
-
- return result;
-}
-
static void track_service( mlt_field field, void *service, mlt_destructor destructor )
{
mlt_properties properties = mlt_field_properties( field );
mlt_properties_set_int( properties, "registered", ++ registered );
}
+static mlt_producer create_producer( mlt_field field, char *file )
+{
+ mlt_producer result = mlt_factory_producer( "fezzik", file );
+
+ if ( result != NULL )
+ track_service( field, result, ( mlt_destructor )mlt_producer_close );
+
+ return result;
+}
+
static mlt_filter create_filter( mlt_field field, char *id, int track )
{
char *arg = strchr( id, ':' );
return transition;
}
-static void set_properties( mlt_properties properties, char *namevalue )
-{
- mlt_properties_parse( properties, namevalue );
-}
-
mlt_producer producer_inigo_init( char **argv )
{
int i;
mlt_playlist_append( playlist, producer );
producer = NULL;
mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist ), track ++ );
+ track_service( field, playlist, ( mlt_destructor )mlt_playlist_close );
playlist = mlt_playlist_init( );
}
else if ( strstr( argv[ i ], "=" ) )
{
- set_properties( properties, argv[ i ] );
+ mlt_properties_parse( properties, argv[ i ] );
}
else if ( argv[ i ][ 0 ] != '-' )
{
if ( producer != NULL )
mlt_playlist_append( playlist, producer );
- producer = create_producer( argv[ i ] );
+ producer = create_producer( field, argv[ i ] );
if ( producer != NULL )
{
properties = mlt_producer_properties( producer );
}
}
- // Connect producer to playlist
+ // Connect last producer to playlist
if ( producer != NULL )
mlt_playlist_append( playlist, producer );
- // We must have a producer at this point
+ // Track the last playlist too
+ track_service( field, playlist, ( mlt_destructor )mlt_playlist_close );
+
+ // We must have a playlist to connect
if ( mlt_playlist_count( playlist ) > 0 )
- {
- // Connect multitrack to producer
mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist ), track );
- }
-
- mlt_properties props = mlt_multitrack_properties( multitrack );
- mlt_properties_set_data( props, "field", field, 0, NULL, NULL );
- mlt_properties_set_data( props, "group", group, 0, NULL, NULL );
- return mlt_multitrack_producer( multitrack );
+ mlt_tractor tractor = mlt_field_tractor( field );
+ mlt_producer prod = mlt_tractor_producer( tractor );
+ mlt_properties props = mlt_tractor_properties( tractor );
+ mlt_properties_set_data( props, "multitrack", multitrack, 0, ( mlt_destructor )mlt_multitrack_close, NULL );
+ mlt_properties_set_data( props, "field", field, 0, ( mlt_destructor )mlt_field_close, NULL );
+ mlt_properties_set_data( props, "group", group, 0, ( mlt_destructor )mlt_properties_close, NULL );
+ mlt_properties_set_position( props, "length", mlt_producer_get_out( mlt_multitrack_producer( multitrack ) ) + 1 );
+ mlt_producer_set_in_and_out( prod, 0, mlt_producer_get_out( mlt_multitrack_producer( multitrack ) ) );
+ mlt_properties_set_double( props, "fps", mlt_producer_get_fps( mlt_multitrack_producer( multitrack ) ) );
+
+ return mlt_tractor_producer( tractor );
}