]> git.sesse.net Git - mlt/blobdiff - src/modules/core/transition_region.c
add ability to ignore field order as used by sdl consumer
[mlt] / src / modules / core / transition_region.c
index dfdb83cb0fd31a14dcd2d37c366b170dd29565b1..0c2e59727b47e752f109c07d8d404ec5894a2dbb 100644 (file)
@@ -47,7 +47,8 @@ static int create_instance( mlt_transition transition, char *name, char *value,
 
        // Create the filter
        mlt_profile profile = mlt_service_profile( MLT_TRANSITION_SERVICE( transition ) );
-       filter = mlt_factory_filter( profile, type, arg );
+       if ( type )
+               filter = mlt_factory_filter( profile, type, arg );
 
        // If we have a filter, then initialise and store it
        if ( filter != NULL )
@@ -113,25 +114,26 @@ static uint8_t *filter_get_alpha_mask( mlt_frame frame )
 
        alpha = mlt_frame_get_alpha_mask( shape_frame );
 
+       int size = region_width * region_height;
+       uint8_t *alpha_duplicate = mlt_pool_alloc( size );
+
        // Generate from the Y component of the image if no alpha available
        if ( alpha == NULL )
        {
-               int size = region_width * region_height;
-               uint8_t *p = mlt_pool_alloc( size );
-               alpha = p;
+               alpha = alpha_duplicate;
                while ( size -- )
                {
-                       *p ++ = ( int )( ( ( *image ++ - 16 ) * 299 ) / 255 );
+                       *alpha ++ = ( int )( ( ( *image ++ - 16 ) * 299 ) / 255 );
                        image ++;
                }
-               mlt_frame_set_alpha( frame, alpha, region_width * region_height, mlt_pool_release );
        }
        else
        {
-               mlt_frame_set_alpha( frame, alpha, region_width * region_height, NULL );
+               memcpy( alpha_duplicate, alpha, size );
        }
+       mlt_frame_set_alpha( frame, alpha_duplicate, region_width * region_height, mlt_pool_release );
 
-       return alpha;
+       return alpha_duplicate;
 }
 
 /** Do it :-).