@ac-kit/format-hls 0.0.0-stage → 0.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.
Files changed (148) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/LICENSE +28 -0
  3. package/README.md +145 -2
  4. package/dist/_date-range-fields.d.ts +14 -0
  5. package/dist/_date-range-fields.d.ts.map +1 -0
  6. package/dist/_date-range-fields.js +53 -0
  7. package/dist/_date-range-fields.js.map +1 -0
  8. package/dist/_key-scope.d.ts +8 -0
  9. package/dist/_key-scope.d.ts.map +1 -0
  10. package/dist/_key-scope.js +14 -0
  11. package/dist/_key-scope.js.map +1 -0
  12. package/dist/_temporal.d.ts +3 -0
  13. package/dist/_temporal.d.ts.map +1 -0
  14. package/dist/_temporal.js +14 -0
  15. package/dist/_temporal.js.map +1 -0
  16. package/dist/attribute/_print-attribute.d.ts +10 -0
  17. package/dist/attribute/_print-attribute.d.ts.map +1 -0
  18. package/dist/attribute/_print-attribute.js +31 -0
  19. package/dist/attribute/_print-attribute.js.map +1 -0
  20. package/dist/attribute/_scan-attribute-list.d.ts +24 -0
  21. package/dist/attribute/_scan-attribute-list.d.ts.map +1 -0
  22. package/dist/attribute/_scan-attribute-list.js +147 -0
  23. package/dist/attribute/_scan-attribute-list.js.map +1 -0
  24. package/dist/attribute/hls-attribute.d.ts +38 -0
  25. package/dist/attribute/hls-attribute.d.ts.map +1 -0
  26. package/dist/attribute/hls-attribute.js +42 -0
  27. package/dist/attribute/hls-attribute.js.map +1 -0
  28. package/dist/document/hls-document.d.ts +52 -0
  29. package/dist/document/hls-document.d.ts.map +1 -0
  30. package/dist/document/hls-document.js +2 -0
  31. package/dist/document/hls-document.js.map +1 -0
  32. package/dist/document/parse-hls-document.d.ts +14 -0
  33. package/dist/document/parse-hls-document.d.ts.map +1 -0
  34. package/dist/document/parse-hls-document.js +79 -0
  35. package/dist/document/parse-hls-document.js.map +1 -0
  36. package/dist/document/print-hls-document.d.ts +10 -0
  37. package/dist/document/print-hls-document.d.ts.map +1 -0
  38. package/dist/document/print-hls-document.js +28 -0
  39. package/dist/document/print-hls-document.js.map +1 -0
  40. package/dist/errors.d.ts +92 -0
  41. package/dist/errors.d.ts.map +1 -0
  42. package/dist/errors.js +67 -0
  43. package/dist/errors.js.map +1 -0
  44. package/dist/hls-playlist-queries.d.ts +16 -0
  45. package/dist/hls-playlist-queries.d.ts.map +1 -0
  46. package/dist/hls-playlist-queries.js +28 -0
  47. package/dist/hls-playlist-queries.js.map +1 -0
  48. package/dist/index.d.ts +21 -0
  49. package/dist/index.d.ts.map +1 -0
  50. package/dist/index.js +21 -0
  51. package/dist/index.js.map +1 -0
  52. package/dist/limits.d.ts +48 -0
  53. package/dist/limits.d.ts.map +1 -0
  54. package/dist/limits.js +24 -0
  55. package/dist/limits.js.map +1 -0
  56. package/dist/live/apply-hls-delta-update.d.ts +49 -0
  57. package/dist/live/apply-hls-delta-update.d.ts.map +1 -0
  58. package/dist/live/apply-hls-delta-update.js +298 -0
  59. package/dist/live/apply-hls-delta-update.js.map +1 -0
  60. package/dist/model/hls-key.d.ts +29 -0
  61. package/dist/model/hls-key.d.ts.map +1 -0
  62. package/dist/model/hls-key.js +2 -0
  63. package/dist/model/hls-key.js.map +1 -0
  64. package/dist/model/hls-media-playlist.d.ts +202 -0
  65. package/dist/model/hls-media-playlist.d.ts.map +1 -0
  66. package/dist/model/hls-media-playlist.js +2 -0
  67. package/dist/model/hls-media-playlist.js.map +1 -0
  68. package/dist/model/hls-multivariant-playlist.d.ts +142 -0
  69. package/dist/model/hls-multivariant-playlist.d.ts.map +1 -0
  70. package/dist/model/hls-multivariant-playlist.js +2 -0
  71. package/dist/model/hls-multivariant-playlist.js.map +1 -0
  72. package/dist/model/hls-playlist.d.ts +77 -0
  73. package/dist/model/hls-playlist.d.ts.map +1 -0
  74. package/dist/model/hls-playlist.js +2 -0
  75. package/dist/model/hls-playlist.js.map +1 -0
  76. package/dist/parse/_attribute-reader.d.ts +106 -0
  77. package/dist/parse/_attribute-reader.d.ts.map +1 -0
  78. package/dist/parse/_attribute-reader.js +266 -0
  79. package/dist/parse/_attribute-reader.js.map +1 -0
  80. package/dist/parse/_context.d.ts +87 -0
  81. package/dist/parse/_context.d.ts.map +1 -0
  82. package/dist/parse/_context.js +179 -0
  83. package/dist/parse/_context.js.map +1 -0
  84. package/dist/parse/_interpret-media.d.ts +18 -0
  85. package/dist/parse/_interpret-media.d.ts.map +1 -0
  86. package/dist/parse/_interpret-media.js +677 -0
  87. package/dist/parse/_interpret-media.js.map +1 -0
  88. package/dist/parse/_interpret-multivariant.d.ts +9 -0
  89. package/dist/parse/_interpret-multivariant.d.ts.map +1 -0
  90. package/dist/parse/_interpret-multivariant.js +435 -0
  91. package/dist/parse/_interpret-multivariant.js.map +1 -0
  92. package/dist/parse/_media-validation.d.ts +14 -0
  93. package/dist/parse/_media-validation.d.ts.map +1 -0
  94. package/dist/parse/_media-validation.js +50 -0
  95. package/dist/parse/_media-validation.js.map +1 -0
  96. package/dist/parse/_prepare-lines.d.ts +12 -0
  97. package/dist/parse/_prepare-lines.d.ts.map +1 -0
  98. package/dist/parse/_prepare-lines.js +118 -0
  99. package/dist/parse/_prepare-lines.js.map +1 -0
  100. package/dist/parse/_sink.d.ts +30 -0
  101. package/dist/parse/_sink.d.ts.map +1 -0
  102. package/dist/parse/_sink.js +53 -0
  103. package/dist/parse/_sink.js.map +1 -0
  104. package/dist/parse/_values.d.ts +31 -0
  105. package/dist/parse/_values.d.ts.map +1 -0
  106. package/dist/parse/_values.js +89 -0
  107. package/dist/parse/_values.js.map +1 -0
  108. package/dist/parse/_variables.d.ts +34 -0
  109. package/dist/parse/_variables.d.ts.map +1 -0
  110. package/dist/parse/_variables.js +65 -0
  111. package/dist/parse/_variables.js.map +1 -0
  112. package/dist/parse/parse-hls-date-time.d.ts +13 -0
  113. package/dist/parse/parse-hls-date-time.d.ts.map +1 -0
  114. package/dist/parse/parse-hls-date-time.js +36 -0
  115. package/dist/parse/parse-hls-date-time.js.map +1 -0
  116. package/dist/parse/parse-hls-playlist.d.ts +58 -0
  117. package/dist/parse/parse-hls-playlist.d.ts.map +1 -0
  118. package/dist/parse/parse-hls-playlist.js +119 -0
  119. package/dist/parse/parse-hls-playlist.js.map +1 -0
  120. package/dist/parse-stream.d.ts +19 -0
  121. package/dist/parse-stream.d.ts.map +1 -0
  122. package/dist/parse-stream.js +54 -0
  123. package/dist/parse-stream.js.map +1 -0
  124. package/dist/print/print-hls-playlist.d.ts +39 -0
  125. package/dist/print/print-hls-playlist.d.ts.map +1 -0
  126. package/dist/print/print-hls-playlist.js +504 -0
  127. package/dist/print/print-hls-playlist.js.map +1 -0
  128. package/dist/print-stream.d.ts +11 -0
  129. package/dist/print-stream.d.ts.map +1 -0
  130. package/dist/print-stream.js +13 -0
  131. package/dist/print-stream.js.map +1 -0
  132. package/dist/resolve/_href.d.ts +13 -0
  133. package/dist/resolve/_href.d.ts.map +1 -0
  134. package/dist/resolve/_href.js +26 -0
  135. package/dist/resolve/_href.js.map +1 -0
  136. package/dist/resolve/hls-resolve-diagnostic.d.ts +26 -0
  137. package/dist/resolve/hls-resolve-diagnostic.d.ts.map +1 -0
  138. package/dist/resolve/hls-resolve-diagnostic.js +2 -0
  139. package/dist/resolve/hls-resolve-diagnostic.js.map +1 -0
  140. package/dist/resolve/resolve-hls-segments.d.ts +74 -0
  141. package/dist/resolve/resolve-hls-segments.d.ts.map +1 -0
  142. package/dist/resolve/resolve-hls-segments.js +179 -0
  143. package/dist/resolve/resolve-hls-segments.js.map +1 -0
  144. package/dist/resolve/resolve-hls-variants.d.ts +105 -0
  145. package/dist/resolve/resolve-hls-variants.d.ts.map +1 -0
  146. package/dist/resolve/resolve-hls-variants.js +162 -0
  147. package/dist/resolve/resolve-hls-variants.js.map +1 -0
  148. package/package.json +63 -3
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=hls-media-playlist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hls-media-playlist.js","sourceRoot":"","sources":["../../src/model/hls-media-playlist.ts"],"names":[],"mappings":""}
@@ -0,0 +1,142 @@
1
+ import type { HlsAttribute } from "../attribute/hls-attribute.js";
2
+ import type { HlsKey } from "./hls-key.js";
3
+ import type { HlsPlaylistHeader, HlsResolution } from "./hls-playlist.js";
4
+ /**
5
+ * A multivariant playlist (§4.4.6): the variant streams of a presentation and
6
+ * their alternative renditions.
7
+ */
8
+ export type HlsMultivariantPlaylist = HlsPlaylistHeader & {
9
+ readonly kind: "multivariant";
10
+ /** `EXT-X-MEDIA`s, in source order. */
11
+ readonly renditions: readonly HlsRendition[];
12
+ /** `EXT-X-STREAM-INF`s with their URI lines, in source order. */
13
+ readonly variants: readonly HlsVariant[];
14
+ /** `EXT-X-I-FRAME-STREAM-INF`s, in source order. */
15
+ readonly iFrameVariants: readonly HlsIFrameVariant[];
16
+ /** `EXT-X-SESSION-DATA`s, in source order. */
17
+ readonly sessionData: readonly HlsSessionData[];
18
+ /** `EXT-X-SESSION-KEY`s, in source order; never `METHOD=NONE`. Plain data. */
19
+ readonly sessionKeys: readonly HlsKey[];
20
+ /** `EXT-X-CONTENT-STEERING`. */
21
+ readonly contentSteering: HlsContentSteering | null;
22
+ };
23
+ /** The rendition types §4.4.6.1 defines. */
24
+ export type HlsRenditionType = "AUDIO" | "VIDEO" | "SUBTITLES" | "CLOSED-CAPTIONS";
25
+ /**
26
+ * `EXT-X-MEDIA` (§4.4.6.1): one alternative rendition.
27
+ *
28
+ * An attribute whose value the parser did not recognize — `DEFAULT=MAYBE` — is
29
+ * kept in `unknownAttributes`; {@link resolveHlsVariants} reports such a
30
+ * rendition as unsupported (§6.3.1).
31
+ */
32
+ export type HlsRendition = {
33
+ /**
34
+ * `null` when `TYPE` is not one the parser recognizes; the attribute is then
35
+ * in `unknownAttributes`, the rendition joins no group, and
36
+ * {@link resolveHlsVariants} reports it as unsupported.
37
+ */
38
+ readonly type: HlsRenditionType | null;
39
+ readonly groupId: string;
40
+ readonly name: string;
41
+ /** `null`: the media is in the variant's own playlist. */
42
+ readonly uri: string | null;
43
+ readonly language: string | null;
44
+ readonly assocLanguage: string | null;
45
+ readonly stableRenditionId: string | null;
46
+ readonly default: boolean;
47
+ readonly autoselect: boolean;
48
+ readonly forced: boolean;
49
+ readonly instreamId: string | null;
50
+ readonly bitDepth: number | null;
51
+ readonly sampleRate: number | null;
52
+ /** `CHARACTERISTICS` split at commas. */
53
+ readonly characteristics: readonly string[];
54
+ readonly channels: HlsChannels | null;
55
+ readonly unknownAttributes: readonly HlsAttribute[];
56
+ };
57
+ /**
58
+ * `CHANNELS`, split at `/`, every parameter after the first split at commas:
59
+ * `"6/-/BINAURAL"` is `{ count: 6, audioCoding: ["-"], specialUsage:
60
+ * ["BINAURAL"], further: [] }`. A parameter that is absent is `null`.
61
+ */
62
+ export type HlsChannels = {
63
+ readonly count: number;
64
+ readonly audioCoding: readonly string[] | null;
65
+ readonly specialUsage: readonly string[] | null;
66
+ /** Parameters past the third, as written. */
67
+ readonly further: readonly string[];
68
+ };
69
+ /** One `ALLOWED-CPC` entry: a `KEYFORMAT` and its CPC labels. */
70
+ export type HlsAllowedCpc = {
71
+ readonly keyFormat: string;
72
+ readonly labels: readonly string[];
73
+ };
74
+ /**
75
+ * Attributes `EXT-X-STREAM-INF` and `EXT-X-I-FRAME-STREAM-INF` share (§4.4.6.2,
76
+ * §4.4.6.3).
77
+ *
78
+ * An attribute whose value the parser did not recognize — `VIDEO-RANGE=XYZ`, an
79
+ * unknown `REQ-` attribute — is kept in `unknownAttributes`;
80
+ * {@link resolveHlsVariants} reports such a variant as unsupported (§6.3.1).
81
+ */
82
+ export type HlsVariantAttributes = {
83
+ /** `BANDWIDTH`, bit/s; `null` only from a lenient parse that found none. */
84
+ readonly bandwidth: number | null;
85
+ readonly averageBandwidth: number | null;
86
+ readonly score: number | null;
87
+ /** `CODECS` split at commas; RFC 6381 strings are not interpreted. */
88
+ readonly codecs: readonly string[];
89
+ /**
90
+ * `"dvh1.08.07/db4h"` is `[["dvh1.08.07", "db4h"]]`: a codec, then its
91
+ * brands.
92
+ */
93
+ readonly supplementalCodecs: readonly (readonly string[])[];
94
+ readonly resolution: HlsResolution | null;
95
+ readonly hdcpLevel: "TYPE-0" | "TYPE-1" | "NONE" | null;
96
+ readonly allowedCpc: readonly HlsAllowedCpc[];
97
+ readonly videoRange: "SDR" | "HLG" | "PQ" | null;
98
+ /** `REQ-VIDEO-LAYOUT`: View Presentation Entries, each a list of specifiers. */
99
+ readonly reqVideoLayout: readonly (readonly string[])[];
100
+ readonly stableVariantId: string | null;
101
+ /** `VIDEO` group ID. */
102
+ readonly video: string | null;
103
+ /** `PATHWAY-ID`; `null` means the default pathway `"."`. */
104
+ readonly pathwayId: string | null;
105
+ readonly unknownAttributes: readonly HlsAttribute[];
106
+ };
107
+ /** `EXT-X-STREAM-INF` and its URI line: a variant stream. */
108
+ export type HlsVariant = HlsVariantAttributes & {
109
+ /** The URI line as written, after variable substitution. */
110
+ readonly uri: string;
111
+ readonly frameRate: number | null;
112
+ /** `AUDIO` group ID. */
113
+ readonly audio: string | null;
114
+ /** `SUBTITLES` group ID. */
115
+ readonly subtitles: string | null;
116
+ /** A group ID, `"NONE"` for the enumerated value, or `null` when absent. */
117
+ readonly closedCaptions: {
118
+ readonly groupId: string;
119
+ } | "NONE" | null;
120
+ };
121
+ /** `EXT-X-I-FRAME-STREAM-INF`: an I-frame playlist. */
122
+ export type HlsIFrameVariant = HlsVariantAttributes & {
123
+ readonly uri: string;
124
+ };
125
+ /** `EXT-X-SESSION-DATA` (§4.4.6.4). */
126
+ export type HlsSessionData = {
127
+ readonly dataId: string;
128
+ readonly value: string | null;
129
+ readonly uri: string | null;
130
+ /** `JSON` when absent. */
131
+ readonly format: "JSON" | "RAW";
132
+ readonly language: string | null;
133
+ readonly unknownAttributes: readonly HlsAttribute[];
134
+ };
135
+ /** `EXT-X-CONTENT-STEERING` (§4.4.6.6). */
136
+ export type HlsContentSteering = {
137
+ readonly serverUri: string;
138
+ /** The pathway to start with. */
139
+ readonly pathwayId: string | null;
140
+ readonly unknownAttributes: readonly HlsAttribute[];
141
+ };
142
+ //# sourceMappingURL=hls-multivariant-playlist.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hls-multivariant-playlist.d.ts","sourceRoot":"","sources":["../../src/model/hls-multivariant-playlist.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE1E;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG;IACzD,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,uCAAuC;IACvC,QAAQ,CAAC,UAAU,EAAE,SAAS,YAAY,EAAE,CAAC;IAC7C,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,CAAC;IACzC,oDAAoD;IACpD,QAAQ,CAAC,cAAc,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACrD,8CAA8C;IAC9C,QAAQ,CAAC,WAAW,EAAE,SAAS,cAAc,EAAE,CAAC;IAChD,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,gCAAgC;IAChC,QAAQ,CAAC,eAAe,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACpD,CAAC;AAEF,4CAA4C;AAC5C,MAAM,MAAM,gBAAgB,GACzB,OAAO,GACP,OAAO,GACP,WAAW,GACX,iBAAiB,CAAC;AAErB;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,MA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CAAC;IAClC,wBAAwB;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,4BAA4B;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,4EAA4E;IAC5E,QAAQ,CAAC,cAAc,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,GAAG,IAAI,CAAC;CACtE,CAAC;AAEF,uDAAuD;AACvD,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG;IACrD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,uCAAuC;AACvC,MAAM,MAAM,cAAc,GAAG;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,0BAA0B;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,iBAAiB,EAAE,SAAS,YAAY,EAAE,CAAC;CACpD,CAAC;AAEF,2CAA2C;AAC3C,MAAM,MAAM,kBAAkB,GAAG;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,iCAAiC;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,iBAAiB,EAAE,SAAS,YAAY,EAAE,CAAC;CACpD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=hls-multivariant-playlist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hls-multivariant-playlist.js","sourceRoot":"","sources":["../../src/model/hls-multivariant-playlist.ts"],"names":[],"mappings":""}
@@ -0,0 +1,77 @@
1
+ import type { HlsAttribute } from "../attribute/hls-attribute.js";
2
+ import type { HlsMediaPlaylist } from "./hls-media-playlist.js";
3
+ import type { HlsMultivariantPlaylist } from "./hls-multivariant-playlist.js";
4
+ /** A parsed playlist: `kind` tells a media playlist from a multivariant one. */
5
+ export type HlsPlaylist = HlsMediaPlaylist | HlsMultivariantPlaylist;
6
+ /** Tags allowed in both kinds of playlist (§4.4.1, §4.4.2). */
7
+ export type HlsPlaylistHeader = {
8
+ /** `EXT-X-VERSION`; `null` when absent, which means version 1. */
9
+ readonly version: number | null;
10
+ /** `EXT-X-INDEPENDENT-SEGMENTS`. */
11
+ readonly independentSegments: boolean;
12
+ /** `EXT-X-START`. */
13
+ readonly start: HlsStart | null;
14
+ /** `EXT-X-DEFINE`s in source order, each with the value in effect. */
15
+ readonly defines: readonly HlsDefine[];
16
+ /**
17
+ * Tags this package does not model, and tags it set aside (see
18
+ * {@link HlsUnknownTag}), found before any segment tag of a media playlist or
19
+ * anywhere in a multivariant playlist, in source order.
20
+ */
21
+ readonly unknownTags: readonly HlsUnknownTag[];
22
+ };
23
+ /** `EXT-X-START` (§4.4.2.2). */
24
+ export type HlsStart = {
25
+ /** Signed seconds; a negative offset counts back from the end. */
26
+ readonly timeOffset: number;
27
+ /** `PRECISE=YES`. */
28
+ readonly precise: boolean;
29
+ readonly unknownAttributes: readonly HlsAttribute[];
30
+ };
31
+ /**
32
+ * `EXT-X-DEFINE` (§4.4.2.3), with the value in effect however it was declared:
33
+ * written in the playlist (`NAME`/`VALUE`), taken from the parent multivariant
34
+ * playlist (`IMPORT`), or read from the playlist URL's query (`QUERYPARAM`).
35
+ * The printer writes the declaration back, so a playlist with an import or a
36
+ * query parameter reads back the same only given the same `importedVariables`
37
+ * or `url`.
38
+ */
39
+ export type HlsDefine = {
40
+ readonly kind: "value" | "import" | "query-parameter";
41
+ readonly name: string;
42
+ readonly value: string;
43
+ };
44
+ /**
45
+ * A tag the parser does not model, or one it set aside, kept raw and never
46
+ * substituted.
47
+ *
48
+ * A known tag is set aside, with a warning, when its value cannot be read in
49
+ * lenient mode — a missing required attribute, an integer past 2^53−1 — or when
50
+ * §6.3.1 says a client must ignore it and nothing in the model can carry it: an
51
+ * unknown `EXT-X-PLAYLIST-TYPE`, `EXT-X-MEDIA` `TYPE`, `EXT-X-PRELOAD-HINT`
52
+ * `TYPE` or `EXT-X-SESSION-DATA` `FORMAT`. `EXT-X-KEY` is never set aside, so a
53
+ * segment under a key the parser cannot read never looks unencrypted.
54
+ */
55
+ export type HlsUnknownTag = {
56
+ /** Without the `#`, trailing whitespace removed. */
57
+ readonly name: string;
58
+ /** Text after the first `:`, verbatim; `null` when there is none. */
59
+ readonly value: string | null;
60
+ /** The URI line a set-aside `EXT-X-STREAM-INF` took with it, verbatim. */
61
+ readonly uri: string | null;
62
+ };
63
+ /**
64
+ * `<length>[@<offset>]`: a sub-range of a resource, in bytes. `offset: null`
65
+ * continues right after the previous segment's sub-range of the same resource
66
+ * (§4.4.4.2), or the previous partial segment's in `EXT-X-PART`.
67
+ */
68
+ export type HlsByteRange = {
69
+ readonly length: number;
70
+ readonly offset: number | null;
71
+ };
72
+ /** A decimal-resolution: `1920x1080`. */
73
+ export type HlsResolution = {
74
+ readonly width: number;
75
+ readonly height: number;
76
+ };
77
+ //# sourceMappingURL=hls-playlist.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hls-playlist.d.ts","sourceRoot":"","sources":["../../src/model/hls-playlist.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAE9E,gFAAgF;AAChF,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,uBAAuB,CAAC;AAErE,+DAA+D;AAC/D,MAAM,MAAM,iBAAiB,GAAG;IAC/B,kEAAkE;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C,MAAM,MAAM,aAAa,GAAG;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=hls-playlist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hls-playlist.js","sourceRoot":"","sources":["../../src/model/hls-playlist.ts"],"names":[],"mappings":""}
@@ -0,0 +1,106 @@
1
+ import type { HlsAttribute } from "../attribute/hls-attribute.js";
2
+ import type { HlsByteRange, HlsResolution } from "../model/hls-playlist.js";
3
+ import { type DiagnosticSink } from "./_sink.js";
4
+ import type { VariableTable } from "./_variables.js";
5
+ /** Where a tag is, and what reading its value may report to. */
6
+ export type TagContext = {
7
+ readonly sink: DiagnosticSink;
8
+ readonly variables: VariableTable;
9
+ readonly tagName: string;
10
+ /** 1-based line. */
11
+ readonly line: number;
12
+ /** 1-based column of the first character after the `:`. */
13
+ readonly valueColumn: number;
14
+ };
15
+ /** How a reader treats a value it cannot read. */
16
+ type Requirement = {
17
+ /** Absent or unreadable sets the tag aside in lenient mode. */
18
+ readonly required?: boolean;
19
+ };
20
+ /**
21
+ * Reads the attributes of one tag by name, each at most once, in the type its
22
+ * definition gives.
23
+ *
24
+ * A value of the wrong lexical type is a violation; lenient mode moves the
25
+ * attribute to {@link unknownAttributes} and answers `null`, so nothing is lost
26
+ * and the printer writes it back. An integer past 2^53−1 is an `unsafe-integer`
27
+ * violation; lenient mode sets the whole tag aside (a {@link SetAsideSignal}),
28
+ * unless `keepOnUnsafe` is set, as for `EXT-X-KEY`. A recognized enumerated
29
+ * attribute with an unrecognized value is kept in {@link unknownAttributes} with
30
+ * an `ignorable-tag` advisory (§6.3.1).
31
+ */
32
+ export declare class AttributeReader {
33
+ private readonly context_;
34
+ private readonly keepOnUnsafe_;
35
+ private readonly attributes_;
36
+ private readonly byName_;
37
+ private readonly consumed_;
38
+ private readonly setAsideAttributes_;
39
+ private readonly substituted_;
40
+ constructor(context_: TagContext, value: string | null, keepOnUnsafe_?: boolean);
41
+ /** Whether the tag carries `name`, read or not. */
42
+ has(name: string): boolean;
43
+ /** A quoted-string, variables substituted unless `substitute` is false. */
44
+ quoted(name: string, options?: Requirement & {
45
+ readonly substitute?: boolean;
46
+ readonly allowEmpty?: boolean;
47
+ }): string | null;
48
+ /** A decimal-integer. */
49
+ integer(name: string, options?: Requirement): number | null;
50
+ /** A decimal-floating-point, or a signed one. */
51
+ float(name: string, options?: Requirement & {
52
+ readonly signed?: boolean;
53
+ }): number | null;
54
+ /** A hexadecimal-sequence as written, after substitution. */
55
+ hexadecimal(name: string, options?: Requirement): string | null;
56
+ /** A decimal-resolution. */
57
+ resolution(name: string): HlsResolution | null;
58
+ /** A quoted `<n>[@<o>]`, as `EXT-X-MAP` and `EXT-X-PART` carry. */
59
+ byteRange(name: string): HlsByteRange | null;
60
+ /**
61
+ * An enumerated-string from `allowed`. An unrecognized value is kept in
62
+ * {@link unknownAttributes} with an `ignorable-tag` advisory, or sets the tag
63
+ * aside when `setAsideUnknown` is set.
64
+ */
65
+ enumerated<T extends string>(name: string, allowed: readonly T[], options?: Requirement & {
66
+ readonly setAsideUnknown?: boolean;
67
+ }): T | null;
68
+ /**
69
+ * `YES` or `NO`, `false` when absent. With `yesOnly`, only `YES` is
70
+ * recognized. Anything else is kept as for {@link enumerated}.
71
+ */
72
+ boolean(name: string, options?: {
73
+ readonly yesOnly?: boolean;
74
+ }): boolean;
75
+ /**
76
+ * Every attribute not read, and every one read but unreadable, in source
77
+ * order. Quoted values, and unquoted ones starting with `0x`, are
78
+ * substituted: the only two value types a substitution can apply to (§4.3).
79
+ */
80
+ unknownAttributes(): HlsAttribute[];
81
+ /**
82
+ * The value as written, blanks trimmed in lenient mode, for a value whose
83
+ * grammar the caller checks itself.
84
+ */
85
+ text(name: string): {
86
+ readonly value: string;
87
+ readonly quoted: boolean;
88
+ } | null;
89
+ /** Moves an attribute the caller found unreadable to {@link unknownAttributes}. */
90
+ reject(name: string): void;
91
+ /** Records a violation at `name`, or at the tag when it is absent. */
92
+ violation(name: string, code: Parameters<DiagnosticSink["violation"]>[0], message: string): void;
93
+ /** Records an `ignorable-tag` advisory at `name` (§6.3.1). */
94
+ advisory(name: string, message: string): void;
95
+ /** Sets the tag aside: in strict mode the violation already threw. */
96
+ setAside(): never;
97
+ private get lenient_();
98
+ private take_;
99
+ private invalid_;
100
+ private unsafe_;
101
+ private violation_;
102
+ private substitute_;
103
+ private column_;
104
+ }
105
+ export {};
106
+ //# sourceMappingURL=_attribute-reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_attribute-reader.d.ts","sourceRoot":"","sources":["../../src/parse/_attribute-reader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,YAAY,CAAC;AASjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,gEAAgE;AAChE,MAAM,MAAM,UAAU,GAAG;IACxB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,oBAAoB;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2DAA2D;IAC3D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,kDAAkD;AAClD,KAAK,WAAW,GAAG;IAClB,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,qBAAa,eAAe;IAQ1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAEzB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3
+ import { isHexadecimalSequence, looksHexadecimal, readByteRange, readDecimalFloat, readDecimalInteger, readResolution, } from "./_values.js";
4
+ /**
5
+ * Reads the attributes of one tag by name, each at most once, in the type its
6
+ * definition gives.
7
+ *
8
+ * A value of the wrong lexical type is a violation; lenient mode moves the
9
+ * attribute to {@link unknownAttributes} and answers `null`, so nothing is lost
10
+ * and the printer writes it back. An integer past 2^53−1 is an `unsafe-integer`
11
+ * violation; lenient mode sets the whole tag aside (a {@link SetAsideSignal}),
12
+ * unless `keepOnUnsafe` is set, as for `EXT-X-KEY`. A recognized enumerated
13
+ * attribute with an unrecognized value is kept in {@link unknownAttributes} with
14
+ * an `ignorable-tag` advisory (§6.3.1).
15
+ */
16
+ export class AttributeReader {
17
+ context_;
18
+ keepOnUnsafe_;
19
+ attributes_;
20
+ byName_ = new Map();
21
+ consumed_ = new Set();
22
+ setAsideAttributes_ = new Set();
23
+ substituted_ = new Map();
24
+ constructor(context_, value, keepOnUnsafe_ = false) {
25
+ this.context_ = context_;
26
+ this.keepOnUnsafe_ = keepOnUnsafe_;
27
+ const { sink, line, valueColumn } = context_;
28
+ this.attributes_ = scanAttributeList(value ?? "", sink.lenient, (code, offset, message) => {
29
+ sink.violation(code, line, valueColumn + offset, message);
30
+ });
31
+ for (const attribute of this.attributes_) {
32
+ this.byName_.set(attribute.name, attribute);
33
+ }
34
+ if (this.attributes_.length === 0) {
35
+ sink.violation("invalid-attribute-list", line, valueColumn, `${context_.tagName} needs at least one attribute`);
36
+ }
37
+ }
38
+ /** Whether the tag carries `name`, read or not. */
39
+ has(name) {
40
+ return this.byName_.has(name);
41
+ }
42
+ /** A quoted-string, variables substituted unless `substitute` is false. */
43
+ quoted(name, options) {
44
+ const attribute = this.take_(name, options);
45
+ if (attribute === null) {
46
+ return null;
47
+ }
48
+ if (!attribute.quoted) {
49
+ this.violation_(attribute, "invalid-attribute-value", `${name} must be a quoted-string`);
50
+ }
51
+ else if (attribute.value.length === 0 && options?.allowEmpty !== true) {
52
+ this.violation_(attribute, "invalid-attribute-value", `${name} must not be empty`);
53
+ }
54
+ return options?.substitute === false
55
+ ? attribute.value
56
+ : this.substitute_(attribute);
57
+ }
58
+ /** A decimal-integer. */
59
+ integer(name, options) {
60
+ const attribute = this.take_(name, options);
61
+ if (attribute === null) {
62
+ return null;
63
+ }
64
+ const value = readDecimalInteger(attribute.value, this.lenient_);
65
+ if (value === "unsafe") {
66
+ return this.unsafe_(attribute);
67
+ }
68
+ if (value === null || attribute.quoted) {
69
+ return this.invalid_(attribute, value, options, `${name} must be a decimal-integer`);
70
+ }
71
+ return value;
72
+ }
73
+ /** A decimal-floating-point, or a signed one. */
74
+ float(name, options) {
75
+ const attribute = this.take_(name, options);
76
+ if (attribute === null) {
77
+ return null;
78
+ }
79
+ const value = readDecimalFloat(attribute.value, this.lenient_, options?.signed === true);
80
+ if (value === null || attribute.quoted) {
81
+ return this.invalid_(attribute, value, options, `${name} must be a decimal number`);
82
+ }
83
+ return value;
84
+ }
85
+ /** A hexadecimal-sequence as written, after substitution. */
86
+ hexadecimal(name, options) {
87
+ const attribute = this.take_(name, options);
88
+ if (attribute === null) {
89
+ return null;
90
+ }
91
+ const value = this.substitute_(attribute);
92
+ if (attribute.quoted || !isHexadecimalSequence(value, false)) {
93
+ return this.invalid_(attribute, this.lenient_ && isHexadecimalSequence(value, true) ? value : null, options, `${name} must be a hexadecimal-sequence`);
94
+ }
95
+ return value;
96
+ }
97
+ /** A decimal-resolution. */
98
+ resolution(name) {
99
+ const attribute = this.take_(name, undefined);
100
+ if (attribute === null) {
101
+ return null;
102
+ }
103
+ const value = readResolution(attribute.value);
104
+ if (value === "unsafe") {
105
+ return this.unsafe_(attribute);
106
+ }
107
+ if (value === null || attribute.quoted) {
108
+ return this.invalid_(attribute, value, undefined, `${name} must be a decimal-resolution`);
109
+ }
110
+ return value;
111
+ }
112
+ /** A quoted `<n>[@<o>]`, as `EXT-X-MAP` and `EXT-X-PART` carry. */
113
+ byteRange(name) {
114
+ const attribute = this.take_(name, undefined);
115
+ if (attribute === null) {
116
+ return null;
117
+ }
118
+ const value = readByteRange(this.substitute_(attribute), this.lenient_);
119
+ if (value === "unsafe") {
120
+ return this.unsafe_(attribute);
121
+ }
122
+ if (value === null || !attribute.quoted) {
123
+ return this.invalid_(attribute, value, undefined, `${name} must be a quoted byte range`);
124
+ }
125
+ return value;
126
+ }
127
+ /**
128
+ * An enumerated-string from `allowed`. An unrecognized value is kept in
129
+ * {@link unknownAttributes} with an `ignorable-tag` advisory, or sets the tag
130
+ * aside when `setAsideUnknown` is set.
131
+ */
132
+ enumerated(name, allowed, options) {
133
+ const attribute = this.take_(name, options);
134
+ if (attribute === null) {
135
+ return null;
136
+ }
137
+ const value = this.lenient_ ? attribute.value.trim() : attribute.value;
138
+ if (attribute.quoted) {
139
+ this.violation_(attribute, "invalid-attribute-value", `${name} must not be quoted`);
140
+ }
141
+ if (allowed.includes(value)) {
142
+ return value;
143
+ }
144
+ this.context_.sink.advisory("ignorable-tag", this.context_.line, this.column_(attribute), `Unrecognized ${name} value "${value}": a client ignores this tag`);
145
+ if (options?.setAsideUnknown === true || options?.required === true) {
146
+ throw new SetAsideSignal();
147
+ }
148
+ this.setAsideAttributes_.add(name);
149
+ return null;
150
+ }
151
+ /**
152
+ * `YES` or `NO`, `false` when absent. With `yesOnly`, only `YES` is
153
+ * recognized. Anything else is kept as for {@link enumerated}.
154
+ */
155
+ boolean(name, options) {
156
+ const value = this.enumerated(name, options?.yesOnly === true ? ["YES"] : ["YES", "NO"]);
157
+ return value === "YES";
158
+ }
159
+ /**
160
+ * Every attribute not read, and every one read but unreadable, in source
161
+ * order. Quoted values, and unquoted ones starting with `0x`, are
162
+ * substituted: the only two value types a substitution can apply to (§4.3).
163
+ */
164
+ unknownAttributes() {
165
+ const unknown = [];
166
+ for (const attribute of this.attributes_) {
167
+ if (this.consumed_.has(attribute.name) &&
168
+ !this.setAsideAttributes_.has(attribute.name)) {
169
+ continue;
170
+ }
171
+ const substitutable = attribute.quoted || looksHexadecimal(attribute.value);
172
+ unknown.push({
173
+ name: attribute.name,
174
+ value: substitutable ? this.substitute_(attribute) : attribute.value,
175
+ quoted: attribute.quoted,
176
+ });
177
+ }
178
+ return unknown;
179
+ }
180
+ /**
181
+ * The value as written, blanks trimmed in lenient mode, for a value whose
182
+ * grammar the caller checks itself.
183
+ */
184
+ text(name) {
185
+ const attribute = this.take_(name, undefined);
186
+ if (attribute === null) {
187
+ return null;
188
+ }
189
+ return {
190
+ value: this.lenient_ ? attribute.value.trim() : attribute.value,
191
+ quoted: attribute.quoted,
192
+ };
193
+ }
194
+ /** Moves an attribute the caller found unreadable to {@link unknownAttributes}. */
195
+ reject(name) {
196
+ this.setAsideAttributes_.add(name);
197
+ }
198
+ /** Records a violation at `name`, or at the tag when it is absent. */
199
+ violation(name, code, message) {
200
+ const attribute = this.byName_.get(name);
201
+ this.context_.sink.violation(code, this.context_.line, attribute === undefined
202
+ ? this.context_.valueColumn
203
+ : this.column_(attribute), message);
204
+ }
205
+ /** Records an `ignorable-tag` advisory at `name` (§6.3.1). */
206
+ advisory(name, message) {
207
+ const attribute = this.byName_.get(name);
208
+ this.context_.sink.advisory("ignorable-tag", this.context_.line, attribute === undefined
209
+ ? this.context_.valueColumn
210
+ : this.column_(attribute), message);
211
+ }
212
+ /** Sets the tag aside: in strict mode the violation already threw. */
213
+ setAside() {
214
+ throw new SetAsideSignal();
215
+ }
216
+ get lenient_() {
217
+ return this.context_.sink.lenient;
218
+ }
219
+ take_(name, options) {
220
+ const attribute = this.byName_.get(name);
221
+ if (attribute === undefined) {
222
+ if (options?.required === true) {
223
+ this.context_.sink.violation("missing-attribute", this.context_.line, this.context_.valueColumn, `${this.context_.tagName} requires ${name}`);
224
+ throw new SetAsideSignal();
225
+ }
226
+ return null;
227
+ }
228
+ this.consumed_.add(name);
229
+ return attribute;
230
+ }
231
+ invalid_(attribute, recovered, options, message) {
232
+ this.violation_(attribute, "invalid-attribute-value", message);
233
+ if (recovered !== null) {
234
+ return recovered;
235
+ }
236
+ if (options?.required === true) {
237
+ throw new SetAsideSignal();
238
+ }
239
+ this.setAsideAttributes_.add(attribute.name);
240
+ return null;
241
+ }
242
+ unsafe_(attribute) {
243
+ this.violation_(attribute, "unsafe-integer", `${attribute.name} is past 2^53-1`);
244
+ if (!this.keepOnUnsafe_) {
245
+ throw new SetAsideSignal();
246
+ }
247
+ this.setAsideAttributes_.add(attribute.name);
248
+ return null;
249
+ }
250
+ violation_(attribute, code, message) {
251
+ this.context_.sink.violation(code, this.context_.line, this.column_(attribute), message);
252
+ }
253
+ substitute_(attribute) {
254
+ const cached = this.substituted_.get(attribute.name);
255
+ if (cached !== undefined) {
256
+ return cached;
257
+ }
258
+ const value = this.context_.variables.substitute(attribute.value, this.context_.line, this.column_(attribute));
259
+ this.substituted_.set(attribute.name, value);
260
+ return value;
261
+ }
262
+ column_(attribute) {
263
+ return this.context_.valueColumn + attribute.offset;
264
+ }
265
+ }
266
+ //# sourceMappingURL=_attribute-reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_attribute-reader.js","sourceRoot":"","sources":["../../src/parse/_attribute-reader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAGzE,OAAO,EAAuB,cAAc,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EACN,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,GACd,MAAM,cAAc,CAAC;AAoBtB;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,eAAe;IAQT,QAAQ;IAER,aAAa;IATd,WAAW,CAA8B;IACzC,OAAO,GAAG,IAAI,GAAG,EAA4B,CAAC;IAC9C,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,mBAAmB,GAAG,IAAI,GAAG,EAAU,CAAC;IACxC,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE1D,YACkB,QAAoB,EACrC,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