]> git.sesse.net Git - mlt/commitdiff
clip and mix manipulation on playlist
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 29 Sep 2004 07:32:12 +0000 (07:32 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 29 Sep 2004 07:32:12 +0000 (07:32 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@456 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_frame.c
src/framework/mlt_playlist.c
src/framework/mlt_playlist.h

index e3e4f3f4ae25146ecc444aca1fca25884a3346a5..e61db675c3252f02988b202e936ca526e298d564 100644 (file)
@@ -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 )
        {
index 6788f1e8990b404255bd46f77dcc216329071a70..7f71d4943fdd68f0844d7119e9420bc73dc095eb 100644 (file)
@@ -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.
 */
index 0cc0a1d9ba81072817f082b6cbd690936bbe0b11..a7dd3f28ef666d70ffaad7ade570172b39375324 100644 (file)
@@ -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