From: Dan Dennedy Date: Sat, 15 Feb 2014 19:28:25 +0000 (-0800) Subject: Refactor producer color to use mlt_properties_get_color(). X-Git-Url: https://git.sesse.net/?p=mlt;a=commitdiff_plain;h=29298bd6b1862840bcc473b8a158d255fccaaebb Refactor producer color to use mlt_properties_get_color(). --- 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 )