sprintf( key, "%s.", name );
// Just in case, let's assume that the filter here has a composite
- //mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "composite.geometry", "0%,0%:100%x100%" );
+ //mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "composite.geometry", "0%/0%:100%x100%" );
//mlt_properties_set_int( MLT_FILTER_PROPERTIES( filter ), "composite.fill", 1 );
// Pass all the key properties on the filter down
*p ++ = ( int )( ( ( *image ++ - 16 ) * 299 ) / 255 );
image ++;
}
- mlt_properties_set_data( MLT_FRAME_PROPERTIES( this ), "alpha", alpha, region_width * region_height, mlt_pool_release, NULL );
+ mlt_frame_set_alpha( this, alpha, region_width * region_height, mlt_pool_release );
}
else
{
- mlt_properties_set_data( MLT_FRAME_PROPERTIES( this ), "alpha", alpha, region_width * region_height, NULL, NULL );
+ mlt_frame_set_alpha( this, alpha, region_width * region_height, NULL );
}
this->get_alpha_mask = NULL;
// Get the properties of the transition
mlt_properties properties = MLT_TRANSITION_PROPERTIES( this );
+ mlt_service_lock( MLT_TRANSITION_SERVICE( this ) );
+
// Get the composite from the transition
mlt_transition composite = mlt_properties_get_data( properties, "composite", NULL );
// Look for the first filter
mlt_filter filter = mlt_properties_get_data( properties, "_filter_0", NULL );
- // Get the unique id of the filter (used to reacquire the producer position)
- char *name = mlt_properties_get( properties, "_unique_id" );
-
- // Get the original producer position
- mlt_position position = mlt_properties_get_position( MLT_FRAME_PROPERTIES( frame ), name );
+ // Get the position
+ mlt_position position = mlt_transition_get_position( this, frame );
// Create a composite if we don't have one
if ( composite == NULL )
}
}
- // Get the image
- error = mlt_frame_get_image( frame, image, format, width, height, 1 );
+ mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "width", *width );
+ mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "height", *height );
// Only continue if we have both filter and composite
if ( composite != NULL )
{
// Get the resource of this filter (could be a shape [rectangle/circle] or an alpha provider of choice
- char *resource = mlt_properties_get( properties, "resource" );
+ const char *resource = mlt_properties_get( properties, "resource" );
// Get the old resource in case it's changed
char *old_resource = mlt_properties_get( properties, "_old_resource" );
// Index to hold the count
int i = 0;
- // We will get the 'b frame' from the composite only if it's NULL
+ // We will get the 'b frame' from the composite only if it's NULL (region filter)
if ( b_frame == NULL )
{
// Copy the region
b_frame = composite_copy_region( composite, frame, position );
// Ensure a destructor
+ char *name = mlt_properties_get( properties, "_unique_id" );
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 );
+ // filter_only prevents copying the alpha channel of the shape to the output frame
+ // by compositing filtered frame over itself
+ if ( mlt_properties_get_int( properties, "filter_only" ) )
+ {
+ frame = composite_copy_region( composite, b_frame, position );
+ }
// Make sure the filter is in the correct position
while ( filter != NULL )
// Special case circle resource
if ( strcmp( resource, "circle" ) == 0 )
- {
- // Special case to ensure that fezzik produces a pixbuf with a NULL constructor
- resource = "pixbuf";
-
- // Specify the svg circle
- mlt_properties_set( properties, "producer.resource", "<svg width='100' height='100'><circle cx='50' cy='50' r='50' fill='black'/></svg>" );
- }
+ resource = "pixbuf:<svg width='100' height='100'><circle cx='50' cy='50' r='50' fill='black'/></svg>";
// Create the producer
mlt_profile profile = mlt_service_profile( MLT_TRANSITION_SERVICE( this ) );
error = mlt_frame_get_image( frame, image, format, width, height, 0 );
}
+ mlt_service_unlock( MLT_TRANSITION_SERVICE( this ) );
+
return error;
}
static mlt_frame transition_process( mlt_transition this, mlt_frame a_frame, mlt_frame b_frame )
{
- // Get the properties of the frame
- mlt_properties properties = MLT_FRAME_PROPERTIES( a_frame );
-
- // Get a unique name to store the frame position
- char *name = mlt_properties_get( MLT_TRANSITION_PROPERTIES( this ), "_unique_id" );
-
- // Assign the current position to the name
- mlt_properties_set_position( properties, name, mlt_frame_get_position( a_frame ) );
-
// Push the transition on to the frame
mlt_frame_push_service( a_frame, this );
this->process = transition_process;
// Default factory
- mlt_properties_set( properties, "factory", "fezzik" );
+ mlt_properties_set( properties, "factory", mlt_environment( "MLT_PRODUCER" ) );
// Resource defines the shape of the region
mlt_properties_set( properties, "resource", arg == NULL ? "rectangle" : arg );