Allow filter attachment to clip
[melted] / src / modules / inigo / producer_inigo.c
index d6fb283..31368cb 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 ) )
                        {
@@ -159,12 +163,21 @@ mlt_producer producer_inigo_init( char **argv )
                                producer = info.cut;
                        }
 
+                       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 );