From cc7993dc7fdb45803bbd689573b623aa554929ec Mon Sep 17 00:00:00 2001 From: lilo_booter Date: Mon, 26 Jul 2004 15:45:23 +0000 Subject: [PATCH] Mutable properties git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@342 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/modules/core/filter_luma.c | 5 ++++- src/modules/core/filter_mirror.c | 10 +++++----- src/modules/core/transition_composite.c | 19 +++++++------------ src/modules/core/transition_region.c | 3 ++- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/modules/core/filter_luma.c b/src/modules/core/filter_luma.c index 62277a4b..ef5043e3 100644 --- a/src/modules/core/filter_luma.c +++ b/src/modules/core/filter_luma.c @@ -54,7 +54,6 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * mlt_properties_set_int( luma_properties, "in", 0 ); mlt_properties_set_int( luma_properties, "out", out ); mlt_properties_set_int( luma_properties, "reverse", 1 ); - mlt_properties_pass( luma_properties, properties, "luma." ); mlt_properties_set_data( properties, "luma", luma, 0, ( mlt_destructor )mlt_transition_close, NULL ); } } @@ -68,7 +67,11 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * if ( luma != NULL && ( mlt_properties_get( properties, "blur" ) != NULL || mlt_frame_get_position( this ) % ( out + 1 ) != out ) ) + { + mlt_properties luma_properties = mlt_transition_properties( luma ); + mlt_properties_pass( luma_properties, properties, "luma." ); mlt_transition_process( luma, this, b_frame ); + } error = mlt_frame_get_image( this, image, format, width, height, 1 ); diff --git a/src/modules/core/filter_mirror.c b/src/modules/core/filter_mirror.c index e007ac2a..66b88720 100644 --- a/src/modules/core/filter_mirror.c +++ b/src/modules/core/filter_mirror.c @@ -63,7 +63,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format q = p + *width * 2; if ( !reverse ) { - while ( p != q ) + while ( p < q ) { *p ++ = *( q - 2 ); *p ++ = *( q - 3 ); @@ -74,7 +74,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format } else { - while ( p != q ) + while ( p < q ) { *( q - 2 ) = *p ++; *( q - 3 ) = *p ++; @@ -95,7 +95,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format for ( i = 0; i < hh; i ++ ) { p = ( uint16_t * )*image + i * *width; - q = end - i * *width; + q = end - ( i + 1 ) * *width; j = *width; if ( !reverse ) { @@ -191,7 +191,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format { p = ( uint8_t * )*image + i * *width * 2; q = p + *width * 2; - while ( p != q ) + while ( p < q ) { t[ 0 ] = p[ 0 ]; t[ 1 ] = p[ 1 ]; @@ -219,7 +219,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format for ( i = 0; i < hh; i ++ ) { p = ( uint16_t * )*image + i * *width; - q = end - i * *width; + q = end - ( i + 1 ) * *width; j = *width; while ( j -- ) { diff --git a/src/modules/core/transition_composite.c b/src/modules/core/transition_composite.c index 174d5325..5a0db4dd 100644 --- a/src/modules/core/transition_composite.c +++ b/src/modules/core/transition_composite.c @@ -275,9 +275,6 @@ static struct geometry_s *transition_parse_keys( mlt_transition this, int norma else end->position = 1; - // Assign to properties to ensure we get destroyed - mlt_properties_set_data( properties, "geometries", start, 0, transition_destroy_keys, NULL ); - return start; } @@ -863,7 +860,7 @@ static int get_b_frame_image( mlt_transition this, mlt_frame b_frame, uint8_t ** } -struct geometry_s *composite_calculate( struct geometry_s *result, mlt_transition this, mlt_frame a_frame, float position ) +static struct geometry_s *composite_calculate( struct geometry_s *result, mlt_transition this, mlt_frame a_frame, float position ) { // Get the properties from the transition mlt_properties properties = mlt_transition_properties( this ); @@ -875,7 +872,7 @@ struct geometry_s *composite_calculate( struct geometry_s *result, mlt_transitio struct geometry_s *start = mlt_properties_get_data( properties, "geometries", NULL ); // Now parse the geometries - if ( start == NULL ) + if ( start == NULL || mlt_properties_get_int( properties, "refresh" ) ) { // Obtain the normalised width and height from the a_frame int normalised_width = mlt_properties_get_int( a_props, "normalised_width" ); @@ -883,6 +880,10 @@ struct geometry_s *composite_calculate( struct geometry_s *result, mlt_transitio // Parse the transitions properties start = transition_parse_keys( this, normalised_width, normalised_height ); + + // Assign to properties to ensure we get destroyed + mlt_properties_set_data( properties, "geometries", start, 0, transition_destroy_keys, NULL ); + mlt_properties_set_int( properties, "refresh", 0 ); } // Do the calculation @@ -941,7 +942,7 @@ mlt_frame composite_copy_region( mlt_transition this, mlt_frame a_frame, mlt_pos h = result.h * height / result.nh; x &= 0xfffffffe; - //w &= 0xfffffffe; + w &= 0xfffffffe; // Now we need to create a new destination image dest = mlt_pool_alloc( w * h * 2 ); @@ -1010,10 +1011,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f // Optimisation - no compositing required if ( result.mix == 0 || ( result.w == 0 && result.h == 0 ) ) - { - mlt_properties_set_data( properties, "geometries", NULL, 0, NULL, NULL ); return 0; - } // Since we are the consumer of the b_frame, we must pass along these // consumer properties from the a_frame @@ -1056,9 +1054,6 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f } } - // Force geometries to be recalculated - mlt_properties_set_data( properties, "geometries", NULL, 0, NULL, NULL ); - return 0; } diff --git a/src/modules/core/transition_region.c b/src/modules/core/transition_region.c index d24def91..a4b4cab2 100644 --- a/src/modules/core/transition_region.c +++ b/src/modules/core/transition_region.c @@ -265,7 +265,8 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for while ( filter != NULL ) { // Stack this filter - mlt_filter_process( filter, b_frame ); + if ( mlt_properties_get_int( mlt_filter_properties( filter ), "off" ) == 0 ) + mlt_filter_process( filter, b_frame ); // Generate the key for the next sprintf( id, "_filter_%d", ++ i ); -- 2.39.2