Extendable factories; general producer related modifications; westley storage; sdl_st...
[melted] / src / modules / inigo / producer_inigo.c
index 2bb3ccf..5367d4e 100644 (file)
@@ -147,9 +147,13 @@ mlt_producer producer_inigo_init( char **argv )
                        if ( group != NULL )
                                properties = group;
                }
-               else if ( !strcmp( argv[ i ], "-attach" ) || !strcmp( argv[ i ], "-chain" ) )
+               else if ( !strcmp( argv[ i ], "-attach" ) || 
+                                 !strcmp( argv[ i ], "-attach-cut" ) ||
+                                 !strcmp( argv[ i ], "-attach-clip" ) )
                {
-                       int type = !strcmp( argv[ i ], "-attach" ) ? 0 : 1;
+                       int type = !strcmp( argv[ i ], "-attach" ) ? 0 : 
+                                          !strcmp( argv[ i ], "-attach-cut" ) ? 1 : 
+                                          2;
                        mlt_filter filter = create_attach( field, argv[ ++ i ], track );
                        if ( producer != NULL && !mlt_producer_is_cut( producer ) )
                        {
@@ -157,15 +161,23 @@ mlt_producer producer_inigo_init( char **argv )
                                mlt_playlist_append( playlist, producer );
                                mlt_playlist_get_clip_info( playlist, &info, mlt_playlist_count( playlist ) - 1 );
                                producer = info.cut;
-                               properties = mlt_producer_properties( producer );
+                       }
+
+                       if ( type == 1 || type == 2 )
+                       {
+                               mlt_playlist_clip_info info;
+                               mlt_playlist_get_clip_info( playlist, &info, mlt_playlist_count( playlist ) - 1 );
+                               producer = info.cut;
                        }
 
                        if ( filter != NULL && mlt_playlist_count( playlist ) > 0 )
                        {
                                if ( type == 0 )
                                        mlt_service_attach( ( mlt_service )properties, filter );
-                               else
+                               else if ( type == 1 )
                                        mlt_service_attach( ( mlt_service )producer, filter );
+                               else if ( type == 2 )
+                                       mlt_service_attach( ( mlt_service )mlt_producer_cut_parent( producer ), filter );
 
                                properties = mlt_filter_properties( filter );
                                mlt_properties_inherit( properties, group );
@@ -347,7 +359,7 @@ mlt_producer producer_inigo_init( char **argv )
                                        mlt_properties_set_int( properties, "hide", 2 );
                        }
                }
-               else if ( strchr( argv[ i ], '=' ) )
+               else if ( strchr( argv[ i ], '=' ) && strstr( argv[ i ], "<?xml" ) != argv[ i ] )
                {
                        mlt_properties_parse( properties, argv[ i ] );
                }
@@ -355,7 +367,7 @@ mlt_producer producer_inigo_init( char **argv )
                {
                        if ( producer != NULL && !mlt_producer_is_cut( producer ) )
                                mlt_playlist_append( playlist, producer );
-                       if ( title == NULL )
+                       if ( title == NULL && strstr( argv[ i ], "<?xml" ) != argv[ i ] )
                                title = argv[ i ];
                        producer = create_producer( field, argv[ i ] );
                        if ( producer != NULL )
@@ -390,6 +402,7 @@ mlt_producer producer_inigo_init( char **argv )
                mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist ), track );
 
        mlt_producer prod = mlt_tractor_producer( tractor );
+       mlt_producer_optimise( prod );
        mlt_properties props = mlt_tractor_properties( tractor );
        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 );