{
playlist_entry *entry = this->list[ clip ];
mlt_producer producer = entry->producer;
+ mlt_properties properties = MLT_PLAYLIST_PROPERTIES( this );
+
+ mlt_events_block( properties, properties );
if ( mlt_producer_is_blank( producer ) )
{
if ( out - in + 1 > mlt_producer_get_length( &this->blank ) )
{
mlt_properties blank_props = MLT_PRODUCER_PROPERTIES( &this->blank );
- mlt_events_block( blank_props, blank_props );
- mlt_producer_set_in_and_out( &this->blank, in, out );
- mlt_events_unblock( blank_props, blank_props );
+ mlt_properties_set_int( blank_props, "length", out - in + 1 );
+ mlt_properties_set_int( MLT_PRODUCER_PROPERTIES( producer ), "length", out - in + 1 );
+ mlt_producer_set_in_and_out( &this->blank, 0, out - in );
}
}
}
mlt_producer_set_in_and_out( producer, in, out );
+ mlt_events_unblock( properties, properties );
+ mlt_playlist_virtual_refresh( this );
}
return error;
}
mlt_playlist_resize_clip( this, clip, in, in + position );
if ( !mlt_producer_is_blank( entry->producer ) )
{
+ int i = 0;
+ mlt_properties entry_properties = MLT_PRODUCER_PROPERTIES( entry->producer );
mlt_producer split = mlt_producer_cut( entry->producer, in + position + 1, out );
+ mlt_properties split_properties = MLT_PRODUCER_PROPERTIES( split );
mlt_playlist_insert( this, split, clip + 1, 0, -1 );
+ for ( i = 0; i < mlt_properties_count( entry_properties ); i ++ )
+ {
+ char *name = mlt_properties_get_name( entry_properties, i );
+ if ( name != NULL && !strncmp( name, "meta.", 5 ) )
+ mlt_properties_set( split_properties, name, mlt_properties_get_value( entry_properties, i ) );
+ }
mlt_producer_close( split );
}
else
playlist_entry *left = this->list[ i - 1 ];
playlist_entry *right = this->list[ i ];
- if ( mlt_producer_cut_parent( left->producer ) == mlt_producer_cut_parent( right->producer ) &&
- mlt_producer_is_blank( left->producer ) )
+ if ( mlt_producer_is_blank( left->producer ) && mlt_producer_is_blank( right->producer ) )
{
mlt_playlist_resize_clip( this, i - 1, 0, left->frame_count + right->frame_count - 1 );
mlt_playlist_remove( this, i -- );
mlt_playlist_remove( this, clip );
mlt_playlist_blank( this, out - in );
mlt_playlist_move( this, this->count - 1, clip );
- mlt_producer_set_in_and_out( producer, in, out );
mlt_events_unblock( properties, properties );
mlt_playlist_virtual_refresh( this );
+ mlt_producer_set_in_and_out( producer, in, out );
}
return producer;
}
mlt_events_block( properties, this );
if ( clip < this->count && mlt_playlist_is_blank( this, clip ) )
{
- mlt_playlist_split( this, clip, position - info.start );
- mlt_playlist_get_clip_info( this, &info, ++ clip );
+ // Split and move to new clip if need be
+ if ( mlt_playlist_split( this, clip, position - info.start ) == 0 )
+ mlt_playlist_get_clip_info( this, &info, ++ clip );
+
+ // Split again if need be
if ( length < info.frame_count )
- mlt_playlist_split( this, clip, length );
+ mlt_playlist_split( this, clip, length - 1 );
+
+ // Remove
mlt_playlist_remove( this, clip );
+
+ // Insert
mlt_playlist_insert( this, producer, clip, -1, -1 );
ret = clip;
}
char *resource = mlt_properties_get( properties, "resource" );
if ( mlt_type == NULL )
type = unknown_type;
+ else if ( resource == NULL || !strcmp( resource, "<producer>" ) )
+ type = producer_type;
+ else if ( !strcmp( resource, "<playlist>" ) )
+ type = playlist_type;
+ else if ( !strcmp( resource, "<tractor>" ) )
+ type = tractor_type;
+ else if ( !strcmp( resource, "<multitrack>" ) )
+ type = multitrack_type;
else if ( !strcmp( mlt_type, "producer" ) )
type = producer_type;
- else if ( !strcmp( mlt_type, "mlt_producer" ) )
- {
- if ( resource == NULL || !strcmp( resource, "<producer>" ) )
- type = producer_type;
- else if ( !strcmp( resource, "<playlist>" ) )
- type = playlist_type;
- else if ( !strcmp( resource, "<tractor>" ) )
- type = tractor_type;
- else if ( !strcmp( resource, "<multitrack>" ) )
- type = multitrack_type;
- }
else if ( !strcmp( mlt_type, "filter" ) )
type = filter_type;
else if ( !strcmp( mlt_type, "transition" ) )
mlt_tractor mix = NULL;
mlt_playlist playlist = mlt_playlist_init( );
mlt_properties group = mlt_properties_new( );
- mlt_properties properties = group;
mlt_tractor tractor = mlt_tractor_new( );
+ mlt_properties properties = MLT_TRACTOR_PROPERTIES( tractor );
mlt_field field = mlt_tractor_field( tractor );
mlt_properties field_properties = mlt_field_properties( field );
mlt_multitrack multitrack = mlt_tractor_multitrack( tractor );
mlt_playlist_blank( playlist, atof( argv[ ++ i ] ) );
}
else if ( !strcmp( argv[ i ], "-track" ) ||
+ !strcmp( argv[ i ], "-null-track" ) ||
+ !strcmp( argv[ i ], "-video-track" ) ||
+ !strcmp( argv[ i ], "-audio-track" ) ||
!strcmp( argv[ i ], "-hide-track" ) ||
!strcmp( argv[ i ], "-hide-video" ) ||
!strcmp( argv[ i ], "-hide-audio" ) )
if ( producer != NULL && !mlt_producer_is_cut( producer ) )
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( );
+ if ( mlt_producer_get_playtime( MLT_PLAYLIST_PRODUCER( playlist ) ) > 0 )
+ {
+ mlt_multitrack_connect( multitrack, MLT_PLAYLIST_PRODUCER( playlist ), track ++ );
+ track_service( field, playlist, ( mlt_destructor )mlt_playlist_close );
+ playlist = mlt_playlist_init( );
+ }
if ( playlist != NULL )
{
properties = MLT_PLAYLIST_PROPERTIES( playlist );
- if ( !strcmp( argv[ i ], "-hide-track" ) )
+ if ( !strcmp( argv[ i ], "-null-track" ) || !strcmp( argv[ i ], "-hide-track" ) )
mlt_properties_set_int( properties, "hide", 3 );
- else if ( !strcmp( argv[ i ], "-hide-video" ) )
+ else if ( !strcmp( argv[ i ], "-audio-track" ) || !strcmp( argv[ i ], "-hide-video" ) )
mlt_properties_set_int( properties, "hide", 1 );
- else if ( !strcmp( argv[ i ], "-hide-audio" ) )
+ else if ( !strcmp( argv[ i ], "-video-track" ) || !strcmp( argv[ i ], "-hide-audio" ) )
mlt_properties_set_int( properties, "hide", 2 );
}
}