From 14a6dfabee044ad58d4ee2579b25d071d02588ec Mon Sep 17 00:00:00 2001 From: lilo_booter Date: Tue, 28 Sep 2004 15:20:23 +0000 Subject: [PATCH] Corrections to filter attachment and in/out point handling git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@455 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/framework/mlt_filter.c | 4 ++++ src/framework/mlt_service.c | 18 +++++++++++++----- src/modules/core/filter_watermark.c | 2 +- src/modules/core/transition_composite.c | 21 ++------------------- src/modules/core/transition_region.c | 3 +++ src/modules/inigo/producer_inigo.c | 1 - src/modules/plus/filter_affine.c | 1 + src/modules/plus/transition_affine.c | 3 +-- 8 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/framework/mlt_filter.c b/src/framework/mlt_filter.c index 37f91db3..ccdf45da 100644 --- a/src/framework/mlt_filter.c +++ b/src/framework/mlt_filter.c @@ -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 diff --git a/src/framework/mlt_service.c b/src/framework/mlt_service.c index 9a0cd772..362f3cc8 100644 --- a/src/framework/mlt_service.c +++ b/src/framework/mlt_service.c @@ -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. diff --git a/src/modules/core/filter_watermark.c b/src/modules/core/filter_watermark.c index cfd9e82e..bf781dc2 100644 --- a/src/modules/core/filter_watermark.c +++ b/src/modules/core/filter_watermark.c @@ -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 ); diff --git a/src/modules/core/transition_composite.c b/src/modules/core/transition_composite.c index c3eaa104..de2c464d 100644 --- a/src/modules/core/transition_composite.c +++ b/src/modules/core/transition_composite.c @@ -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 ); diff --git a/src/modules/core/transition_region.c b/src/modules/core/transition_region.c index 1e2f8246..c93eec89 100644 --- a/src/modules/core/transition_region.c +++ b/src/modules/core/transition_region.c @@ -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 ) { diff --git a/src/modules/inigo/producer_inigo.c b/src/modules/inigo/producer_inigo.c index 2bb3ccff..d6fb2838 100644 --- a/src/modules/inigo/producer_inigo.c +++ b/src/modules/inigo/producer_inigo.c @@ -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 ) diff --git a/src/modules/plus/filter_affine.c b/src/modules/plus/filter_affine.c index 8c786866..a3053e1d 100644 --- a/src/modules/plus/filter_affine.c +++ b/src/modules/plus/filter_affine.c @@ -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; } diff --git a/src/modules/plus/transition_affine.c b/src/modules/plus/transition_affine.c index 61547713..c37d7c2b 100644 --- a/src/modules/plus/transition_affine.c +++ b/src/modules/plus/transition_affine.c @@ -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; } -- 2.39.2