diff --git a/src/lib_ccx/ccx_encoders_smptett.c b/src/lib_ccx/ccx_encoders_smptett.c index becf4260..79500444 100644 --- a/src/lib_ccx/ccx_encoders_smptett.c +++ b/src/lib_ccx/ccx_encoders_smptett.c @@ -365,11 +365,63 @@ int write_cc_buffer_as_smptett(struct eia608_screen *data, struct encoder_ctx *c } } - else - { - //NO styling, writing as it is.\n"); - strcpy(final,(context->subline)); - } + else //No style or Font Color + { + + start = strstr((context->subline), " cc + if(start!=NULL) //font color attribute is present + { + unsigned char *end = strstr((context->subline), ""); + if(end == NULL) + { + //Incorrect styling, writing as it is + strcpy(final,(context->subline)); + } + + else + { + int start_index = start-(context->subline); + int end_index = end-(context->subline); + + strncat(final,(context->subline),start_index); // copying content before opening tag e.g. + + strcat(final,""); //adding : replacement of + + + unsigned char *temp_pointer = strchr((context->subline),'#'); //locating color code + + unsigned char *color_code=malloc(7); + strncat(color_code,(context->subline) + (temp_pointer - (context->subline) + 1),6); //obtained color code + + + temp_pointer = strchr((context->subline), '>'); //The content is in between and + + strncat(temp, (context->subline) + (temp_pointer - (context->subline) + 1), end_index - (temp_pointer - (context->subline) + 1)); + + strcat(final,temp); //attaching to final sentence. + + sprintf(temp,"