| 10 | namespace { |
| 11 | |
| 12 | void validate_options(const SubtitleFormatOptions & options) { |
| 13 | if (options.sample_rate <= 0) { |
| 14 | throw std::runtime_error("subtitle formatter requires a positive sample_rate"); |
| 15 | } |
| 16 | if (options.max_chars_per_line <= 0) { |
| 17 | throw std::runtime_error("subtitle formatter requires max_chars_per_line > 0"); |
| 18 | } |
| 19 | if (options.max_lines <= 0) { |
| 20 | throw std::runtime_error("subtitle formatter requires max_lines > 0"); |
| 21 | } |
| 22 | if (!(options.max_block_seconds > 0.0)) { |
| 23 | throw std::runtime_error("subtitle formatter requires max_block_seconds > 0"); |
| 24 | } |
| 25 | if (options.max_gap_seconds < 0.0) { |
| 26 | throw std::runtime_error("subtitle formatter requires max_gap_seconds >= 0"); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | void validate_word(const runtime::WordTimestamp & word, int64_t previous_start) { |
| 31 | if (word.word.empty()) { |
no outgoing calls
no test coverage detected