Commit 3cc7093
committed
feat(cc608): choose the timecc608 caption mode, defaulting to paint-on
timecc608 injected one pop-on caption per second, built and flipped inside the cue's own frames, so the caption became visible ~0.5 s into the second its clock named. go-608 v0.9.0 generates all three CTA-608 caption modes per unit, so the option now names one: <channel>-<lang>[-<mode>[-<modifier>]] with paint (the default), pop, pop-sc, roll2 and roll3.
Paint-on is the default because it is self-contained by construction: each cue clears the screen and writes the caption straight onto it two characters per frame, so no cue's data leaves its own segment, every segment decodes standalone, and a client that starts, seeks or joins anywhere is correct from the first cue boundary it sees. The typing doubles as a liveness tell. Roll-up (roll2, roll3) types each line onto the base row of a window that scrolls the earlier lines up, reset at the start of every segment so the display owes nothing to the previous one; it is limited to 2 or 3 rows because the caption's own lines put its base row at row 3.
Pop-on keeps both placements. With -pop each cue's EOC rides its cue's first frame and the build drains over the frames before it, so the caption is displayed over exactly the interval its text names; the cost is that a cue's build lives in the preceding segment, and a receiver joining mid-stream gets a leading EOC without it - blank on a fresh decoder, one cue of a stale caption on one that keeps 608 state, correct from the next cue on. That is a receiver-side matter: an ENM ahead of the EOC would erase the build about to be flipped. -pop-sc trades the frame accuracy back for a segment that stands alone.
The scheduling is go-608's per-unit builders throughout. Their generate.Unit carries a unit's number, start time and frame count as independent facts, so a segment whose number does not match its media time - startnr_, a non-zero availabilityStartTime - still gets the right clock, and the next unit's start comes from the fragment's media duration in ticks rather than frames times frame duration, which a fractional frame rate would drift on. NumCues divides a segment down into whole periods, so a cue is never shorter than a second: a 1.92s segment gets one 1.92s cue instead of two of 0.96s.
The language field is a three-letter ISO 639-2 code. It is used in one place, the SCTE 214-1 accessibility descriptor value (value="CC1=eng"), whose scheme is defined in those terms; it is not DASH's RFC 5646 @lang, which this option never sets, so en, en-US and zh-Hans would have gone straight into a non-conformant descriptor. A single-token language also makes the value's fields positional, so a mistyped mode or modifier is reported instead of being read as part of the language.
The tests decode the injected cc_data back in presentation order - the order a conformant receiver reassembles it in - and assert the caption text and the frame it lands on: across two consecutive segments for the cross-segment pop-on case, for AVC and HEVC, at 30, 29.97 and 24 fps, through the low-latency chunked path, and per frame for paint-on's clear-and-type and roll-up's scroll history. Test configurations come from CreateCC608Config, so each test names its mode exactly as a request does.1 parent 9a7bcc0 commit 3cc7093
12 files changed
Lines changed: 898 additions & 189 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
10 | 21 | | |
11 | 22 | | |
12 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
13 | 47 | | |
14 | 48 | | |
15 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
38 | 98 | | |
39 | 99 | | |
40 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | | - | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
25 | 46 | | |
26 | 47 | | |
27 | | - | |
28 | | - | |
29 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
30 | 103 | | |
31 | 104 | | |
32 | 105 | | |
33 | | - | |
34 | | - | |
35 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
36 | 121 | | |
37 | | - | |
| 122 | + | |
38 | 123 | | |
39 | | - | |
| 124 | + | |
40 | 125 | | |
41 | 126 | | |
42 | 127 | | |
43 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
44 | 141 | | |
45 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
46 | 169 | | |
47 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
48 | 177 | | |
49 | 178 | | |
50 | 179 | | |
| |||
0 commit comments