X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Finigo%2Fproducer_inigo.c;h=b03d3d75278d864449485f664635c5656e22d10f;hb=d7ae73d25cf5a38a3a8153ae52409fcbef16bb22;hp=1b82b943d0dc3246cc31301b8a5b46eed8c0fccb;hpb=75288bcb5a5a3925cf8e94ba12f034a0a8fd6758;p=melted diff --git a/src/modules/inigo/producer_inigo.c b/src/modules/inigo/producer_inigo.c index 1b82b94..b03d3d7 100644 --- a/src/modules/inigo/producer_inigo.c +++ b/src/modules/inigo/producer_inigo.c @@ -26,7 +26,7 @@ #include -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 ); @@ -58,53 +58,6 @@ static mlt_producer parse_inigo( char *file ) 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 ); - else if ( strstr( file, ".westley" ) ) - result = mlt_factory_producer( "westley", file ); - else if ( strstr( file, ".ogg" ) ) - result = mlt_factory_producer( "vorbis", 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( "avformat", file ); - - // 4th 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 ); @@ -114,6 +67,16 @@ static void track_service( mlt_field field, void *service, mlt_destructor destru 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, ':' ); @@ -201,6 +164,7 @@ mlt_producer producer_inigo_init( char **argv ) 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 ], "=" ) ) @@ -211,7 +175,7 @@ mlt_producer producer_inigo_init( char **argv ) { 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 ); @@ -232,16 +196,16 @@ mlt_producer producer_inigo_init( char **argv ) } } - // 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_tractor tractor = mlt_field_tractor( field ); mlt_producer prod = mlt_tractor_producer( tractor );