@norskvideo/ctl-test-harness 0.1.94 → 0.1.96

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.
@@ -1,5 +1,5 @@
1
1
  import type { MediaConversionV1 } from "@norskvideo/ctl-product-template-schema";
2
- import { type Norsk, type NorskLinkTransport } from "@norskvideo/norsk-sdk";
2
+ import { type Norsk, type NorskLinkTransport, type StreamKey } from "@norskvideo/norsk-sdk";
3
3
  import { type Check, type Observation } from "./evaluate.js";
4
4
  export type ConversionLauncher = {
5
5
  /** Start the template with these launch values. Resolves once it is launched;
@@ -43,4 +43,16 @@ export type ConformanceResult = {
43
43
  values: Record<string, string>;
44
44
  observation: Observation;
45
45
  };
46
+ /** The source programme's tracks: one source name, a stream id each (video
47
+ * first, from 256, as a TS programme numbers them). A conversion's norsk-link
48
+ * input keys what it receives under its own source name, so tracks told apart
49
+ * by source name alone would collide there. */
50
+ export declare function programmeKeys(prefix: string, counts: {
51
+ video: number;
52
+ audio: number;
53
+ }): {
54
+ kind: "video" | "audio";
55
+ index: number;
56
+ key: StreamKey;
57
+ }[];
46
58
  export declare function runMediaConversionConformance(opts: ConformanceOptions): Promise<ConformanceResult>;
@@ -10,6 +10,21 @@ function stamp(t) {
10
10
  }
11
11
  const keyOf = (k) => `${k.sourceName}/${k.programNumber}/${k.streamId}/${k.renditionName}`;
12
12
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
13
+ /** The source programme's tracks: one source name, a stream id each (video
14
+ * first, from 256, as a TS programme numbers them). A conversion's norsk-link
15
+ * input keys what it receives under its own source name, so tracks told apart
16
+ * by source name alone would collide there. */
17
+ export function programmeKeys(prefix, counts) {
18
+ const tracks = [
19
+ ...Array.from({ length: counts.video }, (_, index) => ({ kind: "video", index })),
20
+ ...Array.from({ length: counts.audio }, (_, index) => ({ kind: "audio", index })),
21
+ ];
22
+ return tracks.map((t, i) => ({
23
+ ...t,
24
+ key: { sourceName: `${prefix}-source`, programNumber: 1, streamId: 256 + i, renditionName: "default" },
25
+ }));
26
+ }
27
+ /** The source programme's tracks, and every node behind them (to close). */
13
28
  async function startSources(norsk, prefix, declaration) {
14
29
  if (declaration.inputs.length !== 1) {
15
30
  throw new Error(`conformance: v1 drives exactly one input, the declaration has ${declaration.inputs.length}`);
@@ -19,29 +34,29 @@ async function startSources(norsk, prefix, declaration) {
19
34
  const count = kinds[kind];
20
35
  return typeof count === "number" ? count : (count?.min ?? 0);
21
36
  };
22
- const sources = [];
23
- for (let i = 0; i < want("video"); i++) {
24
- sources.push(await norsk.input.videoTestCard({
25
- id: `${prefix}-video-${i}`,
26
- sourceName: `${prefix}-video-${i}`,
27
- resolution: { width: 1920, height: 1080 },
28
- frameRate: { frames: 25, seconds: 1 },
29
- pattern: "smpte75",
30
- }));
31
- }
32
- for (let i = 0; i < want("audio"); i++) {
33
- sources.push(await norsk.input.audioSignal({
34
- id: `${prefix}-audio-${i}`,
35
- sourceName: `${prefix}-audio-${i}`,
36
- channelLayout: "stereo",
37
- sampleRate: 48000,
38
- }));
39
- }
40
37
  for (const kind of ["subtitle", "ancillary"]) {
41
38
  if (want(kind) > 0)
42
39
  throw new Error(`conformance: no ${kind} test source yet`);
43
40
  }
44
- return sources;
41
+ const tracks = [];
42
+ const nodes = [];
43
+ for (const track of programmeKeys(prefix, { video: want("video"), audio: want("audio") })) {
44
+ const id = `${prefix}-${track.kind}-${track.index}`;
45
+ const signal = track.kind === "video"
46
+ ? await norsk.input.videoTestCard({
47
+ id,
48
+ sourceName: id,
49
+ resolution: { width: 1920, height: 1080 },
50
+ frameRate: { frames: 25, seconds: 1 },
51
+ pattern: "smpte75",
52
+ })
53
+ : await norsk.input.audioSignal({ id, sourceName: id, channelLayout: "stereo", sampleRate: 48000 });
54
+ const keyed = await norsk.processor.transform.streamKeyOverride({ id: `${id}-key`, streamKey: track.key });
55
+ keyed.subscribe([{ source: signal, sourceSelector: track.kind === "video" ? selectVideo : selectAudio }]);
56
+ tracks.push(keyed);
57
+ nodes.push(keyed, signal);
58
+ }
59
+ return { tracks, nodes };
45
60
  }
46
61
  export async function runMediaConversionConformance(opts) {
47
62
  const { norsk, declaration, launcher, links } = opts;
@@ -50,7 +65,7 @@ export async function runMediaConversionConformance(opts) {
50
65
  const observeMs = opts.observeMs ?? 10_000;
51
66
  const selectAll = (streams) => [...selectVideo(streams), ...selectAudio(streams)];
52
67
  const sent = new Set();
53
- const sources = await startSources(norsk, prefix, declaration);
68
+ const { tracks: sources, nodes: sourceNodes } = await startSources(norsk, prefix, declaration);
54
69
  const near = await norsk.inspect.streamTimestampReport({
55
70
  id: `${prefix}-sent`,
56
71
  onTimestamp: (_k, t) => {
@@ -137,7 +152,7 @@ export async function runMediaConversionConformance(opts) {
137
152
  }
138
153
  finally {
139
154
  await launcher.stop().catch(() => { });
140
- for (const node of [far, returned, sourceLink, near, ...sources])
155
+ for (const node of [far, returned, sourceLink, near, ...sourceNodes])
141
156
  await node.close().catch(() => { });
142
157
  }
143
158
  const observation = { sent, phases };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norskvideo/ctl-test-harness",
3
- "version": "0.1.94",
3
+ "version": "0.1.96",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -96,8 +96,8 @@
96
96
  "devDependencies": {
97
97
  "@types/bun": "latest",
98
98
  "@types/node": "^22.10.0",
99
- "@norskvideo/norsk-studio": "1.30.0-2026-10-16-837e5d98",
100
- "@norskvideo/norsk-studio-built-ins": "1.30.0-2026-10-16-837e5d98",
99
+ "@norskvideo/norsk-studio": "1.30.0-2026-10-17-4468cc12",
100
+ "@norskvideo/norsk-studio-built-ins": "1.30.0-2026-10-17-4468cc12",
101
101
  "@norskvideo/norsk-sdk": "1.3.1-2026-10-16-e43e0f90"
102
102
  },
103
103
  "peerDependenciesMeta": {