From 125e716b9306d8743294e996522abe3b6f00fab4 Mon Sep 17 00:00:00 2001 From: ddennedy Date: Thu, 29 Jan 2009 05:04:47 +0000 Subject: [PATCH] producer_pixbuf.c, producer_qimage.c, producer_sdl_image.c: bugfix (kdenlive-575) large memory consumption loading many pictures. git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1331 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/modules/gtk2/producer_pixbuf.c | 7 ++++--- src/modules/qimage/producer_qimage.c | 7 ++++--- src/modules/sdl/producer_sdl_image.c | 5 ++++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/modules/gtk2/producer_pixbuf.c b/src/modules/gtk2/producer_pixbuf.c index 9e0d4cfc..45e87704 100644 --- a/src/modules/gtk2/producer_pixbuf.c +++ b/src/modules/gtk2/producer_pixbuf.c @@ -84,12 +84,13 @@ mlt_producer producer_pixbuf_init( char *filename ) mlt_frame frame = mlt_frame_init( MLT_PRODUCER_SERVICE( producer ) ); if ( frame ) { - mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); - mlt_properties_set_data( properties, "producer_pixbuf", this, 0, NULL, NULL ); + mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame ); + mlt_properties_set_data( frame_properties, "producer_pixbuf", this, 0, NULL, NULL ); mlt_frame_set_position( frame, mlt_producer_position( producer ) ); - mlt_properties_set_position( properties, "pixbuf_position", mlt_producer_position( producer ) ); + mlt_properties_set_position( frame_properties, "pixbuf_position", mlt_producer_position( producer ) ); refresh_image( frame, 0, 0 ); mlt_frame_close( frame ); + mlt_properties_set_data( properties, "_pixbuf", NULL, 0, NULL, NULL ); } } if ( this->width == 0 ) diff --git a/src/modules/qimage/producer_qimage.c b/src/modules/qimage/producer_qimage.c index bd3b0eaf..022dd915 100644 --- a/src/modules/qimage/producer_qimage.c +++ b/src/modules/qimage/producer_qimage.c @@ -67,12 +67,13 @@ mlt_producer producer_qimage_init( mlt_profile profile, mlt_service_type type, c mlt_frame frame = mlt_frame_init( MLT_PRODUCER_SERVICE( producer ) ); if ( frame ) { - mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); - mlt_properties_set_data( properties, "producer_qimage", this, 0, NULL, NULL ); + mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame ); + mlt_properties_set_data( frame_properties, "producer_qimage", this, 0, NULL, NULL ); mlt_frame_set_position( frame, mlt_producer_position( producer ) ); - mlt_properties_set_position( properties, "qimage_position", mlt_producer_position( producer ) ); + mlt_properties_set_position( frame_properties, "qimage_position", mlt_producer_position( producer ) ); refresh_qimage( frame, 0, 0 ); mlt_frame_close( frame ); + mlt_properties_set_data( properties, "_qimage", NULL, 0, NULL, NULL ); } } if ( this->current_width == 0 ) diff --git a/src/modules/sdl/producer_sdl_image.c b/src/modules/sdl/producer_sdl_image.c index 9c3bd8b7..19f4f4b0 100644 --- a/src/modules/sdl/producer_sdl_image.c +++ b/src/modules/sdl/producer_sdl_image.c @@ -155,7 +155,7 @@ static SDL_Surface *load_image( mlt_producer producer ) image_idx = ( int )floor( ( double )position / ttl ) % mlt_properties_count( filenames ); this_resource = mlt_properties_get_value( filenames, image_idx ); - if ( last_resource == NULL || strcmp( last_resource, this_resource ) ) + if ( surface == NULL || last_resource == NULL || strcmp( last_resource, this_resource ) ) { surface = IMG_Load( this_resource ); if ( surface != NULL ) @@ -163,6 +163,8 @@ static SDL_Surface *load_image( mlt_producer producer ) surface->refcount ++; mlt_properties_set_data( properties, "_surface", surface, 0, ( mlt_destructor )SDL_FreeSurface, 0 ); mlt_properties_set( properties, "_last_resource", this_resource ); + mlt_properties_set_int( properties, "_real_width", surface->w ); + mlt_properties_set_int( properties, "_real_height", surface->h ); } } else if ( surface != NULL ) @@ -244,6 +246,7 @@ mlt_producer producer_sdl_image_init( mlt_profile profile, mlt_service_type type if ( file && ( surface = load_image( producer ) ) ) { SDL_FreeSurface( surface ); + mlt_properties_set_data( properties, "_surface", NULL, 0, NULL, NULL ); } else { -- 2.39.2