}
// Check if the length of the producer has changed
- if ( this->list[ i ]->frame_in != mlt_producer_get_in( producer ) ||
- this->list[ i ]->frame_out != mlt_producer_get_out( producer ) );
+ if ( this->list[ i ]->producer != &this->blank &&
+ ( this->list[ i ]->frame_in != mlt_producer_get_in( producer ) ||
+ this->list[ i ]->frame_out != mlt_producer_get_out( producer ) ) )
{
// This clip should be removed...
if ( current_length == 1 )
static int mlt_playlist_virtual_append( mlt_playlist this, mlt_producer source, mlt_position in, mlt_position out )
{
- mlt_producer producer = mlt_producer_is_cut( source ) ? source : mlt_producer_cut( source, in, out );
- mlt_properties properties = mlt_producer_properties( producer );
+ mlt_producer producer = NULL;
+ mlt_properties properties = NULL;
// If we have a cut, then use the in/out points from the cut
- if ( mlt_producer_is_cut( source ) )
+ if ( &this->blank == source )
{
+ producer = source;
+ properties = mlt_producer_properties( producer );
mlt_properties_inc_ref( properties );
- in = mlt_producer_get_in( source );
- out = mlt_producer_get_out( source );
}
+ else if ( mlt_producer_is_cut( source ) )
+ {
+ producer = source;
+ if ( in == -1 )
+ in = mlt_producer_get_in( producer );
+ if ( out == -1 || out > mlt_producer_get_out( producer ) )
+ out = mlt_producer_get_out( producer );
+ properties = mlt_producer_properties( producer );
+ mlt_properties_inc_ref( properties );
+ }
+ else
+ {
+ producer = mlt_producer_cut( source, in, out );
+ if ( in == -1 || in < mlt_producer_get_in( producer ) )
+ in = mlt_producer_get_in( producer );
+ if ( out == -1 || out > mlt_producer_get_out( producer ) )
+ out = mlt_producer_get_out( producer );
+ properties = mlt_producer_properties( producer );
+ }
+
// Check that we have room
if ( this->count >= this->size )
this->list[ this->count ]->event = mlt_events_listen( properties, this, "producer-changed", ( mlt_listener )mlt_playlist_listener );
mlt_event_inc_ref( this->list[ this->count ]->event );
+ mlt_properties_set( mlt_producer_properties( source ), "eof", "pause" );
mlt_properties_set( properties, "eof", "pause" );
+ mlt_producer_set_speed( source, 0 );
mlt_producer_set_speed( producer, 0 );
this->count ++;
-
return mlt_playlist_virtual_refresh( this );
}
mlt_tractor tractor = mlt_tractor_new( );
mlt_events_block( mlt_playlist_properties( this ), this );
- mlt_playlist_resize_clip( this, clip, clip_a->frame_in, clip_a->frame_out - length );
+ track_a = mlt_producer_cut( clip_a->producer, clip_a->frame_out - length + 1, clip_a->frame_out );
+ mlt_properties_set_int( mlt_producer_properties( track_a ), "cut", 1 );
+ track_b = mlt_producer_cut( clip_b->producer, clip_b->frame_in, clip_b->frame_in + length - 1 );
+ mlt_properties_set_int( mlt_producer_properties( track_b ), "cut", 1 );
+
+ mlt_playlist_resize_clip( this, clip, clip_a->frame_in, clip_a->frame_out - length + 1 );
mlt_playlist_resize_clip( this, clip + 1, clip_b->frame_in + length, clip_b->frame_out );
- track_a = mlt_producer_cut( mlt_producer_cut_parent( clip_a->producer ), clip_a->frame_out + 1, clip_a->frame_out + length );
- track_b = mlt_producer_cut( mlt_producer_cut_parent( clip_b->producer ), clip_b->frame_in - length, clip_b->frame_in - 1 );
mlt_tractor_set_track( tractor, track_a, 0 );
mlt_tractor_set_track( tractor, track_b, 1 );
mlt_playlist_insert( this, mlt_tractor_producer( tractor ), clip + 1, -1, -1 );
mlt_frame mlt_transition_process( mlt_transition this, mlt_frame a_frame, mlt_frame b_frame )
{
- if ( this->process == NULL || b_frame == NULL || ( mlt_frame_is_test_card( b_frame ) && mlt_frame_is_test_audio( b_frame ) ) )
+ if ( this->process == NULL )
return a_frame;
- else if ( a_frame == NULL || ( mlt_frame_is_test_card( a_frame ) && mlt_frame_is_test_audio( a_frame ) ) )
- return b_frame;
else
return this->process( this, a_frame, b_frame );
}
mlt_position position = mlt_frame_get_position( this->a_frame );
if ( position >= in && position <= out )
{
- // Process the transition
- *frame = mlt_transition_process( this, this->a_frame, this->b_frame );
- if ( *frame == this->b_frame )
+#if 0
+ // TODO: This could is breaking muliple transitions, but it would be nice to have...
+ // essentially, it allows transitions to run over whole tracks, while ignoring test cards
+ // (alternative is to put the handling in the transitions themselves :-/)
+ if ( this->b_frame == NULL || ( mlt_frame_is_test_card( this->b_frame ) && mlt_frame_is_test_audio( this->b_frame ) ) )
+ {
+ *frame = this->a_frame;
+ }
+ else if ( this->a_frame == NULL || ( mlt_frame_is_test_card( this->a_frame ) && mlt_frame_is_test_audio( this->a_frame ) ) )
{
mlt_frame t = this->a_frame;
this->a_frame = this->b_frame;
this->b_frame = t;
+ *frame = this->a_frame;
+ }
+ else
+#endif
+ {
+ *frame = mlt_transition_process( this, this->a_frame, this->b_frame );
+ if ( !mlt_properties_get_int( mlt_frame_properties( this->a_frame ), "test_image" ) )
+ mlt_properties_set_int( mlt_frame_properties( this->b_frame ), "test_image", 1 );
+ if ( !mlt_properties_get_int( mlt_frame_properties( this->a_frame ), "test_audio" ) )
+ mlt_properties_set_int( mlt_frame_properties( this->b_frame ), "test_audio", 1 );
}
- if ( !mlt_properties_get_int( mlt_frame_properties( this->a_frame ), "test_image" ) )
- mlt_properties_set_int( mlt_frame_properties( this->b_frame ), "test_image", 1 );
- if ( !mlt_properties_get_int( mlt_frame_properties( this->a_frame ), "test_audio" ) )
- mlt_properties_set_int( mlt_frame_properties( this->b_frame ), "test_audio", 1 );
this->a_held = 0;
}
else
char *id = westley_get_id( context, MLT_SERVICE( parent ), westley_existing );
xmlNewProp( track, "producer", id );
- xmlNewProp( track, "in", mlt_properties_get( properties, "in" ) );
- xmlNewProp( track, "out", mlt_properties_get( properties, "out" ) );
+ if ( mlt_properties_get_int( properties, "cut" ) == 1 )
+ {
+ xmlNewProp( track, "in", mlt_properties_get( properties, "in" ) );
+ xmlNewProp( track, "out", mlt_properties_get( properties, "out" ) );
+ }
hide = mlt_properties_get_int( context->hide_map, id );
if ( hide )
// Set the track on the multitrack
// Set producer i/o if specified
- if ( mlt_properties_get( track_props, "in" ) != NULL ||
- mlt_properties_get( track_props, "out" ) != NULL )
+ if ( mlt_properties_get( track_props, "in" ) != NULL &&
+ mlt_properties_get( track_props, "out" ) != NULL )
{
mlt_producer cut = mlt_producer_cut( MLT_PRODUCER( producer ),
mlt_properties_get_position( track_props, "in" ),
mlt_properties_get_position( track_props, "out" ) );
+ mlt_properties_set_int( mlt_producer_properties( cut ), "cut", 1 );
mlt_multitrack_connect( multitrack, cut, mlt_multitrack_count( multitrack ) );
mlt_producer_close( cut );
}