X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fcore%2Ftransition_composite.c;h=0e1c0d76153c5babefaeff041eaf73aa6c9e36c5;hb=904efc28172abbb254d488735c83480c40c1b3b5;hp=efa251c3ece08c4de6bc85fdf397611a045d9154;hpb=74268cd86c30a0af9f03981c799aa4bba253c6e9;p=melted diff --git a/src/modules/core/transition_composite.c b/src/modules/core/transition_composite.c index efa251c..0e1c0d7 100644 --- a/src/modules/core/transition_composite.c +++ b/src/modules/core/transition_composite.c @@ -120,6 +120,12 @@ static int composite_yuv( uint8_t *p_dest, mlt_image_format format_dest, int wid int width_b = mlt_properties_get_double( b_props, "real_width" ); int height_b = mlt_properties_get_double( b_props, "real_height" ); + // Maximise the dimensioning rectangle to the aspect of the b_frame + if ( mlt_properties_get_double( b_props, "aspect_ratio" ) * height_src > width_src ) + height_src = ( double )width_src / mlt_properties_get_double( b_props, "aspect_ratio" ) + 0.5; + else + width_src = mlt_properties_get_double( b_props, "aspect_ratio" ) * height_src + 0.5; + // See if we need to normalise pixel aspect ratio // We can use consumer_aspect_ratio because the a_frame will take on this aspect double aspect = mlt_properties_get_double( b_props, "consumer_aspect_ratio" ); @@ -133,24 +139,29 @@ static int composite_yuv( uint8_t *p_dest, mlt_image_format format_dest, int wid // Normalise pixel aspect if ( iaspect != 0 && iaspect != oaspect ) + { width_b = iaspect / oaspect * ( double )width_b + 0.5; + width_src = iaspect / oaspect * ( double )width_src + 0.5; + } // Tell rescale not to normalise display aspect mlt_frame_set_aspect_ratio( that, aspect ); } - - // Constrain the overlay to the dimensioning rectangle - if ( width_b < width_src ) - width_src = width_b; - if ( height_b < height_src ) - height_src = height_b; - + // Adjust overall scale for consumer double consumer_scale = mlt_properties_get_double( b_props, "consumer_scale" ); if ( consumer_scale > 0 ) { - width_src = consumer_scale * width_src + 0.5; - height_src = consumer_scale * height_src + 0.5; + width_b = consumer_scale * width_b + 0.5; + height_b = consumer_scale * height_b + 0.5; + } + +// fprintf( stderr, "bounding rect %dx%d for overlay %dx%d\n", width_src, height_src, width_b, height_b ); + // Constrain the overlay to the dimensioning rectangle + if ( width_b < width_src && height_b < height_src ) + { + width_src = width_b; + height_src = height_b; } } else if ( mlt_properties_get( b_props, "real_width" ) != NULL )