Source: externs/shaka/text.js

  1. /**
  2. * @license
  3. * Copyright 2016 Google Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /** @externs */
  18. /**
  19. * An interface for plugins that parse text tracks.
  20. *
  21. * @interface
  22. * @exportDoc
  23. */
  24. shakaExtern.TextParser = function() {};
  25. /**
  26. * A collection of time offsets used to adjust text cue times.
  27. *
  28. * @typedef {{
  29. * periodStart : number,
  30. * segmentStart : number,
  31. * segmentEnd : number
  32. * }}
  33. *
  34. * @property {number} periodStart
  35. * The absolute start time of the period in seconds.
  36. * @property {number} segmentStart
  37. * The absolute start time of the segment in seconds.
  38. * @property {number} segmentEnd
  39. * The absolute end time of the segment in seconds.
  40. *
  41. * @exportDoc
  42. */
  43. shakaExtern.TextParser.TimeContext;
  44. /**
  45. * Parse an initialization segment. Some formats do not have init
  46. * segments so this won't always be called.
  47. *
  48. * @param {!ArrayBuffer} data
  49. * The data that makes up the init segment.
  50. *
  51. * @exportDoc
  52. */
  53. shakaExtern.TextParser.prototype.parseInit = function(data) {};
  54. /**
  55. * Parse a media segment and return the cues that make up the segment.
  56. *
  57. * @param {!ArrayBuffer} data
  58. * The next section of buffer.
  59. * @param {shakaExtern.TextParser.TimeContext} timeContext
  60. * The time information that should be used to adjust the times values
  61. * for each cue.
  62. * @return {!Array.<!TextTrackCue>}
  63. *
  64. * @exportDoc
  65. */
  66. shakaExtern.TextParser.prototype.parseMedia = function(data, timeContext) {};
  67. /**
  68. * @typedef {function(new:shakaExtern.TextParser)}
  69. */
  70. shakaExtern.TextParserPlugin;