producer_pixbuf.c, producer_qimage.c, producer_sdl_image.c:
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Thu, 29 Jan 2009 05:04:47 +0000 (05:04 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Thu, 29 Jan 2009 05:04:47 +0000 (05:04 +0000)
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
src/modules/qimage/producer_qimage.c
src/modules/sdl/producer_sdl_image.c

index 9e0d4cf..45e8770 100644 (file)
@@ -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 )
index bd3b0ea..022dd91 100644 (file)
@@ -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 )
index 9c3bd8b..19f4f4b 100644 (file)
@@ -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
                {