[FIX] #1516 in webvtt added support to two-three-four utf-8 bytes (#1518)

* in webvtt added support to two-three-four utf-8 bytes
This commit is contained in:
Chidam
2023-03-27 07:09:46 +05:30
committed by GitHub
parent 7994096669
commit fa85a5270d

View File

@@ -470,6 +470,7 @@ int write_cc_buffer_as_webvtt(struct eia608_screen *data, struct encoder_ctx *co
// Write symbol by symbol with events
for (int j = 0; j < length; j++)
{
if (ccx_options.use_webvtt_styling)
{
// opening events for fonts
@@ -494,7 +495,37 @@ int write_cc_buffer_as_webvtt(struct eia608_screen *data, struct encoder_ctx *co
// write current text symbol
if (context->subline[j] != '\0')
write_wrapped(context->out->fh, &(context->subline[j]), 1);
if ((context->subline[j]) > 240)
{ // 4bytes
char c[4];
c[0] = context->subline[j];
c[1] = context->subline[j + 1];
c[2] = context->subline[j + 2];
c[3] = context->subline[j + 3];
write_wrapped(context->out->fh, c, 4);
}
else if ((context->subline[j]) > 224)
{ // 3bytes
char c[3];
c[0] = context->subline[j];
c[1] = context->subline[j + 1];
c[2] = context->subline[j + 2];
write_wrapped(context->out->fh, c, 3);
}
else if ((context->subline[j]) > 192)
{ // 2bytes
char c[2];
c[0] = context->subline[j];
c[1] = context->subline[j + 1];
write_wrapped(context->out->fh, c, 2);
}
else if ((context->subline[j]) > 128 && (context->subline[j]) < 192)
{
}
else
{ // 1byte
write_wrapped(context->out->fh, &(context->subline[j]), 1);
}
if (ccx_options.use_webvtt_styling)
{