@blockcast/mmt-base 2.2.0-main.5e3e277b4606 → 2.2.0-main.6491af2cf117

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.
@@ -0,0 +1,21 @@
1
+ export interface EventTimelineTrack {
2
+ readonly name: string;
3
+ readonly namespace?: string;
4
+ readonly eventType: string;
5
+ /** Media tracks whose timeline the records index (riedl 3, R3). */
6
+ readonly depends: readonly string[];
7
+ }
8
+ export type EventTimelineTrackIssueCode = 'track_event_type' | 'track_event_mime_type' | 'track_event_depends';
9
+ export interface EventTimelineTrackIssue {
10
+ readonly code: EventTimelineTrackIssueCode;
11
+ readonly path: string;
12
+ readonly name: string;
13
+ readonly index: number;
14
+ }
15
+ /** Tracks of packaging "eventtimeline", only those of `eventTypes` when given. `issues` names every
16
+ * eventtimeline track a consumer must skip, whatever its eventType. */
17
+ export declare function catalogEventTimelineTracks(catalog: unknown, eventTypes?: readonly string[]): {
18
+ tracks: EventTimelineTrack[];
19
+ issues: EventTimelineTrackIssue[];
20
+ };
21
+ //# sourceMappingURL=event-timeline-catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-timeline-catalog.d.ts","sourceRoot":"","sources":["../src/event-timeline-catalog.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CACpC;AACD,MAAM,MAAM,2BAA2B,GAAG,kBAAkB,GAAG,uBAAuB,GAAG,qBAAqB,CAAA;AAC9G,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,2BAA2B,CAAA;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAID;wEACwE;AACxE,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG;IAC5F,MAAM,EAAE,kBAAkB,EAAE,CAAA;IAC5B,MAAM,EAAE,uBAAuB,EAAE,CAAA;CAClC,CA4BA"}
@@ -0,0 +1,40 @@
1
+ // The Event Timeline tracks of an MSF catalog (draft-ietf-moq-msf-01 8.2), read once for every
2
+ // consumer: the container's ad-creative receiver, the transport's join selection, the players.
3
+ // Track-level, like mmtpTrackIssues: a bad entry costs that track, never the catalog.
4
+ const isObject = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
5
+ /** Tracks of packaging "eventtimeline", only those of `eventTypes` when given. `issues` names every
6
+ * eventtimeline track a consumer must skip, whatever its eventType. */
7
+ export function catalogEventTimelineTracks(catalog, eventTypes) {
8
+ const tracks = [];
9
+ const issues = [];
10
+ const list = isObject(catalog) && Array.isArray(catalog['tracks']) ? catalog['tracks'] : [];
11
+ // msf-01 5.2.14: a depends name resolves in the namespace of the track that declares it.
12
+ const named = new Set(list.filter(isObject).map((t) => `${String(t['namespace'] ?? '')}\u0000${String(t['name'])}`));
13
+ list.forEach((t, index) => {
14
+ if (!isObject(t) || t['packaging'] !== 'eventtimeline' || typeof t['name'] !== 'string')
15
+ return;
16
+ const name = t['name'];
17
+ const issue = (code, field) => {
18
+ issues.push({ code, path: `$.tracks[${index}].${field}`, name, index });
19
+ };
20
+ const eventType = t['eventType'];
21
+ if (typeof eventType !== 'string' || eventType.length === 0)
22
+ return issue('track_event_type', 'eventType');
23
+ // msf-01 8.2 requires application/json; the MSF editor's copy dropped the field, so only another value rejects.
24
+ if (t['mimeType'] !== undefined && t['mimeType'] !== 'application/json')
25
+ return issue('track_event_mime_type', 'mimeType');
26
+ const depends = t['depends'];
27
+ const namespace = String(t['namespace'] ?? '');
28
+ // riedl 3 (R3): depends names the media track(s) whose timeline the index uses; the timeline needs that clock.
29
+ if (!Array.isArray(depends) || depends.length === 0 ||
30
+ !depends.every((d) => typeof d === 'string' && d !== name && named.has(`${namespace}\u0000${d}`))) {
31
+ return issue('track_event_depends', 'depends');
32
+ }
33
+ if (eventTypes !== undefined && !eventTypes.includes(eventType))
34
+ return;
35
+ const ns = t['namespace'];
36
+ tracks.push({ name, ...(typeof ns === 'string' ? { namespace: ns } : {}), eventType, depends: depends });
37
+ });
38
+ return { tracks, issues };
39
+ }
40
+ //# sourceMappingURL=event-timeline-catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-timeline-catalog.js","sourceRoot":"","sources":["../src/event-timeline-catalog.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,+FAA+F;AAC/F,sFAAsF;AAiBtF,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAgC,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AAEvH;wEACwE;AACxE,MAAM,UAAU,0BAA0B,CAAC,OAAgB,EAAE,UAA8B;IAIzF,MAAM,MAAM,GAAyB,EAAE,CAAA;IACvC,MAAM,MAAM,GAA8B,EAAE,CAAA;IAC5C,MAAM,IAAI,GAAc,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACtG,yFAAyF;IACzF,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,CA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AAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YACpG,OAAO,KAAK,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAA;QAChD,CAAC;QACD,IAAI,UAAU,KAAK,SAAS,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC;YAAE,OAAM;QACvE,MAAM,EAAE,GAAG,CAAC,CAAC,WAAW,CAAC,CAAA;QACzB,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,OAAmB,EAAE,CAAC,CAAA;IACtH,CAAC,CAAC,CAAA;IACF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AAC3B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -10,4 +10,5 @@ export * from './fec-catalog.js';
10
10
  export * from './fec-bindings.js';
11
11
  export * from './mmtp-siblings.js';
12
12
  export * from './datagram-leg-size.js';
13
+ export * from './event-timeline-catalog.js';
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA"}
package/dist/index.js CHANGED
@@ -10,4 +10,5 @@ export * from './fec-catalog.js';
10
10
  export * from './fec-bindings.js';
11
11
  export * from './mmtp-siblings.js';
12
12
  export * from './datagram-leg-size.js';
13
+ export * from './event-timeline-catalog.js';
13
14
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockcast/mmt-base",
3
- "version": "2.2.0-main.5e3e277b4606",
3
+ "version": "2.2.0-main.6491af2cf117",
4
4
  "description": "Shared MMTP parsing primitives and protocol constants (zero FEC dependency). Hosts MMTP_HEADER_SIZE, parseMMTPHeader, extractMFUPayload and friends, plus wire constants such as DEFAULT_AMT_RELAY_PORT, so @blockcast/mmt-fec, @blockcast/mmt-container and @blockcast/mmt-transport can share one definition without a circular dep.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,55 @@
1
+ // The Event Timeline tracks of an MSF catalog (draft-ietf-moq-msf-01 8.2), read once for every
2
+ // consumer: the container's ad-creative receiver, the transport's join selection, the players.
3
+ // Track-level, like mmtpTrackIssues: a bad entry costs that track, never the catalog.
4
+
5
+ export interface EventTimelineTrack {
6
+ readonly name: string
7
+ readonly namespace?: string
8
+ readonly eventType: string
9
+ /** Media tracks whose timeline the records index (riedl 3, R3). */
10
+ readonly depends: readonly string[]
11
+ }
12
+ export type EventTimelineTrackIssueCode = 'track_event_type' | 'track_event_mime_type' | 'track_event_depends'
13
+ export interface EventTimelineTrackIssue {
14
+ readonly code: EventTimelineTrackIssueCode
15
+ readonly path: string
16
+ readonly name: string
17
+ readonly index: number
18
+ }
19
+
20
+ const isObject = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null && !Array.isArray(v)
21
+
22
+ /** Tracks of packaging "eventtimeline", only those of `eventTypes` when given. `issues` names every
23
+ * eventtimeline track a consumer must skip, whatever its eventType. */
24
+ export function catalogEventTimelineTracks(catalog: unknown, eventTypes?: readonly string[]): {
25
+ tracks: EventTimelineTrack[]
26
+ issues: EventTimelineTrackIssue[]
27
+ } {
28
+ const tracks: EventTimelineTrack[] = []
29
+ const issues: EventTimelineTrackIssue[] = []
30
+ const list: unknown[] = isObject(catalog) && Array.isArray(catalog['tracks']) ? catalog['tracks'] : []
31
+ // msf-01 5.2.14: a depends name resolves in the namespace of the track that declares it.
32
+ const named = new Set(list.filter(isObject).map((t) => `${String(t['namespace'] ?? '')}\u0000${String(t['name'])}`))
33
+ list.forEach((t, index) => {
34
+ if (!isObject(t) || t['packaging'] !== 'eventtimeline' || typeof t['name'] !== 'string') return
35
+ const name = t['name']
36
+ const issue = (code: EventTimelineTrackIssueCode, field: string): void => {
37
+ issues.push({ code, path: `$.tracks[${index}].${field}`, name, index })
38
+ }
39
+ const eventType = t['eventType']
40
+ if (typeof eventType !== 'string' || eventType.length === 0) return issue('track_event_type', 'eventType')
41
+ // msf-01 8.2 requires application/json; the MSF editor's copy dropped the field, so only another value rejects.
42
+ if (t['mimeType'] !== undefined && t['mimeType'] !== 'application/json') return issue('track_event_mime_type', 'mimeType')
43
+ const depends = t['depends']
44
+ const namespace = String(t['namespace'] ?? '')
45
+ // riedl 3 (R3): depends names the media track(s) whose timeline the index uses; the timeline needs that clock.
46
+ if (!Array.isArray(depends) || depends.length === 0 ||
47
+ !depends.every((d) => typeof d === 'string' && d !== name && named.has(`${namespace}\u0000${d}`))) {
48
+ return issue('track_event_depends', 'depends')
49
+ }
50
+ if (eventTypes !== undefined && !eventTypes.includes(eventType)) return
51
+ const ns = t['namespace']
52
+ tracks.push({ name, ...(typeof ns === 'string' ? { namespace: ns } : {}), eventType, depends: depends as string[] })
53
+ })
54
+ return { tracks, issues }
55
+ }
package/src/index.ts CHANGED
@@ -10,3 +10,4 @@ export * from './fec-catalog.js'
10
10
  export * from './fec-bindings.js'
11
11
  export * from './mmtp-siblings.js'
12
12
  export * from './datagram-leg-size.js'
13
+ export * from './event-timeline-catalog.js'