Skip to content

Commit 70c2cbb

Browse files
Create MXL resources based on streaming profile config
1 parent b3537a2 commit 70c2cbb

File tree

1 file changed

+139
-10
lines changed

1 file changed

+139
-10
lines changed

code/src/Server.ts

Lines changed: 139 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { v4 as uuidv4 } from 'uuid';
66
import { jsonIgnoreReplacer } from 'json-ignore';
77

88
import { Configuration, StreamingProfile } from './Configuration';
9-
import { NmosNode } from './NmosNode';
9+
import { NmosClock, NmosInterface, NmosNode } from './NmosNode';
1010
import { NmosDevice } from './NmosDevice';
1111
import { RegistrationClient } from './RegistrationClient';
1212
import { SessionManager } from './SessionManager';
@@ -32,6 +32,10 @@ import { NmosReceiverMpegTS } from './NmosReceiverMpegTS';
3232
import { NmosReceiverStagedRtp } from './NmosReceiverRtp';
3333

3434
import cors from 'cors';
35+
import { NmosFlowVideoMXL } from './NmosFlowVideoMXL';
36+
import { NmosSourceVideoMXL } from './NmosSourceVideoMXL';
37+
import { NmosSenderMXL } from './NmosSenderMXL';
38+
import { NmosReceiverVideoMXL } from './NmosReceiverVideoMXL';
3539

3640
export interface WebSocketConnection extends WebSocket {
3741
isAlive: boolean;
@@ -70,15 +74,61 @@ try
7074

7175
const registrationClient = new RegistrationClient(config.registry_address, config.registry_port, config.work_without_registry);
7276

73-
const myNode = new NmosNode(
74-
config.node_id,
75-
config.base_label,
76-
config.address,
77-
config.outside_port,
78-
config.manufacturer,
79-
config.product,
80-
config.instance,
81-
registrationClient);
77+
let myNode: NmosNode;
78+
79+
switch(config.streaming_profile)
80+
{
81+
case StreamingProfile.RTP_RAW:
82+
{
83+
myNode = new NmosNode(
84+
config.node_id,
85+
config.base_label,
86+
config.address,
87+
config.outside_port,
88+
[ new NmosClock('clk0', 'internal') ],
89+
[ new NmosInterface('00-15-5d-67-c3-4e', 'eth0', '00-15-5d-67-c3-4e'), new NmosInterface('96-1c-70-61-b1-54', 'eth1', '96-1c-70-61-b1-54') ],
90+
config.manufacturer,
91+
config.product,
92+
config.instance,
93+
registrationClient);
94+
}
95+
break;
96+
97+
case StreamingProfile.RTP_MPEG_TS:
98+
{
99+
myNode = new NmosNode(
100+
config.node_id,
101+
config.base_label,
102+
config.address,
103+
config.outside_port,
104+
[ new NmosClock('clk0', 'internal') ],
105+
[ new NmosInterface('00-15-5d-67-c3-4e', 'eth0', '00-15-5d-67-c3-4e') ],
106+
config.manufacturer,
107+
config.product,
108+
config.instance,
109+
registrationClient);
110+
}
111+
break;
112+
113+
case StreamingProfile.MXL:
114+
{
115+
myNode = new NmosNode(
116+
config.node_id,
117+
config.base_label,
118+
config.address,
119+
config.outside_port,
120+
[],
121+
[],
122+
config.manufacturer,
123+
config.product,
124+
config.instance,
125+
registrationClient);
126+
}
127+
break;
128+
129+
default:
130+
throw new Error(`Invalid streaming profile in configuration: ${config.streaming_profile}`);
131+
}
82132

83133
const myDevice = new NmosDevice(
84134
config.device_id,
@@ -90,6 +140,7 @@ try
90140
config.product,
91141
config.instance,
92142
config.function,
143+
config.streaming_profile == StreamingProfile.MXL,
93144
registrationClient);
94145

95146
let mySource: NmosSource | null = null;
@@ -122,6 +173,20 @@ try
122173
registrationClient);
123174
}
124175
break;
176+
177+
case StreamingProfile.MXL:
178+
{
179+
mySource = new NmosSourceVideoMXL(
180+
config.source_id,
181+
config.device_id,
182+
config.base_label,
183+
[],
184+
30000,
185+
1001,
186+
"urn:x-nmos:format:video",
187+
registrationClient);
188+
}
189+
break;
125190
}
126191

127192
let myFlow: NmosFlow | null = null;
@@ -182,6 +247,47 @@ try
182247
registrationClient);
183248
}
184249
break;
250+
251+
case StreamingProfile.MXL:
252+
{
253+
myFlow = new NmosFlowVideoMXL(
254+
config.flow_id,
255+
config.source_id,
256+
config.device_id,
257+
config.base_label,
258+
[],
259+
30000,
260+
1001,
261+
"urn:x-nmos:format:video",
262+
1920,
263+
1080,
264+
"BT709",
265+
"progressive",
266+
"SDR",
267+
"video/v210",
268+
[
269+
{
270+
"name": "Y",
271+
"width": 1920,
272+
"height": 1080,
273+
"bit_depth": 10
274+
},
275+
{
276+
"name": "Cb",
277+
"width": 960,
278+
"height": 1080,
279+
"bit_depth": 10
280+
},
281+
{
282+
"name": "Cr",
283+
"width": 960,
284+
"height": 1080,
285+
"bit_depth": 10
286+
}
287+
],
288+
registrationClient);
289+
}
290+
break;
185291
}
186292

187293
let mySender: NmosSender | null = null;
@@ -216,6 +322,18 @@ try
216322
registrationClient);
217323
}
218324
break;
325+
326+
case StreamingProfile.MXL:
327+
{
328+
mySender = new NmosSenderMXL(
329+
config.sender_id,
330+
config.flow_id,
331+
config.device_id,
332+
config.base_label,
333+
"urn:x-nmos:transport:mxl",
334+
registrationClient);
335+
}
336+
break;
219337
}
220338

221339
let myReceiver: NmosReceiver | null = null;
@@ -245,6 +363,17 @@ try
245363
registrationClient);
246364
}
247365
break;
366+
367+
case StreamingProfile.MXL:
368+
{
369+
myReceiver = new NmosReceiverVideoMXL(
370+
config.receiver_id,
371+
config.device_id,
372+
config.base_label,
373+
'urn:x-nmos:transport:mxl',
374+
registrationClient);
375+
}
376+
break;
248377
}
249378

250379
if(myReceiver != null)

0 commit comments

Comments
 (0)