]> git.sesse.net Git - mlt/blobdiff - src/modules/core/filter_imageconvert.c
Let loader producer use new GLSL normalizing filters (opengl branch).
[mlt] / src / modules / core / filter_imageconvert.c
index 99378604b1658a062a915bc7d81476abc49f0b27..33c938802ce8762a91d1d840e24c09982cdcf8b8 100644 (file)
@@ -324,8 +324,9 @@ static int convert_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *f
        {
                conversion_function converter = conversion_matrix[ *format - 1 ][ requested_format - 1 ];
 
-               mlt_log_debug( NULL, "[filter imageconvert] %s -> %s\n",
-                       mlt_image_format_name( *format ), mlt_image_format_name( requested_format ) );
+               mlt_log_debug( NULL, "[filter imageconvert] %s -> %s @ %dx%d\n",
+                       mlt_image_format_name( *format ), mlt_image_format_name( requested_format ),
+                       width, height );
                if ( converter )
                {
                        int size = width * height * bpp_table[ requested_format - 1 ];
@@ -336,15 +337,17 @@ static int convert_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *f
                                         ? mlt_pool_alloc( width * height ) : NULL;
                        if ( requested_format == mlt_image_rgb24a || requested_format == mlt_image_opengl )
                        {
+                               if ( alpha )
+                                       mlt_pool_release( alpha );
                                alpha = mlt_frame_get_alpha_mask( frame );
                                mlt_properties_get_data( properties, "alpha", &alpha_size );
                        }
 
                        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;
                        }
@@ -360,8 +363,6 @@ static int convert_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *f
                        error = 1;
                }
        }
-       if ( !error )
-               mlt_properties_set_int( properties, "format", *format );
 
        return error;
 }
@@ -371,7 +372,8 @@ static int convert_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *f
 
 static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
 {
-       frame->convert_image = convert_image;
+       if ( !frame->convert_image )
+               frame->convert_image = convert_image;
        return frame;
 }
 
@@ -380,7 +382,7 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
 
 mlt_filter filter_imageconvert_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
 {
-       mlt_filter this = calloc( sizeof( struct mlt_filter_s ), 1 );
+       mlt_filter this = calloc( 1, sizeof( struct mlt_filter_s ) );
        if ( mlt_filter_init( this, this ) == 0 )
        {
                this->process = filter_process;