Libraryless. Click here for Pure Java version (3106L/18K).
1 | sS transformTimestampAccordingToCut(S ts, L<DoubleRange> segments) { |
2 | try { |
3 | double time = ffmpeg_parseTimestamp(ts); |
4 | int idx = indexOfPred(segments, r -> r.end > time); |
5 | if (idx >= 0 && idx < l(segments)) { |
6 | double len = 0; |
7 | for i to idx: len += l(segments.get(i)); |
8 | DoubleRange seg = segments.get(idx); |
9 | double ofs = time-seg.start; |
10 | double result = len+ofs; |
11 | S formatted = formatHoursMinutesColonSeconds(result); |
12 | printVars_str("transformTimestampAccordingToCut", +ts, +idx, +seg, +ofs, +result, +formatted); |
13 | ret formatted; |
14 | } else |
15 | ret "[cut] " + ts; |
16 | } catch print e { |
17 | ret ts; |
18 | } |
19 | } |
Began life as a copy of #1030676
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030678 |
Snippet name: | transformTimestampAccordingToCut |
Eternal ID of this version: | #1030678/7 |
Text MD5: | 8eca8dca416ad3459e6f17df0057d773 |
Transpilation MD5: | 8d96af6ab1290cc110e0ce41e0a0a06a |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-03-03 23:57:49 |
Source code size: | 670 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 218 / 290 |
Version history: | 6 change(s) |
Referenced in: | [show references] |