From 0486280ed87912e4ee9c1103c8ace19fa322a4af Mon Sep 17 00:00:00 2001 From: lilo_booter Date: Wed, 29 Sep 2004 07:32:12 +0000 Subject: [PATCH] clip and mix manipulation on playlist git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@456 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/framework/mlt_frame.c | 6 +++++- src/framework/mlt_playlist.c | 39 +++++++++++++++++++++++++++++++++++++++ src/framework/mlt_playlist.h | 3 +++ 3 files changed, 47 insertions(+), 1 deletions(-) diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index e3e4f3f..e61db67 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -205,7 +205,11 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for if ( get_image != NULL ) { - return get_image( this, buffer, format, width, height, writable ); + int error = 0; + mlt_position position = mlt_frame_get_position( this ); + error = get_image( this, buffer, format, width, height, writable ); + mlt_frame_set_position( this, position ); + return error; } else if ( mlt_properties_get_data( properties, "image", NULL ) != NULL ) { diff --git a/src/framework/mlt_playlist.c b/src/framework/mlt_playlist.c index 6788f1e..7f71d49 100644 --- a/src/framework/mlt_playlist.c +++ b/src/framework/mlt_playlist.c @@ -890,6 +890,45 @@ int mlt_playlist_mix( mlt_playlist this, int clip, int length, mlt_transition tr return error; } +/** Add a transition to an existing mix. +*/ + +int mlt_playlist_mix_add( mlt_playlist this, int clip, mlt_transition transition ) +{ + mlt_producer producer = mlt_producer_cut_parent( mlt_playlist_get_clip( this, clip ) ); + 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; + if ( error == 0 ) + { + mlt_field field = mlt_tractor_field( tractor ); + mlt_field_plant_transition( field, transition, 0, 1 ); + mlt_transition_set_in_and_out( transition, 0, this->list[ clip ]->frame_count - 1 ); + } + return error; +} + +/** Return the clip at the position. +*/ + +mlt_producer mlt_playlist_get_clip( mlt_playlist this, int clip ) +{ + if ( clip > 0 && clip < this->count ) + return this->list[ clip ]->producer; + return NULL; +} + +/** Determine if the clip is a mix. +*/ + +int mlt_playlist_clip_is_mix( mlt_playlist this, int clip ) +{ + mlt_producer producer = mlt_producer_cut_parent( mlt_playlist_get_clip( this, clip ) ); + 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; +} + /** Remove a mixed clip - ensure that the cuts included in the mix find their way back correctly on to the playlist. */ diff --git a/src/framework/mlt_playlist.h b/src/framework/mlt_playlist.h index 0cc0a1d..a7dd3f2 100644 --- a/src/framework/mlt_playlist.h +++ b/src/framework/mlt_playlist.h @@ -66,6 +66,9 @@ extern int mlt_playlist_repeat_clip( mlt_playlist self, int clip, int repeat ); extern int mlt_playlist_split( mlt_playlist self, int clip, mlt_position position ); extern int mlt_playlist_join( mlt_playlist self, int clip, int count, int merge ); extern int mlt_playlist_mix( mlt_playlist self, int clip, int length, mlt_transition transition ); +extern int mlt_playlist_mix_add( mlt_playlist self, int clip, mlt_transition transition ); +extern mlt_producer mlt_playlist_get_clip( mlt_playlist self, int clip ); +extern int mlt_playlist_clip_is_mix( mlt_playlist self, int clip ); extern void mlt_playlist_close( mlt_playlist self ); #endif -- 1.7.4.4