From 44e63c02bce85ee20151d930db9a19fabceccd0c Mon Sep 17 00:00:00 2001 From: Dan Dennedy Date: Sun, 6 Mar 2011 21:09:33 -0800 Subject: [PATCH] Refactor to use mlt_frame_set_image/_alpha. --- src/framework/mlt_tractor.c | 4 ++-- src/modules/avformat/filter_avcolour_space.c | 4 ++-- src/modules/avformat/filter_swscale.c | 6 ++---- src/modules/avformat/producer_avformat.c | 8 ++++---- src/modules/core/filter_audiowave.c | 2 +- src/modules/core/filter_crop.c | 6 ++---- src/modules/core/filter_imageconvert.c | 4 ++-- src/modules/core/filter_luma.c | 2 +- src/modules/core/filter_rescale.c | 11 +++-------- src/modules/core/filter_resize.c | 8 +++----- src/modules/core/filter_watermark.c | 4 ++-- src/modules/core/producer_colour.c | 4 ++-- src/modules/core/producer_consumer.c | 4 ++-- src/modules/core/producer_hold.c | 6 +++--- src/modules/core/producer_noise.c | 4 +--- src/modules/core/producer_ppm.c | 2 +- src/modules/core/transition_composite.c | 2 +- src/modules/core/transition_region.c | 4 ++-- src/modules/dgraft/filter_telecide.c | 2 +- src/modules/dv/producer_libdv.c | 4 ++-- src/modules/frei0r/frei0r_helper.c | 2 +- src/modules/frei0r/producer_frei0r.c | 4 +--- src/modules/gtk2/filter_rescale.c | 8 ++------ src/modules/gtk2/producer_pango.c | 2 +- src/modules/gtk2/producer_pixbuf.c | 4 ++-- src/modules/kdenlive/filter_freeze.c | 2 +- src/modules/kdenlive/filter_wave.c | 2 +- src/modules/kdenlive/producer_framebuffer.c | 4 ++-- src/modules/motion_est/producer_slowmotion.c | 2 +- src/modules/plus/filter_affine.c | 4 ++-- src/modules/plus/filter_charcoal.c | 2 +- src/modules/qimage/producer_kdenlivetitle.c | 8 +------- src/modules/qimage/producer_qimage.c | 2 +- src/modules/sdl/producer_sdl_image.c | 4 +--- src/modules/swfdec/producer_swfdec.c | 2 +- src/modules/vmfx/producer_pgm.c | 2 +- src/modules/xine/filter_deinterlace.c | 2 +- 37 files changed, 60 insertions(+), 87 deletions(-) diff --git a/src/framework/mlt_tractor.c b/src/framework/mlt_tractor.c index 235bbe01..e509fe27 100644 --- a/src/framework/mlt_tractor.c +++ b/src/framework/mlt_tractor.c @@ -273,7 +273,7 @@ static int producer_get_image( mlt_frame self, uint8_t **buffer, mlt_image_forma mlt_properties_set_int( frame_properties, "normalised_width", mlt_properties_get_int( properties, "normalised_width" ) ); mlt_properties_set_int( frame_properties, "normalised_height", mlt_properties_get_int( properties, "normalised_height" ) ); mlt_frame_get_image( frame, buffer, format, width, height, writable ); - mlt_properties_set_data( properties, "image", *buffer, 0, NULL, NULL ); + mlt_frame_set_image( self, *buffer, 0, NULL ); mlt_properties_set_int( properties, "width", *width ); mlt_properties_set_int( properties, "height", *height ); mlt_properties_set_int( properties, "format", *format ); @@ -284,7 +284,7 @@ static int producer_get_image( mlt_frame self, uint8_t **buffer, mlt_image_forma mlt_properties_set_int( properties, "force_full_luma", mlt_properties_get_int( frame_properties, "force_full_luma" ) ); data = mlt_frame_get_alpha_mask( frame ); mlt_properties_get_data( frame_properties, "alpha", &size ); - mlt_properties_set_data( properties, "alpha", data, size, NULL, NULL ); + mlt_frame_set_alpha( self, data, size, NULL ); self->convert_image = frame->convert_image; self->convert_audio = frame->convert_audio; return 0; diff --git a/src/modules/avformat/filter_avcolour_space.c b/src/modules/avformat/filter_avcolour_space.c index 72177f7c..77c2fee0 100644 --- a/src/modules/avformat/filter_avcolour_space.c +++ b/src/modules/avformat/filter_avcolour_space.c @@ -190,7 +190,7 @@ static int convert_image( mlt_frame frame, uint8_t **image, mlt_image_format *fo } while ( --n > 0 ); } - mlt_properties_set_data( properties, "alpha", alpha, len, mlt_pool_release, NULL ); + mlt_frame_set_alpha( frame, alpha, len, mlt_pool_release ); frame->get_alpha_mask = NULL; } } @@ -208,7 +208,7 @@ static int convert_image( mlt_frame frame, uint8_t **image, mlt_image_format *fo av_convert_image( output, *image, out_fmt, in_fmt, width, height, colorspace, force_full_luma ); *image = output; *format = output_format; - mlt_properties_set_data( properties, "image", output, size, mlt_pool_release, NULL ); + mlt_frame_set_image( frame, output, size, mlt_pool_release ); mlt_properties_set_int( properties, "format", output_format ); if ( output_format == mlt_image_rgb24a || output_format == mlt_image_opengl ) diff --git a/src/modules/avformat/filter_swscale.c b/src/modules/avformat/filter_swscale.c index aa2f362f..5bbe85c0 100644 --- a/src/modules/avformat/filter_swscale.c +++ b/src/modules/avformat/filter_swscale.c @@ -146,9 +146,7 @@ static int filter_scale( mlt_frame frame, uint8_t **image, mlt_image_format *for sws_freeContext( context ); // Now update the frame - mlt_properties_set_data( properties, "image", output.data[0], owidth * ( oheight + 1 ) * bpp, ( mlt_destructor )mlt_pool_release, NULL ); - mlt_properties_set_int( properties, "width", owidth ); - mlt_properties_set_int( properties, "height", oheight ); + mlt_frame_set_image( frame, output.data[0], owidth * ( oheight + 1 ) * bpp, mlt_pool_release ); // Return the output *image = output.data[0]; @@ -173,7 +171,7 @@ static int filter_scale( mlt_frame frame, uint8_t **image, mlt_image_format *for sws_freeContext( context ); // Set it back on the frame - mlt_properties_set_data( MLT_FRAME_PROPERTIES( frame ), "alpha", output.data[0], owidth * oheight, mlt_pool_release, NULL ); + mlt_frame_set_alpha( frame, output.data[0], owidth * oheight, mlt_pool_release ); } } diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index eb3850d8..d5ffd096 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -941,7 +941,7 @@ static inline void convert_image( AVFrame *frame, uint8_t *buffer, int pix_fmt, /** Allocate the image buffer and set it on the frame. */ -static int allocate_buffer( mlt_properties frame_properties, AVCodecContext *codec_context, uint8_t **buffer, mlt_image_format *format, int *width, int *height ) +static int allocate_buffer( mlt_frame frame, AVCodecContext *codec_context, uint8_t **buffer, mlt_image_format *format, int *width, int *height ) { int size = 0; @@ -974,7 +974,7 @@ static int allocate_buffer( mlt_properties frame_properties, AVCodecContext *cod // Construct the output image *buffer = mlt_pool_alloc( size ); if ( *buffer ) - mlt_properties_set_data( frame_properties, "image", *buffer, size, mlt_pool_release, NULL ); + mlt_frame_set_image( frame, *buffer, size, mlt_pool_release ); else size = 0; @@ -1046,7 +1046,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form break; } mlt_properties_set_data( frame_properties, "avformat.image_cache", item, 0, ( mlt_destructor )mlt_cache_item_close, NULL ); - mlt_properties_set_data( frame_properties, "image", *buffer, size, NULL, NULL ); + mlt_frame_set_image( frame, *buffer, size, NULL ); // self->top_field_first = mlt_properties_get_int( frame_properties, "top_field_first" ); self->got_picture = 1; @@ -1206,7 +1206,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form || ( !use_new_seek && self->current_position > req_position ) ) ) { // Duplicate it - if ( ( image_size = allocate_buffer( frame_properties, codec_context, buffer, format, width, height ) ) ) + if ( ( image_size = allocate_buffer( frame, codec_context, buffer, format, width, height ) ) ) { // Workaround 1088 encodings missing cropping info. if ( *height == 1088 && mlt_profile_dar( mlt_service_profile( MLT_PRODUCER_SERVICE( producer ) ) ) == 16.0/9.0 ) diff --git a/src/modules/core/filter_audiowave.c b/src/modules/core/filter_audiowave.c index 08d848f6..5d179807 100644 --- a/src/modules/core/filter_audiowave.c +++ b/src/modules/core/filter_audiowave.c @@ -32,7 +32,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * int size = *width * *height * 2; *format = mlt_image_yuv422; *image = mlt_pool_alloc( size ); - mlt_properties_set_data( MLT_FRAME_PROPERTIES(this), "image", *image, size, mlt_pool_release, NULL ); + mlt_frame_set_image( this, *image, size, mlt_pool_release ); uint8_t *wave = mlt_frame_get_waveform( this, *width, *height ); if ( wave ) { diff --git a/src/modules/core/filter_crop.c b/src/modules/core/filter_crop.c index cac0d85c..4477b156 100644 --- a/src/modules/core/filter_crop.c +++ b/src/modules/core/filter_crop.c @@ -129,10 +129,8 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * crop( *image, output, bpp, *width, *height, left, right, top, bottom ); // Now update the frame + mlt_frame_set_image( this, output, owidth * ( oheight + 1 ) * bpp, mlt_pool_release ); *image = output; - mlt_properties_set_data( properties, "image", output, owidth * ( oheight + 1 ) * bpp, ( mlt_destructor )mlt_pool_release, NULL ); - mlt_properties_set_int( properties, "width", owidth ); - mlt_properties_set_int( properties, "height", oheight ); } // We should resize the alpha too @@ -145,7 +143,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * if ( newalpha ) { crop( alpha, newalpha, 1, *width, *height, left, right, top, bottom ); - mlt_properties_set_data( properties, "alpha", newalpha, owidth * oheight, ( mlt_destructor )mlt_pool_release, NULL ); + mlt_frame_set_alpha( this, newalpha, owidth * oheight, mlt_pool_release ); this->get_alpha_mask = NULL; } } diff --git a/src/modules/core/filter_imageconvert.c b/src/modules/core/filter_imageconvert.c index 5c2ffdf6..1dfc8b9c 100644 --- a/src/modules/core/filter_imageconvert.c +++ b/src/modules/core/filter_imageconvert.c @@ -343,9 +343,9 @@ static int convert_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *f if ( !( error = converter( *buffer, image, alpha, width, height ) ) ) { - mlt_properties_set_data( properties, "image", image, size, mlt_pool_release, NULL ); + mlt_frame_set_image( frame, image, size, mlt_pool_release ); if ( alpha && ( *format == mlt_image_rgb24a || *format == mlt_image_opengl ) ) - mlt_properties_set_data( properties, "alpha", alpha, alpha_size, mlt_pool_release, NULL ); + mlt_frame_set_alpha( frame, alpha, alpha_size, mlt_pool_release ); *buffer = image; *format = requested_format; } diff --git a/src/modules/core/filter_luma.c b/src/modules/core/filter_luma.c index 0a146beb..a44416b2 100644 --- a/src/modules/core/filter_luma.c +++ b/src/modules/core/filter_luma.c @@ -107,7 +107,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * mlt_log_debug( MLT_FILTER_SERVICE(filter), "copying frame %d\n", modulo_pos ); mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame ); memcpy( dst, src, size ); - mlt_properties_set_data( b_props, "image", dst, size, mlt_pool_release, NULL ); + mlt_frame_set_image( b_frame, dst, size, mlt_pool_release ); mlt_properties_set_int( b_props, "width", *width ); mlt_properties_set_int( b_props, "height", *height ); mlt_properties_set_int( b_props, "format", *format ); diff --git a/src/modules/core/filter_rescale.c b/src/modules/core/filter_rescale.c index 152c7624..b0cd7657 100644 --- a/src/modules/core/filter_rescale.c +++ b/src/modules/core/filter_rescale.c @@ -41,9 +41,6 @@ typedef int ( *image_scaler )( mlt_frame this, uint8_t **image, mlt_image_format static int filter_scale( mlt_frame this, uint8_t **image, mlt_image_format *format, int iwidth, int iheight, int owidth, int oheight ) { - // Get the properties - mlt_properties properties = MLT_FRAME_PROPERTIES( this ); - // Create the output image uint8_t *output = mlt_pool_alloc( owidth * ( oheight + 1 ) * 2 ); @@ -106,11 +103,9 @@ static int filter_scale( mlt_frame this, uint8_t **image, mlt_image_format *form } // Now update the frame - mlt_properties_set_data( properties, "image", output, owidth * ( oheight + 1 ) * 2, ( mlt_destructor ) mlt_pool_release, NULL ); - mlt_properties_set_int( properties, "width", owidth ); - mlt_properties_set_int( properties, "height", oheight ); - + mlt_frame_set_image( this, output, owidth * ( oheight + 1 ) * 2, mlt_pool_release ); *image = output; + return 0; } @@ -139,7 +134,7 @@ static void scale_alpha( mlt_frame this, int iwidth, int iheight, int owidth, in } // Set it back on the frame - mlt_properties_set_data( MLT_FRAME_PROPERTIES( this ), "alpha", output, owidth * oheight, mlt_pool_release, NULL ); + mlt_frame_set_alpha( this, output, owidth * oheight, mlt_pool_release ); } } diff --git a/src/modules/core/filter_resize.c b/src/modules/core/filter_resize.c index 6013bd69..bb61e849 100644 --- a/src/modules/core/filter_resize.c +++ b/src/modules/core/filter_resize.c @@ -158,9 +158,7 @@ static uint8_t *frame_resize_image( mlt_frame this, int owidth, int oheight, int resize_image( output, owidth, oheight, input, iwidth, iheight, bpp ); // Now update the frame - mlt_properties_set_data( properties, "image", output, owidth * ( oheight + 1 ) * bpp, ( mlt_destructor )mlt_pool_release, NULL ); - mlt_properties_set_int( properties, "width", owidth ); - mlt_properties_set_int( properties, "height", oheight ); + mlt_frame_set_image( this, output, owidth * ( oheight + 1 ) * bpp, mlt_pool_release ); // We should resize the alpha too if ( alpha && alpha_size >= iwidth * iheight ) @@ -168,7 +166,7 @@ static uint8_t *frame_resize_image( mlt_frame this, int owidth, int oheight, int alpha = resize_alpha( alpha, owidth, oheight, iwidth, iheight, alpha_value ); if ( alpha ) { - mlt_properties_set_data( properties, "alpha", alpha, owidth * oheight, ( mlt_destructor )mlt_pool_release, NULL ); + mlt_frame_set_alpha( this, alpha, owidth * oheight, mlt_pool_release ); this->get_alpha_mask = NULL; } } @@ -301,7 +299,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * // Get the input image, width and height int size = owidth * oheight * bpp; uint8_t *new_image = mlt_pool_alloc( size ); - mlt_properties_set_data( properties, "image", new_image, size, ( mlt_destructor )mlt_pool_release, NULL ); + mlt_frame_set_image( this, new_image, size, mlt_pool_release ); uint8_t *ptr = new_image + owidth * bpp; memcpy( new_image, *image, owidth * bpp ); memcpy( ptr, *image, size - owidth * bpp ); diff --git a/src/modules/core/filter_watermark.c b/src/modules/core/filter_watermark.c index bb9ffd88..bf2b87d9 100644 --- a/src/modules/core/filter_watermark.c +++ b/src/modules/core/filter_watermark.c @@ -197,8 +197,8 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format mlt_service_apply_filters( MLT_FILTER_SERVICE( this ), b_frame, 0 ); error = mlt_frame_get_image( b_frame, image, format, width, height, 1 ); alpha = mlt_frame_get_alpha_mask( b_frame ); - mlt_properties_set_data( a_props, "image", *image, *width * *height * 2, NULL, NULL ); - mlt_properties_set_data( a_props, "alpha", alpha, *width * *height, NULL, NULL ); + mlt_frame_set_image( frame, *image, *width * *height * 2, NULL ); + mlt_frame_set_alpha( frame, alpha, *width * *height, NULL ); mlt_properties_set_int( a_props, "width", *width ); mlt_properties_set_int( a_props, "height", *height ); mlt_properties_set_int( a_props, "progressive", 1 ); diff --git a/src/modules/core/producer_colour.c b/src/modules/core/producer_colour.c index 7c1e19f7..03c41a2b 100644 --- a/src/modules/core/producer_colour.c +++ b/src/modules/core/producer_colour.c @@ -226,8 +226,8 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form memcpy( *buffer, image, size ); // Now update properties so we free the copy after - mlt_properties_set_data( properties, "image", *buffer, size, mlt_pool_release, NULL ); - mlt_properties_set_data( properties, "alpha", alpha, alpha_size, mlt_pool_release, NULL ); + mlt_frame_set_image( frame, *buffer, size, mlt_pool_release ); + mlt_frame_set_alpha( frame, alpha, alpha_size, mlt_pool_release ); mlt_properties_set_double( properties, "aspect_ratio", mlt_properties_get_double( producer_props, "aspect_ratio" ) ); mlt_properties_set_int( properties, "real_width", *width ); mlt_properties_set_int( properties, "real_height", *height ); diff --git a/src/modules/core/producer_consumer.c b/src/modules/core/producer_consumer.c index ba61f33e..22bb2322 100644 --- a/src/modules/core/producer_consumer.c +++ b/src/modules/core/producer_consumer.c @@ -52,7 +52,7 @@ static int get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format // Update the frame mlt_properties properties = mlt_frame_properties( frame ); - mlt_properties_set_data( properties, "image", new_image, size, mlt_pool_release, NULL ); + mlt_frame_set_image( frame, new_image, size, mlt_pool_release ); memcpy( new_image, *image, size ); mlt_properties_set( properties, "progressive", mlt_properties_get( MLT_FRAME_PROPERTIES(nested_frame), "progressive" ) ); *image = new_image; @@ -63,7 +63,7 @@ static int get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format { new_image = mlt_pool_alloc( size ); memcpy( new_image, alpha, size ); - mlt_properties_set_data( properties, "alpha", new_image, size, mlt_pool_release, NULL ); + mlt_frame_set_alpha( frame, new_image, size, mlt_pool_release ); } return result; diff --git a/src/modules/core/producer_hold.c b/src/modules/core/producer_hold.c index acd39ef8..da8a438f 100644 --- a/src/modules/core/producer_hold.c +++ b/src/modules/core/producer_hold.c @@ -119,12 +119,12 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form uint8_t *image = mlt_pool_alloc( size ); memcpy( image, *buffer, size ); *buffer = image; - mlt_properties_set_data( properties, "image", *buffer, size, mlt_pool_release, NULL ); + mlt_frame_set_image( frame, *buffer, size, mlt_pool_release ); } else { // Pass the current image as is - mlt_properties_set_data( properties, "image", *buffer, size, NULL, NULL ); + mlt_frame_set_image( frame, *buffer, size, NULL ); } // Make sure that no further scaling is done @@ -171,7 +171,7 @@ static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index { // Temporary fix - ensure that we aren't seen as a test frame int8_t *image = mlt_properties_get_data( MLT_FRAME_PROPERTIES( real_frame ), "image", NULL ); - mlt_properties_set_data( MLT_FRAME_PROPERTIES( *frame ), "image", image, 0, NULL, NULL ); + mlt_frame_set_image( *frame, image, 0, NULL ); mlt_properties_set_int( MLT_FRAME_PROPERTIES( *frame ), "test_image", 0 ); } diff --git a/src/modules/core/producer_noise.c b/src/modules/core/producer_noise.c index ae0dc21b..3c7a699e 100644 --- a/src/modules/core/producer_noise.c +++ b/src/modules/core/producer_noise.c @@ -78,9 +78,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form *buffer = mlt_pool_alloc( size ); // Update the frame - mlt_properties_set_data( properties, "image", *buffer, size, mlt_pool_release, NULL ); - mlt_properties_set_int( properties, "width", *width ); - mlt_properties_set_int( properties, "height", *height ); + mlt_frame_set_image( frame, *buffer, size, mlt_pool_release ); // Before we write to the image, make sure we have one if ( *buffer != NULL ) diff --git a/src/modules/core/producer_ppm.c b/src/modules/core/producer_ppm.c index faa27926..aeb35912 100644 --- a/src/modules/core/producer_ppm.c +++ b/src/modules/core/producer_ppm.c @@ -214,7 +214,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i fread( image, width * height * 3, 1, video ); // Pass the data on the frame properties - mlt_properties_set_data( properties, "image", image, width * ( height + 1 ) * 3, ( mlt_destructor )mlt_pool_release, NULL ); + mlt_frame_set_image( *frame, image, width * ( height + 1 ) * 3, mlt_pool_release ); mlt_properties_set_int( properties, "width", width ); mlt_properties_set_int( properties, "height", height ); mlt_properties_set_int( properties, "has_image", 1 ); diff --git a/src/modules/core/transition_composite.c b/src/modules/core/transition_composite.c index c8f92df6..ccceb513 100644 --- a/src/modules/core/transition_composite.c +++ b/src/modules/core/transition_composite.c @@ -1048,7 +1048,7 @@ mlt_frame composite_copy_region( mlt_transition this, mlt_frame a_frame, mlt_pos dest = mlt_pool_alloc( w * h * 2 ); // Assign to the new frame - mlt_properties_set_data( b_props, "image", dest, w * h * 2, mlt_pool_release, NULL ); + mlt_frame_set_image( b_frame, dest, w * h * 2, mlt_pool_release ); mlt_properties_set_int( b_props, "width", w ); mlt_properties_set_int( b_props, "height", h ); mlt_properties_set_int( b_props, "format", format ); diff --git a/src/modules/core/transition_region.c b/src/modules/core/transition_region.c index 9524dfc9..404faf1b 100644 --- a/src/modules/core/transition_region.c +++ b/src/modules/core/transition_region.c @@ -123,11 +123,11 @@ static uint8_t *filter_get_alpha_mask( mlt_frame this ) *p ++ = ( int )( ( ( *image ++ - 16 ) * 299 ) / 255 ); image ++; } - mlt_properties_set_data( MLT_FRAME_PROPERTIES( this ), "alpha", alpha, region_width * region_height, mlt_pool_release, NULL ); + mlt_frame_set_alpha( this, alpha, region_width * region_height, mlt_pool_release ); } else { - mlt_properties_set_data( MLT_FRAME_PROPERTIES( this ), "alpha", alpha, region_width * region_height, NULL, NULL ); + mlt_frame_set_alpha( this, alpha, region_width * region_height, NULL ); } this->get_alpha_mask = NULL; diff --git a/src/modules/dgraft/filter_telecide.c b/src/modules/dgraft/filter_telecide.c index 152683fb..d76f45ea 100644 --- a/src/modules/dgraft/filter_telecide.c +++ b/src/modules/dgraft/filter_telecide.c @@ -1062,7 +1062,7 @@ static int get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format // Do first and last lines. uint8_t *final = mlt_pool_alloc( image_size ); cx->finalp = final; - mlt_properties_set_data( frame_properties, "image", final, image_size, (mlt_destructor)mlt_pool_release, NULL ); + mlt_frame_set_image( frame, final, image_size, mlt_pool_release ); dstpn = cx->dstp + cx->dpitch; for ( cx->x = 0; cx->x < cx->w; cx->x++ ) { diff --git a/src/modules/dv/producer_libdv.c b/src/modules/dv/producer_libdv.c index 80c713c7..3d9eaf4e 100644 --- a/src/modules/dv/producer_libdv.c +++ b/src/modules/dv/producer_libdv.c @@ -326,7 +326,7 @@ static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_forma uint8_t *image = mlt_pool_alloc( *width * ( *height + 1 ) * 2 ); // Pass to properties for clean up - mlt_properties_set_data( properties, "image", image, *width * ( *height + 1 ) * 2, ( mlt_destructor )mlt_pool_release, NULL ); + mlt_frame_set_image( this, image, *width * ( *height + 1 ) * 2, mlt_pool_release ); // Decode the image pitches[ 0 ] = *width * 2; @@ -343,7 +343,7 @@ static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_forma uint8_t *image = mlt_pool_alloc( *width * ( *height + 1 ) * 3 ); // Pass to properties for clean up - mlt_properties_set_data( properties, "image", image, *width * ( *height + 1 ) * 3, ( mlt_destructor )mlt_pool_release, NULL ); + mlt_frame_set_image( this, image, *width * ( *height + 1 ) * 3, mlt_pool_release ); // Decode the frame pitches[ 0 ] = 720 * 3; diff --git a/src/modules/frei0r/frei0r_helper.c b/src/modules/frei0r/frei0r_helper.c index bbc08cea..f4a02984 100644 --- a/src/modules/frei0r/frei0r_helper.c +++ b/src/modules/frei0r/frei0r_helper.c @@ -155,7 +155,7 @@ int process_frei0r_item( mlt_service service, double position, mlt_properties pr rgba_bgra((uint8_t*) dest, (uint8_t*) result, *width, *height); } *image = (uint8_t*) result; - mlt_properties_set_data(MLT_FRAME_PROPERTIES(this), "image", result, video_area * sizeof(uint32_t), mlt_pool_release, NULL); + mlt_frame_set_image(this, (uint8_t*) result, video_area * sizeof(uint32_t), mlt_pool_release); if (extra) mlt_pool_release(extra); diff --git a/src/modules/frei0r/producer_frei0r.c b/src/modules/frei0r/producer_frei0r.c index dc8b0a1e..47e36cdf 100644 --- a/src/modules/frei0r/producer_frei0r.c +++ b/src/modules/frei0r/producer_frei0r.c @@ -43,9 +43,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form *buffer = mlt_pool_alloc( size ); // Update the frame - mlt_properties_set_data( properties, "image", *buffer, size, mlt_pool_release, NULL ); - mlt_properties_set_int( properties, "width", *width ); - mlt_properties_set_int( properties, "height", *height ); + mlt_frame_set_image( frame, *buffer, size, mlt_pool_release ); *format = mlt_image_rgb24a; if ( *buffer != NULL ) diff --git a/src/modules/gtk2/filter_rescale.c b/src/modules/gtk2/filter_rescale.c index 7639b05b..e4aa1b8c 100644 --- a/src/modules/gtk2/filter_rescale.c +++ b/src/modules/gtk2/filter_rescale.c @@ -62,9 +62,7 @@ static int filter_scale( mlt_frame this, uint8_t **image, mlt_image_format *form yuv422_scale_simple( output, owidth, oheight, ostride, *image, iwidth, iheight, istride, interp ); // Now update the frame - mlt_properties_set_data( properties, "image", output, owidth * ( oheight + 1 ) * 2, ( mlt_destructor )mlt_pool_release, NULL ); - mlt_properties_set_int( properties, "width", owidth ); - mlt_properties_set_int( properties, "height", oheight ); + mlt_frame_set_image( this, output, owidth * ( oheight + 1 ) * 2, mlt_pool_release ); // Return the output *image = output; @@ -109,9 +107,7 @@ static int filter_scale( mlt_frame this, uint8_t **image, mlt_image_format *form g_object_unref( scaled ); // Now update the frame - mlt_properties_set_data( properties, "image", output, owidth * ( oheight + 1 ) * bpp, ( mlt_destructor )mlt_pool_release, NULL ); - mlt_properties_set_int( properties, "width", owidth ); - mlt_properties_set_int( properties, "height", oheight ); + mlt_frame_set_image( this, output, owidth * ( oheight + 1 ) * bpp, mlt_pool_release ); // Return the output *image = output; diff --git a/src/modules/gtk2/producer_pango.c b/src/modules/gtk2/producer_pango.c index 74c0d464..2e4de192 100644 --- a/src/modules/gtk2/producer_pango.c +++ b/src/modules/gtk2/producer_pango.c @@ -485,7 +485,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form memcpy( *buffer, gdk_pixbuf_get_pixels( this->pixbuf ), image_size ); // Now update properties so we free the copy after - mlt_properties_set_data( properties, "image", *buffer, image_size, mlt_pool_release, NULL ); + mlt_frame_set_image( frame, *buffer, image_size, mlt_pool_release ); *format = mlt_image_rgb24a; } else diff --git a/src/modules/gtk2/producer_pixbuf.c b/src/modules/gtk2/producer_pixbuf.c index e839df20..b12d7811 100644 --- a/src/modules/gtk2/producer_pixbuf.c +++ b/src/modules/gtk2/producer_pixbuf.c @@ -443,7 +443,7 @@ static void refresh_image( producer_pixbuf this, mlt_frame frame, int width, int mlt_properties_set_int( cached_props, "height", this->height ); mlt_properties_set_int( cached_props, "real_width", mlt_properties_get_int( producer_props, "_real_width" ) ); mlt_properties_set_int( cached_props, "real_height", mlt_properties_get_int( producer_props, "_real_height" ) ); - mlt_properties_set_data( cached_props, "image", this->image, this->width * ( this->alpha ? 4 : 3 ) * this->height, mlt_pool_release, NULL ); + mlt_frame_set_image( cached, this->image, this->width * ( this->alpha ? 4 : 3 ) * this->height, mlt_pool_release ); mlt_properties_set_int( cached_props, "alpha", this->alpha ); mlt_properties_set_data( cache, image_key, cached, 0, ( mlt_destructor )mlt_frame_close, NULL ); } @@ -482,7 +482,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form uint8_t *image_copy = mlt_pool_alloc( image_size ); memcpy( image_copy, this->image, image_size ); // Now update properties so we free the copy after - mlt_properties_set_data( properties, "image", image_copy, image_size, mlt_pool_release, NULL ); + mlt_frame_set_image( frame, image_copy, image_size, mlt_pool_release ); // We're going to pass the copy on *buffer = image_copy; *format = this->alpha ? mlt_image_rgb24a : mlt_image_rgb24; diff --git a/src/modules/kdenlive/filter_freeze.c b/src/modules/kdenlive/filter_freeze.c index c4768e27..28feb895 100755 --- a/src/modules/kdenlive/filter_freeze.c +++ b/src/modules/kdenlive/filter_freeze.c @@ -99,7 +99,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * uint8_t *image_copy = mlt_pool_alloc( size ); memcpy( image_copy, buffer, size ); *image = image_copy; - mlt_properties_set_data( props, "image", *image, size, ( mlt_destructor ) mlt_pool_release, NULL ); + mlt_frame_set_image( this, *image, size, mlt_pool_release ); mlt_service_unlock( MLT_FILTER_SERVICE( filter ) ); return error; diff --git a/src/modules/kdenlive/filter_wave.c b/src/modules/kdenlive/filter_wave.c index 2e655f4c..10811866 100644 --- a/src/modules/kdenlive/filter_wave.c +++ b/src/modules/kdenlive/filter_wave.c @@ -81,7 +81,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format uint8_t *dst = mlt_pool_alloc (image_size); DoWave(*image, *width, (*height), dst, position, speed, factor, deformX, deformY); *image = dst; - mlt_properties_set_data( MLT_FRAME_PROPERTIES( frame ), "image", *image, image_size, mlt_pool_release, NULL ); + mlt_frame_set_image( frame, *image, image_size, mlt_pool_release ); } } diff --git a/src/modules/kdenlive/producer_framebuffer.c b/src/modules/kdenlive/producer_framebuffer.c index 72487866..6ec1740a 100644 --- a/src/modules/kdenlive/producer_framebuffer.c +++ b/src/modules/kdenlive/producer_framebuffer.c @@ -132,7 +132,7 @@ static int framebuffer_get_image( mlt_frame this, uint8_t **image, mlt_image_for // Set the output image *image = image_copy; - mlt_properties_set_data( frame_properties, "image", image_copy, size, ( mlt_destructor )mlt_pool_release, NULL ); + mlt_frame_set_image( this, image_copy, size, mlt_pool_release ); *width = mlt_properties_get_int( properties, "_output_width" ); *height = mlt_properties_get_int( properties, "_output_height" ); @@ -191,7 +191,7 @@ static int framebuffer_get_image( mlt_frame this, uint8_t **image, mlt_image_for // Set the output image *image = image_copy; - mlt_properties_set_data( frame_properties, "image", *image, size, ( mlt_destructor )mlt_pool_release, NULL ); + mlt_frame_set_image( this, *image, size, mlt_pool_release ); return 0; } diff --git a/src/modules/motion_est/producer_slowmotion.c b/src/modules/motion_est/producer_slowmotion.c index 1e4ba0c5..7e3a4cff 100644 --- a/src/modules/motion_est/producer_slowmotion.c +++ b/src/modules/motion_est/producer_slowmotion.c @@ -261,7 +261,7 @@ static int slowmotion_get_image( mlt_frame this, uint8_t **image, mlt_image_form } *image = output; - mlt_properties_set_data( frame_properties, "image", output, size, NULL, NULL ); + mlt_frame_set_image( this, output, size, NULL ); // Make sure that no further scaling is done mlt_properties_set( frame_properties, "rescale.interps", "none" ); diff --git a/src/modules/plus/filter_affine.c b/src/modules/plus/filter_affine.c index f8c21e2c..1318b281 100644 --- a/src/modules/plus/filter_affine.c +++ b/src/modules/plus/filter_affine.c @@ -105,8 +105,8 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * 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 ); - mlt_properties_set_data( frame_properties, "image", *image, *width * *height * 4, NULL, NULL ); - mlt_properties_set_data( frame_properties, "alpha", mlt_frame_get_alpha_mask( a_frame ), *width * *height, NULL, NULL ); + mlt_frame_set_image( this, *image, *width * *height * 4, NULL ); + mlt_frame_set_alpha( this, mlt_frame_get_alpha_mask( a_frame ), *width * *height, NULL ); } else { diff --git a/src/modules/plus/filter_charcoal.c b/src/modules/plus/filter_charcoal.c index 3c7c22cd..703b3224 100644 --- a/src/modules/plus/filter_charcoal.c +++ b/src/modules/plus/filter_charcoal.c @@ -138,7 +138,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * *image = temp; // Store new and destroy old - mlt_properties_set_data( MLT_FRAME_PROPERTIES( this ), "image", *image, *width * *height * 2, mlt_pool_release, NULL ); + mlt_frame_set_image( this, *image, *width * *height * 2, mlt_pool_release ); } return error; diff --git a/src/modules/qimage/producer_kdenlivetitle.c b/src/modules/qimage/producer_kdenlivetitle.c index 6a90abde..5c37d3a3 100644 --- a/src/modules/qimage/producer_kdenlivetitle.c +++ b/src/modules/qimage/producer_kdenlivetitle.c @@ -60,9 +60,6 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form *width = mlt_properties_get_int( properties, "rescale_width" ); *height = mlt_properties_get_int( properties, "rescale_height" ); - /* Allocate the image */ - int size = *width * ( *height ) * 4; - mlt_service_lock( MLT_PRODUCER_SERVICE( &this->parent ) ); /* Allocate the image */ @@ -86,12 +83,9 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form uint8_t *image_copy = mlt_pool_alloc( image_size ); memcpy( image_copy, this->current_image, image_size ); // Now update properties so we free the copy after - mlt_properties_set_data( properties, "image", image_copy, image_size, mlt_pool_release, NULL ); + mlt_frame_set_image( frame, image_copy, image_size, mlt_pool_release ); // We're going to pass the copy on *buffer = image_copy; - - /* Update the frame */ - mlt_properties_set_data( properties, "image", *buffer, size, mlt_pool_release, NULL ); mlt_log_debug( MLT_PRODUCER_SERVICE( &this->parent ), "width:%d height:%d %s\n", *width, *height, mlt_image_format_name( *format ) ); } diff --git a/src/modules/qimage/producer_qimage.c b/src/modules/qimage/producer_qimage.c index 561eef9f..7ad5a435 100644 --- a/src/modules/qimage/producer_qimage.c +++ b/src/modules/qimage/producer_qimage.c @@ -179,7 +179,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form uint8_t *image_copy = mlt_pool_alloc( image_size ); memcpy( image_copy, this->current_image, image_size ); // Now update properties so we free the copy after - mlt_properties_set_data( properties, "image", image_copy, image_size, mlt_pool_release, NULL ); + mlt_frame_set_image( frame, image_copy, image_size, mlt_pool_release ); // We're going to pass the copy on *buffer = image_copy; *format = this->has_alpha ? mlt_image_rgb24a : mlt_image_rgb24; diff --git a/src/modules/sdl/producer_sdl_image.c b/src/modules/sdl/producer_sdl_image.c index 0d624664..bb7bdfba 100644 --- a/src/modules/sdl/producer_sdl_image.c +++ b/src/modules/sdl/producer_sdl_image.c @@ -80,9 +80,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **image, mlt_image_forma SDL_FreeSurface( converted ); // Update the frame - mlt_properties_set_data( properties, "image", *image, image_size, mlt_pool_release, NULL ); - mlt_properties_set_int( properties, "width", *width ); - mlt_properties_set_int( properties, "height", *height ); + mlt_frame_set_image( frame, *image, image_size, mlt_pool_release ); return 0; } diff --git a/src/modules/swfdec/producer_swfdec.c b/src/modules/swfdec/producer_swfdec.c index 8f0d7008..a58d48c7 100644 --- a/src/modules/swfdec/producer_swfdec.c +++ b/src/modules/swfdec/producer_swfdec.c @@ -125,7 +125,7 @@ static int get_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *forma *format = mlt_image_rgb24a; *buffer = mlt_pool_alloc( *width * ( *height + 1 ) * 4 ); - mlt_properties_set_data( properties, "image", *buffer, *width * ( *height + 1 ) * 4, (mlt_destructor) mlt_pool_release, NULL ); + mlt_frame_set_image( frame, *buffer, *width * ( *height + 1 ) * 4, mlt_pool_release ); // Seek mlt_position pos = mlt_properties_get_position( properties, "swfdec.position" ); diff --git a/src/modules/vmfx/producer_pgm.c b/src/modules/vmfx/producer_pgm.c index 6713317c..3988da64 100644 --- a/src/modules/vmfx/producer_pgm.c +++ b/src/modules/vmfx/producer_pgm.c @@ -161,7 +161,7 @@ static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_forma uint8_t *image = mlt_pool_alloc( size * 2 ); uint8_t *source = mlt_properties_get_data( MLT_PRODUCER_PROPERTIES( producer ), "image", NULL ); - mlt_properties_set_data( MLT_FRAME_PROPERTIES( this ), "image", image, size * 2, mlt_pool_release, NULL ); + mlt_frame_set_image( this, image, size * 2, mlt_pool_release ); *width = real_width; *height = real_height; diff --git a/src/modules/xine/filter_deinterlace.c b/src/modules/xine/filter_deinterlace.c index e864c805..c028da91 100644 --- a/src/modules/xine/filter_deinterlace.c +++ b/src/modules/xine/filter_deinterlace.c @@ -247,7 +247,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * uint8_t *new_image = mlt_pool_alloc( image_size ); deinterlace_yuv( new_image, image, *width * 2, *height, method ); - mlt_properties_set_data( properties, "image", new_image, image_size, mlt_pool_release, NULL ); + mlt_frame_set_image( this, new_image, image_size, mlt_pool_release ); *image = new_image; } } -- 2.39.2