]> git.sesse.net Git - mlt/blobdiff - src/modules/core/producer_colour.c
add mlt_image_none support to producers
[mlt] / src / modules / core / producer_colour.c
index e5188fa7c056df41c9e8ac7e33b4bee45ae02c13..91c354b134d296433ed241dd400b85e60f589a27 100644 (file)
@@ -125,6 +125,14 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
        }
        rgba_color color = parse_color( now, mlt_properties_get_int( producer_props, "resource" ) );
 
+       // Choose suitable out values if nothing specific requested
+       if ( *format == mlt_image_none )
+               *format = mlt_image_rgb24a;
+       if ( *width <= 0 )
+               *width = mlt_service_profile( MLT_PRODUCER_SERVICE(producer) )->width;
+       if ( *height <= 0 )
+               *height = mlt_service_profile( MLT_PRODUCER_SERVICE(producer) )->height;
+
        // See if we need to regenerate
        if ( strcmp( now, then ) || *width != current_width || *height != current_height || *format != current_format )
        {
@@ -181,8 +189,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
                                *p ++ = color.b;
                        }
                        break;
-               case mlt_image_rgb24a:
-               case mlt_image_opengl:
+               default:
                        while ( --i )
                        {
                                *p ++ = color.r;
@@ -191,8 +198,6 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
                                *p ++ = color.a;
                        }
                        break;
-               default:
-                       break;
                }
        }
        else