remove no longer necessary blanks
[melted] / src / inigo / inigo.c
index 8b84043..29465db 100644 (file)
@@ -147,6 +147,20 @@ mlt_filter create_filter( mlt_field field, char *id, int track )
        return filter;
 }
 
+mlt_transition create_transition( mlt_field field, char *id, int track )
+{
+       char *arg = strchr( id, ':' );
+       if ( arg != NULL )
+               *arg ++ = '\0';
+       mlt_transition transition = mlt_factory_transition( id, arg );
+       if ( transition != NULL )
+       {
+               mlt_field_plant_transition( field, transition, track, track + 1 );
+               track_service( field, transition, ( mlt_destructor )mlt_transition_close );
+       }
+       return transition;
+}
+
 void set_properties( mlt_properties properties, char *namevalue )
 {
        mlt_properties_parse( properties, namevalue );
@@ -181,7 +195,7 @@ int main( int argc, char **argv )
        int track = 0;
        mlt_consumer consumer = NULL;
        mlt_producer producer = NULL;
-       mlt_playlist playlist = NULL;
+       mlt_playlist playlist = mlt_playlist_init( );
        mlt_properties group = mlt_properties_new( );
        mlt_properties properties = group;
        mlt_field field = mlt_field_init( );
@@ -191,9 +205,6 @@ int main( int argc, char **argv )
        // Construct the factory
        mlt_factory_init( getenv( "MLT_REPOSITORY" ) );
 
-       // Set up containers
-       playlist = mlt_playlist_init( );
-
        // We need to track the number of registered filters
        mlt_properties_set_int( field_properties, "registered", 0 );
 
@@ -221,13 +232,22 @@ int main( int argc, char **argv )
                }
                else if ( !strcmp( argv[ i ], "-filter" ) )
                {
-                       mlt_filter filter = create_filter( field, argv[ ++ i ], 0 );
+                       mlt_filter filter = create_filter( field, argv[ ++ i ], track );
                        if ( filter != NULL )
                        {
                                properties = mlt_filter_properties( filter );
                                mlt_properties_inherit( properties, group );
                        }
                }
+               else if ( !strcmp( argv[ i ], "-transition" ) )
+               {
+                       mlt_transition transition = create_transition( field, argv[ ++ i ], track );
+                       if ( transition != NULL )
+                       {
+                               properties = mlt_transition_properties( transition );
+                               mlt_properties_inherit( properties, group );
+                       }
+               }
                else if ( !strcmp( argv[ i ], "-blank" ) )
                {
                        if ( producer != NULL )
@@ -235,6 +255,14 @@ int main( int argc, char **argv )
                        producer = NULL;
                        mlt_playlist_blank( playlist, atof( argv[ ++ i ] ) );
                }
+               else if ( !strcmp( argv[ i ], "-track" ) )
+               {
+                       if ( producer != NULL )
+                               mlt_playlist_append( playlist, producer );
+                       producer = NULL;
+                       mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist ), track ++ );
+                       playlist = mlt_playlist_init( );
+               }
                else if ( !strstr( argv[ i ], "=" ) )
                {
                        if ( producer != NULL )
@@ -289,6 +317,8 @@ int main( int argc, char **argv )
                fprintf( stderr, "Usage: inigo [ -group [ name=value ]* ]\n"
                                                 "             [ -consumer id[:arg] [ name=value ]* ]\n"
                                         "             [ -filter id[:arg] [ name=value ] * ]\n"
+                                        "             [ -transition id[:arg] [ name=value ] * ]\n"
+                                                "             [ -blank time ]\n"
                                         "             [ producer [ name=value ] * ]+\n" );
        }