@norskvideo/ctl-dev-kit 0.2.116 → 0.2.118
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/conventions/build-image.yml +6 -0
- package/package.json +1 -1
- package/workflow/ladder.ts +29 -5
|
@@ -54,6 +54,12 @@ on:
|
|
|
54
54
|
|
|
55
55
|
permissions:
|
|
56
56
|
contents: read
|
|
57
|
+
# gate-checks calls checks.yml as a reusable workflow, and GitHub refuses to
|
|
58
|
+
# start a caller that grants less than its callee asks for (startup_failure,
|
|
59
|
+
# no jobs): every permission checks.yml / checks.sdk-app.yml declares must be
|
|
60
|
+
# here too. checks-callable.test.ts holds the two in step. packages: read is
|
|
61
|
+
# the dev SDK lane reading norsk's dev packages from GitHub Packages.
|
|
62
|
+
packages: read
|
|
57
63
|
|
|
58
64
|
concurrency:
|
|
59
65
|
group: ${{ github.workflow }}-${{ github.ref }}
|
package/package.json
CHANGED
package/workflow/ladder.ts
CHANGED
|
@@ -54,11 +54,34 @@ export function isPortraitRung(rung: Pick<LadderRung, "width" | "height">): bool
|
|
|
54
54
|
return rung.height > rung.width;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
// The standard rungs and ladders are frozen, objects and arrays alike: a rung
|
|
58
|
+
// that appears in two ladders is one object, so a product mutating it in place
|
|
59
|
+
// would silently change the other ladder. A product that wants a variant
|
|
60
|
+
// builds a new rung or ladder from these instead. `rungs` stays typed as a
|
|
61
|
+
// mutable `LadderRung[]` (frozen at runtime only) so a standard ladder still
|
|
62
|
+
// assigns to a product's `Record<ItsKey, LadderPreset>`; `readonly` on the
|
|
63
|
+
// objects' properties does not get in the way of that.
|
|
64
|
+
function freezeRungs<T extends Record<string, LadderRung>>(rungs: T): { readonly [K in keyof T]: Readonly<T[K]> } {
|
|
65
|
+
for (const rung of Object.values(rungs)) Object.freeze(rung);
|
|
66
|
+
return Object.freeze(rungs);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function freezeLadders<K extends string>(
|
|
70
|
+
ladders: Record<K, LadderPreset>,
|
|
71
|
+
): { readonly [P in K]: Readonly<LadderPreset> } {
|
|
72
|
+
for (const preset of Object.values<LadderPreset>(ladders)) {
|
|
73
|
+
for (const rung of preset.rungs) Object.freeze(rung);
|
|
74
|
+
Object.freeze(preset.rungs);
|
|
75
|
+
Object.freeze(preset);
|
|
76
|
+
}
|
|
77
|
+
return Object.freeze(ladders);
|
|
78
|
+
}
|
|
79
|
+
|
|
57
80
|
/**
|
|
58
81
|
* The named rungs of the standard ladders. A rung that appears in two ladders
|
|
59
|
-
* (`abr_360`, `abr_480`) is the same rung in both.
|
|
82
|
+
* (`abr_360`, `abr_480`) is the same rung in both. Frozen.
|
|
60
83
|
*/
|
|
61
|
-
export const STANDARD_RUNGS = {
|
|
84
|
+
export const STANDARD_RUNGS = freezeRungs({
|
|
62
85
|
default: { name: "default", kbps: 2000, width: 1280, height: 720, fps: 25, bitrateMode: "abr" },
|
|
63
86
|
abr_234: { name: "abr_234", kbps: 300, width: 416, height: 234, fps: 25, bitrateMode: "abr" },
|
|
64
87
|
abr_360: { name: "abr_360", kbps: 600, width: 640, height: 360, fps: 25, bitrateMode: "abr" },
|
|
@@ -98,7 +121,7 @@ export const STANDARD_RUNGS = {
|
|
|
98
121
|
bitrateMode: "abr",
|
|
99
122
|
codec: "hevc",
|
|
100
123
|
},
|
|
101
|
-
} satisfies Record<string, LadderRung
|
|
124
|
+
} satisfies Record<string, LadderRung>);
|
|
102
125
|
|
|
103
126
|
export type StandardRungName = keyof typeof STANDARD_RUNGS;
|
|
104
127
|
|
|
@@ -110,8 +133,9 @@ const R = STANDARD_RUNGS;
|
|
|
110
133
|
/**
|
|
111
134
|
* The ladders more than one product offers, with the labels and rungs they
|
|
112
135
|
* ship today. A product spreads the ones it offers into its own catalogue.
|
|
136
|
+
* Frozen.
|
|
113
137
|
*/
|
|
114
|
-
export const STANDARD_LADDERS
|
|
138
|
+
export const STANDARD_LADDERS = freezeLadders<StandardLadderKey>({
|
|
115
139
|
single: {
|
|
116
140
|
label: "Single rung (720p25 @ 2000 kbps)",
|
|
117
141
|
rungs: [R.default],
|
|
@@ -137,4 +161,4 @@ export const STANDARD_LADDERS: Record<StandardLadderKey, LadderPreset> = {
|
|
|
137
161
|
label: "UHD HEVC (3 rungs, 720p–2160p, 3–20 Mbps)",
|
|
138
162
|
rungs: [R.hevc_3840x2160, R.hevc_1920x1080, R.hevc_1280x720],
|
|
139
163
|
},
|
|
140
|
-
};
|
|
164
|
+
});
|