Warning removal
[melted] / src / modules / core / transition_luma.c
index c241b3e..9da80b3 100644 (file)
@@ -372,7 +372,15 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
 
        if ( luma_bitmap == NULL && resource != NULL )
        {
-               char *extension = extension = strrchr( resource, '.' );
+               char temp[ 512 ];
+               char *extension = strrchr( resource, '.' );
+
+               if ( strchr( resource, '%' ) )
+               {
+                       sprintf( temp, "%s/lumas/%s/%s", mlt_factory_prefix( ), mlt_environment( "MLT_NORMALISATION" ), strchr( resource, '%' ) + 1 );
+                       resource = temp;
+                       extension = strrchr( resource, '.' );
+               }
 
                // See if it is a PGM
                if ( extension != NULL && strcmp( extension, ".pgm" ) == 0 )
@@ -457,6 +465,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
                        mlt_properties_get_int( b_props, "luma.progressive" );
        int top_field_first =  mlt_properties_get_int( b_props, "top_field_first" );
        int reverse = mlt_properties_get_int( properties, "reverse" );
+       int invert = mlt_properties_get_int( properties, "invert" );
 
        if ( mlt_properties_get( a_props, "rescale.interp" ) == NULL )
                mlt_properties_set( a_props, "rescale.interp", "nearest" );
@@ -472,8 +481,8 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
        if ( mix >= 1.0 )
                mix -= floor( mix );
 
-       mix = reverse ? 1 - mix : mix;
-       frame_delta *= reverse ? -1.0 : 1.0;
+       mix = reverse || invert ? 1 - mix : mix;
+       frame_delta *= reverse || invert ? -1.0 : 1.0;
 
        // Ensure we get scaling on the b_frame
        mlt_properties_set( b_props, "rescale.interp", "nearest" );
@@ -483,16 +492,16 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
 
        if ( luma_width > 0 && luma_height > 0 && luma_bitmap != NULL )
                // Composite the frames using a luma map
-               luma_composite( a_frame, b_frame, luma_width, luma_height, luma_bitmap, mix, frame_delta,
+               luma_composite( !invert ? a_frame : b_frame, !invert ? b_frame : a_frame, luma_width, luma_height, luma_bitmap, mix, frame_delta,
                        luma_softness, progressive ? -1 : top_field_first, width, height );
        else
                // Dissolve the frames using the time offset for mix value
                dissolve_yuv( a_frame, b_frame, mix, *width, *height );
 
        // Extract the a_frame image info
-       *width = mlt_properties_get_int( a_props, "width" );
-       *height = mlt_properties_get_int( a_props, "height" );
-       *image = mlt_properties_get_data( a_props, "image", NULL );
+       *width = mlt_properties_get_int( !invert ? a_props : b_props, "width" );
+       *height = mlt_properties_get_int( !invert ? a_props : b_props, "height" );
+       *image = mlt_properties_get_data( !invert ? a_props : b_props, "image", NULL );
 
        return 0;
 }
@@ -538,6 +547,9 @@ mlt_transition transition_luma_init( char *lumafile )
                // Set the main property
                mlt_properties_set( MLT_TRANSITION_PROPERTIES( transition ), "resource", lumafile );
                
+               // Inform apps and framework that this is a video only transition
+               mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( transition ), "_transition_type", 1 );
+
                return transition;
        }
        return NULL;