@norskvideo/norsk-studio 1.27.0-2025-03-11-6b63bfb6 → 1.27.0-2025-03-13-5c343278
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/lib/client/jsx/connection-editor.d.ts +2 -0
- package/lib/client/jsx/connection-editor.js +91 -79
- package/lib/client/jsx/connection-editor.js.map +1 -1
- package/lib/client/jsx/connection.d.ts +1 -1
- package/lib/client/jsx/connection.js +7 -4
- package/lib/client/jsx/connection.js.map +1 -1
- package/lib/client/jsx/selected-connection.js +16 -17
- package/lib/client/jsx/selected-connection.js.map +1 -1
- package/lib/client/jsx/selected-node.js.map +1 -1
- package/lib/client/rete/connection.js.map +1 -1
- package/lib/extension/base-nodes.d.ts +5 -5
- package/lib/extension/base-nodes.js +8 -14
- package/lib/extension/base-nodes.js.map +1 -1
- package/lib/extension/client-types.d.ts +39 -26
- package/lib/extension/client-types.js +26 -14
- package/lib/extension/client-types.js.map +1 -1
- package/lib/extension/runtime-types.d.ts +10 -39
- package/lib/extension/runtime-types.js +4 -233
- package/lib/extension/runtime-types.js.map +1 -1
- package/lib/runtime/document.js +2 -8
- package/lib/runtime/document.js.map +1 -1
- package/lib/runtime/execution.d.ts +41 -3
- package/lib/runtime/execution.js +148 -12
- package/lib/runtime/execution.js.map +1 -1
- package/lib/runtime/stream-registration.d.ts +14 -8
- package/lib/runtime/stream-registration.js +36 -24
- package/lib/runtime/stream-registration.js.map +1 -1
- package/lib/runtime/util.d.ts +1 -1
- package/lib/shared/document.d.ts +19 -11
- package/lib/shared/document.js +133 -62
- package/lib/shared/document.js.map +1 -1
- package/lib/test/_util/builder.d.ts +2 -2
- package/lib/test/_util/builder.js +11 -10
- package/lib/test/_util/builder.js.map +1 -1
- package/lib/test/_util/runtime.d.ts +2 -2
- package/lib/test/_util/runtime.js.map +1 -1
- package/lib/test/_util/sinks.d.ts +3 -3
- package/lib/test/_util/sinks.js +3 -3
- package/lib/test/_util/sinks.js.map +1 -1
- package/lib/test/_util/test-infos.js +24 -24
- package/lib/test/_util/test-infos.js.map +1 -1
- package/lib/test/client-session.js +3 -3
- package/lib/test/client-session.js.map +1 -1
- package/lib/test/document-execution.js +4 -8
- package/lib/test/document-execution.js.map +1 -1
- package/lib/test/document-loading.js +1 -1
- package/lib/test/document-loading.js.map +1 -1
- package/lib/test/runtime-comms.js +1 -0
- package/lib/test/runtime-comms.js.map +1 -1
- package/lib/test/subscriptions.js +149 -126
- package/lib/test/subscriptions.js.map +1 -1
- package/package.json +2 -2
- package/static/style.css +0 -20
- package/ui/index.js +38237 -38138
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AutoProcessorMediaNode, type AutoSinkMediaNode, type MediaNodeState, type SourceMediaNode, Context } from "@norskvideo/norsk-sdk";
|
|
2
|
-
import { CreatedMediaNode, RelatedMediaNodes, RuntimeUpdates,
|
|
2
|
+
import { CreatedMediaNode, RelatedMediaNodes, RuntimeUpdates, StudioComponentInputStream } from "./runtime-types";
|
|
3
3
|
export type BaseAutoDuplexNodeSetup<State extends object = object, Event extends object = object> = {
|
|
4
4
|
input: AutoSinkMediaNode<string>;
|
|
5
5
|
output: SourceMediaNode[];
|
|
@@ -14,7 +14,7 @@ export declare class CustomAutoDuplexNode implements CreatedMediaNode {
|
|
|
14
14
|
constructor(id: string);
|
|
15
15
|
setup<State extends object = object, Event extends object = object>(setup: BaseAutoDuplexNodeSetup<State, Event>, opts?: SubscriptionOpts): void;
|
|
16
16
|
close(): Promise<void>;
|
|
17
|
-
subscribe(
|
|
17
|
+
subscribe(streams: StudioComponentInputStream[], opts?: SubscriptionOpts): Promise<void>;
|
|
18
18
|
}
|
|
19
19
|
export type BaseSourceNodeSetup<State extends object = object, Event extends object = object> = {
|
|
20
20
|
output: SourceMediaNode[];
|
|
@@ -39,7 +39,7 @@ export declare class CustomSinkNode implements CreatedMediaNode {
|
|
|
39
39
|
relatedMediaNodes: RelatedMediaNodes;
|
|
40
40
|
constructor(id: string);
|
|
41
41
|
setup<State extends object = object, Command extends object = object, Event extends object = object>(setup: BaseSinkNodeSetup<State, Command, Event>, opts?: SubscriptionOpts): void;
|
|
42
|
-
subscribe(
|
|
42
|
+
subscribe(streams: StudioComponentInputStream[], opts?: SubscriptionOpts): Promise<void>;
|
|
43
43
|
registerInput(input: MediaNodeState): void;
|
|
44
44
|
close(): Promise<void>;
|
|
45
45
|
}
|
|
@@ -58,5 +58,5 @@ export declare class SimpleProcessorWrapper extends CustomAutoDuplexNode {
|
|
|
58
58
|
initialised: Promise<void>;
|
|
59
59
|
constructor(id: string, create: () => Promise<AutoProcessorMediaNode<string>>, updates?: RuntimeUpdates);
|
|
60
60
|
}
|
|
61
|
-
export declare function defaultSubscription(innerInput: AutoSinkMediaNode<string>, sources:
|
|
62
|
-
export declare function defaultValidation(sources:
|
|
61
|
+
export declare function defaultSubscription(innerInput: AutoSinkMediaNode<string>, sources: StudioComponentInputStream[], updates?: RuntimeUpdates, opts?: SubscriptionOpts): void;
|
|
62
|
+
export declare function defaultValidation(sources: StudioComponentInputStream[], updates?: RuntimeUpdates, opts?: SubscriptionOpts): ((ctx: Context) => "accept" | "deny") | undefined;
|
|
@@ -19,7 +19,7 @@ class CustomAutoDuplexNode {
|
|
|
19
19
|
this._updates = setup.updates;
|
|
20
20
|
this.opts = opts;
|
|
21
21
|
this.relatedMediaNodes.addInput(setup.input);
|
|
22
|
-
|
|
22
|
+
this.relatedMediaNodes.addOutputs(setup.output);
|
|
23
23
|
}
|
|
24
24
|
async close() {
|
|
25
25
|
await this.innerInput?.close();
|
|
@@ -28,9 +28,9 @@ class CustomAutoDuplexNode {
|
|
|
28
28
|
if (this.innerInput)
|
|
29
29
|
this.relatedMediaNodes.removeInput(this.innerInput);
|
|
30
30
|
}
|
|
31
|
-
subscribe(
|
|
31
|
+
async subscribe(streams, opts) {
|
|
32
32
|
if (this.innerInput)
|
|
33
|
-
defaultSubscription(this.innerInput,
|
|
33
|
+
defaultSubscription(this.innerInput, streams, this._updates, opts || this.opts);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
exports.CustomAutoDuplexNode = CustomAutoDuplexNode;
|
|
@@ -66,9 +66,9 @@ class CustomSinkNode {
|
|
|
66
66
|
this._updates = setup.updates;
|
|
67
67
|
this.relatedMediaNodes.addInput(setup.sink);
|
|
68
68
|
}
|
|
69
|
-
subscribe(
|
|
69
|
+
async subscribe(streams, opts) {
|
|
70
70
|
if (this.inner)
|
|
71
|
-
defaultSubscription(this.inner,
|
|
71
|
+
defaultSubscription(this.inner, streams, this._updates, opts || this.opts);
|
|
72
72
|
}
|
|
73
73
|
registerInput(input) {
|
|
74
74
|
this.relatedMediaNodes.addInput(input);
|
|
@@ -106,10 +106,7 @@ class SimpleProcessorWrapper extends CustomAutoDuplexNode {
|
|
|
106
106
|
}
|
|
107
107
|
exports.SimpleProcessorWrapper = SimpleProcessorWrapper;
|
|
108
108
|
function defaultSubscription(innerInput, sources, updates, opts) {
|
|
109
|
-
|
|
110
|
-
sources.forEach((s) => {
|
|
111
|
-
subs = subs.concat(s.selectStreams());
|
|
112
|
-
});
|
|
109
|
+
const subs = sources.map((s) => s.select());
|
|
113
110
|
if (subs.length > 0) {
|
|
114
111
|
updates?.clearAlert('no-inputs-available');
|
|
115
112
|
innerInput.subscribe(subs, defaultValidation(sources, updates, opts));
|
|
@@ -121,17 +118,14 @@ function defaultSubscription(innerInput, sources, updates, opts) {
|
|
|
121
118
|
}
|
|
122
119
|
}
|
|
123
120
|
function defaultValidation(sources, updates, opts) {
|
|
124
|
-
const totalStreamsExpected = sources.reduce((acc, s) => {
|
|
125
|
-
return acc + s.streams.select.length;
|
|
126
|
-
}, 0);
|
|
127
121
|
const requireAll = opts?.requireOneOfEverything == undefined ? false : opts.requireOneOfEverything;
|
|
128
122
|
return requireAll ? (ctx) => {
|
|
129
|
-
if (ctx.streams.length ==
|
|
123
|
+
if (ctx.streams.length == sources.length) {
|
|
130
124
|
updates?.clearAlert('not-all-streams-present');
|
|
131
125
|
return "accept";
|
|
132
126
|
}
|
|
133
127
|
else {
|
|
134
|
-
updates?.setAlert('not-all-streams-present', { level: 'error', message: `This component requires all configured streams to be present. Expected: ${
|
|
128
|
+
updates?.setAlert('not-all-streams-present', { level: 'error', message: `This component requires all configured streams to be present. Expected: ${sources.length}, Current: ${ctx.streams.length}` });
|
|
135
129
|
return "deny";
|
|
136
130
|
}
|
|
137
131
|
} : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-nodes.js","sourceRoot":"","sources":["../../src/extension/base-nodes.ts"],"names":[],"mappings":";;;AAmJA,
|
|
1
|
+
{"version":3,"file":"base-nodes.js","sourceRoot":"","sources":["../../src/extension/base-nodes.ts"],"names":[],"mappings":";;;AAmJA,kDAcC;AAED,8CAYC;AA9KD,mDAAkH;AAClH,+CAA6C;AAQ7C,MAAa,oBAAoB;IAE/B,EAAE,CAAS;IACX,UAAU,CAA6B;IACvC,iBAAiB,GAAsB,IAAI,iCAAiB,EAAE,CAAC;IAC/D,QAAQ,CAAkB;IAC1B,IAAI,CAAoB;IAExB,YAAY,EAAU;QACpB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED,KAAK,CAA+D,KAA4C,EAAE,IAAuB;QACvI,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,OAAuC,CAAC;QAC9D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAC5C,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC;QAC/B,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,iBAAi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,6 @@
|
|
|
1
1
|
import type { DocumentDescription, NodeDescription, NodeSubscriptionDescription, NodeValidationContext } from "../shared/document";
|
|
2
2
|
import type * as Z from 'zod';
|
|
3
|
-
import type {
|
|
3
|
+
import type { StreamMetadataMessage } from "@norskvideo/norsk-sdk";
|
|
4
4
|
export type Media = Exclude<StreamMetadataMessage["case"], undefined>;
|
|
5
5
|
export declare const All: Media[];
|
|
6
6
|
export declare const Av: Media[];
|
|
@@ -8,36 +8,49 @@ export declare const Audio: Media[];
|
|
|
8
8
|
export declare const Video: Media[];
|
|
9
9
|
export declare const Playlist: Media[];
|
|
10
10
|
export declare const Subtitle: Media[];
|
|
11
|
-
export declare function subscriptionMedia(s
|
|
12
|
-
export declare function outputMedia(s: SubscriptionProduceInfo<BaseConfig> | undefined): Media[];
|
|
13
|
-
export declare function
|
|
11
|
+
export declare function subscriptionMedia<T extends BaseConfig>(s?: NodeSubscriptionDescription<T>): Media[];
|
|
12
|
+
export declare function outputMedia(s: SubscriptionProduceInfo<BaseConfig> | undefined, cfg: BaseConfig, inputs: InputStreamDefinition[]): Media[];
|
|
13
|
+
export declare function simpleToMedia(stream: SimpleStream): Media[];
|
|
14
|
+
export declare function outputStreamComponents(s: SubscriptionProduceInfo<BaseConfig> | undefined, cfg: BaseConfig, inputs: InputStreamDefinition[]): OutputStreamDefinition[];
|
|
15
|
+
export declare function inputMedia<Config extends BaseConfig>(s: SubscriptionAcceptInfo<Config> | undefined, cfg: Config): Media[];
|
|
16
|
+
export type SimpleStream = {
|
|
17
|
+
type: 'simple-stream';
|
|
18
|
+
video?: true;
|
|
19
|
+
audio?: true;
|
|
20
|
+
ancillary?: true;
|
|
21
|
+
subtitle?: true;
|
|
22
|
+
sourceName?: string;
|
|
23
|
+
programNumber?: number;
|
|
24
|
+
};
|
|
14
25
|
export type ComponentCategory = 'input' | 'output' | 'processor';
|
|
15
|
-
export type
|
|
16
|
-
type: '
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
type: 'multi-stream';
|
|
20
|
-
media: Media[];
|
|
26
|
+
export type SubscriptionProduceInfo<Config> = SimpleStream | {
|
|
27
|
+
type: 'dynamic-streams';
|
|
28
|
+
groupBy?: GroupingKey;
|
|
29
|
+
streams: (cfg: Config, inputStreams: OutputStreamDefinition[]) => OutputStreamDefinition[];
|
|
21
30
|
};
|
|
22
|
-
export type
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
keys: (cfg: Config, subscriptions: NodeSubscriptionDescription<BaseConfig>[]) => FixedSubscriptionSelection[];
|
|
29
|
-
selector: (selectionKeys: string[], outputMetadata: StreamMetadata[], cfg: Config, subscriptions: NodeSubscriptionDescription<BaseConfig>[]) => StreamKey[];
|
|
30
|
-
} | {
|
|
31
|
-
type: 'multi-stream';
|
|
32
|
-
media: Media[];
|
|
31
|
+
export type OutputStreamDefinition = {
|
|
32
|
+
media: Media;
|
|
33
|
+
sourceName?: string;
|
|
34
|
+
programNumber?: number;
|
|
35
|
+
streamId?: number;
|
|
36
|
+
renditionName?: string;
|
|
33
37
|
};
|
|
34
|
-
export type
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
export type InputStreamDefinition = {
|
|
39
|
+
media: Media;
|
|
40
|
+
name?: string;
|
|
41
|
+
optional?: true;
|
|
42
|
+
};
|
|
43
|
+
export type GroupingKey = keyof Pick<OutputStreamDefinition, "streamId" | "sourceName" | "programNumber" | "renditionName">;
|
|
44
|
+
export type SubscriptionAcceptInfo<Config> = SimpleStream | {
|
|
45
|
+
type: 'dynamic-streams';
|
|
46
|
+
mode?: {
|
|
47
|
+
type: 'multiple';
|
|
48
|
+
groupBy: GroupingKey;
|
|
49
|
+
} | 'any';
|
|
50
|
+
streams: (cfg: Config) => InputStreamDefinition[];
|
|
38
51
|
};
|
|
39
52
|
export type SubscriptionInfo<Config extends BaseConfig> = {
|
|
40
|
-
accepts?: SubscriptionAcceptInfo
|
|
53
|
+
accepts?: SubscriptionAcceptInfo<Config>;
|
|
41
54
|
produces?: SubscriptionProduceInfo<Config>;
|
|
42
55
|
};
|
|
43
56
|
export type InstanceUrls = {
|
|
@@ -29,41 +29,53 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.RegistrationConsts = exports.Subtitle = exports.Playlist = exports.Video = exports.Audio = exports.Av = exports.All = void 0;
|
|
30
30
|
exports.subscriptionMedia = subscriptionMedia;
|
|
31
31
|
exports.outputMedia = outputMedia;
|
|
32
|
+
exports.simpleToMedia = simpleToMedia;
|
|
33
|
+
exports.outputStreamComponents = outputStreamComponents;
|
|
32
34
|
exports.inputMedia = inputMedia;
|
|
33
35
|
exports.discriminatedForm = discriminatedForm;
|
|
34
|
-
exports.All = ["video", "audio", "subtitle"];
|
|
36
|
+
exports.All = ["video", "audio", "subtitle", "ancillary"];
|
|
35
37
|
exports.Av = ["video", "audio"];
|
|
36
38
|
exports.Audio = ["audio"];
|
|
37
39
|
exports.Video = ["video"];
|
|
38
40
|
exports.Playlist = ["playlist"];
|
|
39
41
|
exports.Subtitle = ["subtitle"];
|
|
40
42
|
function subscriptionMedia(s) {
|
|
41
|
-
|
|
43
|
+
if (!s)
|
|
44
|
+
return [];
|
|
45
|
+
return s.streams.filter.map((f) => f.media);
|
|
46
|
+
}
|
|
47
|
+
function outputMedia(s, cfg, inputs) {
|
|
48
|
+
const components = outputStreamComponents(s, cfg, inputs);
|
|
49
|
+
return [...new Set(components.map((s) => s.media)).values()];
|
|
50
|
+
}
|
|
51
|
+
function simpleToMedia(stream) {
|
|
52
|
+
const keys = Object.keys(stream);
|
|
53
|
+
return exports.All.filter((media) => {
|
|
54
|
+
return keys.includes(media);
|
|
55
|
+
});
|
|
42
56
|
}
|
|
43
|
-
function
|
|
57
|
+
function outputStreamComponents(s, cfg, inputs) {
|
|
44
58
|
if (!s)
|
|
45
59
|
return [];
|
|
46
60
|
const t = s.type;
|
|
47
61
|
switch (t) {
|
|
48
|
-
case '
|
|
49
|
-
return s.media;
|
|
50
|
-
case '
|
|
51
|
-
return s.
|
|
52
|
-
case 'fixed-list':
|
|
53
|
-
return s.possibleMedia;
|
|
62
|
+
case 'simple-stream':
|
|
63
|
+
return simpleToMedia(s).map((media) => ({ media }));
|
|
64
|
+
case 'dynamic-streams':
|
|
65
|
+
return s.streams(cfg, inputs);
|
|
54
66
|
default:
|
|
55
67
|
(0, util_1.assertUnreachable)(t);
|
|
56
68
|
}
|
|
57
69
|
}
|
|
58
|
-
function inputMedia(s) {
|
|
70
|
+
function inputMedia(s, cfg) {
|
|
59
71
|
if (!s)
|
|
60
72
|
return [];
|
|
61
73
|
const t = s.type;
|
|
62
74
|
switch (t) {
|
|
63
|
-
case "
|
|
64
|
-
return s.media;
|
|
65
|
-
case "
|
|
66
|
-
return s
|
|
75
|
+
case "dynamic-streams":
|
|
76
|
+
return s.streams(cfg).map((s) => s.media);
|
|
77
|
+
case "simple-stream":
|
|
78
|
+
return simpleToMedia(s);
|
|
67
79
|
default:
|
|
68
80
|
(0, util_1.assertUnreachable)(t);
|
|
69
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-types.js","sourceRoot":"","sources":["../../src/extension/client-types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"client-types.js","sourceRoot":"","sources":["../../src/extension/client-types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,8CAGC;AAED,kCAGC;AAED,sCAKC;AAED,wDAgBC;AAED,gCAWC;AAmVD,8CAuBC;AA/ZY,QAAA,GAAG,GAAY,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;AAC3D,QAAA,EAAE,GAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACjC,QAAA,KAAK,GAAY,CAAC,OAAO,CAAC,CAAC;AAC3B,QAAA,KAAK,GAAY,CAAC,OAAO,CAAC,CA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mdMA35DLoad, CurrentLoad, MediaNodeId, MediaNodeState, Norsk, ReceiveFromAddress, ReceiveFromAddressAuto, SourceMediaNode,
|
|
1
|
+
import { AmdMA35DLoad, CurrentLoad, MediaNodeId, MediaNodeState, Norsk, ReceiveFromAddress, ReceiveFromAddressAuto, SourceMediaNode, StreamMetadata } from '@norskvideo/norsk-sdk';
|
|
2
2
|
import { ReportBuilder } from '../runtime/execution';
|
|
3
|
-
import { BaseConfig, Media, NodeInfo } from './client-types';
|
|
3
|
+
import { BaseConfig, Media, NodeInfo, OutputStreamDefinition } from './client-types';
|
|
4
4
|
import { IRouter, RequestHandler } from 'express';
|
|
5
|
-
import { NodeDescription, SubscriptionConfiguration } from '../shared/document';
|
|
6
5
|
import { HardwareAccelerationType } from '../shared/config';
|
|
7
6
|
import EventHandler from 'eventhandler';
|
|
8
7
|
import { ComponentAlert } from '../shared/server-msg';
|
|
@@ -15,6 +14,7 @@ export declare class RelatedMediaNodes {
|
|
|
15
14
|
evs: EventHandler;
|
|
16
15
|
constructor();
|
|
17
16
|
onChange(handler: () => void): void;
|
|
17
|
+
removeOnChange(handler: () => void): void;
|
|
18
18
|
addInput(node: MediaNodeState): void;
|
|
19
19
|
addInputs(nodes: MediaNodeState[]): void;
|
|
20
20
|
addOutputs(nodes: SourceMediaNode[]): void;
|
|
@@ -22,47 +22,18 @@ export declare class RelatedMediaNodes {
|
|
|
22
22
|
removeInput(node: MediaNodeState): void;
|
|
23
23
|
removeOutput(node: SourceMediaNode): void;
|
|
24
24
|
}
|
|
25
|
-
export
|
|
26
|
-
mediaNode: SourceMediaNode;
|
|
27
|
-
metadata: StreamMetadata;
|
|
28
|
-
};
|
|
29
|
-
export declare class StudioNodeSubscriptionSource {
|
|
25
|
+
export interface StudioComponentInputStream {
|
|
30
26
|
source: CreatedMediaNode;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
accepted: Map<Media, ActiveStream>;
|
|
37
|
-
constructor(source: CreatedMediaNode, description: NodeDescription<BaseConfig>, streams: SubscriptionConfiguration, info?: NodeInfo<BaseConfig>);
|
|
38
|
-
selectStreams(additional?: (metadata: StreamMetadata[]) => StreamKey[]): ReceiveFromAddressAuto[];
|
|
39
|
-
selectKeys(keys: string[], additional?: (metadata: StreamMetadata[]) => StreamKey[]): ReceiveFromAddressAuto[];
|
|
40
|
-
selectVideo(): ReceiveFromAddressAuto[];
|
|
41
|
-
selectAudio(): ReceiveFromAddressAuto[];
|
|
42
|
-
selectAV(): ReceiveFromAddressAuto[];
|
|
43
|
-
selectVideoForKey(key: string): ReceiveFromAddressAuto[];
|
|
44
|
-
selectAudioForKey(key: string): ReceiveFromAddressAuto[];
|
|
45
|
-
selectAVForKey(key: string): ReceiveFromAddressAuto[];
|
|
46
|
-
selectStreamsToPin<Pins extends string>(p: Pins, additional?: (metadata: StreamMetadata[]) => StreamKey[], keys?: string[]): ReceiveFromAddress<Pins>[];
|
|
47
|
-
selectVideoToPin<Pins extends string>(p: Pins): ReceiveFromAddress<Pins>[];
|
|
48
|
-
selectVideoToPinForKey<Pins extends string>(p: Pins, key: string): ReceiveFromAddress<Pins>[];
|
|
49
|
-
selectAudioToPin<Pins extends string>(p: Pins): ReceiveFromAddress<Pins>[];
|
|
50
|
-
selectAudioToPinForKey<Pins extends string>(p: Pins, key: string): ReceiveFromAddress<Pins>[];
|
|
51
|
-
selectAvToPin<Pins extends string>(p: Pins): ReceiveFromAddress<Pins>[];
|
|
52
|
-
selectAvToPinForKey<Pins extends string>(p: Pins, key: string): ReceiveFromAddress<Pins>[];
|
|
53
|
-
latestStreams(filterOverride?: string[]): ActiveStream[];
|
|
54
|
-
filterStreams(streams: ActiveStream[], filterOverride?: string[]): ActiveStream[];
|
|
55
|
-
onSourceNodesChange(): void;
|
|
56
|
-
registerForContextChange(handler: SubscribeDestination): void;
|
|
57
|
-
unregisterForContextChange(handler: SubscribeDestination): void;
|
|
58
|
-
_availableSourceKeys(): string[];
|
|
59
|
-
activeSourceKeys(): string[];
|
|
27
|
+
definition: OutputStreamDefinition;
|
|
28
|
+
metadata?: StreamMetadata;
|
|
29
|
+
select(): ReceiveFromAddressAuto;
|
|
30
|
+
selectToPin<Pin extends string>(p: Pin): ReceiveFromAddress<Pin>;
|
|
31
|
+
isMedia(media: Media): boolean;
|
|
60
32
|
}
|
|
61
33
|
export interface CreatedMediaNode {
|
|
62
34
|
id: MediaNodeId;
|
|
63
35
|
relatedMediaNodes: RelatedMediaNodes;
|
|
64
|
-
subscribe?: (
|
|
65
|
-
selectOutputs?: (selectionKeys: string[]) => StreamKey[];
|
|
36
|
+
subscribe?: (streams: StudioComponentInputStream[]) => Promise<void>;
|
|
66
37
|
}
|
|
67
38
|
export interface Storage {
|
|
68
39
|
identifier: string;
|
|
@@ -26,15 +26,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.RelatedMediaNodes = void 0;
|
|
30
30
|
exports.hydratePathsObject = hydratePathsObject;
|
|
31
31
|
exports.routeInfoFromSchemas = routeInfoFromSchemas;
|
|
32
32
|
exports.makeRelativeToNode = makeRelativeToNode;
|
|
33
33
|
exports.streamsOfMediaType = streamsOfMediaType;
|
|
34
|
-
const norsk_sdk_1 = require("@norskvideo/norsk-sdk");
|
|
35
34
|
const path = __importStar(require("path"));
|
|
36
35
|
const util_1 = require("../shared/util");
|
|
37
|
-
const logging_1 = require("../server/logging");
|
|
38
36
|
const eventhandler_1 = __importDefault(require("eventhandler"));
|
|
39
37
|
class RelatedMediaNodes {
|
|
40
38
|
_input = [];
|
|
@@ -51,6 +49,9 @@ class RelatedMediaNodes {
|
|
|
51
49
|
onChange(handler) {
|
|
52
50
|
this.evs.on('change', handler);
|
|
53
51
|
}
|
|
52
|
+
removeOnChange(handler) {
|
|
53
|
+
this.evs.removeEventListener('change', handler);
|
|
54
|
+
}
|
|
54
55
|
addInput(node) {
|
|
55
56
|
this._input.push(node);
|
|
56
57
|
this.evs.emit('change', {});
|
|
@@ -77,236 +78,6 @@ class RelatedMediaNodes {
|
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
exports.RelatedMediaNodes = RelatedMediaNodes;
|
|
80
|
-
class StudioNodeSubscriptionSource {
|
|
81
|
-
source;
|
|
82
|
-
sourceDescription;
|
|
83
|
-
streams;
|
|
84
|
-
sourceConfig;
|
|
85
|
-
contextChangeHandlers = [];
|
|
86
|
-
info;
|
|
87
|
-
accepted = new Map();
|
|
88
|
-
constructor(source, description, streams, info) {
|
|
89
|
-
this.sourceConfig = description.config;
|
|
90
|
-
this.sourceDescription = description;
|
|
91
|
-
this.source = source;
|
|
92
|
-
this.streams = streams;
|
|
93
|
-
this.info = info;
|
|
94
|
-
this.source.relatedMediaNodes.onChange(this.onSourceNodesChange.bind(this));
|
|
95
|
-
}
|
|
96
|
-
selectStreams(additional) {
|
|
97
|
-
return this.source.relatedMediaNodes.output.map((output) => {
|
|
98
|
-
return {
|
|
99
|
-
source: output,
|
|
100
|
-
sourceSelector: (streams) => {
|
|
101
|
-
const matching = this.filterStreams(streams.map((m) => ({ mediaNode: output, metadata: m })))
|
|
102
|
-
.map((m) => m.metadata);
|
|
103
|
-
if (additional) {
|
|
104
|
-
return additional(matching);
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
return matching.map((m) => m.streamKey);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
selectKeys(keys, additional) {
|
|
114
|
-
return this.source.relatedMediaNodes.output.map((output) => {
|
|
115
|
-
return {
|
|
116
|
-
source: output,
|
|
117
|
-
sourceSelector: (streams) => {
|
|
118
|
-
const matching = this.filterStreams(streams.map((m) => ({ mediaNode: output, metadata: m })), keys)
|
|
119
|
-
.map((m) => m.metadata);
|
|
120
|
-
if (additional) {
|
|
121
|
-
return additional(matching);
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
return matching.map((m) => m.streamKey);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
selectVideo() {
|
|
131
|
-
return this.selectStreams(norsk_sdk_1.selectVideo);
|
|
132
|
-
}
|
|
133
|
-
selectAudio() {
|
|
134
|
-
return this.selectStreams(norsk_sdk_1.selectAudio);
|
|
135
|
-
}
|
|
136
|
-
selectAV() {
|
|
137
|
-
return this.selectStreams(norsk_sdk_1.selectAV);
|
|
138
|
-
}
|
|
139
|
-
selectVideoForKey(key) {
|
|
140
|
-
return this.selectKeys([key], norsk_sdk_1.selectVideo);
|
|
141
|
-
}
|
|
142
|
-
selectAudioForKey(key) {
|
|
143
|
-
return this.selectKeys([key], norsk_sdk_1.selectAudio);
|
|
144
|
-
}
|
|
145
|
-
selectAVForKey(key) {
|
|
146
|
-
return this.selectKeys([key], norsk_sdk_1.selectAV);
|
|
147
|
-
}
|
|
148
|
-
selectStreamsToPin(p, additional, keys) {
|
|
149
|
-
return this.source.relatedMediaNodes.output.map((output) => {
|
|
150
|
-
return {
|
|
151
|
-
source: output,
|
|
152
|
-
sourceSelector: (streams) => {
|
|
153
|
-
const matching = this.filterStreams(streams.map((m) => ({ mediaNode: output, metadata: m })), keys)
|
|
154
|
-
.map((m) => m.metadata);
|
|
155
|
-
if (additional) {
|
|
156
|
-
return { [p]: additional(matching) };
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
return {
|
|
160
|
-
[p]: matching.map((m) => m.streamKey)
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
selectVideoToPin(p) {
|
|
168
|
-
return this.selectStreamsToPin(p, norsk_sdk_1.selectVideo);
|
|
169
|
-
}
|
|
170
|
-
selectVideoToPinForKey(p, key) {
|
|
171
|
-
return this.selectStreamsToPin(p, norsk_sdk_1.selectVideo, [key]);
|
|
172
|
-
}
|
|
173
|
-
selectAudioToPin(p) {
|
|
174
|
-
return this.selectStreamsToPin(p, norsk_sdk_1.selectAudio);
|
|
175
|
-
}
|
|
176
|
-
selectAudioToPinForKey(p, key) {
|
|
177
|
-
return this.selectStreamsToPin(p, norsk_sdk_1.selectAudio, [key]);
|
|
178
|
-
}
|
|
179
|
-
selectAvToPin(p) {
|
|
180
|
-
return this.selectStreamsToPin(p, norsk_sdk_1.selectAV);
|
|
181
|
-
}
|
|
182
|
-
selectAvToPinForKey(p, key) {
|
|
183
|
-
return this.selectStreamsToPin(p, norsk_sdk_1.selectAV, [key]);
|
|
184
|
-
}
|
|
185
|
-
latestStreams(filterOverride) {
|
|
186
|
-
return this.filterStreams(this.source.relatedMediaNodes.output.flatMap((n => n.outputStreams.map((s) => ({ mediaNode: n, metadata: s })))), filterOverride);
|
|
187
|
-
}
|
|
188
|
-
filterStreams(streams, filterOverride) {
|
|
189
|
-
const output = this.source.relatedMediaNodes.output;
|
|
190
|
-
if (!output) {
|
|
191
|
-
(0, logging_1.debuglog)("No output on subscription source", this.source.id);
|
|
192
|
-
return [];
|
|
193
|
-
}
|
|
194
|
-
const sType = this.streams.type;
|
|
195
|
-
switch (sType) {
|
|
196
|
-
case "take-all-streams": {
|
|
197
|
-
const media = this.streams.select;
|
|
198
|
-
const producer = this.info?.subscription.produces;
|
|
199
|
-
if (filterOverride && producer?.type == 'fixed-list') {
|
|
200
|
-
const needle = filterOverride ? filterOverride : this.activeSourceKeys();
|
|
201
|
-
(0, logging_1.sillylog)("Searching for filter keys in streams", { needle, streams: streams.map((m) => m.metadata.streamKey) });
|
|
202
|
-
const keys = this.source.selectOutputs
|
|
203
|
-
? this.source.selectOutputs(needle)
|
|
204
|
-
: producer.selector(needle, streams.map((s) => s.metadata), this.sourceConfig, this.sourceDescription.subscriptions);
|
|
205
|
-
return streams.filter((s) => s.metadata.streamKey && keys.find((k) => (0, norsk_sdk_1.streamKeysAreEqual)(k, s.metadata.streamKey)) && streamsOfMediaType(this.streams.select)(s.metadata));
|
|
206
|
-
}
|
|
207
|
-
else if (filterOverride) {
|
|
208
|
-
(0, logging_1.warninglog)("Component attempting to use filterovverride in filterStreams, but source is not a fixed-list", { source: this.source.id, component: this.info?.identifier });
|
|
209
|
-
}
|
|
210
|
-
return streams.filter((s) => streamsOfMediaType(media)(s.metadata));
|
|
211
|
-
}
|
|
212
|
-
case "take-first-stream": {
|
|
213
|
-
const media = this.streams.select;
|
|
214
|
-
for (const m of media) {
|
|
215
|
-
if (!this.accepted.get(m)) {
|
|
216
|
-
const matching = streams.find((s) => streamsOfMediaType([m])(s.metadata));
|
|
217
|
-
if (matching) {
|
|
218
|
-
(0, logging_1.sillylog)("TFS: Subscription accepting stream key from source", {
|
|
219
|
-
streamKey: matching.metadata.streamKey,
|
|
220
|
-
source: this.source.id,
|
|
221
|
-
media: m
|
|
222
|
-
});
|
|
223
|
-
this.accepted.set(m, matching);
|
|
224
|
-
}
|
|
225
|
-
continue;
|
|
226
|
-
}
|
|
227
|
-
if (this.accepted.get(m) && streams.find((s) => _streamKeysAreEqual(s.metadata.streamKey, this.accepted.get(m)?.metadata.streamKey))) {
|
|
228
|
-
continue;
|
|
229
|
-
}
|
|
230
|
-
const existing = this.accepted.get(m);
|
|
231
|
-
if (existing) {
|
|
232
|
-
(0, logging_1.sillylog)("TFS: Subscription removing stream key from source", {
|
|
233
|
-
streamKey: existing.metadata.streamKey,
|
|
234
|
-
source: this.source.id,
|
|
235
|
-
media: m
|
|
236
|
-
});
|
|
237
|
-
this.accepted.delete(m);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return [...this.accepted.values()];
|
|
241
|
-
}
|
|
242
|
-
case "take-specific-stream":
|
|
243
|
-
case "take-specific-streams": {
|
|
244
|
-
const producer = this.info?.subscription.produces;
|
|
245
|
-
if (producer?.type != 'fixed-list') {
|
|
246
|
-
(0, logging_1.errorlog)("Badly constructed subscription, fixed list not available", { producer, id: this.source.id });
|
|
247
|
-
return [];
|
|
248
|
-
}
|
|
249
|
-
const needle = filterOverride ? filterOverride : this.activeSourceKeys();
|
|
250
|
-
(0, logging_1.sillylog)("Searching for filter keys in streams", { needle, streams: streams.map((m) => m.metadata.streamKey) });
|
|
251
|
-
const keys = this.source.selectOutputs
|
|
252
|
-
? this.source.selectOutputs(needle)
|
|
253
|
-
: producer.selector(needle, streams.map((s) => s.metadata), this.sourceConfig, this.sourceDescription.subscriptions);
|
|
254
|
-
const selected = streams.filter((s) => s.metadata.streamKey && keys.find((k) => (0, norsk_sdk_1.streamKeysAreEqual)(k, s.metadata.streamKey)) && streamsOfMediaType(this.streams.select)(s.metadata));
|
|
255
|
-
(0, logging_1.sillylog)("Searched", { needle, selected: selected.map(s => s.metadata), streams });
|
|
256
|
-
return selected;
|
|
257
|
-
}
|
|
258
|
-
default:
|
|
259
|
-
(0, util_1.assertUnreachable)(sType);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
onSourceNodesChange() {
|
|
263
|
-
this.contextChangeHandlers.forEach((h) => {
|
|
264
|
-
this.source.relatedMediaNodes.output.forEach((s) => s.registerForContextChange(h));
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
registerForContextChange(handler) {
|
|
268
|
-
this.source.relatedMediaNodes.output.forEach((s) => s.registerForContextChange(handler));
|
|
269
|
-
this.contextChangeHandlers.push(handler);
|
|
270
|
-
}
|
|
271
|
-
unregisterForContextChange(handler) {
|
|
272
|
-
this.source.relatedMediaNodes.output.forEach((s) => s.unregisterForContextChange(handler));
|
|
273
|
-
this.contextChangeHandlers = this.contextChangeHandlers.filter((h) => h !== handler);
|
|
274
|
-
}
|
|
275
|
-
_availableSourceKeys() {
|
|
276
|
-
const producer = this.info?.subscription.produces;
|
|
277
|
-
if (producer?.type != 'fixed-list') {
|
|
278
|
-
(0, logging_1.errorlog)("Badly constructed subscription, fixed list not available", { producer, id: this.source.id });
|
|
279
|
-
return [];
|
|
280
|
-
}
|
|
281
|
-
return producer.keys(this.sourceConfig, this.sourceDescription.subscriptions).map((s) => s.key);
|
|
282
|
-
}
|
|
283
|
-
activeSourceKeys() {
|
|
284
|
-
const producer = this.info?.subscription.produces;
|
|
285
|
-
if (producer?.type != 'fixed-list') {
|
|
286
|
-
(0, logging_1.errorlog)("Badly constructed subscription, fixed list not available", { producer, id: this.source.id });
|
|
287
|
-
return [];
|
|
288
|
-
}
|
|
289
|
-
const sType = this.streams.type;
|
|
290
|
-
switch (sType) {
|
|
291
|
-
case 'take-all-streams':
|
|
292
|
-
return this._availableSourceKeys();
|
|
293
|
-
case 'take-first-stream':
|
|
294
|
-
return this._availableSourceKeys().slice(0, 1);
|
|
295
|
-
case 'take-specific-stream':
|
|
296
|
-
return [this.streams.filter];
|
|
297
|
-
case 'take-specific-streams':
|
|
298
|
-
return this.streams.filter;
|
|
299
|
-
default:
|
|
300
|
-
(0, util_1.assertUnreachable)(sType);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
exports.StudioNodeSubscriptionSource = StudioNodeSubscriptionSource;
|
|
305
|
-
function _streamKeysAreEqual(l, r) {
|
|
306
|
-
if (!l || !r)
|
|
307
|
-
return false;
|
|
308
|
-
return (0, norsk_sdk_1.streamKeysAreEqual)(l, r);
|
|
309
|
-
}
|
|
310
81
|
function hydratePathsObject(target, source, tags) {
|
|
311
82
|
if (source.type)
|
|
312
83
|
return;
|