]> git.sesse.net Git - mlt/commitdiff
Corrections to filter attachment and in/out point handling
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 28 Sep 2004 15:20:23 +0000 (15:20 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 28 Sep 2004 15:20:23 +0000 (15:20 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@455 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_filter.c
src/framework/mlt_service.c
src/modules/core/filter_watermark.c
src/modules/core/transition_composite.c
src/modules/core/transition_region.c
src/modules/inigo/producer_inigo.c
src/modules/plus/filter_affine.c
src/modules/plus/transition_affine.c

index 37f91db3b8ed7cbd63660b0a907fb42d586fcb98..ccdf45dab3c0638960684be788d8523e96008e0a 100644 (file)
@@ -176,7 +176,11 @@ static int filter_get_frame( mlt_service service, mlt_frame_ptr frame, int index
                {
                        mlt_position position = mlt_frame_get_position( *frame );
                        if ( position >= in && ( out == 0 || position <= out ) )
+                       {
+                               mlt_frame_set_position( *frame, position - in );
                                *frame = mlt_filter_process( this, *frame );
+                               mlt_frame_set_position( *frame, position + in );
+                       }
                        return 0;
                }
                else
index 9a0cd7722f8041a3cc583efa8b07b159cf772e27..362f3cc8d927e12f01a808af90d29fec14d3d0d9 100644 (file)
@@ -269,11 +269,16 @@ void mlt_service_apply_filters( mlt_service this, mlt_frame frame, int index )
        mlt_properties frame_properties = mlt_frame_properties( frame );
        mlt_properties filter_properties = mlt_service_properties( this );
        mlt_service_base *base = this->local;
-       mlt_position position = mlt_properties_get_position( frame_properties, "_position" );
+       mlt_position position = mlt_frame_get_position( frame );
+       mlt_position this_in = mlt_properties_get_position( filter_properties, "in" );
 
        // Hmm - special case for cuts - apply filters from the parent first
        if ( mlt_properties_get_int( filter_properties, "_cut" ) )
+       {
+               position -= this_in;
+               mlt_frame_set_position( frame, position );
                mlt_service_apply_filters( ( mlt_service )mlt_properties_get_data( filter_properties, "_cut_parent", NULL ), frame, 0 );
+       }
 
        if ( index == 0 || mlt_properties_get_int( filter_properties, "_filter_private" ) == 0 )
        {
@@ -283,18 +288,21 @@ void mlt_service_apply_filters( mlt_service this, mlt_frame frame, int index )
                        if ( base->filters[ i ] != NULL )
                        {
                                mlt_properties properties = mlt_filter_properties( base->filters[ i ] );
-                               mlt_position in = mlt_properties_get_position( properties, "in" );
-                               mlt_position out = mlt_properties_get_position( properties, "out" );
+                               mlt_position in = mlt_filter_get_in( base->filters[ i ] );
+                               mlt_position out = mlt_filter_get_out( base->filters[ i ] );
                                if ( ( in == 0 && out == 0 ) || ( position >= in && ( position <= out || out == 0 ) ) )
                                {
+                                       mlt_frame_set_position( frame, position - in );
                                        mlt_filter_process( base->filters[ i ], frame );
-                                       mlt_properties_set_position( frame_properties, "_position", position - in );
                                        mlt_service_apply_filters( mlt_filter_service( base->filters[ i ] ), frame, index + 1 );
-                                       mlt_properties_set_position( frame_properties, "_position", position );
+                                       mlt_frame_set_position( frame, position + in );
                                }
                        }
                }
        }
+
+       if ( mlt_properties_get_int( filter_properties, "_cut" ) )
+               mlt_frame_set_position( frame, position + this_in );
 }
 
 /** Obtain a frame.
index cfd9e82e857d9de8433484df81308344e4cebcca..bf781dc2480296b66547646a03a9148d64a59010 100644 (file)
@@ -190,7 +190,7 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
        char *name = mlt_properties_get( mlt_filter_properties( this ), "_unique_id" );
 
        // Assign the current position to the name
-       mlt_properties_set_position( properties, name, mlt_frame_get_position( frame ) - mlt_filter_get_in( this ) );
+       mlt_properties_set_position( properties, name, mlt_frame_get_position( frame ) );
 
        // Push the filter on to the stack
        mlt_frame_push_service( frame, this );
index c3eaa104173527a03887a7b6ed656af07af539c4..de2c464dae55c473f861b5e0431b33d4de52ce47 100644 (file)
@@ -177,23 +177,6 @@ static void geometry_calculate( struct geometry_s *output, struct geometry_s *in
                output->mix = out->mix;
                output->distort = out->distort;
        }
-
-       // Definitely incorrect...
-#if 0
-       if ( ( int )output->x & 1 && ( int )output->w & 1 )
-       {
-               output->x -= 1.0;
-               output->w += 1.0;
-       }
-       else if ( ( int )output->x & 1 )
-       {
-               output->x += 1.0;
-       }
-       else if ( ( int )output->w & 1 )
-       {
-               output->w += 1.0;
-       }
-#endif
 }
 
 static void transition_destroy_keys( void *arg )
@@ -972,8 +955,8 @@ mlt_frame composite_copy_region( mlt_transition this, mlt_frame a_frame, mlt_pos
        if ( y + h > height )
                h = height - y;
 
-       //x = ( x | 1 ) ^ 1;
-       //w = ( w | 1 ) ^ 1;
+       x = ( x | 1 ) ^ 1;
+       w = ( w | 1 ) ^ 1;
 
        // Now we need to create a new destination image
        dest = mlt_pool_alloc( w * h * 2 );
index 1e2f8246e680ffac2db8abe3b84de39a08701cae..c93eec89f028ae0ff1d3a7dbd366e755ba391ae4 100644 (file)
@@ -283,6 +283,9 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for
                        mlt_properties_set_data( mlt_frame_properties( frame ), name, b_frame, 0, ( mlt_destructor )mlt_frame_close, NULL );
                }
 
+               // Set the position of the b_frame
+               mlt_frame_set_position( b_frame, position );
+
                // Make sure the filter is in the correct position
                while ( filter != NULL )
                {
index 2bb3ccff18dd8103d7323d722d08e2b0c42466ce..d6fb2838d8da5255c50f91f9948cf9519dff5320 100644 (file)
@@ -157,7 +157,6 @@ mlt_producer producer_inigo_init( char **argv )
                                mlt_playlist_append( playlist, producer );
                                mlt_playlist_get_clip_info( playlist, &info, mlt_playlist_count( playlist ) - 1 );
                                producer = info.cut;
-                               properties = mlt_producer_properties( producer );
                        }
 
                        if ( filter != NULL && mlt_playlist_count( playlist ) > 0 )
index 8c78686670479589005e0a309e5651bf2ea489fc..a3053e1df798791b1dd15dd9c31a7a258b1a0546 100644 (file)
@@ -101,6 +101,7 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
        // Push the frame filter
        mlt_frame_push_service( frame, this );
        mlt_frame_push_get_image( frame, filter_get_image );
+
        return frame;
 }
 
index 6154771348658f25dd13e21792493449d1cd42b0..c37d7c2b7d4af8da735212202b6759d4466bdc06 100644 (file)
@@ -517,7 +517,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
        mlt_frame_get_image( a_frame, image, format, width, height, 1 );
 
        // Calculate the region now
-       composite_calculate( &result, this, a_frame, ( float )( position - in ) / ( out - in + 1 ) );
+       composite_calculate( &result, this, a_frame, ( float )( position ) / ( out - in + 1 ) );
 
        // Fetch the b frame image
        result.w = ( int )( result.w * *width / result.nw );
@@ -674,7 +674,6 @@ static mlt_frame transition_process( mlt_transition transition, mlt_frame a_fram
        // Push the transition method
        mlt_frame_push_get_image( a_frame, transition_get_image );
 
-
        return a_frame;
 }