diff --git a/src/lib_ccx/ccx_decoders_common.c b/src/lib_ccx/ccx_decoders_common.c index 34a598b6..019c9720 100644 --- a/src/lib_ccx/ccx_decoders_common.c +++ b/src/lib_ccx/ccx_decoders_common.c @@ -459,11 +459,6 @@ struct encoder_ctx* copy_encoder_context(struct encoder_ctx *ctx) ctx_copy->end_credits_text = malloc(strlen(ctx->end_credits_text) * sizeof(char)); memcpy(ctx_copy->end_credits_text, ctx->end_credits_text, (strlen(ctx->end_credits_text) + 1) * sizeof(char)); } - if (ctx->sbs_buffer) - { - ctx_copy->sbs_buffer = malloc((strlen(ctx->sbs_buffer) + 2) * sizeof(unsigned char)); - memcpy(ctx_copy->sbs_buffer, ctx->sbs_buffer, (strlen(ctx->sbs_buffer) + 2) * sizeof(unsigned char)); - } return ctx_copy; } struct lib_cc_decode* copy_decoder_context(struct lib_cc_decode *ctx) @@ -537,7 +532,6 @@ void free_encoder_context(struct encoder_ctx *ctx) freep(&ctx->subline); freep(&ctx->start_credits_text); freep(&ctx->end_credits_text); - freep(&ctx->sbs_buffer); freep(&ctx->prev); freep(&ctx); } diff --git a/src/lib_ccx/ccx_encoders_splitbysentence.c b/src/lib_ccx/ccx_encoders_splitbysentence.c index 7f898528..1d1525c7 100644 --- a/src/lib_ccx/ccx_encoders_splitbysentence.c +++ b/src/lib_ccx/ccx_encoders_splitbysentence.c @@ -8,6 +8,8 @@ * https://github.com/maxkoryukov/ccextractor/issues * Only SBS-related bugs! * + * IMPORTANT: SBS is color-blind, and color tags mislead SBS. + * Please, use `-sbs` option with `-nodvbcolor` (actual for CCE 0.8.5) */ #include "ccx_common_platform.h" diff --git a/tests/ccx_encoders_splitbysentence_suite.c b/tests/ccx_encoders_splitbysentence_suite.c index 1076cf8b..c1c14fad 100644 --- a/tests/ccx_encoders_splitbysentence_suite.c +++ b/tests/ccx_encoders_splitbysentence_suite.c @@ -67,16 +67,6 @@ struct cc_subtitle * helper_sbs_append_sub_from_file(FILE * fd, struct encoder_c return sub; } -// struct cc_subtitle * wrapper_sbs_append_string(char * str, LLONG time_from, LLONG time_trim, struct encoder_ctx * context) { -// char * str1; -// struct cc_subtitle * sub; - -// str1 = strdup(str); -// sub = sbs_append_string(str1, time_from, time_trim, context); -// free(str1); -// return sub; -// } - struct cc_subtitle * helper_create_sub(char * str, LLONG time_from, LLONG time_trim) { struct cc_bitmap* rect; struct cc_subtitle * sub = (struct cc_subtitle *)malloc(sizeof(struct cc_subtitle)); @@ -209,8 +199,6 @@ END_TEST START_TEST(test_sbs_append_string_two_with_broken_sentence) { - // important !! - // summary len == 32 char * test_strings[] = { "First string", " ends here, deabbea." @@ -307,6 +295,7 @@ chance after being appointed the Scottish FA's new Performance Director."); // TODO : It is too hard to fix this error automatically (hard for me) // May be someone knows, how to implement this checker, and then next // assertion could be uncommented +// maxkoryukov/ccextractor#3 /* ck_assert_str_eq(sub->data, "Mackay was sacked by Cardiff in 2013 after it \ emerged he sent racist There has been some opposition When I said at the time, \ @@ -316,15 +305,36 @@ I deeply to his appointment but he's asked regret."); ck_assert_int_eq(sub->end_time, 38924); - skip = 15; + skip = 19; while (skip-- > 0) { -printf("%d\n", skip); + +// if (sub != NULL) { +// printf("%d :> [%s]\n", skip, sub->data); +// } sub = helper_sbs_append_sub_from_file(fsample, context); - // TODO : this 15 subs should give an empty response + // TODO : this subs should give an empty response // But the algorithm is not smart enough -// ck_assert_ptr_eq(sub, NULL); + // maxkoryukov/ccextractor#3 + /* + ck_assert_ptr_eq(sub, NULL); + */ } + sub = helper_sbs_append_sub_from_file(fsample, context); + ck_assert_ptr_ne(sub, NULL); +// TODO : It is too hard to fix this error automatically (hard for me) +// May be someone knows, how to implement this checker, and then next +// assertion could be uncommented +// maxkoryukov/ccextractor#3 + /* + ck_assert_str_eq(sub->data, "It was said in I am in support to \ +shoot support to shoot —— I spoke to the two individuals that were \ +involved." + ); + ck_assert_int_eq(sub->start_time, 38925); + */ + ck_assert_int_eq(sub->end_time, 47406); + fclose(fsample); } END_TEST diff --git a/tests/samples/sbs_append_string_00 b/tests/samples/sbs_append_string_00 index 9ef85b0e..632b4b5a 100644 --- a/tests/samples/sbs_append_string_00 +++ b/tests/samples/sbs_append_string_00 @@ -32,12 +32,13 @@ 45529 45734 regret It was said in I am in\nsupport to shoot —— I spoke 45735 46277 regret It was said in I am in\nsupport to shoot —— I spoke to 46278 46389 regret It was said in I am in\nsupport to shoot —— I spoke to the - 46390 46643 support to shoot —— I spoke to the\ntwo 46644 46821 support to shoot —— I spoke to the\ntwo individuals 46822 46967 support to shoot —— I spoke to the\ntwo individuals that 46968 47187 support to shoot —— I spoke to the\ntwo individuals that were 47188 47406 support to shoot —— I spoke to the\ntwo individuals that were involved. + + 47407 50240 two individuals that were involved.\nWhat 50241 50432 two individuals that were involved.\nWhat will 50433 50589 two individuals that were involved.\nWhat will you