Source: lib/cea/i_caption_decoder.js

  1. /*! @license
  2. * Shaka Player
  3. * Copyright 2016 Google LLC
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. goog.provide('shaka.cea.ICaptionDecoder');
  7. goog.require('shaka.text.Cue');
  8. /**
  9. * Interface for decoding inband closed captions from packets.
  10. * @interface
  11. */
  12. shaka.cea.ICaptionDecoder = class {
  13. /**
  14. * Extracts packets and prepares them for decoding. In a given media fragment,
  15. * all the caption packets found in its SEI messages should be extracted by
  16. * successive calls to extract(), followed by a single call to decode().
  17. *
  18. * @param {!Uint8Array} userDataSeiMessage
  19. * This is a User Data registered by Rec.ITU-T T.35 SEI message.
  20. * It is described in sections D.1.6 and D.2.6 of Rec. ITU-T H.264 (06/2019).
  21. * @param {number} pts PTS when this packet was received, in seconds.
  22. */
  23. extract(userDataSeiMessage, pts) {}
  24. /**
  25. * Decodes all currently extracted packets and then clears them.
  26. * This should be called once for a set of extracts (see comment on extract).
  27. * @return {!Array.<!shaka.cea.ICaptionDecoder.ClosedCaption>}
  28. */
  29. decode() {}
  30. /**
  31. * Clears the decoder state completely.
  32. * Should be used when an action renders the decoder state invalid,
  33. * e.g. unbuffered seeks.
  34. */
  35. clear() {}
  36. };
  37. /**
  38. * Parsed Cue.
  39. * @typedef {{
  40. * cue: !shaka.text.Cue,
  41. * stream: string
  42. * }}
  43. */
  44. shaka.cea.ICaptionDecoder.ClosedCaption;