-static int mlt_playlist_unmix( mlt_playlist this, int clip );
-static int mlt_playlist_resize_mix( mlt_playlist this, int clip, int in, int out );
+static int mlt_playlist_unmix( mlt_playlist self, int clip );
+static int mlt_playlist_resize_mix( mlt_playlist self, int clip, int in, int out );
// Override the producer get_frame
producer->get_frame = producer_get_frame;
// Define the destructor
producer->close = ( mlt_destructor )mlt_playlist_close;
// Override the producer get_frame
producer->get_frame = producer_get_frame;
// Define the destructor
producer->close = ( mlt_destructor )mlt_playlist_close;
- mlt_producer_init( &this->blank, NULL );
- mlt_properties_set( MLT_PRODUCER_PROPERTIES( &this->blank ), "mlt_service", "blank" );
- mlt_properties_set( MLT_PRODUCER_PROPERTIES( &this->blank ), "resource", "blank" );
+ mlt_producer_init( &self->blank, NULL );
+ mlt_properties_set( MLT_PRODUCER_PROPERTIES( &self->blank ), "mlt_service", "blank" );
+ mlt_properties_set( MLT_PRODUCER_PROPERTIES( &self->blank ), "resource", "blank" );
- mlt_properties_set_data( MLT_PLAYLIST_PROPERTIES( this ), "playlist", this, 0, NULL, NULL );
+ mlt_properties_set_data( MLT_PLAYLIST_PROPERTIES( self ), "playlist", self, 0, NULL, NULL );
- mlt_properties_set( MLT_PLAYLIST_PROPERTIES( this ), "eof", "pause" );
- mlt_properties_set( MLT_PLAYLIST_PROPERTIES( this ), "resource", "<playlist>" );
- mlt_properties_set( MLT_PLAYLIST_PROPERTIES( this ), "mlt_type", "mlt_producer" );
- mlt_properties_set_position( MLT_PLAYLIST_PROPERTIES( this ), "in", 0 );
- mlt_properties_set_position( MLT_PLAYLIST_PROPERTIES( this ), "out", -1 );
- mlt_properties_set_position( MLT_PLAYLIST_PROPERTIES( this ), "length", 0 );
-
- this->size = 10;
- this->list = malloc( this->size * sizeof( playlist_entry * ) );
+ mlt_properties_set( MLT_PLAYLIST_PROPERTIES( self ), "eof", "pause" );
+ mlt_properties_set( MLT_PLAYLIST_PROPERTIES( self ), "resource", "<playlist>" );
+ mlt_properties_set( MLT_PLAYLIST_PROPERTIES( self ), "mlt_type", "mlt_producer" );
+ mlt_properties_set_position( MLT_PLAYLIST_PROPERTIES( self ), "in", 0 );
+ mlt_properties_set_position( MLT_PLAYLIST_PROPERTIES( self ), "out", -1 );
+ mlt_properties_set_position( MLT_PLAYLIST_PROPERTIES( self ), "length", 0 );
+
+ self->size = 10;
+ self->list = malloc( self->size * sizeof( playlist_entry * ) );
if ( producer )
{
int current_length = mlt_producer_get_out( producer ) - mlt_producer_get_in( producer ) + 1;
// Check if the length of the producer has changed
if ( producer )
{
int current_length = mlt_producer_get_out( producer ) - mlt_producer_get_in( producer ) + 1;
// 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 ( self->list[ i ]->frame_in != mlt_producer_get_in( producer ) ||
+ self->list[ i ]->frame_out != mlt_producer_get_out( producer ) )
- this->list[ i ]->frame_in = 0;
- this->list[ i ]->frame_out = -1;
- this->list[ i ]->frame_count = 0;
+ self->list[ i ]->frame_in = 0;
+ self->list[ i ]->frame_out = -1;
+ self->list[ i ]->frame_count = 0;
- this->list[ i ]->frame_in = mlt_producer_get_in( producer );
- this->list[ i ]->frame_out = mlt_producer_get_out( producer );
- this->list[ i ]->frame_count = current_length;
+ self->list[ i ]->frame_in = mlt_producer_get_in( producer );
+ self->list[ i ]->frame_out = mlt_producer_get_out( producer );
+ self->list[ i ]->frame_count = current_length;
* Refreshes the playlist whenever an entry receives producer-changed.
* \private \memberof mlt_playlist_s
* \param producer a producer
* Refreshes the playlist whenever an entry receives producer-changed.
* \private \memberof mlt_playlist_s
* \param producer a producer
* \param source a producer
* \param in the producer's starting time
* \param out the producer's ending time
* \return true if there was an error
*/
* \param source a producer
* \param in the producer's starting time
* \param out the producer's ending time
* \return true if there was an error
*/
-static int mlt_playlist_virtual_append( mlt_playlist this, mlt_producer source, mlt_position in, mlt_position out )
+static int mlt_playlist_virtual_append( mlt_playlist self, mlt_producer source, mlt_position in, mlt_position out )
if ( mlt_producer_is_blank( source ) )
{
// Make sure the blank is long enough to accomodate the length specified
if ( mlt_producer_is_blank( source ) )
{
// Make sure the blank is long enough to accomodate the length specified
out = mlt_producer_get_out( producer );
properties = MLT_PRODUCER_PROPERTIES( producer );
mlt_properties_inc_ref( properties );
out = mlt_producer_get_out( producer );
properties = MLT_PRODUCER_PROPERTIES( producer );
mlt_properties_inc_ref( properties );
- this->list = realloc( this->list, ( this->size + 10 ) * sizeof( playlist_entry * ) );
- for ( i = this->size; i < this->size + 10; i ++ ) this->list[ i ] = NULL;
- this->size += 10;
+ self->list = realloc( self->list, ( self->size + 10 ) * sizeof( playlist_entry * ) );
+ for ( i = self->size; i < self->size + 10; i ++ ) self->list[ i ] = NULL;
+ self->size += 10;
- this->list[ this->count ] = calloc( sizeof( playlist_entry ), 1 );
- if ( this->list[ this->count ] != NULL )
+ self->list[ self->count ] = calloc( sizeof( playlist_entry ), 1 );
+ if ( self->list[ self->count ] != NULL )
- this->list[ this->count ]->producer = producer;
- this->list[ this->count ]->frame_in = in;
- this->list[ this->count ]->frame_out = out;
- this->list[ this->count ]->frame_count = out - in + 1;
- this->list[ this->count ]->repeat = 1;
- this->list[ this->count ]->producer_length = mlt_producer_get_out( producer ) - mlt_producer_get_in( producer ) + 1;
- this->list[ this->count ]->event = mlt_events_listen( parent, this, "producer-changed", ( mlt_listener )mlt_playlist_listener );
- mlt_event_inc_ref( this->list[ this->count ]->event );
+ self->list[ self->count ]->producer = producer;
+ self->list[ self->count ]->frame_in = in;
+ self->list[ self->count ]->frame_out = out;
+ self->list[ self->count ]->frame_count = out - in + 1;
+ self->list[ self->count ]->repeat = 1;
+ self->list[ self->count ]->producer_length = mlt_producer_get_out( producer ) - mlt_producer_get_in( producer ) + 1;
+ self->list[ self->count ]->event = mlt_events_listen( parent, self, "producer-changed", ( mlt_listener )mlt_playlist_listener );
+ mlt_event_inc_ref( self->list[ self->count ]->event );
mlt_properties_set( properties, "eof", "pause" );
mlt_producer_set_speed( producer, 0 );
mlt_properties_set( properties, "eof", "pause" );
mlt_producer_set_speed( producer, 0 );
* \param[in, out] position the time at which to locate the producer, returns the time relative to the producer's starting point
* \param[out] clip the index of the playlist entry
* \param[out] total the duration of the playlist up to and including this producer
* \return a producer or NULL if not found
*/
* \param[in, out] position the time at which to locate the producer, returns the time relative to the producer's starting point
* \param[out] clip the index of the playlist entry
* \param[out] total the duration of the playlist up to and including this producer
* \return a producer or NULL if not found
*/
-static mlt_producer mlt_playlist_locate( mlt_playlist this, mlt_position *position, int *clip, int *total )
+static mlt_producer mlt_playlist_locate( mlt_playlist self, mlt_position *position, int *clip, int *total )
{
// Default producer to NULL
mlt_producer producer = NULL;
// Loop for each producer until found
{
// Default producer to NULL
mlt_producer producer = NULL;
// Loop for each producer until found
// Check if the position indicates that we have found the clip
// Note that 0 length clips get skipped automatically
// Check if the position indicates that we have found the clip
// Note that 0 length clips get skipped automatically
* closing producers previous to the preceding playlist if the autoclose
* property is set.
* \private \memberof mlt_playlist_s
* closing producers previous to the preceding playlist if the autoclose
* property is set.
* \private \memberof mlt_playlist_s
* \param[out] progressive true if the producer should be displayed progressively
* \return the service interface of the producer at the play head
* \see producer_get_frame
*/
* \param[out] progressive true if the producer should be displayed progressively
* \return the service interface of the producer at the play head
* \see producer_get_frame
*/
// Keep the original position since we change it while iterating through the list
mlt_position original = position;
// Keep the original position since we change it while iterating through the list
mlt_position original = position;
- mlt_producer producer = mlt_playlist_locate( this, &position, &i, &total );
+ mlt_producer producer = mlt_playlist_locate( self, &position, &i, &total );
// Automatically close previous producers if requested
if ( i > 1 // keep immediate previous in case app wants to get info about what just finished
// Automatically close previous producers if requested
if ( i > 1 // keep immediate previous in case app wants to get info about what just finished
- mlt_service_lock( MLT_PRODUCER_SERVICE( this->list[ j ]->producer ) );
- mlt_producer p = this->list[ j ]->producer;
+ mlt_service_lock( MLT_PRODUCER_SERVICE( self->list[ j ]->producer ) );
+ mlt_producer p = self->list[ j ]->producer;
*progressive = count == 1;
mlt_producer_seek( producer, (int)position % count );
}
else if ( !strcmp( eof, "pause" ) && total > 0 )
{
*progressive = count == 1;
mlt_producer_seek( producer, (int)position % count );
}
else if ( !strcmp( eof, "pause" ) && total > 0 )
{
- mlt_producer this_producer = MLT_PLAYLIST_PRODUCER( this );
- mlt_producer_seek( this_producer, original - 1 );
+ mlt_producer self_producer = MLT_PLAYLIST_PRODUCER( self );
+ mlt_producer_seek( self_producer, original - 1 );
producer = entry->producer;
mlt_producer_seek( producer, (int)entry->frame_out % count );
producer = entry->producer;
mlt_producer_seek( producer, (int)entry->frame_out % count );
mlt_producer_set_speed( producer, 0 );
*progressive = count == 1;
}
else if ( !strcmp( eof, "loop" ) && total > 0 )
{
mlt_producer_set_speed( producer, 0 );
*progressive = count == 1;
}
else if ( !strcmp( eof, "loop" ) && total > 0 )
{
- playlist_entry *entry = this->list[ 0 ];
- mlt_producer this_producer = MLT_PLAYLIST_PRODUCER( this );
- mlt_producer_seek( this_producer, 0 );
+ playlist_entry *entry = self->list[ 0 ];
+ mlt_producer self_producer = MLT_PLAYLIST_PRODUCER( self );
+ mlt_producer_seek( self_producer, 0 );
producer = entry->producer;
mlt_producer_seek( producer, 0 );
}
else
{
producer = entry->producer;
mlt_producer_seek( producer, 0 );
}
else
{
/** Invoked when a producer indicates that it has prematurely reached its end.
*
* \private \memberof mlt_playlist_s
/** Invoked when a producer indicates that it has prematurely reached its end.
*
* \private \memberof mlt_playlist_s
- this->list[ i ]->frame_out = position;
- this->list[ i ]->frame_count = this->list[ i ]->frame_out - this->list[ i ]->frame_in + 1;
+ self->list[ i ]->frame_out = position;
+ self->list[ i ]->frame_count = self->list[ i ]->frame_out - self->list[ i ]->frame_in + 1;
}
/** Get the position which corresponds to the start of the next clip.
*
* \public \memberof mlt_playlist_s
}
/** Get the position which corresponds to the start of the next clip.
*
* \public \memberof mlt_playlist_s
* \param whence the location from which to make the index relative:
* start of playlist, end of playlist, or current position
* \param index the playlist entry index relative to whence
* \return the time at which the referenced clip starts
*/
* \param whence the location from which to make the index relative:
* start of playlist, end of playlist, or current position
* \param index the playlist entry index relative to whence
* \return the time at which the referenced clip starts
*/
* \param info a clip info struct
* \param index a playlist entry index
* \return true if there was an error
*/
* \param info a clip info struct
* \param index a playlist entry index
* \return true if there was an error
*/
- info->cut = this->list[ index ]->producer;
- info->start = mlt_playlist_clip( this, mlt_whence_relative_start, index );
+ info->cut = self->list[ index ]->producer;
+ info->start = mlt_playlist_clip( self, mlt_whence_relative_start, index );
- info->frame_in = this->list[ index ]->frame_in;
- info->frame_out = this->list[ index ]->frame_out;
- info->frame_count = this->list[ index ]->frame_count;
- info->repeat = this->list[ index ]->repeat;
+ info->frame_in = self->list[ index ]->frame_in;
+ info->frame_out = self->list[ index ]->frame_out;
+ info->frame_count = self->list[ index ]->frame_count;
+ info->repeat = self->list[ index ]->repeat;
- return mlt_playlist_virtual_append( this, producer, 0, mlt_producer_get_playtime( producer ) - 1 );
+ return mlt_playlist_virtual_append( self, producer, 0, mlt_producer_get_playtime( producer ) - 1 );
- * \param in the starting point on the producer
- * \param out the ending point on the producer
+ * \param in the starting point on the producer; a negative value is the same as 0
+ * \param out the ending point on the producer; a negative value is the same as producer length - 1
-int mlt_playlist_append_io( mlt_playlist this, mlt_producer producer, mlt_position in, mlt_position out )
+int mlt_playlist_append_io( mlt_playlist self, mlt_producer producer, mlt_position in, mlt_position out )
- if ( in != -1 && out != -1 )
- return mlt_playlist_virtual_append( this, producer, in, out );
+ if ( in < 0 && out < 0 )
+ return mlt_playlist_append( self, producer );
* \param length the ending time of the blank entry, not its duration
* \return true if there was an error
*/
* \param length the ending time of the blank entry, not its duration
* \return true if there was an error
*/
- return mlt_playlist_virtual_append( this, &this->blank, 0, length );
+ return mlt_playlist_virtual_append( self, &self->blank, 0, length );
* \param producer the producer to insert
* \param where the producer's playlist entry index
* \param in the starting point on the producer
* \param producer the producer to insert
* \param where the producer's playlist entry index
* \param in the starting point on the producer
-int mlt_playlist_insert( mlt_playlist this, mlt_producer producer, int where, mlt_position in, mlt_position out )
+int mlt_playlist_insert( mlt_playlist self, mlt_producer producer, int where, mlt_position in, mlt_position out )
- mlt_events_block( MLT_PLAYLIST_PROPERTIES( this ), this );
- mlt_playlist_append_io( this, producer, in, out );
+ mlt_events_block( MLT_PLAYLIST_PROPERTIES( self ), self );
+ mlt_playlist_append_io( self, producer, in, out );
- mlt_playlist_move( this, this->count - 1, where );
- mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( this ), this );
+ mlt_playlist_move( self, self->count - 1, where );
+ mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( self ), self );
- int error = where < 0 || where >= this->count;
- if ( error == 0 && mlt_playlist_unmix( this, where ) != 0 )
+ int error = where < 0 || where >= self->count;
+ if ( error == 0 && mlt_playlist_unmix( self, where ) != 0 )
- int current = mlt_playlist_current_clip( this );
- mlt_position position = mlt_producer_position( MLT_PLAYLIST_PRODUCER( this ) );
+ int current = mlt_playlist_current_clip( self );
+ mlt_position position = mlt_producer_position( MLT_PLAYLIST_PRODUCER( self ) );
- mlt_producer_seek( MLT_PLAYLIST_PRODUCER( this ), where_info.start );
- else if ( where < current && this->count > 0 )
- mlt_producer_seek( MLT_PLAYLIST_PRODUCER( this ), position - where_info.frame_count );
- else if ( this->count == 0 )
- mlt_producer_seek( MLT_PLAYLIST_PRODUCER( this ), 0 );
+ mlt_producer_seek( MLT_PLAYLIST_PRODUCER( self ), where_info.start );
+ else if ( where < current && self->count > 0 )
+ mlt_producer_seek( MLT_PLAYLIST_PRODUCER( self ), position - where_info.frame_count );
+ else if ( self->count == 0 )
+ mlt_producer_seek( MLT_PLAYLIST_PRODUCER( self ), 0 );
- int current = mlt_playlist_current_clip( this );
- mlt_position position = mlt_producer_position( MLT_PLAYLIST_PRODUCER( this ) );
+ int current = mlt_playlist_current_clip( self );
+ mlt_position position = mlt_producer_position( MLT_PLAYLIST_PRODUCER( self ) );
playlist_entry *src_entry = NULL;
// We need all the details about the current clip
mlt_playlist_clip_info current_info;
playlist_entry *src_entry = NULL;
// We need all the details about the current clip
mlt_playlist_clip_info current_info;
- mlt_playlist_get_clip_info( this, ¤t_info, current );
- mlt_producer_seek( MLT_PLAYLIST_PRODUCER( this ), current_info.start + position );
- mlt_playlist_virtual_refresh( this );
+ mlt_playlist_get_clip_info( self, ¤t_info, current );
+ mlt_producer_seek( MLT_PLAYLIST_PRODUCER( self ), current_info.start + position );
+ mlt_playlist_virtual_refresh( self );
* \param clip a playlist entry index
* \param repeat the number of times to repeat the clip
* \return true if there was an error
*/
* \param clip a playlist entry index
* \param repeat the number of times to repeat the clip
* \return true if there was an error
*/
- * \param in the new starting time on the clip's producer
- * \param out the new ending time on the clip's producer
+ * \param in the new starting time on the clip's producer; a negative value is the same as 0
+ * \param out the new ending time on the clip's producer; a negative value is the same as length - 1
-int mlt_playlist_resize_clip( mlt_playlist this, int clip, mlt_position in, mlt_position out )
+int mlt_playlist_resize_clip( mlt_playlist self, int clip, mlt_position in, mlt_position out )
- int error = clip < 0 || clip >= this->count;
- if ( error == 0 && mlt_playlist_resize_mix( this, clip, in, out ) != 0 )
+ int error = clip < 0 || clip >= self->count;
+ if ( error == 0 && mlt_playlist_resize_mix( self, clip, in, out ) != 0 )
mlt_events_block( properties, properties );
if ( mlt_producer_is_blank( producer ) )
{
// Make sure the blank is long enough to accomodate the length specified
mlt_events_block( properties, properties );
if ( mlt_producer_is_blank( producer ) )
{
// Make sure the blank is long enough to accomodate the length specified
mlt_properties_set_int( blank_props, "length", out - in + 1 );
mlt_properties_set_int( MLT_PRODUCER_PROPERTIES( producer ), "length", out - in + 1 );
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( producer, in, out );
mlt_events_unblock( properties, properties );
mlt_producer_set_in_and_out( producer, in, out );
mlt_events_unblock( properties, properties );
* \param clip the index of the playlist entry
* \param position the time at which to split relative to the beginning of the clip or its end if negative
* \return true if there was an error
*/
* \param clip the index of the playlist entry
* \param position the time at which to split relative to the beginning of the clip or its end if negative
* \return true if there was an error
*/
position = position < 0 ? entry->frame_count + position - 1 : position;
if ( position >= 0 && position < entry->frame_count - 1 )
{
int in = entry->frame_in;
int out = entry->frame_out;
position = position < 0 ? entry->frame_count + position - 1 : position;
if ( position >= 0 && position < entry->frame_count - 1 )
{
int in = entry->frame_in;
int out = entry->frame_out;
- mlt_events_block( MLT_PLAYLIST_PROPERTIES( this ), this );
- mlt_playlist_resize_clip( this, clip, in, in + position );
+ mlt_events_block( MLT_PLAYLIST_PROPERTIES( self ), self );
+ mlt_playlist_resize_clip( self, 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 );
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 );
+ mlt_playlist_insert( self, split, clip + 1, 0, -1 );
for ( i = 0; i < mlt_properties_count( entry_properties ); i ++ )
{
char *name = mlt_properties_get_name( entry_properties, i );
for ( i = 0; i < mlt_properties_count( entry_properties ); i ++ )
{
char *name = mlt_properties_get_name( entry_properties, i );
- mlt_playlist_insert( this, &this->blank, clip + 1, 0, out - position - 1 );
+ mlt_playlist_insert( self, &self->blank, clip + 1, 0, out - position - 1 );
- mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( this ), this );
- mlt_playlist_virtual_refresh( this );
+ mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( self ), self );
+ mlt_playlist_virtual_refresh( self );
* \param position the time at which to split relative to the beginning of the clip
* \param left true to split before the frame starting at position
* \return true if there was an error
*/
* \param position the time at which to split relative to the beginning of the clip
* \param left true to split before the frame starting at position
* \return true if there was an error
*/
* \param clip the starting playlist entry index
* \param count the number of entries to merge
* \param merge ignored
* \return true if there was an error
*/
* \param clip the starting playlist entry index
* \param count the number of entries to merge
* \param merge ignored
* \return true if there was an error
*/
-int mlt_playlist_join( mlt_playlist this, int clip, int count, int merge )
+int mlt_playlist_join( mlt_playlist self, int clip, int count, int merge )
- mlt_events_block( MLT_PLAYLIST_PROPERTIES( this ), this );
- if ( clip + count >= this->count )
- count = this->count - clip - 1;
+ mlt_events_block( MLT_PLAYLIST_PROPERTIES( self ), self );
+ if ( clip + count >= self->count )
+ count = self->count - clip - 1;
mlt_playlist_append( new_clip, entry->producer );
mlt_playlist_repeat_clip( new_clip, i, entry->repeat );
entry->preservation_hack = 1;
mlt_playlist_append( new_clip, entry->producer );
mlt_playlist_repeat_clip( new_clip, i, entry->repeat );
entry->preservation_hack = 1;
- mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( this ), this );
- mlt_playlist_insert( this, MLT_PLAYLIST_PRODUCER( new_clip ), clip, 0, -1 );
+ mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( self ), self );
+ mlt_playlist_insert( self, MLT_PLAYLIST_PRODUCER( new_clip ), clip, 0, -1 );
/** Mix consecutive clips for a specified length and apply transition if specified.
*
* \public \memberof mlt_playlist_s
/** Mix consecutive clips for a specified length and apply transition if specified.
*
* \public \memberof mlt_playlist_s
* \param clip the index of the playlist entry
* \param length the number of frames over which to create the mix
* \param transition the transition to use for the mix
* \return true if there was an error
*/
* \param clip the index of the playlist entry
* \param length the number of frames over which to create the mix
* \param transition the transition to use for the mix
* \return true if there was an error
*/
-int mlt_playlist_mix( mlt_playlist this, int clip, int length, mlt_transition transition )
+int mlt_playlist_mix( mlt_playlist self, int clip, int length, mlt_transition transition )
mlt_producer track_a = NULL;
mlt_producer track_b = NULL;
mlt_tractor tractor = mlt_tractor_new( );
mlt_producer track_a = NULL;
mlt_producer track_b = NULL;
mlt_tractor tractor = mlt_tractor_new( );
// Check length is valid for both clips and resize if necessary.
int max_size = clip_a->frame_count > clip_b->frame_count ? clip_a->frame_count : clip_b->frame_count;
// Check length is valid for both clips and resize if necessary.
int max_size = clip_a->frame_count > clip_b->frame_count ? clip_a->frame_count : clip_b->frame_count;
mlt_tractor_set_track( tractor, track_b, 1 );
// Insert the mix object into the playlist
mlt_tractor_set_track( tractor, track_b, 1 );
// Insert the mix object into the playlist
- mlt_playlist_insert( this, MLT_TRACTOR_PRODUCER( tractor ), clip + 1, -1, -1 );
+ mlt_playlist_insert( self, MLT_TRACTOR_PRODUCER( tractor ), clip + 1, -1, -1 );
mlt_properties_set_data( MLT_TRACTOR_PROPERTIES( tractor ), "mlt_mix", tractor, 0, NULL, NULL );
// Attach the transition
mlt_properties_set_data( MLT_TRACTOR_PROPERTIES( tractor ), "mlt_mix", tractor, 0, NULL, NULL );
// Attach the transition
- mlt_playlist_resize_clip( this, clip + 2, clip_b->frame_in + length, clip_b->frame_out );
+ mlt_playlist_resize_clip( self, clip + 2, clip_b->frame_in + length, clip_b->frame_out );
mlt_properties_set_data( MLT_PRODUCER_PROPERTIES( clip_b->producer ), "mix_in", tractor, 0, NULL, NULL );
mlt_properties_set_data( MLT_TRACTOR_PROPERTIES( tractor ), "mix_out", clip_b->producer, 0, NULL, NULL );
}
else
{
mlt_producer_clear( clip_b->producer );
mlt_properties_set_data( MLT_PRODUCER_PROPERTIES( clip_b->producer ), "mix_in", tractor, 0, NULL, NULL );
mlt_properties_set_data( MLT_TRACTOR_PROPERTIES( tractor ), "mix_out", clip_b->producer, 0, NULL, NULL );
}
else
{
mlt_producer_clear( clip_b->producer );
}
// Check if we have anything left on the left hand clip
if ( track_a == clip_a->producer )
{
clip_a->preservation_hack = 1;
}
// Check if we have anything left on the left hand clip
if ( track_a == clip_a->producer )
{
clip_a->preservation_hack = 1;
- mlt_playlist_resize_clip( this, clip, clip_a->frame_in, clip_a->frame_out - length );
+ mlt_playlist_resize_clip( self, clip, clip_a->frame_in, clip_a->frame_out - length );
mlt_properties_set_data( MLT_PRODUCER_PROPERTIES( clip_a->producer ), "mix_out", tractor, 0, NULL, NULL );
mlt_properties_set_data( MLT_TRACTOR_PROPERTIES( tractor ), "mix_in", clip_a->producer, 0, NULL, NULL );
}
else
{
mlt_producer_clear( clip_a->producer );
mlt_properties_set_data( MLT_PRODUCER_PROPERTIES( clip_a->producer ), "mix_out", tractor, 0, NULL, NULL );
mlt_properties_set_data( MLT_TRACTOR_PROPERTIES( tractor ), "mix_in", clip_a->producer, 0, NULL, NULL );
}
else
{
mlt_producer_clear( clip_a->producer );
- mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( this ), this );
- mlt_playlist_virtual_refresh( this );
+ mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( self ), self );
+ mlt_playlist_virtual_refresh( self );
* \param clip the index of the playlist entry
* \param transition a transition
* \return true if there was an error
*/
* \param clip the index of the playlist entry
* \param transition a transition
* \return true if there was an error
*/
mlt_properties properties = producer != NULL ? MLT_PRODUCER_PROPERTIES( producer ) : NULL;
mlt_tractor tractor = properties != NULL ? mlt_properties_get_data( properties, "mlt_mix", NULL ) : NULL;
int error = transition == NULL || tractor == NULL;
mlt_properties properties = producer != NULL ? MLT_PRODUCER_PROPERTIES( producer ) : NULL;
mlt_tractor tractor = properties != NULL ? mlt_properties_get_data( properties, "mlt_mix", NULL ) : NULL;
int error = transition == NULL || tractor == NULL;
{
mlt_field field = mlt_tractor_field( tractor );
mlt_field_plant_transition( field, transition, 0, 1 );
{
mlt_field field = mlt_tractor_field( tractor );
mlt_field_plant_transition( field, transition, 0, 1 );
* \param position a time relative to the beginning of the playlist
* \return a producer or NULL if not found
*/
* \param position a time relative to the beginning of the playlist
* \return a producer or NULL if not found
*/
- return mlt_playlist_locate( this, &position, &index, &total );
+ return mlt_playlist_locate( self, &position, &index, &total );
* \param position a time relative to the beginning of the playlist
* \return the index of the playlist entry
*/
* \param position a time relative to the beginning of the playlist
* \return the index of the playlist entry
*/
- mlt_playlist_locate( this, &position, &index, &total );
+ mlt_playlist_locate( self, &position, &index, &total );
mlt_properties properties = producer != NULL ? MLT_PRODUCER_PROPERTIES( producer ) : NULL;
mlt_tractor tractor = properties != NULL ? mlt_properties_get_data( properties, "mlt_mix", NULL ) : NULL;
return tractor != NULL;
mlt_properties properties = producer != NULL ? MLT_PRODUCER_PROPERTIES( producer ) : NULL;
mlt_tractor tractor = properties != NULL ? mlt_properties_get_data( properties, "mlt_mix", NULL ) : NULL;
return tractor != NULL;
mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer );
error = mlt_properties_get_data( properties, "mlt_mix", NULL ) == NULL ||
mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer );
error = mlt_properties_get_data( properties, "mlt_mix", NULL ) == NULL ||
mlt_tractor tractor = ( mlt_tractor )mlt_producer_cut_parent( mix->producer );
mlt_properties properties = MLT_TRACTOR_PROPERTIES( tractor );
mlt_producer clip_a = mlt_properties_get_data( properties, "mix_in", NULL );
mlt_producer clip_b = mlt_properties_get_data( properties, "mix_out", NULL );
int length = mlt_producer_get_playtime( MLT_TRACTOR_PRODUCER( tractor ) );
mlt_tractor tractor = ( mlt_tractor )mlt_producer_cut_parent( mix->producer );
mlt_properties properties = MLT_TRACTOR_PROPERTIES( tractor );
mlt_producer clip_a = mlt_properties_get_data( properties, "mix_in", NULL );
mlt_producer clip_b = mlt_properties_get_data( properties, "mix_out", NULL );
int length = mlt_producer_get_playtime( MLT_TRACTOR_PRODUCER( tractor ) );
- mlt_playlist_insert( this, cut, clip, -1, -1 );
+ mlt_playlist_insert( self, cut, clip, -1, -1 );
- mlt_playlist_insert( this, cut, clip + 1, -1, -1 );
+ mlt_playlist_insert( self, cut, clip + 1, -1, -1 );
}
mlt_properties_set_data( properties, "mlt_mix", NULL, 0, NULL, NULL );
}
mlt_properties_set_data( properties, "mlt_mix", NULL, 0, NULL, NULL );
- mlt_playlist_remove( this, clip );
- mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( this ), this );
- mlt_playlist_virtual_refresh( this );
+ mlt_playlist_remove( self, clip );
+ mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( self ), self );
+ mlt_playlist_virtual_refresh( self );
* \param clip the index of the playlist entry
* \param in the new starting point
* \param out the new ending point
* \return true if there was an error
*/
* \param clip the index of the playlist entry
* \param in the new starting point
* \param out the new ending point
* \return true if there was an error
*/
-static int mlt_playlist_resize_mix( mlt_playlist this, int clip, int in, int out )
+static int mlt_playlist_resize_mix( mlt_playlist self, int clip, int in, int out )
mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer );
error = mlt_properties_get_data( properties, "mlt_mix", NULL ) == NULL;
}
if ( error == 0 )
{
mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer );
error = mlt_properties_get_data( properties, "mlt_mix", NULL ) == NULL;
}
if ( error == 0 )
{
mlt_tractor tractor = ( mlt_tractor )mlt_producer_cut_parent( mix->producer );
mlt_properties properties = MLT_TRACTOR_PROPERTIES( tractor );
mlt_producer clip_a = mlt_properties_get_data( properties, "mix_in", NULL );
mlt_tractor tractor = ( mlt_tractor )mlt_producer_cut_parent( mix->producer );
mlt_properties properties = MLT_TRACTOR_PROPERTIES( tractor );
mlt_producer clip_a = mlt_properties_get_data( properties, "mix_in", NULL );
mlt_producer track_b = mlt_tractor_get_track( tractor, 1 );
int length = out - in + 1;
int length_diff = length - mlt_producer_get_playtime( MLT_TRACTOR_PRODUCER( tractor ) );
mlt_producer track_b = mlt_tractor_get_track( tractor, 1 );
int length = out - in + 1;
int length_diff = length - mlt_producer_get_playtime( MLT_TRACTOR_PRODUCER( tractor ) );
if ( clip_a != NULL )
mlt_producer_set_in_and_out( clip_a, mlt_producer_get_in( clip_a ), mlt_producer_get_out( clip_a ) - length_diff );
if ( clip_a != NULL )
mlt_producer_set_in_and_out( clip_a, mlt_producer_get_in( clip_a ), mlt_producer_get_out( clip_a ) - length_diff );
mlt_properties_set_position( MLT_PRODUCER_PROPERTIES( mix->producer ), "length", out - in + 1 );
mlt_producer_set_in_and_out( mix->producer, in, out );
mlt_properties_set_position( MLT_PRODUCER_PROPERTIES( mix->producer ), "length", out - in + 1 );
mlt_producer_set_in_and_out( mix->producer, in, out );
- mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( this ), this );
- mlt_playlist_virtual_refresh( this );
+ mlt_events_unblock( MLT_PLAYLIST_PROPERTIES( self ), self );
+ mlt_playlist_virtual_refresh( self );
- mlt_playlist_resize_clip( this, i - 1, 0, left->frame_count + right->frame_count - 1 );
- mlt_playlist_remove( this, i -- );
+ mlt_playlist_resize_clip( self, i - 1, 0, left->frame_count + right->frame_count - 1 );
+ mlt_playlist_remove( self, i -- );
* \param position a time relative to the start or end (negative) of the playlist
* \return true if there was an error
*/
* \param position a time relative to the start or end (negative) of the playlist
* \return true if there was an error
*/
producer = entry->producer;
mlt_properties_inc_ref( MLT_PRODUCER_PROPERTIES( producer ) );
mlt_events_block( properties, properties );
producer = entry->producer;
mlt_properties_inc_ref( MLT_PRODUCER_PROPERTIES( producer ) );
mlt_events_block( properties, properties );
- mlt_playlist_remove( this, clip );
- mlt_playlist_blank( this, out - in );
- mlt_playlist_move( this, this->count - 1, clip );
+ mlt_playlist_remove( self, clip );
+ mlt_playlist_blank( self, out - in );
+ mlt_playlist_move( self, self->count - 1, clip );
* \param clip the index of the new blank section
* \param length the ending time of the new blank section (duration - 1)
*/
* \param clip the index of the new blank section
* \param length the ending time of the new blank section (duration - 1)
*/
- mlt_playlist_blank( this, length );
- mlt_playlist_move( this, this->count - 1, clip );
+ mlt_playlist_blank( self, length );
+ mlt_playlist_move( self, self->count - 1, clip );
* \param position the time at which the blank entry exists relative to the start or end (negative) of the playlist.
* \param length the additional amount of blank frames to add
* \param find true to fist locate the blank after the clip at position
*/
* \param position the time at which the blank entry exists relative to the start or end (negative) of the playlist.
* \param length the additional amount of blank frames to add
* \param find true to fist locate the blank after the clip at position
*/
-void mlt_playlist_pad_blanks( mlt_playlist this, mlt_position position, int length, int find )
+void mlt_playlist_pad_blanks( mlt_playlist self, mlt_position position, int length, int find )
- int clip = mlt_playlist_get_clip_index_at( this, position );
- mlt_properties properties = MLT_PLAYLIST_PROPERTIES( this );
+ int clip = mlt_playlist_get_clip_index_at( self, position );
+ mlt_properties properties = MLT_PLAYLIST_PROPERTIES( self );
- mlt_playlist_resize_clip( this, clip, info.frame_in, info.frame_out + length );
+ mlt_playlist_resize_clip( self, clip, info.frame_in, info.frame_out + length );
* \param position the time at which to insert
* \param producer the producer to insert
* \param mode true if you want to overwrite any blank section
* \return true if there was an error
*/
* \param position the time at which to insert
* \param producer the producer to insert
* \param mode true if you want to overwrite any blank section
* \return true if there was an error
*/
-int mlt_playlist_insert_at( mlt_playlist this, mlt_position position, mlt_producer producer, int mode )
+int mlt_playlist_insert_at( mlt_playlist self, mlt_position position, mlt_producer producer, int mode )
- mlt_playlist_get_clip_info( this, &info, clip );
- mlt_events_block( properties, this );
- if ( clip < this->count && mlt_playlist_is_blank( this, clip ) )
+ mlt_playlist_get_clip_info( self, &info, clip );
+ mlt_events_block( properties, self );
+ if ( clip < self->count && mlt_playlist_is_blank( self, clip ) )
- if ( position != info.start && mlt_playlist_split( this, clip, position - info.start - 1 ) == 0 )
- mlt_playlist_get_clip_info( this, &info, ++ clip );
+ if ( position != info.start && mlt_playlist_split( self, clip, position - info.start - 1 ) == 0 )
+ mlt_playlist_get_clip_info( self, &info, ++ clip );
- mlt_playlist_insert( this, producer, clip, -1, -1 );
+ mlt_playlist_insert( self, producer, clip, -1, -1 );
- mlt_playlist_split( this, clip, length );
- mlt_playlist_remove( this, clip );
+ mlt_playlist_split( self, clip, length );
+ mlt_playlist_remove( self, clip );
- mlt_playlist_insert( this, producer, clip, -1, -1 );
+ mlt_playlist_insert( self, producer, clip, -1, -1 );
- mlt_events_unblock( properties, this );
- mlt_playlist_virtual_refresh( this );
+ mlt_events_unblock( properties, self );
+ mlt_playlist_virtual_refresh( self );
/** Get the time at which the clip starts relative to the playlist.
*
* \public \memberof mlt_playlist_s
/** Get the time at which the clip starts relative to the playlist.
*
* \public \memberof mlt_playlist_s
* \param clip the index of the playlist entry
* \param bounded the maximum number of blank entries or 0 for all
* \return the duration of a blank section
*/
* \param clip the index of the playlist entry
* \param bounded the maximum number of blank entries or 0 for all
* \return the duration of a blank section
*/
- mlt_playlist_get_clip_info( this, &info, clip );
- if ( mlt_playlist_is_blank( this, clip ) )
+ mlt_playlist_get_clip_info( self, &info, clip );
+ if ( mlt_playlist_is_blank( self, clip ) )
- mlt_playlist_get_clip_info( this, &info, clip );
- if ( mlt_playlist_is_blank( this, clip ) )
+ mlt_playlist_get_clip_info( self, &info, clip );
+ if ( mlt_playlist_is_blank( self, clip ) )
* \param position the starting time
* \param length the duration of time to remove
* \return the new entry index at the position
*/
* \param position the starting time
* \param length the duration of time to remove
* \return the new entry index at the position
*/
- int index = mlt_playlist_get_clip_index_at( this, position );
- if ( index >= 0 && index < this->count )
+ int index = mlt_playlist_get_clip_index_at( self, position );
+ if ( index >= 0 && index < self->count )
- mlt_properties properties = MLT_PLAYLIST_PROPERTIES( this );
- int clip_start = mlt_playlist_clip_start( this, index );
- int list_length = mlt_producer_get_playtime( MLT_PLAYLIST_PRODUCER( this ) );
- mlt_events_block( properties, this );
+ mlt_properties properties = MLT_PLAYLIST_PROPERTIES( self );
+ int clip_start = mlt_playlist_clip_start( self, index );
+ int list_length = mlt_producer_get_playtime( MLT_PLAYLIST_PRODUCER( self ) );
+ mlt_events_block( properties, self );
if ( position + length > list_length )
length -= ( position + length - list_length );
if ( clip_start < position )
{
if ( position + length > list_length )
length -= ( position + length - list_length );
if ( clip_start < position )
{
- if ( mlt_playlist_clip_length( this, index ) > length )
- mlt_playlist_split( this, index, length - 1 );
- length -= mlt_playlist_clip_length( this, index );
- mlt_playlist_remove( this, index );
+ if ( mlt_playlist_clip_length( self, index ) > length )
+ mlt_playlist_split( self, index, length - 1 );
+ length -= mlt_playlist_clip_length( self, index );
+ mlt_playlist_remove( self, index );
- mlt_playlist_consolidate_blanks( this, 0 );
- mlt_events_unblock( properties, this );
- mlt_playlist_virtual_refresh( this );
+ mlt_playlist_consolidate_blanks( self, 0 );
+ mlt_events_unblock( properties, self );
+ mlt_playlist_virtual_refresh( self );
-int mlt_playlist_move_region( mlt_playlist this, mlt_position position, int length, int new_position )
+int mlt_playlist_move_region( mlt_playlist self, mlt_position position, int length, int new_position )
// Check if we're at the end of the clip
mlt_properties properties = MLT_FRAME_PROPERTIES( *frame );
if ( mlt_properties_get_int( properties, "end_of_clip" ) )
// Check if we're at the end of the clip
mlt_properties properties = MLT_FRAME_PROPERTIES( *frame );
if ( mlt_properties_get_int( properties, "end_of_clip" ) )
- mlt_event_close( this->list[ i ]->event );
- mlt_producer_close( this->list[ i ]->producer );
- free( this->list[ i ] );
+ mlt_event_close( self->list[ i ]->event );
+ mlt_producer_close( self->list[ i ]->producer );
+ free( self->list[ i ] );