]> git.sesse.net Git - mlt/blobdiff - src/framework/mlt_playlist.c
Fix doc error for mlt_playlist_is_blank().
[mlt] / src / framework / mlt_playlist.c
index 79fbd8bf65a82af2bceea710ccdd44abe0bbc7af..b4cc7534222654585ac763f49b0a6529141cb07d 100644 (file)
@@ -53,6 +53,7 @@ struct playlist_entry_s
 static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int index );
 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 );
+static void mlt_playlist_next( mlt_listener listener, mlt_properties owner, mlt_service self, void **args );
 
 /** Construct a playlist.
  *
@@ -99,6 +100,7 @@ mlt_playlist mlt_playlist_init( )
                self->list = calloc( self->size, sizeof( playlist_entry * ) );
                if ( self->list == NULL ) goto error2;
                
+               mlt_events_register( MLT_PLAYLIST_PROPERTIES( self ), "playlist-next", (mlt_transmitter) mlt_playlist_next );
        }
 
        return self;
@@ -394,6 +396,24 @@ static mlt_producer mlt_playlist_locate( mlt_playlist self, mlt_position *positi
        return producer;
 }
 
+/** The transmitter for the producer-next event
+ *
+ * Invokes the listener.
+ *
+ * \private \memberof mlt_playlist_s
+ * \param listener a function pointer that will be invoked
+ * \param owner the events object that will be passed to \p listener
+ * \param self a service that will be passed to \p listener
+ * \param args an array of pointers.
+ */
+
+static void mlt_playlist_next( mlt_listener listener, mlt_properties owner, mlt_service self, void **args )
+{
+       if ( listener )
+               listener( owner, self, args[ 0 ] );
+}
+
+
 /** Seek in the virtual playlist.
  *
  * This gets the producer at the current position and seeks on the producer
@@ -481,6 +501,10 @@ static mlt_service mlt_playlist_virtual_seek( mlt_playlist self, int *progressiv
                producer = &self->blank;
        }
 
+       // Determine if we have moved to the next entry in the playlist.
+       if ( original == total - 2 )
+               mlt_events_fire( properties, "playlist-next", i, NULL );
+
        return MLT_PRODUCER_SERVICE( producer );
 }
 
@@ -1145,6 +1169,11 @@ int mlt_playlist_mix( mlt_playlist self, int clip, int length, mlt_transition tr
                mlt_producer track_a = NULL;
                mlt_producer track_b = NULL;
                mlt_tractor tractor = mlt_tractor_new( );
+
+               mlt_service_set_profile( MLT_TRACTOR_SERVICE( tractor ),
+                       mlt_service_profile( MLT_PLAYLIST_SERVICE( self ) ) );
+               mlt_properties_set_lcnumeric( MLT_TRACTOR_PROPERTIES( tractor ),
+                       mlt_properties_get_lcnumeric( MLT_PLAYLIST_PROPERTIES( self ) ) );
                mlt_events_block( MLT_PLAYLIST_PROPERTIES( self ), self );
 
                // Check length is valid for both clips and resize if necessary.
@@ -1471,7 +1500,7 @@ void mlt_playlist_consolidate_blanks( mlt_playlist self, int keep_length )
  * \public \memberof mlt_playlist_s
  * \param self a playlist
  * \param clip the index of the playlist entry
- * \return true if there was an error
+ * \return true if \p clip is a "blank" producer
  */
 
 int mlt_playlist_is_blank( mlt_playlist self, int clip )
@@ -1527,16 +1556,16 @@ mlt_producer mlt_playlist_replace_with_blank( mlt_playlist self, int clip )
  * \public \memberof mlt_playlist_s
  * \param self a playlist
  * \param clip the index of the new blank section
- * \param length the ending time of the new blank section (duration - 1)
+ * \param out the ending time of the new blank section (duration - 1)
  */
 
-void mlt_playlist_insert_blank( mlt_playlist self, int clip, int length )
+void mlt_playlist_insert_blank( mlt_playlist self, int clip, int out )
 {
-       if ( self != NULL && length >= 0 )
+       if ( self != NULL && out >= 0 )
        {
                mlt_properties properties = MLT_PLAYLIST_PROPERTIES( self );
                mlt_events_block( properties, properties );
-               mlt_playlist_blank( self, length );
+               mlt_playlist_blank( self, out );
                mlt_playlist_move( self, self->count - 1, clip );
                mlt_events_unblock( properties, properties );
                mlt_playlist_virtual_refresh( self );