Tractor frame handling reworked; fix to composite for key diffs of 1; added mlt_consu...
[melted] / src / modules / core / producer_colour.c
index 2290b9d..bee525a 100644 (file)
@@ -48,9 +48,7 @@ mlt_producer producer_colour_init( char *colour )
                producer->close = producer_close;
 
                // Set the default properties
-               if ( colour == NULL )
-                       colour = "0x000000ff";
-               mlt_properties_set( properties, "resource", colour );
+               mlt_properties_set( properties, "resource", colour == NULL ? "0x000000ff" : colour );
                
                return producer;
        }
@@ -136,14 +134,16 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
                // Color the image
                rgba_color color = parse_color( mlt_properties_get( producer_props, "resource" ) );
                uint8_t y, u, v;
-               int i;
+               int i = 0;
                RGB2YUV( color.r, color.g, color.b, y, u, v );
-               color.r = y;
-               color.g = u;
-               color.b = y;
-               color.a = v;
-               for ( i = 0; i < size; i += 4 )
-                       memcpy( &image[ i ], &color, 4 );
+
+               while ( i < size )
+               {
+                       image[ i ++ ] = y;
+                       image[ i ++ ] = u;
+                       image[ i ++ ] = y;
+                       image[ i ++ ] = v;
+               }
        }
 
        // Update the frame
@@ -193,8 +193,10 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
 
                // Set producer-specific frame properties
                mlt_properties_set_int( properties, "progressive", 1 );
+               mlt_properties_set_int( properties, "aspect_ratio", 1 );
 
                // colour is an alias for resource
+               // CY: Do we really need this?
                if ( mlt_properties_get( producer_props, "colour" ) != NULL )
                        mlt_properties_set( producer_props, "resource", mlt_properties_get( producer_props, "colour" ) );
                
@@ -214,4 +216,3 @@ static void producer_close( mlt_producer producer )
        mlt_producer_close( producer );
        free( producer );
 }
-