@norskvideo/moq-hang 0.1.0
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.
- package/README.md +65 -0
- package/catalog/audio.d.ts +139 -0
- package/catalog/audio.d.ts.map +1 -0
- package/catalog/audio.js +55 -0
- package/catalog/audio.js.map +1 -0
- package/catalog/consumer.d.ts +34 -0
- package/catalog/consumer.d.ts.map +1 -0
- package/catalog/consumer.js +30 -0
- package/catalog/consumer.js.map +1 -0
- package/catalog/container.d.ts +24 -0
- package/catalog/container.d.ts.map +1 -0
- package/catalog/container.js +30 -0
- package/catalog/container.js.map +1 -0
- package/catalog/format.d.ts +13 -0
- package/catalog/format.d.ts.map +1 -0
- package/catalog/format.js +24 -0
- package/catalog/format.js.map +1 -0
- package/catalog/index.d.ts +18 -0
- package/catalog/index.d.ts.map +1 -0
- package/catalog/index.js +19 -0
- package/catalog/index.js.map +1 -0
- package/catalog/integers.d.ts +23 -0
- package/catalog/integers.d.ts.map +1 -0
- package/catalog/integers.js +24 -0
- package/catalog/integers.js.map +1 -0
- package/catalog/priority.d.ts +7 -0
- package/catalog/priority.d.ts.map +1 -0
- package/catalog/priority.js +9 -0
- package/catalog/priority.js.map +1 -0
- package/catalog/producer.d.ts +31 -0
- package/catalog/producer.d.ts.map +1 -0
- package/catalog/producer.js +25 -0
- package/catalog/producer.js.map +1 -0
- package/catalog/root.d.ts +252 -0
- package/catalog/root.d.ts.map +1 -0
- package/catalog/root.js +17 -0
- package/catalog/root.js.map +1 -0
- package/catalog/root.test.d.ts +2 -0
- package/catalog/root.test.d.ts.map +1 -0
- package/catalog/root.test.js +20 -0
- package/catalog/root.test.js.map +1 -0
- package/catalog/timeline.d.ts +26 -0
- package/catalog/timeline.d.ts.map +1 -0
- package/catalog/timeline.js +33 -0
- package/catalog/timeline.js.map +1 -0
- package/catalog/track.d.ts +8 -0
- package/catalog/track.d.ts.map +1 -0
- package/catalog/track.js +7 -0
- package/catalog/track.js.map +1 -0
- package/catalog/video.d.ts +171 -0
- package/catalog/video.d.ts.map +1 -0
- package/catalog/video.js +87 -0
- package/catalog/video.js.map +1 -0
- package/container/cmaf/decode.d.ts +68 -0
- package/container/cmaf/decode.d.ts.map +1 -0
- package/container/cmaf/decode.js +303 -0
- package/container/cmaf/decode.js.map +1 -0
- package/container/cmaf/encode.d.ts +51 -0
- package/container/cmaf/encode.d.ts.map +1 -0
- package/container/cmaf/encode.js +834 -0
- package/container/cmaf/encode.js.map +1 -0
- package/container/cmaf/format.d.ts +12 -0
- package/container/cmaf/format.d.ts.map +1 -0
- package/container/cmaf/format.js +19 -0
- package/container/cmaf/format.js.map +1 -0
- package/container/cmaf/index.d.ts +9 -0
- package/container/cmaf/index.d.ts.map +1 -0
- package/container/cmaf/index.js +10 -0
- package/container/cmaf/index.js.map +1 -0
- package/container/consumer.d.ts +41 -0
- package/container/consumer.d.ts.map +1 -0
- package/container/consumer.js +424 -0
- package/container/consumer.js.map +1 -0
- package/container/consumer.test.d.ts +2 -0
- package/container/consumer.test.d.ts.map +1 -0
- package/container/consumer.test.js +396 -0
- package/container/consumer.test.js.map +1 -0
- package/container/format.d.ts +12 -0
- package/container/format.d.ts.map +1 -0
- package/container/format.js +3 -0
- package/container/format.js.map +1 -0
- package/container/index.d.ts +14 -0
- package/container/index.d.ts.map +1 -0
- package/container/index.js +18 -0
- package/container/index.js.map +1 -0
- package/container/legacy.d.ts +39 -0
- package/container/legacy.d.ts.map +1 -0
- package/container/legacy.js +53 -0
- package/container/legacy.js.map +1 -0
- package/container/timeline.d.ts +67 -0
- package/container/timeline.d.ts.map +1 -0
- package/container/timeline.js +87 -0
- package/container/timeline.js.map +1 -0
- package/container/types.d.ts +22 -0
- package/container/types.d.ts.map +1 -0
- package/container/types.js +22 -0
- package/container/types.js.map +1 -0
- package/index.d.ts +13 -0
- package/index.d.ts.map +1 -0
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/package.json +37 -0
- package/util/aac.d.ts +8 -0
- package/util/aac.d.ts.map +1 -0
- package/util/aac.js +57 -0
- package/util/aac.js.map +1 -0
- package/util/aac.test.d.ts +2 -0
- package/util/aac.test.d.ts.map +1 -0
- package/util/aac.test.js +34 -0
- package/util/aac.test.js.map +1 -0
- package/util/hacks.d.ts +5 -0
- package/util/hacks.d.ts.map +1 -0
- package/util/hacks.js +6 -0
- package/util/hacks.js.map +1 -0
- package/util/hex.d.ts +5 -0
- package/util/hex.d.ts.map +1 -0
- package/util/hex.js +18 -0
- package/util/hex.js.map +1 -0
- package/util/index.d.ts +12 -0
- package/util/index.d.ts.map +1 -0
- package/util/index.js +18 -0
- package/util/index.js.map +1 -0
- package/util/latency.d.ts +38 -0
- package/util/latency.d.ts.map +1 -0
- package/util/latency.js +49 -0
- package/util/latency.js.map +1 -0
- package/util/libav.d.ts +3 -0
- package/util/libav.d.ts.map +1 -0
- package/util/libav.js +26 -0
- package/util/libav.js.map +1 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as Json from "@norskvideo/moq-json";
|
|
2
|
+
import type * as z from "zod/mini";
|
|
3
|
+
import { type Root } from "./root";
|
|
4
|
+
/** Options for a catalog {@link Producer}. */
|
|
5
|
+
export interface Config<T extends Root = Root> {
|
|
6
|
+
/** zod schema validating each catalog before publish. Defaults to {@link RootSchema}. */
|
|
7
|
+
schema?: z.ZodMiniType<T>;
|
|
8
|
+
/**
|
|
9
|
+
* Delta encoding ratio forwarded to the underlying JSON producer.
|
|
10
|
+
*
|
|
11
|
+
* Defaults to `0`, which disables deltas: every change publishes a full snapshot in its own
|
|
12
|
+
* group, keeping the catalog byte-compatible with snapshot-only consumers. Note this overrides
|
|
13
|
+
* the `@norskvideo/moq-json` producer's own default ratio. Set a positive number to enable JSON Merge Patch
|
|
14
|
+
* deltas.
|
|
15
|
+
*/
|
|
16
|
+
deltaRatio?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Publishes a {@link Root} catalog, fanning it out to every subscriber (including relays that
|
|
20
|
+
* reconnect).
|
|
21
|
+
*
|
|
22
|
+
* A thin wrapper around a track-less `@norskvideo/moq-json` producer, pre-seeded with an empty catalog and
|
|
23
|
+
* wired to {@link RootSchema}. Edit it at any time with `mutate` and answer subscription requests
|
|
24
|
+
* with `serve`. Extend the catalog by passing a schema built via `z.extend(RootSchema, ...)` and
|
|
25
|
+
* writing the extra sections in `mutate`.
|
|
26
|
+
*/
|
|
27
|
+
export declare class Producer<T extends Root = Root> extends Json.Snapshot.Producer<T> {
|
|
28
|
+
/** Create a track-less catalog producer seeded with an empty catalog. */
|
|
29
|
+
constructor(config?: Config<T>);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=producer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"producer.d.ts","sourceRoot":"","sources":["../../src/catalog/producer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,KAAK,CAAC,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,WAAW,CAAC;AAElD,8CAA8C;AAC9C,MAAM,WAAW,MAAM,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI;IAC5C,yFAAyF;IACzF,MAAM,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAE1B;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,CAAE,SAAQ,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7E,yEAAyE;IACzE,YAAY,MAAM,GAAE,MAAM,CAAC,CAAC,CAAM,EAQjC;CACD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* @ts-self-types="./producer.d.ts" */
|
|
2
|
+
import * as Json from "@norskvideo/moq-json";
|
|
3
|
+
import { RootSchema } from "./root.js";
|
|
4
|
+
/**
|
|
5
|
+
* Publishes a {@link Root} catalog, fanning it out to every subscriber (including relays that
|
|
6
|
+
* reconnect).
|
|
7
|
+
*
|
|
8
|
+
* A thin wrapper around a track-less `@norskvideo/moq-json` producer, pre-seeded with an empty catalog and
|
|
9
|
+
* wired to {@link RootSchema}. Edit it at any time with `mutate` and answer subscription requests
|
|
10
|
+
* with `serve`. Extend the catalog by passing a schema built via `z.extend(RootSchema, ...)` and
|
|
11
|
+
* writing the extra sections in `mutate`.
|
|
12
|
+
*/
|
|
13
|
+
export class Producer extends Json.Snapshot.Producer {
|
|
14
|
+
/** Create a track-less catalog producer seeded with an empty catalog. */
|
|
15
|
+
constructor(config = {}) {
|
|
16
|
+
super({
|
|
17
|
+
initial: {},
|
|
18
|
+
schema: (config.schema ?? RootSchema),
|
|
19
|
+
// Pin deltas off by default (the @moq/json default would enable them); pass a positive
|
|
20
|
+
// ratio to opt in.
|
|
21
|
+
deltaRatio: config.deltaRatio ?? 0,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=producer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"producer.js","sourceRoot":"","sources":["../../src/catalog/producer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAa,UAAU,EAAE,MAAM,WAAW,CAAC;AAkBlD;;;;;;;;GAQG;AACH,MAAM,OAAO,QAAgC,SAAQ,IAAI,CAAC,QAAQ,CAAC,QAAW;IAC7E,yEAAyE;IACzE,YAAY,MAAM,GAAc,EAAE;QACjC,KAAK,CAAC;YACL,OAAO,EAAE,EAAO;YAChB,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,IAAI,UAAU,CAAqB;YACzD,uFAAuF;YACvF,mBAAmB;YACnB,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,CAAC;SAClC,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["import * as Json from \"@moq/json\";\nimport type * as z from \"zod/mini\";\n\nimport { type Root, RootSchema } from \"./root.ts\";\n\n/** Options for a catalog {@link Producer}. */\nexport interface Config<T extends Root = Root> {\n\t/** zod schema validating each catalog before publish. Defaults to {@link RootSchema}. */\n\tschema?: z.ZodMiniType<T>;\n\n\t/**\n\t * Delta encoding ratio forwarded to the underlying JSON producer.\n\t *\n\t * Defaults to `0`, which disables deltas: every change publishes a full snapshot in its own\n\t * group, keeping the catalog byte-compatible with snapshot-only consumers. Note this overrides\n\t * the `@moq/json` producer's own default ratio. Set a positive number to enable JSON Merge Patch\n\t * deltas.\n\t */\n\tdeltaRatio?: number;\n}\n\n/**\n * Publishes a {@link Root} catalog, fanning it out to every subscriber (including relays that\n * reconnect).\n *\n * A thin wrapper around a track-less `@moq/json` producer, pre-seeded with an empty catalog and\n * wired to {@link RootSchema}. Edit it at any time with `mutate` and answer subscription requests\n * with `serve`. Extend the catalog by passing a schema built via `z.extend(RootSchema, ...)` and\n * writing the extra sections in `mutate`.\n */\nexport class Producer<T extends Root = Root> extends Json.Snapshot.Producer<T> {\n\t/** Create a track-less catalog producer seeded with an empty catalog. */\n\tconstructor(config: Config<T> = {}) {\n\t\tsuper({\n\t\t\tinitial: {} as T,\n\t\t\tschema: (config.schema ?? RootSchema) as z.ZodMiniType<T>,\n\t\t\t// Pin deltas off by default (the @moq/json default would enable them); pass a positive\n\t\t\t// ratio to opt in.\n\t\t\tdeltaRatio: config.deltaRatio ?? 0,\n\t\t});\n\t}\n}\n"]}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
/**
|
|
3
|
+
* The root catalog: the base media sections every hang broadcast carries.
|
|
4
|
+
*
|
|
5
|
+
* This is a *loose* object: unknown root sections pass through validation untouched, so an
|
|
6
|
+
* application can add its own sections (e.g. `scte35`) without modifying hang. A base consumer
|
|
7
|
+
* ignores the extra sections; an extended consumer validates them with its own schema, typically
|
|
8
|
+
* built via `z.extend(RootSchema, { ... })`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const RootSchema: z.ZodMiniObject<{
|
|
11
|
+
video: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
12
|
+
renditions: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
13
|
+
codec: z.ZodMiniString<string>;
|
|
14
|
+
container: z.ZodMiniDefault<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
15
|
+
kind: z.ZodMiniLiteral<"legacy">;
|
|
16
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
17
|
+
kind: z.ZodMiniLiteral<"cmaf">;
|
|
18
|
+
init: z.ZodMiniBase64;
|
|
19
|
+
timescale: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
20
|
+
trackId: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
21
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
22
|
+
kind: z.ZodMiniLiteral<"loc">;
|
|
23
|
+
}, z.core.$strip>], "kind">>;
|
|
24
|
+
description: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
25
|
+
codedWidth: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
26
|
+
codedHeight: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
27
|
+
displayAspectWidth: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
28
|
+
displayAspectHeight: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
29
|
+
framerate: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
30
|
+
bitrate: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
31
|
+
optimizeForLatency: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
32
|
+
jitter: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
33
|
+
timeline: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
34
|
+
track: z.ZodMiniString<string>;
|
|
35
|
+
timescale: z.ZodMiniDefault<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
36
|
+
wall: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
}, z.core.$strip>>;
|
|
39
|
+
display: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
40
|
+
width: z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">;
|
|
41
|
+
height: z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">;
|
|
42
|
+
}, z.core.$strip>>;
|
|
43
|
+
rotation: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
44
|
+
flip: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
45
|
+
}, z.core.$strip>, z.ZodMiniPipe<z.ZodMiniArray<z.ZodMiniObject<{
|
|
46
|
+
track: z.ZodMiniObject<{
|
|
47
|
+
name: z.ZodMiniString<string>;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
config: z.ZodMiniObject<{
|
|
50
|
+
codec: z.ZodMiniString<string>;
|
|
51
|
+
container: z.ZodMiniDefault<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
52
|
+
kind: z.ZodMiniLiteral<"legacy">;
|
|
53
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
54
|
+
kind: z.ZodMiniLiteral<"cmaf">;
|
|
55
|
+
init: z.ZodMiniBase64;
|
|
56
|
+
timescale: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
57
|
+
trackId: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
58
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
59
|
+
kind: z.ZodMiniLiteral<"loc">;
|
|
60
|
+
}, z.core.$strip>], "kind">>;
|
|
61
|
+
description: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
62
|
+
codedWidth: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
63
|
+
codedHeight: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
64
|
+
displayAspectWidth: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
65
|
+
displayAspectHeight: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
66
|
+
framerate: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
67
|
+
bitrate: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
68
|
+
optimizeForLatency: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
69
|
+
jitter: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
70
|
+
timeline: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
71
|
+
track: z.ZodMiniString<string>;
|
|
72
|
+
timescale: z.ZodMiniDefault<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
73
|
+
wall: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
74
|
+
}, z.core.$strip>>;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
}, z.core.$strip>>, z.ZodMiniTransform<{
|
|
77
|
+
renditions: {
|
|
78
|
+
[k: string]: {
|
|
79
|
+
codec: string;
|
|
80
|
+
container: {
|
|
81
|
+
kind: "legacy";
|
|
82
|
+
} | {
|
|
83
|
+
kind: "cmaf";
|
|
84
|
+
init: string;
|
|
85
|
+
timescale?: (number & z.$brand<"u53">) | undefined;
|
|
86
|
+
trackId?: (number & z.$brand<"u53">) | undefined;
|
|
87
|
+
} | {
|
|
88
|
+
kind: "loc";
|
|
89
|
+
};
|
|
90
|
+
description?: string | undefined;
|
|
91
|
+
codedWidth?: (number & z.$brand<"u53">) | undefined;
|
|
92
|
+
codedHeight?: (number & z.$brand<"u53">) | undefined;
|
|
93
|
+
displayAspectWidth?: (number & z.$brand<"u53">) | undefined;
|
|
94
|
+
displayAspectHeight?: (number & z.$brand<"u53">) | undefined;
|
|
95
|
+
framerate?: number | undefined;
|
|
96
|
+
bitrate?: (number & z.$brand<"u53">) | undefined;
|
|
97
|
+
optimizeForLatency?: boolean | undefined;
|
|
98
|
+
jitter?: (number & z.$brand<"u53">) | undefined;
|
|
99
|
+
timeline?: {
|
|
100
|
+
track: string;
|
|
101
|
+
timescale: number & z.$brand<"u53">;
|
|
102
|
+
wall?: (number & z.$brand<"u53">) | undefined;
|
|
103
|
+
} | undefined;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
display: {
|
|
107
|
+
width: number & z.$brand<"u53">;
|
|
108
|
+
height: number & z.$brand<"u53">;
|
|
109
|
+
} | undefined;
|
|
110
|
+
rotation: undefined;
|
|
111
|
+
flip: undefined;
|
|
112
|
+
}, {
|
|
113
|
+
track: {
|
|
114
|
+
name: string;
|
|
115
|
+
};
|
|
116
|
+
config: {
|
|
117
|
+
codec: string;
|
|
118
|
+
container: {
|
|
119
|
+
kind: "legacy";
|
|
120
|
+
} | {
|
|
121
|
+
kind: "cmaf";
|
|
122
|
+
init: string;
|
|
123
|
+
timescale?: (number & z.$brand<"u53">) | undefined;
|
|
124
|
+
trackId?: (number & z.$brand<"u53">) | undefined;
|
|
125
|
+
} | {
|
|
126
|
+
kind: "loc";
|
|
127
|
+
};
|
|
128
|
+
description?: string | undefined;
|
|
129
|
+
codedWidth?: (number & z.$brand<"u53">) | undefined;
|
|
130
|
+
codedHeight?: (number & z.$brand<"u53">) | undefined;
|
|
131
|
+
displayAspectWidth?: (number & z.$brand<"u53">) | undefined;
|
|
132
|
+
displayAspectHeight?: (number & z.$brand<"u53">) | undefined;
|
|
133
|
+
framerate?: number | undefined;
|
|
134
|
+
bitrate?: (number & z.$brand<"u53">) | undefined;
|
|
135
|
+
optimizeForLatency?: boolean | undefined;
|
|
136
|
+
jitter?: (number & z.$brand<"u53">) | undefined;
|
|
137
|
+
timeline?: {
|
|
138
|
+
track: string;
|
|
139
|
+
timescale: number & z.$brand<"u53">;
|
|
140
|
+
wall?: (number & z.$brand<"u53">) | undefined;
|
|
141
|
+
} | undefined;
|
|
142
|
+
};
|
|
143
|
+
}[]>>]>>;
|
|
144
|
+
audio: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
|
|
145
|
+
renditions: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniObject<{
|
|
146
|
+
codec: z.ZodMiniString<string>;
|
|
147
|
+
container: z.ZodMiniDefault<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
148
|
+
kind: z.ZodMiniLiteral<"legacy">;
|
|
149
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
150
|
+
kind: z.ZodMiniLiteral<"cmaf">;
|
|
151
|
+
init: z.ZodMiniBase64;
|
|
152
|
+
timescale: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
153
|
+
trackId: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
154
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
155
|
+
kind: z.ZodMiniLiteral<"loc">;
|
|
156
|
+
}, z.core.$strip>], "kind">>;
|
|
157
|
+
description: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
158
|
+
sampleRate: z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">;
|
|
159
|
+
numberOfChannels: z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">;
|
|
160
|
+
bitrate: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
161
|
+
jitter: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
162
|
+
timeline: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
163
|
+
track: z.ZodMiniString<string>;
|
|
164
|
+
timescale: z.ZodMiniDefault<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
165
|
+
wall: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
166
|
+
}, z.core.$strip>>;
|
|
167
|
+
}, z.core.$strip>>;
|
|
168
|
+
}, z.core.$strip>, z.ZodMiniPipe<z.ZodMiniObject<{
|
|
169
|
+
track: z.ZodMiniObject<{
|
|
170
|
+
name: z.ZodMiniString<string>;
|
|
171
|
+
}, z.core.$strip>;
|
|
172
|
+
config: z.ZodMiniObject<{
|
|
173
|
+
codec: z.ZodMiniString<string>;
|
|
174
|
+
container: z.ZodMiniDefault<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
175
|
+
kind: z.ZodMiniLiteral<"legacy">;
|
|
176
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
177
|
+
kind: z.ZodMiniLiteral<"cmaf">;
|
|
178
|
+
init: z.ZodMiniBase64;
|
|
179
|
+
timescale: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
180
|
+
trackId: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
181
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
182
|
+
kind: z.ZodMiniLiteral<"loc">;
|
|
183
|
+
}, z.core.$strip>], "kind">>;
|
|
184
|
+
description: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
185
|
+
sampleRate: z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">;
|
|
186
|
+
numberOfChannels: z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">;
|
|
187
|
+
bitrate: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
188
|
+
jitter: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
189
|
+
timeline: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
190
|
+
track: z.ZodMiniString<string>;
|
|
191
|
+
timescale: z.ZodMiniDefault<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
192
|
+
wall: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
193
|
+
}, z.core.$strip>>;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
}, z.core.$strip>, z.ZodMiniTransform<{
|
|
196
|
+
renditions: {
|
|
197
|
+
[x: string]: {
|
|
198
|
+
codec: string;
|
|
199
|
+
container: {
|
|
200
|
+
kind: "legacy";
|
|
201
|
+
} | {
|
|
202
|
+
kind: "cmaf";
|
|
203
|
+
init: string;
|
|
204
|
+
timescale?: (number & z.$brand<"u53">) | undefined;
|
|
205
|
+
trackId?: (number & z.$brand<"u53">) | undefined;
|
|
206
|
+
} | {
|
|
207
|
+
kind: "loc";
|
|
208
|
+
};
|
|
209
|
+
description?: string | undefined;
|
|
210
|
+
sampleRate: number & z.$brand<"u53">;
|
|
211
|
+
numberOfChannels: number & z.$brand<"u53">;
|
|
212
|
+
bitrate?: (number & z.$brand<"u53">) | undefined;
|
|
213
|
+
jitter?: (number & z.$brand<"u53">) | undefined;
|
|
214
|
+
timeline?: {
|
|
215
|
+
track: string;
|
|
216
|
+
timescale: number & z.$brand<"u53">;
|
|
217
|
+
wall?: (number & z.$brand<"u53">) | undefined;
|
|
218
|
+
} | undefined;
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
}, {
|
|
222
|
+
track: {
|
|
223
|
+
name: string;
|
|
224
|
+
};
|
|
225
|
+
config: {
|
|
226
|
+
codec: string;
|
|
227
|
+
container: {
|
|
228
|
+
kind: "legacy";
|
|
229
|
+
} | {
|
|
230
|
+
kind: "cmaf";
|
|
231
|
+
init: string;
|
|
232
|
+
timescale?: (number & z.$brand<"u53">) | undefined;
|
|
233
|
+
trackId?: (number & z.$brand<"u53">) | undefined;
|
|
234
|
+
} | {
|
|
235
|
+
kind: "loc";
|
|
236
|
+
};
|
|
237
|
+
description?: string | undefined;
|
|
238
|
+
sampleRate: number & z.$brand<"u53">;
|
|
239
|
+
numberOfChannels: number & z.$brand<"u53">;
|
|
240
|
+
bitrate?: (number & z.$brand<"u53">) | undefined;
|
|
241
|
+
jitter?: (number & z.$brand<"u53">) | undefined;
|
|
242
|
+
timeline?: {
|
|
243
|
+
track: string;
|
|
244
|
+
timescale: number & z.$brand<"u53">;
|
|
245
|
+
wall?: (number & z.$brand<"u53">) | undefined;
|
|
246
|
+
} | undefined;
|
|
247
|
+
};
|
|
248
|
+
}>>]>>;
|
|
249
|
+
}, z.core.$loose>;
|
|
250
|
+
/** The root catalog object, with optional video and audio sections plus any app extensions. */
|
|
251
|
+
export type Root = z.infer<typeof RootSchema>;
|
|
252
|
+
//# sourceMappingURL=root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/catalog/root.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAK9B;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGrB,CAAC;AAEH,+FAA+F;AAC/F,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
package/catalog/root.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* @ts-self-types="./root.d.ts" */
|
|
2
|
+
import * as z from "zod/mini";
|
|
3
|
+
import { AudioSchema } from "./audio";
|
|
4
|
+
import { VideoSchema } from "./video";
|
|
5
|
+
/**
|
|
6
|
+
* The root catalog: the base media sections every hang broadcast carries.
|
|
7
|
+
*
|
|
8
|
+
* This is a *loose* object: unknown root sections pass through validation untouched, so an
|
|
9
|
+
* application can add its own sections (e.g. `scte35`) without modifying hang. A base consumer
|
|
10
|
+
* ignores the extra sections; an extended consumer validates them with its own schema, typically
|
|
11
|
+
* built via `z.extend(RootSchema, { ... })`.
|
|
12
|
+
*/
|
|
13
|
+
export const RootSchema = z.looseObject({
|
|
14
|
+
video: z.optional(VideoSchema),
|
|
15
|
+
audio: z.optional(AudioSchema),
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../src/catalog/root.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC;IACvC,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC;IAC9B,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC;CAC9B,CAAC,CAAC","sourcesContent":["import * as z from \"zod/mini\";\n\nimport { AudioSchema } from \"./audio\";\nimport { VideoSchema } from \"./video\";\n\n/**\n * The root catalog: the base media sections every hang broadcast carries.\n *\n * This is a *loose* object: unknown root sections pass through validation untouched, so an\n * application can add its own sections (e.g. `scte35`) without modifying hang. A base consumer\n * ignores the extra sections; an extended consumer validates them with its own schema, typically\n * built via `z.extend(RootSchema, { ... })`.\n */\nexport const RootSchema = z.looseObject({\n\tvideo: z.optional(VideoSchema),\n\taudio: z.optional(AudioSchema),\n});\n\n/** The root catalog object, with optional video and audio sections plus any app extensions. */\nexport type Root = z.infer<typeof RootSchema>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.test.d.ts","sourceRoot":"","sources":["../../src/catalog/root.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* @ts-self-types="./root.test.d.ts" */
|
|
2
|
+
import { expect, test } from "bun:test";
|
|
3
|
+
import * as z from "zod/mini";
|
|
4
|
+
import { RootSchema } from "./root.js";
|
|
5
|
+
// The base catalog is generic: only `video`/`audio`. Applications add their own root sections
|
|
6
|
+
// (e.g. `scte35`) without modifying hang, relying on the loose schema to pass them through.
|
|
7
|
+
test("base catalog preserves unknown sections", () => {
|
|
8
|
+
const extended = { video: { renditions: {} }, scte35: { spliceId: 42 } };
|
|
9
|
+
const parsed = RootSchema.parse(extended);
|
|
10
|
+
// A base consumer validates the known fields but keeps the unknown section untouched.
|
|
11
|
+
expect(parsed.scte35).toEqual({ spliceId: 42 });
|
|
12
|
+
});
|
|
13
|
+
test("extended schema validates app sections", () => {
|
|
14
|
+
const Scte35Schema = z.object({ spliceId: z.number() });
|
|
15
|
+
const ExtendedSchema = z.extend(RootSchema, { scte35: z.optional(Scte35Schema) });
|
|
16
|
+
expect(ExtendedSchema.parse({ scte35: { spliceId: 7 } }).scte35).toEqual({ spliceId: 7 });
|
|
17
|
+
// The extended schema enforces the app's section type.
|
|
18
|
+
expect(() => ExtendedSchema.parse({ scte35: { spliceId: "nope" } })).toThrow();
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=root.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.test.js","sourceRoot":"","sources":["../../src/catalog/root.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,8FAA8F;AAC9F,4FAA4F;AAE5F,IAAI,CAAC,yCAAyC,EAAE,GAAG,EAAE;IACpD,MAAM,QAAQ,GAAG,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC;IACzE,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,QAAQ,CAA4B,CAAC;IACrE,sFAAsF;IACtF,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;AACjD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,wCAAwC,EAAE,GAAG,EAAE;IACnD,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACxD,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAElF,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;IAE1F,uDAAuD;IACvD,MAAM,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;AAChF,CAAC,CAAC,CAAC","sourcesContent":["import { expect, test } from \"bun:test\";\nimport * as z from \"zod/mini\";\nimport { RootSchema } from \"./root.ts\";\n\n// The base catalog is generic: only `video`/`audio`. Applications add their own root sections\n// (e.g. `scte35`) without modifying hang, relying on the loose schema to pass them through.\n\ntest(\"base catalog preserves unknown sections\", () => {\n\tconst extended = { video: { renditions: {} }, scte35: { spliceId: 42 } };\n\tconst parsed = RootSchema.parse(extended) as Record<string, unknown>;\n\t// A base consumer validates the known fields but keeps the unknown section untouched.\n\texpect(parsed.scte35).toEqual({ spliceId: 42 });\n});\n\ntest(\"extended schema validates app sections\", () => {\n\tconst Scte35Schema = z.object({ spliceId: z.number() });\n\tconst ExtendedSchema = z.extend(RootSchema, { scte35: z.optional(Scte35Schema) });\n\n\texpect(ExtendedSchema.parse({ scte35: { spliceId: 7 } }).scte35).toEqual({ spliceId: 7 });\n\n\t// The extended schema enforces the app's section type.\n\texpect(() => ExtendedSchema.parse({ scte35: { spliceId: \"nope\" } })).toThrow();\n});\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
/**
|
|
3
|
+
* The moq epoch (2020-01-01T00:00:00Z) in Unix-epoch milliseconds.
|
|
4
|
+
*
|
|
5
|
+
* Timeline {@link Timeline.wall} values are measured from here rather than the Unix epoch so the
|
|
6
|
+
* numbers stay small (safely within a 53-bit integer even at fine timescales); a consumer recovers
|
|
7
|
+
* Unix time by adding this back.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MOQ_EPOCH_UNIX_MILLIS = 1577836800000;
|
|
10
|
+
/**
|
|
11
|
+
* Describes a media track's companion timeline track: a track mapping each of the media track's
|
|
12
|
+
* groups to its start timestamp, so a consumer can seek (or build an HLS/DASH playlist) without
|
|
13
|
+
* downloading the media itself.
|
|
14
|
+
*
|
|
15
|
+
* Present on a {@link VideoConfig} / {@link AudioConfig} when the publisher offers one. It is per
|
|
16
|
+
* media track on purpose: audio and video groups have different durations, so a single
|
|
17
|
+
* broadcast-wide timeline can't describe them all.
|
|
18
|
+
*/
|
|
19
|
+
export declare const TimelineSchema: z.ZodMiniObject<{
|
|
20
|
+
track: z.ZodMiniString<string>;
|
|
21
|
+
timescale: z.ZodMiniDefault<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
22
|
+
wall: z.ZodMiniOptional<z.core.$ZodBranded<z.ZodMiniNumber<number>, "u53", "out">>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
/** A media track's companion timeline description. */
|
|
25
|
+
export type Timeline = z.infer<typeof TimelineSchema>;
|
|
26
|
+
//# sourceMappingURL=timeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../src/catalog/timeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,gBAAoB,CAAC;AAEvD;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc;;;;iBAazB,CAAC;AAEH,sDAAsD;AACtD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* @ts-self-types="./timeline.d.ts" */
|
|
2
|
+
import * as z from "zod/mini";
|
|
3
|
+
import { u53, u53Schema } from "./integers";
|
|
4
|
+
/**
|
|
5
|
+
* The moq epoch (2020-01-01T00:00:00Z) in Unix-epoch milliseconds.
|
|
6
|
+
*
|
|
7
|
+
* Timeline {@link Timeline.wall} values are measured from here rather than the Unix epoch so the
|
|
8
|
+
* numbers stay small (safely within a 53-bit integer even at fine timescales); a consumer recovers
|
|
9
|
+
* Unix time by adding this back.
|
|
10
|
+
*/
|
|
11
|
+
export const MOQ_EPOCH_UNIX_MILLIS = 1_577_836_800_000;
|
|
12
|
+
/**
|
|
13
|
+
* Describes a media track's companion timeline track: a track mapping each of the media track's
|
|
14
|
+
* groups to its start timestamp, so a consumer can seek (or build an HLS/DASH playlist) without
|
|
15
|
+
* downloading the media itself.
|
|
16
|
+
*
|
|
17
|
+
* Present on a {@link VideoConfig} / {@link AudioConfig} when the publisher offers one. It is per
|
|
18
|
+
* media track on purpose: audio and video groups have different durations, so a single
|
|
19
|
+
* broadcast-wide timeline can't describe them all.
|
|
20
|
+
*/
|
|
21
|
+
export const TimelineSchema = z.object({
|
|
22
|
+
// The name of the companion MoQ track carrying this track's group -> timestamp records.
|
|
23
|
+
track: z.string(),
|
|
24
|
+
// Units per second for the records' `pts` (and `wall`). Defaults to 1000 (milliseconds).
|
|
25
|
+
timescale: z._default(u53Schema, u53(1000)),
|
|
26
|
+
// The wall-clock time of pts 0, in `timescale` units since the moq epoch
|
|
27
|
+
// ({@link MOQ_EPOCH_UNIX_MILLIS}, 2020-01-01), if known. A consumer derives any group's
|
|
28
|
+
// wall-clock time as `wall + pts`, and Unix time by adding the moq epoch back (for HLS
|
|
29
|
+
// EXT-X-PROGRAM-DATE-TIME / DASH availabilityStartTime). Measured from 2020 rather than 1970 so
|
|
30
|
+
// the value stays small and safely within a 53-bit integer even at fine timescales.
|
|
31
|
+
wall: z.optional(u53Schema),
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=timeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline.js","sourceRoot":"","sources":["../../src/catalog/timeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEvD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,wFAAwF;IACxF,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IAEjB,yFAAyF;IACzF,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IAE3C,yEAAyE;IACzE,wFAAwF;IACxF,uFAAuF;IACvF,gGAAgG;IAChG,oFAAoF;IACpF,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC;CAC3B,CAAC,CAAC","sourcesContent":["import * as z from \"zod/mini\";\nimport { u53, u53Schema } from \"./integers\";\n\n/**\n * The moq epoch (2020-01-01T00:00:00Z) in Unix-epoch milliseconds.\n *\n * Timeline {@link Timeline.wall} values are measured from here rather than the Unix epoch so the\n * numbers stay small (safely within a 53-bit integer even at fine timescales); a consumer recovers\n * Unix time by adding this back.\n */\nexport const MOQ_EPOCH_UNIX_MILLIS = 1_577_836_800_000;\n\n/**\n * Describes a media track's companion timeline track: a track mapping each of the media track's\n * groups to its start timestamp, so a consumer can seek (or build an HLS/DASH playlist) without\n * downloading the media itself.\n *\n * Present on a {@link VideoConfig} / {@link AudioConfig} when the publisher offers one. It is per\n * media track on purpose: audio and video groups have different durations, so a single\n * broadcast-wide timeline can't describe them all.\n */\nexport const TimelineSchema = z.object({\n\t// The name of the companion MoQ track carrying this track's group -> timestamp records.\n\ttrack: z.string(),\n\n\t// Units per second for the records' `pts` (and `wall`). Defaults to 1000 (milliseconds).\n\ttimescale: z._default(u53Schema, u53(1000)),\n\n\t// The wall-clock time of pts 0, in `timescale` units since the moq epoch\n\t// ({@link MOQ_EPOCH_UNIX_MILLIS}, 2020-01-01), if known. A consumer derives any group's\n\t// wall-clock time as `wall + pts`, and Unix time by adding the moq epoch back (for HLS\n\t// EXT-X-PROGRAM-DATE-TIME / DASH availabilityStartTime). Measured from 2020 rather than 1970 so\n\t// the value stays small and safely within a 53-bit integer even at fine timescales.\n\twall: z.optional(u53Schema),\n});\n\n/** A media track's companion timeline description. */\nexport type Timeline = z.infer<typeof TimelineSchema>;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
/** Schema for a catalog track reference, identified by name. */
|
|
3
|
+
export declare const TrackSchema: z.ZodMiniObject<{
|
|
4
|
+
name: z.ZodMiniString<string>;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
/** A catalog track reference, identified by name. */
|
|
7
|
+
export type Track = z.infer<typeof TrackSchema>;
|
|
8
|
+
//# sourceMappingURL=track.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track.d.ts","sourceRoot":"","sources":["../../src/catalog/track.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,gEAAgE;AAChE,eAAO,MAAM,WAAW;;iBAEtB,CAAC;AACH,qDAAqD;AACrD,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
package/catalog/track.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track.js","sourceRoot":"","sources":["../../src/catalog/track.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,gEAAgE;AAChE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;CAChB,CAAC,CAAC","sourcesContent":["import * as z from \"zod/mini\";\n\n/** Schema for a catalog track reference, identified by name. */\nexport const TrackSchema = z.object({\n\tname: z.string(),\n});\n/** A catalog track reference, identified by name. */\nexport type Track = z.infer<typeof TrackSchema>;\n"]}
|