From 73a7b90ac62834a494574195593639c213d5cdd3 Mon Sep 17 00:00:00 2001 From: Chandragupt Singh Date: Thu, 13 Aug 2026 22:31:56 +0530 Subject: [PATCH] fix(transcript): wrote_something |= write_cc_line_as_transcript2() to suppress spurious blank lines --- src/lib_ccx/ccx_encoders_common.h | 2 +- src/lib_ccx/ccx_encoders_transcript.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) 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); } }