From 5302781f73a3e9e099fc35b4d5d5807653c4062e Mon Sep 17 00:00:00 2001 From: lilo_booter Date: Fri, 23 Jul 2004 08:18:52 +0000 Subject: [PATCH] Allows runtime modifications to region fx git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@339 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/modules/core/filter_region.c | 6 ++-- src/modules/core/transition_composite.c | 9 ++++-- src/modules/core/transition_region.c | 45 +++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 6 deletions(-) diff --git a/src/modules/core/filter_region.c b/src/modules/core/filter_region.c index b47eb37..635b390 100644 --- a/src/modules/core/filter_region.c +++ b/src/modules/core/filter_region.c @@ -44,13 +44,13 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame ) // Create the transition transition = mlt_factory_transition( "region", NULL ); - // Pass all properties down - mlt_properties_pass( mlt_transition_properties( transition ), properties, "" ); - // Register with the filter mlt_properties_set_data( properties, "_transition", transition, 0, ( mlt_destructor )mlt_transition_close, NULL ); } + // Pass all properties down + mlt_properties_pass( mlt_transition_properties( transition ), properties, "" ); + // Process the frame return mlt_transition_process( transition, frame, NULL ); } diff --git a/src/modules/core/transition_composite.c b/src/modules/core/transition_composite.c index 0119380..2d4535c 100644 --- a/src/modules/core/transition_composite.c +++ b/src/modules/core/transition_composite.c @@ -987,6 +987,9 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f // Get the image from the a frame mlt_frame_get_image( a_frame, image, format, width, height, 1 ); + // Get the properties from the transition + mlt_properties properties = mlt_transition_properties( this ); + if ( b_frame != NULL ) { // Get the properties of the a frame @@ -995,9 +998,6 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f // Get the properties of the b frame mlt_properties b_props = mlt_frame_properties( b_frame ); - // Get the properties from the transition - mlt_properties properties = mlt_transition_properties( this ); - // Structures for geometry struct geometry_s result; @@ -1053,6 +1053,9 @@ 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 41fce2f..d24def9 100644 --- a/src/modules/core/transition_region.c +++ b/src/modules/core/transition_region.c @@ -162,6 +162,12 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for mlt_properties_set_data( properties, "composite", composite, 0, ( mlt_destructor )mlt_transition_close, NULL ); } } + else + { + // Pass all current properties down + mlt_properties composite_properties = mlt_transition_properties( composite ); + mlt_properties_pass( composite_properties, properties, "composite." ); + } // Create filters if ( filter == NULL ) @@ -190,6 +196,45 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for } } } + else + { + // Pass all properties down + mlt_filter temp = NULL; + + // Loop Variable + int i = 0; + + // Number of filters found + int count = 0; + + // Loop for all properties + for ( i = 0; i < mlt_properties_count( properties ); i ++ ) + { + // Get the name of this property + char *name = mlt_properties_get_name( properties, i ); + + // If the name does not contain a . and matches filter + if ( strchr( name, '.' ) == NULL && !strncmp( name, "filter", 6 ) ) + { + // Strings to hold the id and pass down key + char id[ 256 ]; + char key[ 256 ]; + + // Construct id and key + sprintf( id, "_filter_%d", count ); + sprintf( key, "%s.", name ); + + // Get the filter + temp = mlt_properties_get_data( properties, id, NULL ); + + if ( temp != NULL ) + { + mlt_properties_pass( mlt_filter_properties( temp ), properties, key ); + count ++; + } + } + } + } // Get the image error = mlt_frame_get_image( frame, image, format, width, height, 1 ); -- 1.7.4.4