From: lilo_booter Date: Wed, 22 Jun 2005 07:29:27 +0000 (+0000) Subject: src/framework/mlt_consumer.c X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=9029c77b04ddf9c9d9becacca56615607bb84234;p=mlt src/framework/mlt_consumer.c + Attempt to make all frames have the correct aspect_ratio (works in many but not all cases) src/framework/mlt_frame.h + Provide macro access to the video and image RPN queues src/framework/mlt_tractor.c + Provides orphaned filters src/modules/core/producer_noise.c - remove specification of aspect ratio src/modules/core/filter_watermark.c src/modules/core/transition_composite.c src/modules/core/transition_luma.c src/modules/plus/filter_affine.c src/modules/plus/transition_affine.c + Corrections for frames with an aspect ratio = 0 (supplement to mlt_consumer mod) git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@737 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/framework/mlt_frame.h b/src/framework/mlt_frame.h index 77ca012c..f81a453a 100644 --- a/src/framework/mlt_frame.h +++ b/src/framework/mlt_frame.h @@ -43,6 +43,8 @@ struct mlt_frame_s #define MLT_FRAME_PROPERTIES( frame ) ( &( frame )->parent ) #define MLT_FRAME_SERVICE_STACK( frame ) ( ( frame )->stack_service ) +#define MLT_FRAME_IMAGE_STACK( frame ) ( ( frame )->stack_image ) +#define MLT_FRAME_AUDIO_STACK( frame ) ( ( frame )->stack_audio ) extern mlt_frame mlt_frame_init( ); extern mlt_properties mlt_frame_properties( mlt_frame self ); diff --git a/src/framework/mlt_tractor.c b/src/framework/mlt_tractor.c index 9a1f32e1..8de038be 100644 --- a/src/framework/mlt_tractor.c +++ b/src/framework/mlt_tractor.c @@ -323,6 +323,29 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra // Check for last track done = mlt_properties_get_int( temp_properties, "last_track" ); + // Handle fx only tracks + if ( mlt_properties_get_int( temp_properties, "meta.fx_cut" ) ) + { + // Take all but the first placeholding producer and dump on to the image stack + if ( video ) + { + void *p = mlt_deque_pop_front( MLT_FRAME_IMAGE_STACK( temp ) ); + while ( ( p = mlt_deque_pop_front( MLT_FRAME_IMAGE_STACK( temp ) ) ) != NULL ) + mlt_deque_push_back( MLT_FRAME_IMAGE_STACK( video ), p ); + } + + // Take all but the first placeholding producer and dump on to the audio stack + if ( audio ) + { + void *p = mlt_deque_pop_front( MLT_FRAME_AUDIO_STACK( temp ) ); + while ( ( p = mlt_deque_pop_front( MLT_FRAME_AUDIO_STACK( temp ) ) ) != NULL ) + mlt_deque_push_back( MLT_FRAME_AUDIO_STACK( audio ), p ); + } + + // Ensure everything is hidden + mlt_properties_set_int( temp_properties, "hide", 3 ); + } + // We store all frames with a destructor on the output frame sprintf( label, "_%s_%d", id, count ++ ); mlt_properties_set_data( frame_properties, label, temp, 0, ( mlt_destructor )mlt_frame_close, NULL ); diff --git a/src/modules/core/filter_watermark.c b/src/modules/core/filter_watermark.c index bfd491ee..51181d71 100644 --- a/src/modules/core/filter_watermark.c +++ b/src/modules/core/filter_watermark.c @@ -144,6 +144,12 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) ); mlt_properties_set_int( b_props, "consumer_deinterlace", mlt_properties_get_double( a_props, "consumer_deinterlace" ) ); + // Check for the special case - no aspect ratio means no problem :-) + if ( mlt_frame_get_aspect_ratio( b_frame ) == 0 ) + mlt_properties_set_double( b_props, "aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) ); + if ( mlt_frame_get_aspect_ratio( frame ) == 0 ) + mlt_properties_set_double( a_props, "aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) ); + mlt_properties_set_int( b_props, "normalised_width", mlt_properties_get_int( a_props, "normalised_width" ) ); mlt_properties_set_int( b_props, "normalised_height", mlt_properties_get_int( a_props, "normalised_height" ) ); diff --git a/src/modules/core/producer_noise.c b/src/modules/core/producer_noise.c index 1b71cda4..257f0a2c 100644 --- a/src/modules/core/producer_noise.c +++ b/src/modules/core/producer_noise.c @@ -55,11 +55,6 @@ mlt_producer producer_noise_init( void *arg ) // Initialise the producer if ( this != NULL ) { - int is_pal = mlt_properties_get_int( MLT_PRODUCER_PROPERTIES( this ), "normalised_height" ) == 576; - - // Synthetic - aspect ratio of 1 - mlt_properties_set_double( MLT_PRODUCER_PROPERTIES( this ), "aspect_ratio", is_pal ? 59.0/54.0 : 10.0/11.0 ); - // Callback registration this->get_frame = producer_get_frame; this->close = ( mlt_destructor )producer_close; diff --git a/src/modules/core/transition_composite.c b/src/modules/core/transition_composite.c index 5c3e7afd..5e5118b0 100644 --- a/src/modules/core/transition_composite.c +++ b/src/modules/core/transition_composite.c @@ -710,6 +710,7 @@ static int get_b_frame_image( mlt_transition this, mlt_frame b_frame, uint8_t ** int real_height = get_value( b_props, "real_height", "height" ); double input_ar = mlt_frame_get_aspect_ratio( b_frame ); double output_ar = mlt_properties_get_double( b_props, "consumer_aspect_ratio" ); + if ( input_ar == 0.0 ) input_ar = output_ar; int scaled_width = input_ar / output_ar * real_width; int scaled_height = real_height; diff --git a/src/modules/core/transition_luma.c b/src/modules/core/transition_luma.c index 11c334c0..ebdc82cf 100644 --- a/src/modules/core/transition_luma.c +++ b/src/modules/core/transition_luma.c @@ -486,6 +486,10 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f // Since we are the consumer of the b_frame, we must pass along this // consumer property from the a_frame + if ( mlt_properties_get_double( a_props, "aspect_ratio" ) == 0.0 ) + 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 diff --git a/src/modules/plus/filter_affine.c b/src/modules/plus/filter_affine.c index e465a351..0fa4a86c 100644 --- a/src/modules/plus/filter_affine.c +++ b/src/modules/plus/filter_affine.c @@ -65,6 +65,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * char *name = mlt_properties_get( properties, "_unique_id" ); mlt_position position = mlt_properties_get_position( MLT_FRAME_PROPERTIES( this ), name ); mlt_properties frame_properties = MLT_FRAME_PROPERTIES( this ); + double consumer_ar = mlt_properties_get_double( frame_properties, "consumer_aspect_ratio" ); mlt_properties_set_position( MLT_TRANSITION_PROPERTIES( transition ), "in", mlt_filter_get_in( filter ) ); mlt_properties_set_position( MLT_TRANSITION_PROPERTIES( transition ), "out", mlt_filter_get_out( filter ) ); mlt_producer_seek( producer, position ); @@ -74,8 +75,14 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * mlt_service_get_frame( MLT_PRODUCER_SERVICE( producer ), &a_frame, 0 ); mlt_properties_set( MLT_FRAME_PROPERTIES( a_frame ), "rescale.interp", "nearest" ); mlt_properties_set_int( MLT_FRAME_PROPERTIES( a_frame ), "distort", 1 ); - mlt_properties_set_double( MLT_FRAME_PROPERTIES( a_frame ), "consumer_aspect_ratio", - mlt_properties_get_double( frame_properties, "consumer_aspect_ratio" ) ); + + // Special case - aspect_ratio = 0 + if ( mlt_properties_get_double( frame_properties, "aspect_ratio" ) == 0 ) + mlt_properties_set_double( frame_properties, "aspect_ratio", consumer_ar ); + if ( mlt_properties_get_double( MLT_FRAME_PROPERTIES( a_frame ), "aspect_ratio" ) == 0 ) + mlt_properties_set_double( MLT_FRAME_PROPERTIES( a_frame ), "aspect_ratio", consumer_ar ); + mlt_properties_set_double( MLT_FRAME_PROPERTIES( a_frame ), "consumer_aspect_ratio", consumer_ar ); + mlt_transition_process( transition, a_frame, this ); mlt_frame_get_image( a_frame, image, format, width, height, writable ); mlt_properties_set_data( frame_properties, "affine_frame", a_frame, 0, (mlt_destructor)mlt_frame_close, NULL ); diff --git a/src/modules/plus/transition_affine.c b/src/modules/plus/transition_affine.c index 186ad8b2..83d1cdef 100644 --- a/src/modules/plus/transition_affine.c +++ b/src/modules/plus/transition_affine.c @@ -392,6 +392,8 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f int normalised_width = mlt_properties_get_int( a_props, "normalised_width" ); int normalised_height = mlt_properties_get_int( a_props, "normalised_height" ); + double consumer_ar = mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) ; + // Structures for geometry struct mlt_geometry_item_s result; @@ -414,15 +416,18 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f b_width = result.w; b_height = result.h; + if ( mlt_properties_get_double( b_props, "aspect_ratio" ) == 0.0 ) + mlt_properties_set_double( b_props, "aspect_ratio", consumer_ar ); + if ( !strcmp( mlt_properties_get( a_props, "rescale.interp" ), "none" ) ) { mlt_properties_set( b_props, "rescale.interp", "nearest" ); - mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "aspect_ratio" ) ); + mlt_properties_set_double( b_props, "consumer_aspect_ratio", consumer_ar ); } else { mlt_properties_set( b_props, "rescale.interp", mlt_properties_get( a_props, "rescale.interp" ) ); - 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", consumer_ar ); } mlt_properties_set_int( b_props, "distort", mlt_properties_get_int( properties, "distort" ) );