Fix delay option (#824)

This commit is contained in:
Null 2017-12-06 00:45:47 +08:00 committed by Carlos Fernandez Sanz
parent 200b6a7eb9
commit c78db1dd24

View File

@ -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;