mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2024-12-23 11:27:38 +00:00
Correct broken rcwt
Signed-off-by: Anshul Maheshwari <er.anshul.maheshwari@gmail.com>
This commit is contained in:
parent
1d03bd7d13
commit
beccc3d5b7
@ -667,6 +667,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
// Write last header and data
|
||||
writercwtdata (dec_ctx, NULL, &dec_sub);
|
||||
if (dec_sub.got_output)
|
||||
{
|
||||
encode_sub(enc_ctx,&dec_sub);
|
||||
dec_sub.got_output = 0;
|
||||
}
|
||||
}
|
||||
dinit_encoder(enc_ctx);
|
||||
}
|
||||
|
@ -564,6 +564,14 @@ int encode_sub(struct encoder_ctx *context, struct cc_subtitle *sub)
|
||||
}
|
||||
|
||||
}
|
||||
if (sub->type == CC_RAW)
|
||||
{
|
||||
if (context->send_to_srv)
|
||||
net_send_header(sub->data, sub->nb_data);
|
||||
else
|
||||
write(context->out->fh, sub->data, sub->nb_data);
|
||||
sub->nb_data = 0;
|
||||
}
|
||||
if (!sub->nb_data)
|
||||
freep(&sub->data);
|
||||
return wrote_something;
|
||||
|
@ -23,9 +23,17 @@ int writeraw (const unsigned char *data, int length, void *private_data, struct
|
||||
if (data==NULL)
|
||||
return -1;
|
||||
|
||||
/* TODO dont write directly to file instead follow complete path and write raw data in sub and in above
|
||||
layer choose whether u want to write it to file or not */
|
||||
write (context->out->fh, data, length);
|
||||
sub->data = realloc(sub->data,length + sub->nb_data);
|
||||
if (!sub->data)
|
||||
return EXIT_NOT_ENOUGH_MEMORY;
|
||||
|
||||
memcpy(sub->data + sub->nb_data, data, length);
|
||||
sub->got_output = 1;
|
||||
sub->nb_data += length;
|
||||
sub->type = CC_RAW;
|
||||
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
void flushbuffer (struct lib_ccx_ctx *ctx, struct ccx_s_write *wb, int closefile)
|
||||
@ -215,8 +223,8 @@ void writercwtdata (struct lib_cc_decode *ctx, const unsigned char *data, struct
|
||||
|
||||
memcpy(cbbuffer, "\x04\x80\x80", 3); // Field 1 padding
|
||||
memcpy(cbbuffer+3, "\x05\x80\x80", 3); // Field 2 padding
|
||||
ctx->writedata(cbheader, 10, ctx->context_cc608_field_1, NULL);
|
||||
ctx->writedata(cbbuffer, 3 * cbcount, ctx->context_cc608_field_1, NULL);
|
||||
ctx->writedata(cbheader, 10, ctx->context_cc608_field_1, sub);
|
||||
ctx->writedata(cbbuffer, 3 * cbcount, ctx->context_cc608_field_1, sub);
|
||||
|
||||
cbcount = 0;
|
||||
cbempty = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user