mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2024-12-25 04:11:38 +00:00
Add comments, change array iteration
This commit is contained in:
parent
73f3c83940
commit
e919f1b9f5
@ -95,7 +95,7 @@ static const char *smptett_header = "<?xml version=\"1.0\" encoding=\"UTF-8\" st
|
||||
" <body>\n"
|
||||
" <div>\n";
|
||||
|
||||
static const char *webvtt_header[] = {"WEBVTT","\r\n","\r\n","STYLE","\r\n"};
|
||||
static const char *webvtt_header[] = {"WEBVTT","\r\n","\r\n","STYLE","\r\n",NULL};
|
||||
|
||||
static const char *simple_xml_header = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<captions>\r\n";
|
||||
|
||||
@ -448,21 +448,17 @@ static int write_subtitle_file_header(struct encoder_ctx *ctx, struct ccx_s_writ
|
||||
ret = write_bom(ctx, out);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
for(int i = 0; i < sizeof(webvtt_header)/sizeof(webvtt_header[0]);i++)
|
||||
for(int i = 0; webvtt_header[i]!=NULL ;i++)
|
||||
{
|
||||
header_size += strlen(webvtt_header[i]);
|
||||
if(ccx_options.enc_cfg.line_terminator_lf == 1 && strcmp(webvtt_header[i],"\r\n")==0)
|
||||
{
|
||||
header_size--;
|
||||
}
|
||||
header_size += strlen(webvtt_header[i]); // Find total size of the header
|
||||
}
|
||||
REQUEST_BUFFER_CAPACITY(ctx, header_size*3);
|
||||
for(int i = 0; i < sizeof(webvtt_header)/sizeof(webvtt_header[0]);i++)
|
||||
for(int i = 0; webvtt_header[i]!=NULL;i++)
|
||||
{
|
||||
if(ccx_options.enc_cfg.line_terminator_lf == 1 && strcmp(webvtt_header[i],"\r\n")==0)
|
||||
if(ccx_options.enc_cfg.line_terminator_lf == 1 && strcmp(webvtt_header[i],"\r\n")==0) // If -lf parameter passed, write LF instead of CRLF
|
||||
{
|
||||
used = encode_line (ctx, ctx->buffer,(unsigned char *) "\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
used = encode_line (ctx, ctx->buffer,(unsigned char *) webvtt_header[i]);
|
||||
|
@ -227,7 +227,7 @@ int write_webvtt_header(struct encoder_ctx *context)
|
||||
write (context->out->fh, outline_css_file, strlen(outline_css_file));
|
||||
} else {
|
||||
write(context->out->fh, webvtt_inline_css, strlen(webvtt_inline_css));
|
||||
if(ccx_options.enc_cfg.line_terminator_lf == 1)
|
||||
if(ccx_options.enc_cfg.line_terminator_lf == 1) // If -lf parameter is set.
|
||||
{
|
||||
write(context->out->fh, "\n", 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user