@norskvideo/ctl-dev-kit 0.1.102 → 0.1.104
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/package.json +3 -2
- package/workflow/ladder.ts +51 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@norskvideo/ctl-dev-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.104",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./create-product": "./create-product/create-product.ts",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"./licence/check-template": "./licence/check-template.ts",
|
|
20
20
|
"./package.json": "./package.json",
|
|
21
21
|
"./testing/byte-snapshot": "./testing/byte-snapshot.ts",
|
|
22
|
-
"./testing/invariants": "./testing/invariants.ts"
|
|
22
|
+
"./testing/invariants": "./testing/invariants.ts",
|
|
23
|
+
"./workflow/ladder": "./workflow/ladder.ts"
|
|
23
24
|
},
|
|
24
25
|
"bin": {
|
|
25
26
|
"ctl-dev-kit": "./create-product/cli.ts"
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// The shared shape of an encode-ladder rung and a named preset, single-sourced
|
|
2
|
+
// for every ctl product. Products previously each carried their own
|
|
3
|
+
// near-identical copy of these types in `shared/src/workflow/ladder-presets.ts`
|
|
4
|
+
// (commentary's set, playout's `flagship`/`uhd-hevc`), whose comments already
|
|
5
|
+
// noted they "mirror" one another — this is the shared home they mirror.
|
|
6
|
+
//
|
|
7
|
+
// What lives here is the SHAPE and the product-agnostic helpers. The catalogue
|
|
8
|
+
// of presets and its key union stay per-product (they are genuinely different:
|
|
9
|
+
// commentary ships `single`/`mobile`/`abr-internet`/`tv`/`vertical-mobile`,
|
|
10
|
+
// playout ships `flagship`/`uhd-hevc`), as do product-specific rungs such as
|
|
11
|
+
// commentary's fixed low-latency return-video rung. A product declares its
|
|
12
|
+
// catalogue as `Record<ItsKey, LadderPreset>` over these types.
|
|
13
|
+
//
|
|
14
|
+
// Deliberately zero-dependency (plain types + a pure helper, no zod): the
|
|
15
|
+
// per-product zod `RungSchema`s carry product-specific tuning (differing kbps
|
|
16
|
+
// ceilings, playout's `codec` axis, distinct `.meta` ids) and the cycle-B
|
|
17
|
+
// constraint that a schema module must not import a workflow module, so those
|
|
18
|
+
// stay per-product and are a separate consolidation question.
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* One rung of an encode ladder: a single rendition's name, bitrate, resolution
|
|
22
|
+
* and frame rate. `codec` is optional and absent by default — absent ⇒ the
|
|
23
|
+
* product's H.264 default; `"hevc"` selects the HEVC encoder path. Products
|
|
24
|
+
* that don't expose a codec axis simply never set it.
|
|
25
|
+
*/
|
|
26
|
+
export type LadderRung = {
|
|
27
|
+
name: string;
|
|
28
|
+
kbps: number;
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
fps: number;
|
|
32
|
+
bitrateMode: "abr" | "cbr" | "vbr";
|
|
33
|
+
// Absent ⇒ h264 (the composer default). "hevc" selects the HEVC encoder trio.
|
|
34
|
+
codec?: "h264" | "hevc";
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** A named, operator-selectable ladder: a label plus its ordered rungs. */
|
|
38
|
+
export type LadderPreset = {
|
|
39
|
+
label: string;
|
|
40
|
+
rungs: LadderRung[];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* True when a rung is taller than it is wide (portrait / vertical delivery).
|
|
45
|
+
* Orientation is read off a rung's dimensions rather than a separate flag, so
|
|
46
|
+
* a product can derive a compose shape or a matching low-latency rung from the
|
|
47
|
+
* top user rung without threading an extra config axis.
|
|
48
|
+
*/
|
|
49
|
+
export function isPortraitRung(rung: Pick<LadderRung, "width" | "height">): boolean {
|
|
50
|
+
return rung.height > rung.width;
|
|
51
|
+
}
|