Source: lib/cea/i_cea_parser.js

  1. /*! @license
  2. * Shaka Player
  3. * Copyright 2016 Google LLC
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. goog.provide('shaka.cea.ICeaParser');
  7. /**
  8. * Interface for parsing inband closed caption data from MP4 streams.
  9. * @interface
  10. */
  11. shaka.cea.ICeaParser = class {
  12. /**
  13. * Initializes the parser with init segment data.
  14. * @param {!BufferSource} initSegment init segment to parse.
  15. */
  16. init(initSegment) {}
  17. /**
  18. * Parses the stream and extracts closed captions packets.
  19. * @param {!BufferSource} mediaSegment media segment to parse.
  20. * @return {!Array<!shaka.cea.ICeaParser.CaptionPacket>}
  21. */
  22. parse(mediaSegment) {}
  23. };
  24. /**
  25. * NALU type for Supplemental Enhancement Information (SEI).
  26. * @const {number}
  27. */
  28. shaka.cea.ICeaParser.NALU_TYPE_SEI = 0x06;
  29. /**
  30. * Default timescale value for a track.
  31. */
  32. shaka.cea.ICeaParser.DEFAULT_TIMESCALE_VALUE = 90000;
  33. /**
  34. * @typedef {{
  35. * packet: !Uint8Array,
  36. * pts: number
  37. * }}
  38. *
  39. * @description Parsed Caption Packet.
  40. * @property {!Uint8Array} packet
  41. * Caption packet. More specifically, it contains a "User data
  42. * registered by Recommendation ITU-T T.35 SEI message", from section D.1.6
  43. * and section D.2.6 of Rec. ITU-T H.264 (06/2019).
  44. * @property {number} pts
  45. * The presentation timestamp (pts) at which the ITU-T T.35 data shows up.
  46. * in seconds.
  47. * @exportDoc
  48. */
  49. shaka.cea.ICeaParser.CaptionPacket;