From c78db1dd248f86232ca31d82c1d03bfbfb05f2e6 Mon Sep 17 00:00:00 2001 From: Null Date: Wed, 6 Dec 2017 00:45:47 +0800 Subject: [PATCH] Fix delay option (#824) --- src/lib_ccx/ccx_encoders_srt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib_ccx/ccx_encoders_srt.c b/src/lib_ccx/ccx_encoders_srt.c index 1678a1d4..ff7982b8 100644 --- a/src/lib_ccx/ccx_encoders_srt.c +++ b/src/lib_ccx/ccx_encoders_srt.c @@ -18,6 +18,9 @@ int write_stringz_as_srt(char *string, struct encoder_ctx *context, LLONG ms_sta if(!string || !string[0]) return 0; + if (ms_start<0) // Drop screens that because of subs_delay start too early + return 0; + millis_to_time (ms_start,&h1,&m1,&s1,&ms1); millis_to_time (ms_end-1,&h2,&m2,&s2,&ms2); // -1 To prevent overlapping with next line. context->srt_counter++; @@ -144,7 +147,7 @@ int write_cc_subtitle_as_srt(struct cc_subtitle *sub,struct encoder_ctx *context { if(sub->type == CC_TEXT) { - ret = write_stringz_as_srt(sub->data, context, sub->start_time, sub->end_time); + ret = write_stringz_as_srt(sub->data, context, sub->start_time + context->subs_delay, sub->end_time + context->subs_delay); freep(&sub->data); sub->nb_data = 0; ret = 1;