]> git.sesse.net Git - mlt/commitdiff
Fix regression in commit f9dbf1.
authorDan Dennedy <dan@dennedy.org>
Tue, 7 Sep 2010 01:35:50 +0000 (18:35 -0700)
committerDan Dennedy <dan@dennedy.org>
Tue, 7 Sep 2010 01:35:50 +0000 (18:35 -0700)
Sometimes a frame may not have an alpha channel nor "scaled_width" and
"scaled_height" properties thereby yielding a default alpha with size
0x0. The fix is to add a check for valid alpha size. Also, make the
tractor pass a size for the alpha channel instead of just 0.

src/framework/mlt_tractor.c
src/modules/avformat/filter_avcolour_space.c

index 4d4d722e0a283d22cad858b450719ab3bd532a90..b8a46d9d0d238b527598c1890ae29b5525e40f21 100644 (file)
@@ -260,6 +260,7 @@ mlt_producer mlt_tractor_get_track( mlt_tractor this, int index )
 static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable )
 {
        uint8_t *data = NULL;
+       int size = 0;
        mlt_properties properties = MLT_FRAME_PROPERTIES( this );
        mlt_frame frame = mlt_frame_pop_service( this );
        mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame );
@@ -280,7 +281,8 @@ static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_forma
        mlt_properties_set_int( properties, "progressive", mlt_properties_get_int( frame_properties, "progressive" ) );
        mlt_properties_set_int( properties, "distort", mlt_properties_get_int( frame_properties, "distort" ) );
        data = mlt_frame_get_alpha_mask( frame );
-       mlt_properties_set_data( properties, "alpha", data, 0, NULL, NULL );
+       mlt_properties_get_data( frame_properties, "alpha", &size );
+       mlt_properties_set_data( properties, "alpha", data, size, NULL, NULL );
        return 0;
 }
 
index 6216d8cec74ab668d1e20c46e7bb85af6c16014c..ff7557fa414c36cd94d04fd751af6f2fa55b11cb 100644 (file)
@@ -171,9 +171,11 @@ static int convert_image( mlt_frame frame, uint8_t **image, mlt_image_format *fo
                if ( output_format == mlt_image_rgb24a || output_format == mlt_image_opengl )
                {
                        register int len = width * height;
+                       int alpha_size = 0;
                        uint8_t *alpha = mlt_frame_get_alpha_mask( frame );
+                       mlt_properties_get_data( properties, "alpha", &alpha_size );
 
-                       if ( alpha )
+                       if ( alpha && alpha_size >= len )
                        {
                                // Merge the alpha mask from into the RGBA image using Duff's Device
                                register uint8_t *s = alpha;