The DataView with media data
The start position of the sample within the DataView
The size of the sample in bytes
fieldData array containing field 1 and field 2 data arrays
it('should extract CTA-608 field data from an AV1 metadata OBU', async () => {
const file = await readFile('test/fixtures/608_av1.mp4')
const { view, mdatBodyStart, samples } = parseSegment(file)
// The first sample carries the RCL control pair that opens the caption
const fieldData = extractCta608DataFromAv1Sample(view, mdatBodyStart, samples[0].size)
deepEqual(fieldData, [[0x94, 0x20], []])
})
Extracts CTA-608 data from an AV1 (
av01) sample.AV1 has no NAL units, so captions ride in an
metadata_itu_t_t35OBU rather than in an SEI message. The caption payload is unchanged — the same A/53cc_data()under the same T.35/GA94 identifier that extractCta608DataFromSample reads — so the returned field data feeds Cta608Parser identically.This is a separate function rather than a codec branch inside extractCta608DataFromSample because the two carriages are framed differently and neither sample is self-identifying. A NAL unit sample puts a fixed-width big-endian length in front of each unit, and that width is only known from
lengthSizeMinusOnein theavcC/hvcCconfig. An AV1 sample uses the low-overhead format, where each OBU carries its ownobu_sizeafter the header — and may omit it on the last OBU. Select on the sample entry type (av01) instead.