]> git.sesse.net Git - mlt/blobdiff - src/modules/core/filter_imageconvert.c
Fix calloc() parameter ordering
[mlt] / src / modules / core / filter_imageconvert.c
index 19342114c2105124094aed9c7338d12f54118c9d..f651f172a067b67955effd116690c0c90e42e59e 100644 (file)
@@ -160,8 +160,6 @@ static int convert_rgb24a_to_yuv422( uint8_t *rgba, uint8_t *yuv, uint8_t *alpha
                        RGB2YUV_601( r, g, b, y0, u0 , v0 );
                        *d++ = y0;
                        *d++ = u0;
-                       *d++ = y0;
-                       *d++ = v0;
                }
        }
        else
@@ -195,8 +193,6 @@ static int convert_rgb24a_to_yuv422( uint8_t *rgba, uint8_t *yuv, uint8_t *alpha
                        RGB2YUV_601( r, g, b, y0, u0 , v0 );
                        *d++ = y0;
                        *d++ = u0;
-                       *d++ = y0;
-                       *d++ = v0;
                }
        }
 
@@ -239,8 +235,6 @@ static int convert_rgb24_to_yuv422( uint8_t *rgb, uint8_t *yuv, uint8_t *alpha,
                        RGB2YUV_601( r, g, b, y0, u0 , v0 );
                        *d++ = y0;
                        *d++ = u0;
-                       *d++ = y0;
-                       *d++ = v0;
                }
        }
        return ret;
@@ -343,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;
                        }
@@ -367,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;
 }
@@ -387,7 +381,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;