@svta/cml-608 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -16
- package/dist/index.d.ts +217 -222
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +215 -63
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -16,37 +16,41 @@ import { CaptionScreen, Row } from "@svta/cml-608";
|
|
|
16
16
|
|
|
17
17
|
### Extracting captions from a media sample
|
|
18
18
|
|
|
19
|
-
CTA-608 captions
|
|
20
|
-
payload.
|
|
21
|
-
|
|
19
|
+
CTA-608 captions are embedded in the video elementary stream as an ATSC A/53 `cc_data()`
|
|
20
|
+
payload. Only the envelope around the payload differs by codec. The envelope is either a
|
|
21
|
+
SEI message in a NAL unit, or an OBU. Choose the extractor that matches the sample entry
|
|
22
|
+
type:
|
|
22
23
|
|
|
23
24
|
| Sample entry | Envelope | Extractor |
|
|
24
25
|
| ----------------------- | --------------------------------- | ---------------------------------- |
|
|
25
26
|
| `avc1` / `hvc1` / `vvc1` | `itu_t_t35` SEI message in a NAL | `extractCta608DataFromSample` |
|
|
26
27
|
| `av01` | `metadata_itu_t_t35` OBU | `extractCta608DataFromAv1Sample` |
|
|
27
28
|
|
|
28
|
-
Both return the same `[field1, field2]` byte arrays
|
|
29
|
-
|
|
29
|
+
Both extractors return the same `[field1, field2]` byte arrays. `Cta608Parser` renders
|
|
30
|
+
them as caption screens:
|
|
30
31
|
|
|
31
32
|
```typescript
|
|
32
33
|
import { Cta608Parser, extractCta608DataFromAv1Sample } from "@svta/cml-608";
|
|
34
|
+
import type { CaptionScreen } from "@svta/cml-608";
|
|
33
35
|
|
|
34
36
|
const parser = new Cta608Parser(1, {
|
|
35
|
-
newCue(startTime, endTime, screen) {
|
|
37
|
+
newCue(startTime: number, endTime: number, screen: CaptionScreen) {
|
|
36
38
|
console.log(startTime, endTime, screen.getDisplayText());
|
|
37
39
|
},
|
|
38
40
|
}, null);
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
// Call once per AV1 sample. The sample starts at samplePos in view.
|
|
43
|
+
function onSample(view: DataView, samplePos: number, sampleSize: number, sampleTimeMs: number): void {
|
|
44
|
+
const [field1] = extractCta608DataFromAv1Sample(view, samplePos, sampleSize);
|
|
45
|
+
if (field1.length) {
|
|
46
|
+
parser.addData(sampleTimeMs, field1);
|
|
47
|
+
}
|
|
43
48
|
}
|
|
44
49
|
```
|
|
45
50
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
to the extractor that matches it.
|
|
51
|
+
The two extractors are separate because the two envelopes are framed differently, and a
|
|
52
|
+
sample does not announce its framing. A NAL unit sample puts a fixed-width big-endian
|
|
53
|
+
length before each unit. Only `lengthSizeMinusOne` in the `avcC` or `hvcC` config gives
|
|
54
|
+
that width. An AV1 sample uses the low-overhead format. Each OBU has its own `obu_size`
|
|
55
|
+
after the header, and the last OBU may omit it. In both cases the sample entry gives the
|
|
56
|
+
framing.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import { ValueOf } from "@svta/cml-utils";
|
|
2
|
-
|
|
3
2
|
//#region src/CaptionModes.d.ts
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
|
-
* The different caption modes that can be used.
|
|
7
|
-
*
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
4
|
+
* The different caption modes that can be used.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
10
8
|
type CaptionModes = "MODE_ROLL-UP" | "MODE_POP-ON" | "MODE_PAINT-ON" | "MODE_TEXT" | null;
|
|
11
9
|
//#endregion
|
|
12
10
|
//#region src/VerboseLevel.d.ts
|
|
13
11
|
/**
|
|
14
|
-
* Logging levels for the CTA-608 parser.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @enum
|
|
18
|
-
*
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
declare const VerboseLevel: {
|
|
12
|
+
* Logging levels for the CTA-608 parser.
|
|
13
|
+
*
|
|
14
|
+
*
|
|
15
|
+
* @enum
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare const VerboseLevel: {
|
|
22
20
|
readonly ERROR: 0;
|
|
23
21
|
readonly TEXT: 1;
|
|
24
22
|
readonly WARNING: 2;
|
|
@@ -27,18 +25,17 @@ declare const VerboseLevel: {
|
|
|
27
25
|
readonly DATA: 3;
|
|
28
26
|
};
|
|
29
27
|
/**
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
type VerboseLevel = ValueOf<typeof VerboseLevel>;
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export type VerboseLevel = ValueOf<typeof VerboseLevel>;
|
|
33
31
|
//#endregion
|
|
34
32
|
//#region src/CaptionsLogger.d.ts
|
|
35
|
-
|
|
36
33
|
/**
|
|
37
|
-
* CaptionsLogger. To be removed in the future.
|
|
38
|
-
*
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
declare class CaptionsLogger {
|
|
34
|
+
* CaptionsLogger. To be removed in the future.
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
export declare class CaptionsLogger {
|
|
42
39
|
time: number | null;
|
|
43
40
|
verboseLevel: VerboseLevel;
|
|
44
41
|
log(severity: VerboseLevel, msg: string | (() => string)): void;
|
|
@@ -46,11 +43,11 @@ declare class CaptionsLogger {
|
|
|
46
43
|
//#endregion
|
|
47
44
|
//#region src/PACData.d.ts
|
|
48
45
|
/**
|
|
49
|
-
* Represents a single PAC (Preamble Address Code) data.
|
|
50
|
-
*
|
|
51
|
-
* @public
|
|
52
|
-
*/
|
|
53
|
-
type PACData = {
|
|
46
|
+
* Represents a single PAC (Preamble Address Code) data.
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
export type PACData = {
|
|
54
51
|
row: number;
|
|
55
52
|
indent: number | null;
|
|
56
53
|
color: string | null;
|
|
@@ -60,11 +57,11 @@ type PACData = {
|
|
|
60
57
|
//#endregion
|
|
61
58
|
//#region src/PenStyles.d.ts
|
|
62
59
|
/**
|
|
63
|
-
* PenStyles
|
|
64
|
-
*
|
|
65
|
-
* @public
|
|
66
|
-
*/
|
|
67
|
-
type PenStyles = {
|
|
60
|
+
* PenStyles
|
|
61
|
+
*
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
export type PenStyles = {
|
|
68
65
|
foreground: string | null;
|
|
69
66
|
underline: boolean;
|
|
70
67
|
italics: boolean;
|
|
@@ -73,13 +70,12 @@ type PenStyles = {
|
|
|
73
70
|
};
|
|
74
71
|
//#endregion
|
|
75
72
|
//#region src/PenState.d.ts
|
|
76
|
-
|
|
77
73
|
/**
|
|
78
|
-
* Pen state.
|
|
79
|
-
*
|
|
80
|
-
* @public
|
|
81
|
-
*/
|
|
82
|
-
declare class PenState {
|
|
74
|
+
* Pen state.
|
|
75
|
+
*
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
export declare class PenState {
|
|
83
79
|
foreground: string;
|
|
84
80
|
underline: boolean;
|
|
85
81
|
italics: boolean;
|
|
@@ -93,13 +89,12 @@ declare class PenState {
|
|
|
93
89
|
}
|
|
94
90
|
//#endregion
|
|
95
91
|
//#region src/StyledUnicodeChar.d.ts
|
|
96
|
-
|
|
97
92
|
/**
|
|
98
|
-
* Unicode character with styling and background.
|
|
99
|
-
*
|
|
100
|
-
* @public
|
|
101
|
-
*/
|
|
102
|
-
declare class StyledUnicodeChar {
|
|
93
|
+
* Unicode character with styling and background.
|
|
94
|
+
*
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
export declare class StyledUnicodeChar {
|
|
103
98
|
uchar: string;
|
|
104
99
|
penState: PenState;
|
|
105
100
|
reset(): void;
|
|
@@ -112,11 +107,11 @@ declare class StyledUnicodeChar {
|
|
|
112
107
|
//#endregion
|
|
113
108
|
//#region src/Row.d.ts
|
|
114
109
|
/**
|
|
115
|
-
* CTA-608 row consisting of NR_COLS instances of StyledUnicodeChar.
|
|
116
|
-
*
|
|
117
|
-
* @public
|
|
118
|
-
*/
|
|
119
|
-
declare class Row {
|
|
110
|
+
* CTA-608 row consisting of NR_COLS instances of StyledUnicodeChar.
|
|
111
|
+
*
|
|
112
|
+
* @public
|
|
113
|
+
*/
|
|
114
|
+
export declare class Row {
|
|
120
115
|
chars: StyledUnicodeChar[];
|
|
121
116
|
cueStartTime: number | null;
|
|
122
117
|
private pos;
|
|
@@ -127,16 +122,16 @@ declare class Row {
|
|
|
127
122
|
copy(other: Row): void;
|
|
128
123
|
isEmpty(): boolean;
|
|
129
124
|
/**
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
* Set the cursor to a valid column.
|
|
126
|
+
*/
|
|
132
127
|
setCursor(absPos: number): void;
|
|
133
128
|
/**
|
|
134
|
-
|
|
135
|
-
|
|
129
|
+
* Move the cursor relative to current position.
|
|
130
|
+
*/
|
|
136
131
|
moveCursor(relPos: number): void;
|
|
137
132
|
/**
|
|
138
|
-
|
|
139
|
-
|
|
133
|
+
* Backspace, move one step back and clear character.
|
|
134
|
+
*/
|
|
140
135
|
backSpace(): void;
|
|
141
136
|
insertChar(byte: number): void;
|
|
142
137
|
clearFromPos(startPos: number): void;
|
|
@@ -148,11 +143,11 @@ declare class Row {
|
|
|
148
143
|
//#endregion
|
|
149
144
|
//#region src/CaptionScreen.d.ts
|
|
150
145
|
/**
|
|
151
|
-
* Keep a CTA-608 screen of 32x15 styled characters
|
|
152
|
-
*
|
|
153
|
-
* @public
|
|
154
|
-
*/
|
|
155
|
-
declare class CaptionScreen {
|
|
146
|
+
* Keep a CTA-608 screen of 32x15 styled characters
|
|
147
|
+
*
|
|
148
|
+
* @public
|
|
149
|
+
*/
|
|
150
|
+
export declare class CaptionScreen {
|
|
156
151
|
rows: Row[];
|
|
157
152
|
private currRow;
|
|
158
153
|
private nrRollUpRows;
|
|
@@ -166,33 +161,33 @@ declare class CaptionScreen {
|
|
|
166
161
|
backSpace(): void;
|
|
167
162
|
clearToEndOfRow(): void;
|
|
168
163
|
/**
|
|
169
|
-
|
|
170
|
-
|
|
164
|
+
* Insert a character (without styling) in the current row.
|
|
165
|
+
*/
|
|
171
166
|
insertChar(char: number): void;
|
|
172
167
|
setPen(styles: Partial<PenStyles>): void;
|
|
173
168
|
moveCursor(relPos: number): void;
|
|
174
169
|
setCursor(absPos: number): void;
|
|
175
170
|
setPAC(pacData: PACData): void;
|
|
176
171
|
/**
|
|
177
|
-
|
|
178
|
-
|
|
172
|
+
* Set background/extra foreground, but first do back_space, and then insert space (backwards compatibility).
|
|
173
|
+
*/
|
|
179
174
|
setBkgData(bkgData: Partial<PenStyles>): void;
|
|
180
175
|
setRollUpRows(nrRows: number | null): void;
|
|
181
176
|
rollUp(): void;
|
|
182
177
|
/**
|
|
183
|
-
|
|
184
|
-
|
|
178
|
+
* Get all non-empty rows with as unicode text.
|
|
179
|
+
*/
|
|
185
180
|
getDisplayText(asOneRow?: boolean): string;
|
|
186
181
|
getTextAndFormat(): Row[];
|
|
187
182
|
}
|
|
188
183
|
//#endregion
|
|
189
184
|
//#region src/CueHandler.d.ts
|
|
190
185
|
/**
|
|
191
|
-
* A handler for CTA-608 cues.
|
|
192
|
-
*
|
|
193
|
-
* @public
|
|
194
|
-
*/
|
|
195
|
-
type CueHandler = {
|
|
186
|
+
* A handler for CTA-608 cues.
|
|
187
|
+
*
|
|
188
|
+
* @public
|
|
189
|
+
*/
|
|
190
|
+
export type CueHandler = {
|
|
196
191
|
newCue(startTime: number, endTime: number, screen: CaptionScreen): void;
|
|
197
192
|
reset?(): void;
|
|
198
193
|
dispatchCue?(): void;
|
|
@@ -200,11 +195,11 @@ type CueHandler = {
|
|
|
200
195
|
//#endregion
|
|
201
196
|
//#region src/Cta608Channel.d.ts
|
|
202
197
|
/**
|
|
203
|
-
* CTA-608 Channel
|
|
204
|
-
*
|
|
205
|
-
* @public
|
|
206
|
-
*/
|
|
207
|
-
declare class Cta608Channel {
|
|
198
|
+
* CTA-608 Channel
|
|
199
|
+
*
|
|
200
|
+
* @public
|
|
201
|
+
*/
|
|
202
|
+
export declare class Cta608Channel {
|
|
208
203
|
chNr: number;
|
|
209
204
|
outputFilter: CueHandler;
|
|
210
205
|
mode: CaptionModes;
|
|
@@ -245,19 +240,19 @@ declare class Cta608Channel {
|
|
|
245
240
|
//#endregion
|
|
246
241
|
//#region src/SupportedField.d.ts
|
|
247
242
|
/**
|
|
248
|
-
* SupportedField
|
|
249
|
-
*
|
|
250
|
-
* @public
|
|
251
|
-
*/
|
|
252
|
-
type SupportedField = 1 | 3;
|
|
243
|
+
* SupportedField
|
|
244
|
+
*
|
|
245
|
+
* @public
|
|
246
|
+
*/
|
|
247
|
+
export type SupportedField = 1 | 3;
|
|
253
248
|
//#endregion
|
|
254
249
|
//#region src/Cta608Parser.d.ts
|
|
255
250
|
/**
|
|
256
|
-
* CEA-608 caption parser.
|
|
257
|
-
*
|
|
258
|
-
* @public
|
|
259
|
-
*/
|
|
260
|
-
declare class Cta608Parser {
|
|
251
|
+
* CEA-608 caption parser.
|
|
252
|
+
*
|
|
253
|
+
* @public
|
|
254
|
+
*/
|
|
255
|
+
export declare class Cta608Parser {
|
|
261
256
|
private channels;
|
|
262
257
|
private currentChannel;
|
|
263
258
|
private cmdHistory;
|
|
@@ -265,174 +260,174 @@ declare class Cta608Parser {
|
|
|
265
260
|
private lastTime;
|
|
266
261
|
constructor(field: SupportedField, out1: any, out2: any);
|
|
267
262
|
/**
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
263
|
+
* Add data for time t in forms of list of bytes (unsigned ints). The bytes are treated as pairs.
|
|
264
|
+
*
|
|
265
|
+
* @param time - The time in milliseconds
|
|
266
|
+
* @param byteList - The list of bytes
|
|
267
|
+
*/
|
|
273
268
|
addData(time: number | null, byteList: number[]): void;
|
|
274
269
|
/**
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
270
|
+
* Parse Command.
|
|
271
|
+
*
|
|
272
|
+
* @param a - The first byte
|
|
273
|
+
* @param b - The second byte
|
|
274
|
+
* @returns True if a command was found
|
|
275
|
+
*/
|
|
281
276
|
private parseCmd;
|
|
282
277
|
/**
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
278
|
+
* Parse midrow styling command
|
|
279
|
+
*
|
|
280
|
+
* @param a - The first byte
|
|
281
|
+
* @param b - The second byte
|
|
282
|
+
* @returns `true` if midrow styling command was found
|
|
283
|
+
*/
|
|
289
284
|
private parseMidrow;
|
|
290
285
|
/**
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
286
|
+
* Parse Preable Access Codes (Table 53).
|
|
287
|
+
*
|
|
288
|
+
* @param a - The first byte
|
|
289
|
+
* @param b - The second byte
|
|
290
|
+
* @returns A Boolean that tells if PAC found
|
|
291
|
+
*/
|
|
297
292
|
private parsePAC;
|
|
298
293
|
/**
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
294
|
+
* Interpret the second byte of the pac, and return the information.
|
|
295
|
+
*
|
|
296
|
+
* @param row - The row number
|
|
297
|
+
* @param byte - The second byte
|
|
298
|
+
* @returns pacData with style parameters
|
|
299
|
+
*/
|
|
305
300
|
private interpretPAC;
|
|
306
301
|
/**
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
302
|
+
* Parse characters.
|
|
303
|
+
*
|
|
304
|
+
* @param a - The first byte
|
|
305
|
+
* @param b - The second byte
|
|
306
|
+
* @returns An array with 1 to 2 codes corresponding to chars, if found. null otherwise.
|
|
307
|
+
*/
|
|
313
308
|
private parseChars;
|
|
314
309
|
/**
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
310
|
+
* Parse extended background attributes as well as new foreground color black.
|
|
311
|
+
*
|
|
312
|
+
* @param a - The first byte
|
|
313
|
+
* @param b - The second byte
|
|
314
|
+
* @returns True if background attributes are found
|
|
315
|
+
*/
|
|
321
316
|
private parseBackgroundAttributes;
|
|
322
317
|
/**
|
|
323
|
-
|
|
324
|
-
|
|
318
|
+
* Reset state of parser and its channels.
|
|
319
|
+
*/
|
|
325
320
|
reset(): void;
|
|
326
321
|
/**
|
|
327
|
-
|
|
328
|
-
|
|
322
|
+
* Trigger the generation of a cue, and the start of a new one if displayScreens are not empty.
|
|
323
|
+
*/
|
|
329
324
|
cueSplitAtTime(t: number): void;
|
|
330
325
|
}
|
|
331
326
|
//#endregion
|
|
332
327
|
//#region src/extractCta608Data.d.ts
|
|
333
328
|
/**
|
|
334
|
-
* Extract CTA-608 data from a DataView
|
|
335
|
-
*
|
|
336
|
-
* @param raw - The DataView to extract the data from
|
|
337
|
-
* @param cta608Range - The range of the CTA-608 data
|
|
338
|
-
* @returns The extracted CTA-608 data
|
|
339
|
-
*
|
|
340
|
-
* @public
|
|
341
|
-
*/
|
|
342
|
-
declare function extractCta608Data(raw: DataView, cta608Range: number[]): number[][];
|
|
329
|
+
* Extract CTA-608 data from a DataView
|
|
330
|
+
*
|
|
331
|
+
* @param raw - The DataView to extract the data from
|
|
332
|
+
* @param cta608Range - The range of the CTA-608 data
|
|
333
|
+
* @returns The extracted CTA-608 data
|
|
334
|
+
*
|
|
335
|
+
* @public
|
|
336
|
+
*/
|
|
337
|
+
export declare function extractCta608Data(raw: DataView, cta608Range: number[]): number[][];
|
|
343
338
|
//#endregion
|
|
344
339
|
//#region src/extractCta608DataFromAv1Sample.d.ts
|
|
345
340
|
/**
|
|
346
|
-
* Extracts CTA-608 data from an AV1 (`av01`) sample.
|
|
347
|
-
*
|
|
348
|
-
* AV1 has no NAL units, so captions ride in an `metadata_itu_t_t35` OBU rather than in
|
|
349
|
-
* an SEI message. The caption payload is unchanged — the same A/53 `cc_data()` under the
|
|
350
|
-
* same T.35/GA94 identifier that {@link extractCta608DataFromSample} reads — so the
|
|
351
|
-
* returned field data feeds {@link Cta608Parser} identically.
|
|
352
|
-
*
|
|
353
|
-
* This is a separate function rather than a codec branch inside
|
|
354
|
-
* {@link extractCta608DataFromSample} because the two carriages are framed differently and
|
|
355
|
-
* neither sample is self-identifying. A NAL unit sample puts a fixed-width big-endian
|
|
356
|
-
* length in front of each unit, and that width is only known from `lengthSizeMinusOne` in
|
|
357
|
-
* the `avcC`/`hvcC` config. An AV1 sample uses the low-overhead format, where each OBU
|
|
358
|
-
* carries its own `obu_size` after the header — and may omit it on the last OBU. Select on
|
|
359
|
-
* the sample entry type (`av01`) instead.
|
|
360
|
-
*
|
|
361
|
-
* @param raw - The DataView with media data
|
|
362
|
-
* @param startPos - The start position of the sample within the DataView
|
|
363
|
-
* @param sampleSize - The size of the sample in bytes
|
|
364
|
-
* @returns fieldData array containing field 1 and field 2 data arrays
|
|
365
|
-
*
|
|
366
|
-
* @example
|
|
367
|
-
* {@includeCode ../test/extractCta608DataFromAv1Sample.test.ts#example}
|
|
368
|
-
*
|
|
369
|
-
* @public
|
|
370
|
-
*/
|
|
371
|
-
declare function extractCta608DataFromAv1Sample(raw: DataView, startPos: number, sampleSize: number): number[][];
|
|
341
|
+
* Extracts CTA-608 data from an AV1 (`av01`) sample.
|
|
342
|
+
*
|
|
343
|
+
* AV1 has no NAL units, so captions ride in an `metadata_itu_t_t35` OBU rather than in
|
|
344
|
+
* an SEI message. The caption payload is unchanged — the same A/53 `cc_data()` under the
|
|
345
|
+
* same T.35/GA94 identifier that {@link extractCta608DataFromSample} reads — so the
|
|
346
|
+
* returned field data feeds {@link Cta608Parser} identically.
|
|
347
|
+
*
|
|
348
|
+
* This is a separate function rather than a codec branch inside
|
|
349
|
+
* {@link extractCta608DataFromSample} because the two carriages are framed differently and
|
|
350
|
+
* neither sample is self-identifying. A NAL unit sample puts a fixed-width big-endian
|
|
351
|
+
* length in front of each unit, and that width is only known from `lengthSizeMinusOne` in
|
|
352
|
+
* the `avcC`/`hvcC` config. An AV1 sample uses the low-overhead format, where each OBU
|
|
353
|
+
* carries its own `obu_size` after the header — and may omit it on the last OBU. Select on
|
|
354
|
+
* the sample entry type (`av01`) instead.
|
|
355
|
+
*
|
|
356
|
+
* @param raw - The DataView with media data
|
|
357
|
+
* @param startPos - The start position of the sample within the DataView
|
|
358
|
+
* @param sampleSize - The size of the sample in bytes
|
|
359
|
+
* @returns fieldData array containing field 1 and field 2 data arrays
|
|
360
|
+
*
|
|
361
|
+
* @example
|
|
362
|
+
* {@includeCode ../test/extractCta608DataFromAv1Sample.test.ts#example}
|
|
363
|
+
*
|
|
364
|
+
* @public
|
|
365
|
+
*/
|
|
366
|
+
export declare function extractCta608DataFromAv1Sample(raw: DataView, startPos: number, sampleSize: number): number[][];
|
|
372
367
|
//#endregion
|
|
373
368
|
//#region src/extractCta608DataFromSample.d.ts
|
|
374
369
|
/**
|
|
375
|
-
* Extracts CEA-608 data from a given sample.
|
|
376
|
-
*
|
|
377
|
-
* @param raw - The DataView with media data
|
|
378
|
-
* @param startPos - The start position within the DataView
|
|
379
|
-
* @param sampleSize - The size of the sample in bytes
|
|
380
|
-
* @returns fieldData array containing field 1 and field 2 data arrays
|
|
381
|
-
*
|
|
382
|
-
* @public
|
|
383
|
-
*/
|
|
384
|
-
declare function extractCta608DataFromSample(raw: DataView, startPos: number, sampleSize: number): number[][];
|
|
370
|
+
* Extracts CEA-608 data from a given sample.
|
|
371
|
+
*
|
|
372
|
+
* @param raw - The DataView with media data
|
|
373
|
+
* @param startPos - The start position within the DataView
|
|
374
|
+
* @param sampleSize - The size of the sample in bytes
|
|
375
|
+
* @returns fieldData array containing field 1 and field 2 data arrays
|
|
376
|
+
*
|
|
377
|
+
* @public
|
|
378
|
+
*/
|
|
379
|
+
export declare function extractCta608DataFromSample(raw: DataView, startPos: number, sampleSize: number): number[][];
|
|
385
380
|
//#endregion
|
|
386
381
|
//#region src/findCta608Nalus.d.ts
|
|
387
382
|
/**
|
|
388
|
-
* Find CTA-608 NAL units in a video stream
|
|
389
|
-
*
|
|
390
|
-
* @param raw - The DataView to extract the data from
|
|
391
|
-
* @param startPos - The start position of the data
|
|
392
|
-
* @param size - The size of the data
|
|
393
|
-
* @returns The extracted CTA-608 NAL units
|
|
394
|
-
*
|
|
395
|
-
* @public
|
|
396
|
-
*/
|
|
397
|
-
declare function findCta608Nalus(raw: DataView, startPos: number, size: number): number[][];
|
|
383
|
+
* Find CTA-608 NAL units in a video stream
|
|
384
|
+
*
|
|
385
|
+
* @param raw - The DataView to extract the data from
|
|
386
|
+
* @param startPos - The start position of the data
|
|
387
|
+
* @param size - The size of the data
|
|
388
|
+
* @returns The extracted CTA-608 NAL units
|
|
389
|
+
*
|
|
390
|
+
* @public
|
|
391
|
+
*/
|
|
392
|
+
export declare function findCta608Nalus(raw: DataView, startPos: number, size: number): number[][];
|
|
398
393
|
//#endregion
|
|
399
394
|
//#region src/SccParser.d.ts
|
|
400
395
|
/**
|
|
401
|
-
* The copyright in this software is being made available under the BSD License,
|
|
402
|
-
* included below. This software may be subject to other third party and contributor
|
|
403
|
-
* rights, including patent rights, and no such rights are granted under this license.
|
|
404
|
-
*
|
|
405
|
-
* Copyright (c) 2015-2016, DASH Industry Forum.
|
|
406
|
-
* All rights reserved.
|
|
407
|
-
*
|
|
408
|
-
* Redistribution and use in source and binary forms, with or without modification,
|
|
409
|
-
* are permitted provided that the following conditions are met:
|
|
410
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
411
|
-
* list of conditions and the following disclaimer.
|
|
412
|
-
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
413
|
-
* this list of conditions and the following disclaimer in the documentation and/or
|
|
414
|
-
* other materials provided with the distribution.
|
|
415
|
-
* 2. Neither the name of Dash Industry Forum nor the names of its
|
|
416
|
-
* contributors may be used to endorse or promote products derived from this software
|
|
417
|
-
* without specific prior written permission.
|
|
418
|
-
*
|
|
419
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY
|
|
420
|
-
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
421
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
422
|
-
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
423
|
-
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
424
|
-
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
425
|
-
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
426
|
-
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
427
|
-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
428
|
-
* POSSIBILITY OF SUCH DAMAGE.
|
|
429
|
-
*/
|
|
396
|
+
* The copyright in this software is being made available under the BSD License,
|
|
397
|
+
* included below. This software may be subject to other third party and contributor
|
|
398
|
+
* rights, including patent rights, and no such rights are granted under this license.
|
|
399
|
+
*
|
|
400
|
+
* Copyright (c) 2015-2016, DASH Industry Forum.
|
|
401
|
+
* All rights reserved.
|
|
402
|
+
*
|
|
403
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
|
404
|
+
* are permitted provided that the following conditions are met:
|
|
405
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
406
|
+
* list of conditions and the following disclaimer.
|
|
407
|
+
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
408
|
+
* this list of conditions and the following disclaimer in the documentation and/or
|
|
409
|
+
* other materials provided with the distribution.
|
|
410
|
+
* 2. Neither the name of Dash Industry Forum nor the names of its
|
|
411
|
+
* contributors may be used to endorse or promote products derived from this software
|
|
412
|
+
* without specific prior written permission.
|
|
413
|
+
*
|
|
414
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY
|
|
415
|
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
416
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
417
|
+
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
418
|
+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
419
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
420
|
+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
421
|
+
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
422
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
423
|
+
* POSSIBILITY OF SUCH DAMAGE.
|
|
424
|
+
*/
|
|
430
425
|
/**
|
|
431
|
-
* SCC Parser
|
|
432
|
-
*
|
|
433
|
-
* @public
|
|
434
|
-
*/
|
|
435
|
-
declare class SccParser {
|
|
426
|
+
* SCC Parser
|
|
427
|
+
*
|
|
428
|
+
* @public
|
|
429
|
+
*/
|
|
430
|
+
export declare class SccParser {
|
|
436
431
|
hasHeader: boolean;
|
|
437
432
|
nrLinesParsed: number;
|
|
438
433
|
processor: any;
|
|
@@ -446,5 +441,5 @@ declare class SccParser {
|
|
|
446
441
|
getLinesParsed(): number;
|
|
447
442
|
}
|
|
448
443
|
//#endregion
|
|
449
|
-
export { CaptionModes
|
|
444
|
+
export type { CaptionModes };
|
|
450
445
|
//# sourceMappingURL=index.d.ts.map
|