if ( group != NULL )
properties = group;
}
- else if ( !strcmp( argv[ i ], "-attach" ) )
+ else if ( !strcmp( argv[ i ], "-attach" ) ||
+ !strcmp( argv[ i ], "-attach-cut" ) ||
+ !strcmp( argv[ i ], "-attach-clip" ) )
{
+ 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 ) )
+ {
+ mlt_playlist_clip_info info;
mlt_playlist_append( playlist, producer );
- producer = NULL;
- if ( filter != NULL && mlt_playlist_count( playlist ) > 0 )
+ mlt_playlist_get_clip_info( playlist, &info, mlt_playlist_count( playlist ) - 1 );
+ 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;
- mlt_service_attach( ( mlt_service )producer, filter );
+ }
+
+ if ( filter != NULL && mlt_playlist_count( playlist ) > 0 )
+ {
+ if ( type == 0 )
+ mlt_service_attach( ( mlt_service )properties, filter );
+ 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 );
}
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 );