MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / format_srt

Function format_srt

src/framework/text/subtitle.cpp:151–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151std::string format_srt(
152 const std::vector<runtime::WordTimestamp> & words,
153 const SubtitleFormatOptions & options) {
154 const auto blocks = build_subtitle_blocks(words, options);
155 std::ostringstream out;
156 for (const auto & block : blocks) {
157 out << block.index << "\n"
158 << format_time(block.span.start_sample, options.sample_rate)
159 << " --> "
160 << format_time(block.span.end_sample, options.sample_rate)
161 << "\n";
162 for (const auto & line : block.lines) {
163 out << line << "\n";
164 }
165 out << "\n";
166 }
167 return out.str();
168}
169
170} // namespace engine::text

Calls 3

build_subtitle_blocksFunction · 0.85
format_timeFunction · 0.85
strMethod · 0.80

Tested by 2