]> git.sesse.net Git - mlt/blobdiff - src/framework/mlt_playlist.c
Merge branch 'master' of dennedy.org:git/mltframework.org/mlt
[mlt] / src / framework / mlt_playlist.c
index 91f9fa81d5d48a57323bcfc280d1ea852f0f6dfc..25f540a44e78d551236ea88147878d74c706579a 100644 (file)
@@ -263,9 +263,9 @@ static int mlt_playlist_virtual_append( mlt_playlist this, mlt_producer source,
        else if ( mlt_producer_is_cut( source ) )
        {
                producer = source;
-               if ( in == -1 )
+               if ( in < 0 )
                        in = mlt_producer_get_in( producer );
-               if ( out == -1 || out > mlt_producer_get_out( producer ) )
+               if ( out < 0 || out > mlt_producer_get_out( producer ) )
                        out = mlt_producer_get_out( producer );
                properties = MLT_PRODUCER_PROPERTIES( producer );
                mlt_properties_inc_ref( properties );
@@ -273,9 +273,9 @@ static int mlt_playlist_virtual_append( mlt_playlist this, mlt_producer source,
        else
        {
                producer = mlt_producer_cut( source, in, out );
-               if ( in == -1 || in < mlt_producer_get_in( producer ) )
+               if ( in < 0 || in < mlt_producer_get_in( producer ) )
                        in = mlt_producer_get_in( producer );
-               if ( out == -1 || out > mlt_producer_get_out( producer ) )
+               if ( out < 0 || out > mlt_producer_get_out( producer ) )
                        out = mlt_producer_get_out( producer );
                properties = MLT_PRODUCER_PROPERTIES( producer );
        }
@@ -283,12 +283,12 @@ static int mlt_playlist_virtual_append( mlt_playlist this, mlt_producer source,
        // Fetch the cuts parent properties
        parent = MLT_PRODUCER_PROPERTIES( mlt_producer_cut_parent( producer ) );
 
-       // Remove fezzik normalisers for fx cuts
+       // Remove loader normalisers for fx cuts
        if ( mlt_properties_get_int( parent, "meta.fx_cut" ) )
        {
                mlt_service service = MLT_PRODUCER_SERVICE( mlt_producer_cut_parent( producer ) );
                mlt_filter filter = mlt_service_filter( service, 0 );
-               while ( filter != NULL && mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "_fezzik" ) )
+               while ( filter != NULL && mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "_loader" ) )
                {
                        mlt_service_detach( service, filter );
                        filter = mlt_service_filter( service, 0 );
@@ -678,18 +678,18 @@ int mlt_playlist_append( mlt_playlist this, mlt_producer producer )
  * \public \memberof mlt_playlist_s
  * \param this a playlist
  * \param producer the producer to append
- * \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
  * \return true if there was an error
  */
 
 int mlt_playlist_append_io( mlt_playlist this, mlt_producer producer, mlt_position in, mlt_position out )
 {
        // Append to virtual list
-       if ( in != -1 && out != -1 )
-               return mlt_playlist_virtual_append( this, producer, in, out );
-       else
+       if ( in < 0 && out < 0 )
                return mlt_playlist_append( this, producer );
+       else
+               return mlt_playlist_virtual_append( this, producer, in, out );
 }
 
 /** Append a blank to the playlist of a given length.
@@ -902,8 +902,8 @@ int mlt_playlist_repeat_clip( mlt_playlist this, int clip, int repeat )
  * \public \memberof mlt_playlist_s
  * \param this a playlist
  * \param clip the index of the playlist entry
- * \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
  * \return true if there was an error
  */
 
@@ -930,9 +930,9 @@ int mlt_playlist_resize_clip( mlt_playlist this, int clip, mlt_position in, mlt_
                        }
                }
 
-               if ( in <= -1 )
+               if ( in < 0 )
                        in = 0;
-               if ( out <= -1 || out >= mlt_producer_get_length( producer ) )
+               if ( out < 0 || out >= mlt_producer_get_length( producer ) )
                        out = mlt_producer_get_length( producer ) - 1;
 
                if ( out < in )
@@ -1680,7 +1680,6 @@ int mlt_playlist_remove_region( mlt_playlist this, mlt_position position, int le
        {
                mlt_properties properties = MLT_PLAYLIST_PROPERTIES( this );
                int clip_start = mlt_playlist_clip_start( this, index );
-               int clip_length = mlt_playlist_clip_length( this, index );
                int list_length = mlt_producer_get_playtime( MLT_PLAYLIST_PRODUCER( this ) );
                mlt_events_block( properties, this );
 
@@ -1689,14 +1688,13 @@ int mlt_playlist_remove_region( mlt_playlist this, mlt_position position, int le
 
                if ( clip_start < position )
                {
-                       mlt_playlist_split( this, index ++, position - clip_start );
-                       clip_length -= position - clip_start;
+                       mlt_playlist_split( this, index ++, position - clip_start - 1 );
                }
 
                while( length > 0 )
                {
                        if ( mlt_playlist_clip_length( this, index ) > length )
-                               mlt_playlist_split( this, index, length );
+                               mlt_playlist_split( this, index, length - 1 );
                        length -= mlt_playlist_clip_length( this, index );
                        mlt_playlist_remove( this, index );
                }