ec-ass: drop events whose End is not after Start, as ffmpeg does (zero and backwards durations emit no packet or SRT cue); was clamped to zero-length cues
Browse files at this commit1512e3c486c68d5c0f3ec28fe82698915415f31dParent: be888451 changed file +4 -1
- crates/ec-ass/src/lib.rs +4 -1
crates/ec-ass/src/lib.rsmodified+4 -1
| @@ -237,11 +237,14 @@ fn dialogue(format: &[String], row: &str, wrap_style: u8) -> Option<SubtitleCue> | |||
| 237 | let values: Vec<&str> = row.splitn(format.len(), ',').collect(); | 237 | let values: Vec<&str> = row.splitn(format.len(), ',').collect(); |
| 238 | let start_us = parse_clock(column(format, &values, "Start")?)?; | 238 | let start_us = parse_clock(column(format, &values, "Start")?)?; |
| 239 | let end_us = parse_clock(column(format, &values, "End")?)?; | 239 | let end_us = parse_clock(column(format, &values, "End")?)?; |
| 240 | + if end_us <= start_us { | ||
| 241 | + return None; | ||
| 242 | + } | ||
| 240 | let text = column(format, &values, "Text").unwrap_or_default(); | 243 | let text = column(format, &values, "Text").unwrap_or_default(); |
| 241 | let (segments, positioning) = body(text, wrap_style); | 244 | let (segments, positioning) = body(text, wrap_style); |
| 242 | Some(SubtitleCue { | 245 | Some(SubtitleCue { |
| 243 | start_us, | 246 | start_us, |
| 244 | - end_us: end_us.max(start_us), | 247 | + end_us, |
| 245 | style_ref: column(format, &values, "Style") | 248 | style_ref: column(format, &values, "Style") |
| 246 | .filter(|s| !s.is_empty()) | 249 | .filter(|s| !s.is_empty()) |
| 247 | .map(str::to_owned), | 250 | .map(str::to_owned), |