Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/rust/src/encoder/g608.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,20 @@ pub fn write_cc_buffer_as_g608(data: &eia608_screen, context: &mut encoder_ctx)
}

// Create timeline string for timestamps
let timestamp_line = format!(
"{h1:02}:{m1:02}:{s1:02},{ms1:03} --> {h2:02}:{m2:02}:{s2:02},{ms2:03}{encoded_clrf}"
);
let is_webvtt = context.write_format == crate::bindings::ccx_output_format::CCX_OF_WEBVTT;

let timestamp_line = if is_webvtt {
// WebVTT Standard requires dots instead of commas for milliseconds
// and supports trailing settings (e.g., vertical text direction, alignment)
format!(
"{h1:02}:{m1:02}:{s1:02}.{ms1:03} --> {h2:02}:{m2:02}:{s2:02}.{ms2:03}{encoded_clrf}"
)
} else {
// Legacy SRT Standard requires commas
format!(
"{h1:02}:{m1:02}:{s1:02},{ms1:03} --> {h2:02}:{m2:02}:{s2:02},{ms2:03}{encoded_clrf}"
)
};

// Encode and write timestamp line
let used = encode_line(context, buffer_slice, timestamp_line.as_bytes());
Expand Down
Loading