X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fframework%2Fmlt_frame.c;h=712c8c25a0347dc71727187a4d96ea35ab18a4ed;hb=e6c03148e1dc3b0e363c9f304b3ed93fbc1a91a9;hp=660f3c1de4ffe3ce00be55c7e8c4e2d8e8aa9647;hpb=da46016cc4e9c751ab346b9b8f451a59cd276b03;p=melted diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index 660f3c1..712c8c2 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -181,6 +181,22 @@ void *mlt_frame_pop_service( mlt_frame this ) return mlt_deque_pop_back( this->stack_image ); } +/** Push a service. +*/ + +int mlt_frame_push_service_int( mlt_frame this, int that ) +{ + return mlt_deque_push_back_int( this->stack_image, that ); +} + +/** Pop a service. +*/ + +int mlt_frame_pop_service_int( mlt_frame this ) +{ + return mlt_deque_pop_back_int( this->stack_image ); +} + /** Push an audio item on the stack. */ @@ -205,7 +221,7 @@ mlt_deque mlt_frame_service_stack( mlt_frame this ) return this->stack_service; } -/** [EXPERIMENTAL] Replace image stack with the information provided. +/** Replace image stack with the information provided. This might prove to be unreliable and restrictive - the idea is that a transition which normally uses two images may decide to only use the b frame (ie: in the case @@ -226,8 +242,7 @@ mlt_deque mlt_frame_service_stack( mlt_frame this ) void mlt_frame_replace_image( mlt_frame this, uint8_t *image, mlt_image_format format, int width, int height ) { - // Herein lies the potential problem for this function - it makes a potentially - // dangerous assumption that all content on the image stack can be removed without a destructor + // Remove all items from the stack while( mlt_deque_pop_back( this->stack_image ) ) ; // Update the information @@ -246,16 +261,15 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for mlt_properties properties = MLT_FRAME_PROPERTIES( this ); mlt_get_image get_image = mlt_frame_pop_get_image( this ); mlt_producer producer = mlt_properties_get_data( properties, "test_card_producer", NULL ); + int error = 0; *width = *width >> 1 << 1; if ( get_image != NULL ) { - int error = 0; mlt_position position = mlt_frame_get_position( this ); error = get_image( this, buffer, format, width, height, writable ); mlt_frame_set_position( this, position ); - return error; } else if ( mlt_properties_get_data( properties, "image", NULL ) != NULL ) { @@ -344,14 +358,30 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for mlt_properties_set_int( properties, "test_image", 1 ); } - return 0; + mlt_properties_set_int( properties, "scaled_width", *width ); + mlt_properties_set_int( properties, "scaled_height", *height ); + + return error; } uint8_t *mlt_frame_get_alpha_mask( mlt_frame this ) { - if ( this != NULL && this->get_alpha_mask != NULL ) - return this->get_alpha_mask( this ); - return this == NULL ? NULL : mlt_properties_get_data( &this->parent, "alpha", NULL ); + uint8_t *alpha = NULL; + if ( this != NULL ) + { + if ( this->get_alpha_mask != NULL ) + alpha = this->get_alpha_mask( this ); + if ( alpha == NULL ) + alpha = mlt_properties_get_data( &this->parent, "alpha", NULL ); + if ( alpha == NULL ) + { + int size = mlt_properties_get_int( &this->parent, "scaled_width" ) * mlt_properties_get_int( &this->parent, "scaled_height" ); + alpha = mlt_pool_alloc( size ); + memset( alpha, 255, size ); + mlt_properties_set_data( &this->parent, "alpha", alpha, size, mlt_pool_release, NULL ); + } + } + return alpha; } int mlt_frame_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples ) @@ -941,8 +971,8 @@ int mlt_frame_mix_audio( mlt_frame this, mlt_frame that, float weight_start, flo int i, j; double d = 0, s = 0; - mlt_frame_get_audio( this, &dest, format, &frequency_dest, &channels_dest, &samples_dest ); mlt_frame_get_audio( that, &src, format, &frequency_src, &channels_src, &samples_src ); + mlt_frame_get_audio( this, &dest, format, &frequency_dest, &channels_dest, &samples_dest ); int silent = mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "silent_audio" ); mlt_properties_set_int( MLT_FRAME_PROPERTIES( this ), "silent_audio", 0 );