Commit c6523ce
Dhanush Varma
feat: port SRT encoder to Rust
Implement ccxr_write_stringz_as_srt and ccxr_write_cc_buffer_as_srt
in src/rust/src/encoder/srt.rs. Covers:
- Subtitle counter and timestamp formatting with -1ms overlap prevention
- \n unescape handling for multi-line subtitles
- Encoding conversion (UTF-8, Latin1, UCS-2)
- Autodash detection for CEA-608 screen buffers
- Speaker name detection (colon-based)
Uses existing Rust encoder infrastructure (encode_line, write_wrapped)
and calls C get_decoder_line_encoded for CEA-608 line encoding until
that function is also ported.
Exported as #[no_mangle] extern C functions ready to replace the C
versions in ccx_encoders_srt.c.1 parent 9f250b1 commit c6523ce
3 files changed
+555
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
9 | 15 | | |
10 | 16 | | |
| 17 | + | |
11 | 18 | | |
12 | 19 | | |
13 | 20 | | |
| |||
83 | 90 | | |
84 | 91 | | |
85 | 92 | | |
86 | | - | |
| 93 | + | |
87 | 94 | | |
88 | 95 | | |
89 | 96 | | |
90 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
91 | 101 | | |
92 | 102 | | |
| 103 | + | |
93 | 104 | | |
94 | 105 | | |
95 | 106 | | |
| |||
156 | 167 | | |
157 | 168 | | |
158 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
159 | 173 | | |
160 | 174 | | |
161 | 175 | | |
| |||
191 | 205 | | |
192 | 206 | | |
193 | 207 | | |
| 208 | + | |
194 | 209 | | |
195 | 210 | | |
196 | 211 | | |
197 | 212 | | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
198 | 216 | | |
199 | 217 | | |
200 | 218 | | |
| |||
311 | 329 | | |
312 | 330 | | |
313 | 331 | | |
| 332 | + | |
314 | 333 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
0 commit comments