From: lilo_booter Date: Thu, 9 Dec 2004 18:12:43 +0000 (+0000) Subject: Corrections to playlist manipulations and producer type determination X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=13a70eccf0f8b2c2b0ce1c32862c687b693710ee;p=melted Corrections to playlist manipulations and producer type determination git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@552 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/framework/mlt_playlist.c b/src/framework/mlt_playlist.c index d563d7d..22cd256 100644 --- a/src/framework/mlt_playlist.c +++ b/src/framework/mlt_playlist.c @@ -755,6 +755,9 @@ int mlt_playlist_resize_clip( mlt_playlist this, int clip, mlt_position in, mlt_ { 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 ) ) { @@ -762,9 +765,9 @@ int mlt_playlist_resize_clip( mlt_playlist this, int clip, mlt_position in, mlt_ 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 ); } } @@ -781,6 +784,8 @@ int mlt_playlist_resize_clip( mlt_playlist this, int clip, mlt_position in, mlt_ } mlt_producer_set_in_and_out( producer, in, out ); + mlt_events_unblock( properties, properties ); + mlt_playlist_virtual_refresh( this ); } return error; } @@ -803,8 +808,17 @@ int mlt_playlist_split( mlt_playlist this, int clip, mlt_position position ) 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 @@ -1120,8 +1134,7 @@ void mlt_playlist_consolidate_blanks( mlt_playlist this, int keep_length ) 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 -- ); @@ -1166,9 +1179,9 @@ mlt_producer mlt_playlist_replace_with_blank( mlt_playlist this, int clip ) 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; } @@ -1226,11 +1239,18 @@ int mlt_playlist_insert_at( mlt_playlist this, int position, mlt_producer produc 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; } diff --git a/src/framework/mlt_service.c b/src/framework/mlt_service.c index 36f79e0..d8173d6 100644 --- a/src/framework/mlt_service.c +++ b/src/framework/mlt_service.c @@ -124,19 +124,16 @@ mlt_service_type mlt_service_identify( mlt_service this ) char *resource = mlt_properties_get( properties, "resource" ); if ( mlt_type == NULL ) type = unknown_type; + else if ( resource == NULL || !strcmp( resource, "" ) ) + type = producer_type; + else if ( !strcmp( resource, "" ) ) + type = playlist_type; + else if ( !strcmp( resource, "" ) ) + type = tractor_type; + else if ( !strcmp( resource, "" ) ) + type = multitrack_type; else if ( !strcmp( mlt_type, "producer" ) ) type = producer_type; - else if ( !strcmp( mlt_type, "mlt_producer" ) ) - { - if ( resource == NULL || !strcmp( resource, "" ) ) - type = producer_type; - else if ( !strcmp( resource, "" ) ) - type = playlist_type; - else if ( !strcmp( resource, "" ) ) - type = tractor_type; - else if ( !strcmp( resource, "" ) ) - type = multitrack_type; - } else if ( !strcmp( mlt_type, "filter" ) ) type = filter_type; else if ( !strcmp( mlt_type, "transition" ) ) diff --git a/src/modules/inigo/producer_inigo.c b/src/modules/inigo/producer_inigo.c index e5263c4..707fb77 100644 --- a/src/modules/inigo/producer_inigo.c +++ b/src/modules/inigo/producer_inigo.c @@ -124,8 +124,8 @@ mlt_producer producer_inigo_init( char **argv ) 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 ); @@ -338,6 +338,9 @@ mlt_producer producer_inigo_init( char **argv ) 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" ) ) @@ -345,17 +348,20 @@ mlt_producer producer_inigo_init( char **argv ) 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 ); } }