X-Git-Url: https://git.sesse.net/?p=mlt;a=blobdiff_plain;f=src%2Fmodules%2Fcore%2Fproducer_colour.c;h=bb9427cc40d2783f8983739c601facce6f15fd83;hp=0121689ec1b57c86c7080681b8d4d91f66f3478c;hb=29298bd6b1862840bcc473b8a158d255fccaaebb;hpb=2e68fffb70736b6cdc300031f9edb6028ac29d79 diff --git a/src/modules/core/producer_colour.c b/src/modules/core/producer_colour.c index 0121689e..bb9427cc 100644 --- a/src/modules/core/producer_colour.c +++ b/src/modules/core/producer_colour.c @@ -27,11 +27,6 @@ #include -typedef struct -{ - uint8_t r, g, b, a; -} rgba_color; - static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int index ); static void producer_close( mlt_producer parent ); @@ -58,45 +53,6 @@ mlt_producer producer_colour_init( mlt_profile profile, mlt_service_type type, c return NULL; } -rgba_color parse_color( char *color, unsigned int color_int ) -{ - rgba_color result = { 0xff, 0xff, 0xff, 0xff }; - - if ( !strcmp( color, "red" ) ) - { - result.r = 0xff; - result.g = 0x00; - result.b = 0x00; - } - else if ( !strcmp( color, "green" ) ) - { - result.r = 0x00; - result.g = 0xff; - result.b = 0x00; - } - else if ( !strcmp( color, "blue" ) ) - { - result.r = 0x00; - result.g = 0x00; - result.b = 0xff; - } - else if ( !strcmp( color, "black" ) ) - { - result.r = 0x00; - result.g = 0x00; - result.b = 0x00; - } - else if ( strcmp( color, "white" ) ) - { - result.r = ( color_int >> 24 ) & 0xff; - result.g = ( color_int >> 16 ) & 0xff; - result.b = ( color_int >> 8 ) & 0xff; - result.a = ( color_int ) & 0xff; - } - - return result; -} - static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable ) { // Obtain properties of frame @@ -129,7 +85,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form free( now ); now = mlt_properties_get( producer_props, "resource" ); } - rgba_color color = parse_color( now, mlt_properties_get_int( producer_props, "resource" ) ); + mlt_color color = mlt_properties_get_color( producer_props, "resource" ); // Choose suitable out values if nothing specific requested if ( *format == mlt_image_none )