From: lilo_booter Date: Tue, 5 Jul 2005 09:31:09 +0000 (+0000) Subject: src/framework/mlt_frame.c X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=1f6faabf5ef11e6321d186772d88fb6958cdd057;p=melted src/framework/mlt_frame.c + Correction for aspect ratio of synthesized test card src/framework/mlt_playlist.c + Special case for handling fx cuts src/modules/fezzik.dict + Convenience jfx and jef extensions for jahshaka src/modules/core/transition_composite.c + Ensure that scaling and correct image extraction is handled src/modules/core/transition_luma.c + Ensure that scaling and correct image extraction is handled src/modules/gtk2/producer_pixbuf.c + Allow user overrides for progressive and aspect_ration src/modules/westley/producer_westley.c + Special case for fx cuts git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@748 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index 712c8c2..2c67e76 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -312,7 +312,7 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for mlt_properties_set_int( properties, "width", *width ); mlt_properties_set_int( properties, "height", *height ); - mlt_properties_set_int( properties, "aspect_ratio", 1 ); + mlt_properties_set_int( properties, "aspect_ratio", 0 ); switch( *format ) { diff --git a/src/framework/mlt_playlist.c b/src/framework/mlt_playlist.c index 0433a74..632eefb 100644 --- a/src/framework/mlt_playlist.c +++ b/src/framework/mlt_playlist.c @@ -263,6 +263,18 @@ static int mlt_playlist_virtual_append( mlt_playlist this, mlt_producer source, // Fetch the cuts parent properties parent = MLT_PRODUCER_PROPERTIES( mlt_producer_cut_parent( producer ) ); + // Remove fezzik normalisers for fx cuts + if ( mlt_properties_get_int( parent, "meta.fx_cut" ) ) + { + mlt_service service = MLT_PRODUCER_SERVICE( mlt_producer_cut_parent( producer ) ); + mlt_filter filter = mlt_service_filter( service, 0 ); + while ( filter != NULL && mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "_fezzik" ) ) + { + mlt_service_detach( service, filter ); + filter = mlt_service_filter( service, 0 ); + } + } + // Check that we have room if ( this->count >= this->size ) { diff --git a/src/modules/core/transition_composite.c b/src/modules/core/transition_composite.c index 21909e8..1b4c5ee 100644 --- a/src/modules/core/transition_composite.c +++ b/src/modules/core/transition_composite.c @@ -1012,6 +1012,10 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f int width_b = *width; int height_b = *height; + // Vars for alphas + uint8_t *alpha_a = NULL; + uint8_t *alpha_b = NULL; + // Composites always need scaling... defaulting to lowest char *rescale = mlt_properties_get( a_props, "rescale.interp" ); if ( rescale == NULL || !strcmp( rescale, "none" ) ) @@ -1040,10 +1044,14 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f } if ( a_frame == b_frame ) + { get_b_frame_image( this, b_frame, &image_b, &width_b, &height_b, &result ); + alpha_b = mlt_frame_get_alpha_mask( b_frame ); + } // Get the image from the a frame mlt_frame_get_image( a_frame, image, format, width, height, 1 ); + alpha_a = mlt_frame_get_alpha_mask( a_frame ); // Optimisation - no compositing required if ( result.item.mix == 0 || ( result.item.w == 0 && result.item.h == 0 ) ) @@ -1076,8 +1084,6 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f { uint8_t *dest = *image; uint8_t *src = image_b; - uint8_t *alpha_b = mlt_frame_get_alpha_mask( b_frame ); - uint8_t *alpha_a = mlt_frame_get_alpha_mask( a_frame ); int progressive = mlt_properties_get_int( a_props, "consumer_deinterlace" ) || mlt_properties_get_int( properties, "progressive" ); @@ -1085,6 +1091,9 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f int32_t luma_softness = mlt_properties_get_double( properties, "softness" ) * ( 1 << 16 ); uint16_t *luma_bitmap = get_luma( properties, width_b, height_b ); + + alpha_b = alpha_b == NULL ? mlt_frame_get_alpha_mask( b_frame ) : alpha_b; + composite_line_fn line_fn = composite_line_yuv; if ( mlt_properties_get_int( properties, "or" ) ) diff --git a/src/modules/core/transition_luma.c b/src/modules/core/transition_luma.c index ebdc82c..29eb095 100644 --- a/src/modules/core/transition_luma.c +++ b/src/modules/core/transition_luma.c @@ -481,7 +481,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f 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 ) + if ( mlt_properties_get( a_props, "rescale.interp" ) == NULL || !strcmp( mlt_properties_get( a_props, "rescale.interp" ), "none" ) ) mlt_properties_set( a_props, "rescale.interp", "nearest" ); // Since we are the consumer of the b_frame, we must pass along this @@ -490,10 +490,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f mlt_properties_set_double( a_props, "aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) ); if ( mlt_properties_get_double( b_props, "aspect_ratio" ) == 0.0 ) mlt_properties_set_double( b_props, "aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) ); - if ( !strcmp( mlt_properties_get( a_props, "rescale.interp" ), "none" ) ) - mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "aspect_ratio" ) ); - else - mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) ); + mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) ); // Honour the reverse here if ( mix >= 1.0 ) @@ -503,7 +500,8 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f frame_delta *= reverse || invert ? -1.0 : 1.0; // Ensure we get scaling on the b_frame - mlt_properties_set( b_props, "rescale.interp", "nearest" ); + if ( mlt_properties_get( b_props, "rescale.interp" ) == NULL || !strcmp( mlt_properties_get( b_props, "rescale.interp" ), "none" ) ) + mlt_properties_set( b_props, "rescale.interp", "nearest" ); if ( mlt_properties_get( properties, "fixed" ) ) mix = mlt_properties_get_double( properties, "fixed" ); diff --git a/src/modules/fezzik.dict b/src/modules/fezzik.dict index cb18e3f..42dea24 100644 --- a/src/modules/fezzik.dict +++ b/src/modules/fezzik.dict @@ -9,6 +9,8 @@ http://*=avformat *.dif=mcdv,libdv *.gif=pixbuf *.graphics=westley +*.jfx=westley +*.jef=westley *.jpg=pixbuf *.jpeg=pixbuf *.kino=westley diff --git a/src/modules/gtk2/producer_pixbuf.c b/src/modules/gtk2/producer_pixbuf.c index df23189..e2f4d25 100644 --- a/src/modules/gtk2/producer_pixbuf.c +++ b/src/modules/gtk2/producer_pixbuf.c @@ -79,6 +79,8 @@ mlt_producer producer_pixbuf_init( char *filename ) // Set the default properties mlt_properties_set( properties, "resource", filename ); mlt_properties_set_int( properties, "ttl", 25 ); + mlt_properties_set_int( properties, "aspect_ratio", 1 ); + mlt_properties_set_int( properties, "progressive", 1 ); return producer; } @@ -282,10 +284,12 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i // Get the real structure for this producer producer_pixbuf this = producer->child; - if ( this->count == 0 && mlt_properties_get( MLT_PRODUCER_PROPERTIES( producer ), "resource" ) != NULL ) + // Fetch the producers properties + mlt_properties producer_properties = MLT_PRODUCER_PROPERTIES( producer ); + + if ( this->count == 0 && mlt_properties_get( producer_properties, "resource" ) != NULL ) { - mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer ); - char *filename = mlt_properties_get( properties, "resource" ); + char *filename = mlt_properties_get( producer_properties, "resource" ); // Read xml string if ( strstr( filename, "filenames[ this->count ++ ] = strdup( fullname ); // Teehe - when the producer closes, delete the temp file and the space allo - mlt_properties_set_data( properties, "__temporary_file__", this->filenames[ this->count - 1 ], 0, ( mlt_destructor )unlink, NULL ); + mlt_properties_set_data( producer_properties, "__temporary_file__", this->filenames[ this->count - 1 ], 0, ( mlt_destructor )unlink, NULL ); } } // Obtain filenames else if ( strchr( filename, '%' ) != NULL ) { // handle picture sequences - int i = mlt_properties_get_int( properties, "begin" ); + int i = mlt_properties_get_int( producer_properties, "begin" ); int gap = 0; char full[1024]; @@ -396,8 +400,8 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i refresh_image( *frame, 0, 0 ); // Set producer-specific frame properties - mlt_properties_set_int( properties, "progressive", 1 ); - mlt_properties_set_double( properties, "aspect_ratio", 1 ); + mlt_properties_set_int( properties, "progressive", mlt_properties_get_int( producer_properties, "progressive" ) ); + mlt_properties_set_double( properties, "aspect_ratio", mlt_properties_get_double( producer_properties, "aspect_ratio" ) ); // Set alpha call back ( *frame )->get_alpha_mask = producer_get_alpha_mask; diff --git a/src/modules/westley/producer_westley.c b/src/modules/westley/producer_westley.c index 4921e78..0869e10 100644 --- a/src/modules/westley/producer_westley.c +++ b/src/modules/westley/producer_westley.c @@ -445,6 +445,7 @@ static void on_end_producer( deserialise_context context, const xmlChar *name ) qualify_property( context, properties, "resource" ); char *resource = mlt_properties_get( properties, "resource" ); + int fx_cut = mlt_properties_get_int( properties, "meta.fx_cut" ); // Let Kino-SMIL src be a synonym for resource if ( resource == NULL ) @@ -454,7 +455,7 @@ static void on_end_producer( deserialise_context context, const xmlChar *name ) } // Instantiate the producer - if ( mlt_properties_get( properties, "mlt_service" ) != NULL ) + if ( !fx_cut && mlt_properties_get( properties, "mlt_service" ) != NULL ) { char temp[ 1024 ]; strncpy( temp, mlt_properties_get( properties, "mlt_service" ), 1024 ); @@ -465,6 +466,10 @@ static void on_end_producer( deserialise_context context, const xmlChar *name ) } producer = MLT_SERVICE( mlt_factory_producer( "fezzik", temp ) ); } + else + { + producer = MLT_SERVICE( mlt_factory_producer( mlt_properties_get( properties, "mlt_service" ), resource ) ); + } // Just in case the plugin requested doesn't exist... if ( producer == NULL && resource != NULL )