From 904efc28172abbb254d488735c83480c40c1b3b5 Mon Sep 17 00:00:00 2001 From: ddennedy Date: Mon, 16 Feb 2004 19:17:37 +0000 Subject: [PATCH] bug fixes git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@148 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/modules/core/transition_composite.c | 29 ++++++++++++++++++++--------- src/modules/gtk2/filter_rescale.c | 1 + src/modules/sdl/consumer_sdl.c | 4 ++-- 3 files changed, 23 insertions(+), 11 deletions(-) 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 ) diff --git a/src/modules/gtk2/filter_rescale.c b/src/modules/gtk2/filter_rescale.c index 526b58a..39185be 100644 --- a/src/modules/gtk2/filter_rescale.c +++ b/src/modules/gtk2/filter_rescale.c @@ -175,6 +175,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * mlt_properties_set_int( properties, "height", oheight ); // Return the output + *format = mlt_image_yuv422; *width = owidth; *height = oheight; *image = output; diff --git a/src/modules/sdl/consumer_sdl.c b/src/modules/sdl/consumer_sdl.c index 9d82aac..3e5d28e 100644 --- a/src/modules/sdl/consumer_sdl.c +++ b/src/modules/sdl/consumer_sdl.c @@ -500,8 +500,8 @@ static void *consumer_thread( void *arg ) if ( frame != NULL ) { // SDL adapts display aspect, but set this so pixel aspect can be normalised - mlt_properties_set_double( mlt_frame_properties( frame ), "consumer_aspect_ratio", - mlt_frame_get_aspect_ratio( frame ) ); +// mlt_properties_set_double( mlt_frame_properties( frame ), "consumer_aspect_ratio", +// mlt_frame_get_aspect_ratio( frame ) ); init_audio = consumer_play_audio( this, frame, init_audio ); consumer_play_video( this, frame ); -- 1.7.4.4