diff --git a/src/lib_ccx/ccx_decoders_608.c b/src/lib_ccx/ccx_decoders_608.c index 5147e5865..88019ab39 100644 --- a/src/lib_ccx/ccx_decoders_608.c +++ b/src/lib_ccx/ccx_decoders_608.c @@ -854,7 +854,10 @@ void handle_command(unsigned char c1, const unsigned char c2, ccx_decoder_608_co // not the character typing time. This matches FFmpeg's timing behavior. if (context->rollup_from_popon && !changes) { - context->ts_start_of_current_line = get_fts(context->timing, context->my_field); + // Transcript: anchor to CR time for the next write_cc_line(). + // SRT: preserve first-char time already set by write_char() for cvm at changes=1. + if (context->output_format == CCX_OF_TRANSCRIPT) + context->ts_start_of_current_line = get_fts(context->timing, context->my_field); } else { diff --git a/src/lib_ccx/ccx_encoders_common.h b/src/lib_ccx/ccx_encoders_common.h index d2b87cee6..be82c38ca 100644 --- a/src/lib_ccx/ccx_encoders_common.h +++ b/src/lib_ccx/ccx_encoders_common.h @@ -238,7 +238,7 @@ void write_cc_buffer_to_gui(struct eia608_screen *data, struct encoder_ctx *cont int write_cc_buffer_as_g608(struct eia608_screen *data, struct encoder_ctx *context); int write_cc_buffer_as_transcript2(struct eia608_screen *data, struct encoder_ctx *context); -void write_cc_line_as_transcript2(struct eia608_screen *data, struct encoder_ctx *context, int line_number); +int write_cc_line_as_transcript2(struct eia608_screen *data, struct encoder_ctx *context, int line_number); int write_cc_subtitle_as_srt(struct cc_subtitle *sub, struct encoder_ctx *context); int write_cc_subtitle_as_ssa(struct cc_subtitle *sub, struct encoder_ctx *context); diff --git a/src/lib_ccx/ccx_encoders_transcript.c b/src/lib_ccx/ccx_encoders_transcript.c index 3e13652cf..b98e7ea85 100644 --- a/src/lib_ccx/ccx_encoders_transcript.c +++ b/src/lib_ccx/ccx_encoders_transcript.c @@ -236,7 +236,7 @@ int write_cc_subtitle_as_transcript(struct cc_subtitle *sub, struct encoder_ctx } // TODO Convert CC line to TEXT format and remove this function -void write_cc_line_as_transcript2(struct eia608_screen *data, struct encoder_ctx *context, int line_number) +int write_cc_line_as_transcript2(struct eia608_screen *data, struct encoder_ctx *context, int line_number) { int ret = 0; int length = get_str_basic(context->subline, data->characters[line_number], @@ -255,7 +255,7 @@ void write_cc_line_as_transcript2(struct eia608_screen *data, struct encoder_ctx // is set for example by the write_char function, it possible that we don't have one in empty lines (unclear) // For now, let's not consider this a bug as before and just return. // fatal (EXIT_BUG_BUG, "Bug in timedtranscript (ts_start_of_current_line==-1). Please report."); - return; + return 0; } if (context->transcript_settings->showStartTime) @@ -333,7 +333,9 @@ void write_cc_line_as_transcript2(struct eia608_screen *data, struct encoder_ctx { mprint("Warning:Loss of data\n"); } + return 1; } + return 0; // fprintf (wb->fh,encoded_crlf); } @@ -356,8 +358,7 @@ int write_cc_buffer_as_transcript2(struct eia608_screen *data, struct encoder_ct } } - write_cc_line_as_transcript2(data, context, i); - wrote_something = 1; + wrote_something |= write_cc_line_as_transcript2(data, context, i); } }