@stinkycomputing/sesame-api-client 1.4.1-alpha.8 → 1.4.1-beta.1
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/README.md +64 -142
- package/dist/browser.cjs +24 -24
- package/dist/browser.cjs.map +2 -2
- package/dist/browser.d.ts +1 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.mjs +24 -24
- package/dist/browser.mjs.map +2 -2
- package/dist/command-list.d.ts +60 -28
- package/dist/command-list.d.ts.map +1 -1
- package/dist/index.browser.mjs +23008 -0
- package/dist/index.browser.mjs.map +7 -0
- package/dist/index.cjs +896 -456
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +769 -331
- package/dist/index.mjs.map +4 -4
- package/dist/proto/api.d.ts +305 -0
- package/dist/proto/api.js +923 -1
- package/dist/rpc-client.d.ts +1 -6
- package/dist/rpc-client.d.ts.map +1 -1
- package/dist/sesame-api-client.d.ts +5 -6
- package/dist/sesame-api-client.d.ts.map +1 -1
- package/dist/sesame-connection.d.ts +17 -8
- package/dist/sesame-connection.d.ts.map +1 -1
- package/dist/sesame-wire-protocol.d.ts +29 -0
- package/dist/sesame-wire-protocol.d.ts.map +1 -0
- package/dist/status-api.d.ts +0 -1
- package/dist/status-api.d.ts.map +1 -1
- package/package.json +11 -14
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/proto/api.js
|
|
2
|
-
import
|
|
2
|
+
import $protobuf from "protobufjs/minimal.js";
|
|
3
3
|
var $Reader = $protobuf.Reader;
|
|
4
4
|
var $Writer = $protobuf.Writer;
|
|
5
5
|
var $util = $protobuf.util;
|
|
@@ -20377,8 +20377,8 @@ var sesame = $root.sesame = (() => {
|
|
|
20377
20377
|
return jobs;
|
|
20378
20378
|
}();
|
|
20379
20379
|
v1.rpc = function() {
|
|
20380
|
-
const
|
|
20381
|
-
|
|
20380
|
+
const rpc = {};
|
|
20381
|
+
rpc.Message = function() {
|
|
20382
20382
|
function Message2(properties) {
|
|
20383
20383
|
if (properties) {
|
|
20384
20384
|
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
@@ -20540,7 +20540,7 @@ var sesame = $root.sesame = (() => {
|
|
|
20540
20540
|
};
|
|
20541
20541
|
return Message2;
|
|
20542
20542
|
}();
|
|
20543
|
-
|
|
20543
|
+
rpc.Request = function() {
|
|
20544
20544
|
function Request2(properties) {
|
|
20545
20545
|
if (properties) {
|
|
20546
20546
|
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
@@ -20677,7 +20677,7 @@ var sesame = $root.sesame = (() => {
|
|
|
20677
20677
|
};
|
|
20678
20678
|
return Request2;
|
|
20679
20679
|
}();
|
|
20680
|
-
|
|
20680
|
+
rpc.Response = function() {
|
|
20681
20681
|
function Response2(properties) {
|
|
20682
20682
|
if (properties) {
|
|
20683
20683
|
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
@@ -20833,7 +20833,7 @@ var sesame = $root.sesame = (() => {
|
|
|
20833
20833
|
};
|
|
20834
20834
|
return Response2;
|
|
20835
20835
|
}();
|
|
20836
|
-
|
|
20836
|
+
rpc.Event = function() {
|
|
20837
20837
|
function Event2(properties) {
|
|
20838
20838
|
if (properties) {
|
|
20839
20839
|
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
@@ -20994,7 +20994,7 @@ var sesame = $root.sesame = (() => {
|
|
|
20994
20994
|
};
|
|
20995
20995
|
return Event2;
|
|
20996
20996
|
}();
|
|
20997
|
-
|
|
20997
|
+
rpc.SesameAPIService = function() {
|
|
20998
20998
|
function SesameAPIService(rpcImpl, requestDelimited, responseDelimited) {
|
|
20999
20999
|
$protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited);
|
|
21000
21000
|
}
|
|
@@ -21052,7 +21052,603 @@ var sesame = $root.sesame = (() => {
|
|
|
21052
21052
|
}, "name", { value: "RequestIODeviceList" });
|
|
21053
21053
|
return SesameAPIService;
|
|
21054
21054
|
}();
|
|
21055
|
-
return
|
|
21055
|
+
return rpc;
|
|
21056
|
+
}();
|
|
21057
|
+
v1.wire = function() {
|
|
21058
|
+
const wire = {};
|
|
21059
|
+
wire.FrameType = function() {
|
|
21060
|
+
const valuesById = {}, values = Object.create(valuesById);
|
|
21061
|
+
values[valuesById[0] = "FRAME_TYPE_UNSPECIFIED"] = 0;
|
|
21062
|
+
values[valuesById[1] = "FRAME_TYPE_RPC"] = 1;
|
|
21063
|
+
values[valuesById[2] = "FRAME_TYPE_VIDEO"] = 2;
|
|
21064
|
+
values[valuesById[3] = "FRAME_TYPE_AUDIO"] = 3;
|
|
21065
|
+
values[valuesById[4] = "FRAME_TYPE_MUXED"] = 4;
|
|
21066
|
+
values[valuesById[5] = "FRAME_TYPE_DECODER_DATA"] = 5;
|
|
21067
|
+
return values;
|
|
21068
|
+
}();
|
|
21069
|
+
wire.CodecType = function() {
|
|
21070
|
+
const valuesById = {}, values = Object.create(valuesById);
|
|
21071
|
+
values[valuesById[0] = "CODEC_TYPE_UNSPECIFIED"] = 0;
|
|
21072
|
+
values[valuesById[1] = "CODEC_TYPE_VIDEO_VP8"] = 1;
|
|
21073
|
+
values[valuesById[2] = "CODEC_TYPE_VIDEO_VP9"] = 2;
|
|
21074
|
+
values[valuesById[3] = "CODEC_TYPE_VIDEO_AVC"] = 3;
|
|
21075
|
+
values[valuesById[4] = "CODEC_TYPE_VIDEO_HEVC"] = 4;
|
|
21076
|
+
values[valuesById[5] = "CODEC_TYPE_VIDEO_AV1"] = 5;
|
|
21077
|
+
values[valuesById[64] = "CODEC_TYPE_AUDIO_OPUS"] = 64;
|
|
21078
|
+
values[valuesById[65] = "CODEC_TYPE_AUDIO_AAC"] = 65;
|
|
21079
|
+
values[valuesById[66] = "CODEC_TYPE_AUDIO_PCM"] = 66;
|
|
21080
|
+
return values;
|
|
21081
|
+
}();
|
|
21082
|
+
wire.MediaCodecData = function() {
|
|
21083
|
+
function MediaCodecData2(properties) {
|
|
21084
|
+
if (properties) {
|
|
21085
|
+
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
21086
|
+
if (properties[keys[i]] != null)
|
|
21087
|
+
this[keys[i]] = properties[keys[i]];
|
|
21088
|
+
}
|
|
21089
|
+
}
|
|
21090
|
+
MediaCodecData2.prototype.codecType = 0;
|
|
21091
|
+
MediaCodecData2.prototype.sampleRate = 0;
|
|
21092
|
+
MediaCodecData2.prototype.timebaseNum = 0;
|
|
21093
|
+
MediaCodecData2.prototype.timebaseDen = 0;
|
|
21094
|
+
MediaCodecData2.prototype.codecProfile = 0;
|
|
21095
|
+
MediaCodecData2.prototype.codecLevel = 0;
|
|
21096
|
+
MediaCodecData2.prototype.width = 0;
|
|
21097
|
+
MediaCodecData2.prototype.height = 0;
|
|
21098
|
+
MediaCodecData2.prototype.channels = 0;
|
|
21099
|
+
MediaCodecData2.prototype.bitDepth = 0;
|
|
21100
|
+
MediaCodecData2.create = function create(properties) {
|
|
21101
|
+
return new MediaCodecData2(properties);
|
|
21102
|
+
};
|
|
21103
|
+
MediaCodecData2.encode = function encode(message, writer) {
|
|
21104
|
+
if (!writer)
|
|
21105
|
+
writer = $Writer.create();
|
|
21106
|
+
if (message.codecType != null && Object.hasOwnProperty.call(message, "codecType"))
|
|
21107
|
+
writer.uint32(
|
|
21108
|
+
/* id 1, wireType 0 =*/
|
|
21109
|
+
8
|
|
21110
|
+
).int32(message.codecType);
|
|
21111
|
+
if (message.sampleRate != null && Object.hasOwnProperty.call(message, "sampleRate"))
|
|
21112
|
+
writer.uint32(
|
|
21113
|
+
/* id 2, wireType 0 =*/
|
|
21114
|
+
16
|
|
21115
|
+
).uint32(message.sampleRate);
|
|
21116
|
+
if (message.timebaseNum != null && Object.hasOwnProperty.call(message, "timebaseNum"))
|
|
21117
|
+
writer.uint32(
|
|
21118
|
+
/* id 3, wireType 0 =*/
|
|
21119
|
+
24
|
|
21120
|
+
).uint32(message.timebaseNum);
|
|
21121
|
+
if (message.timebaseDen != null && Object.hasOwnProperty.call(message, "timebaseDen"))
|
|
21122
|
+
writer.uint32(
|
|
21123
|
+
/* id 4, wireType 0 =*/
|
|
21124
|
+
32
|
|
21125
|
+
).uint32(message.timebaseDen);
|
|
21126
|
+
if (message.codecProfile != null && Object.hasOwnProperty.call(message, "codecProfile"))
|
|
21127
|
+
writer.uint32(
|
|
21128
|
+
/* id 5, wireType 0 =*/
|
|
21129
|
+
40
|
|
21130
|
+
).uint32(message.codecProfile);
|
|
21131
|
+
if (message.codecLevel != null && Object.hasOwnProperty.call(message, "codecLevel"))
|
|
21132
|
+
writer.uint32(
|
|
21133
|
+
/* id 6, wireType 0 =*/
|
|
21134
|
+
48
|
|
21135
|
+
).uint32(message.codecLevel);
|
|
21136
|
+
if (message.width != null && Object.hasOwnProperty.call(message, "width"))
|
|
21137
|
+
writer.uint32(
|
|
21138
|
+
/* id 7, wireType 0 =*/
|
|
21139
|
+
56
|
|
21140
|
+
).uint32(message.width);
|
|
21141
|
+
if (message.height != null && Object.hasOwnProperty.call(message, "height"))
|
|
21142
|
+
writer.uint32(
|
|
21143
|
+
/* id 8, wireType 0 =*/
|
|
21144
|
+
64
|
|
21145
|
+
).uint32(message.height);
|
|
21146
|
+
if (message.channels != null && Object.hasOwnProperty.call(message, "channels"))
|
|
21147
|
+
writer.uint32(
|
|
21148
|
+
/* id 9, wireType 0 =*/
|
|
21149
|
+
72
|
|
21150
|
+
).uint32(message.channels);
|
|
21151
|
+
if (message.bitDepth != null && Object.hasOwnProperty.call(message, "bitDepth"))
|
|
21152
|
+
writer.uint32(
|
|
21153
|
+
/* id 10, wireType 0 =*/
|
|
21154
|
+
80
|
|
21155
|
+
).uint32(message.bitDepth);
|
|
21156
|
+
return writer;
|
|
21157
|
+
};
|
|
21158
|
+
MediaCodecData2.encodeDelimited = function encodeDelimited(message, writer) {
|
|
21159
|
+
return this.encode(message, writer).ldelim();
|
|
21160
|
+
};
|
|
21161
|
+
MediaCodecData2.decode = function decode(reader, length, error) {
|
|
21162
|
+
if (!(reader instanceof $Reader))
|
|
21163
|
+
reader = $Reader.create(reader);
|
|
21164
|
+
let end = length === void 0 ? reader.len : reader.pos + length, message = new $root.sesame.v1.wire.MediaCodecData();
|
|
21165
|
+
while (reader.pos < end) {
|
|
21166
|
+
let tag = reader.uint32();
|
|
21167
|
+
if (tag === error)
|
|
21168
|
+
break;
|
|
21169
|
+
switch (tag >>> 3) {
|
|
21170
|
+
case 1: {
|
|
21171
|
+
message.codecType = reader.int32();
|
|
21172
|
+
break;
|
|
21173
|
+
}
|
|
21174
|
+
case 2: {
|
|
21175
|
+
message.sampleRate = reader.uint32();
|
|
21176
|
+
break;
|
|
21177
|
+
}
|
|
21178
|
+
case 3: {
|
|
21179
|
+
message.timebaseNum = reader.uint32();
|
|
21180
|
+
break;
|
|
21181
|
+
}
|
|
21182
|
+
case 4: {
|
|
21183
|
+
message.timebaseDen = reader.uint32();
|
|
21184
|
+
break;
|
|
21185
|
+
}
|
|
21186
|
+
case 5: {
|
|
21187
|
+
message.codecProfile = reader.uint32();
|
|
21188
|
+
break;
|
|
21189
|
+
}
|
|
21190
|
+
case 6: {
|
|
21191
|
+
message.codecLevel = reader.uint32();
|
|
21192
|
+
break;
|
|
21193
|
+
}
|
|
21194
|
+
case 7: {
|
|
21195
|
+
message.width = reader.uint32();
|
|
21196
|
+
break;
|
|
21197
|
+
}
|
|
21198
|
+
case 8: {
|
|
21199
|
+
message.height = reader.uint32();
|
|
21200
|
+
break;
|
|
21201
|
+
}
|
|
21202
|
+
case 9: {
|
|
21203
|
+
message.channels = reader.uint32();
|
|
21204
|
+
break;
|
|
21205
|
+
}
|
|
21206
|
+
case 10: {
|
|
21207
|
+
message.bitDepth = reader.uint32();
|
|
21208
|
+
break;
|
|
21209
|
+
}
|
|
21210
|
+
default:
|
|
21211
|
+
reader.skipType(tag & 7);
|
|
21212
|
+
break;
|
|
21213
|
+
}
|
|
21214
|
+
}
|
|
21215
|
+
return message;
|
|
21216
|
+
};
|
|
21217
|
+
MediaCodecData2.decodeDelimited = function decodeDelimited(reader) {
|
|
21218
|
+
if (!(reader instanceof $Reader))
|
|
21219
|
+
reader = new $Reader(reader);
|
|
21220
|
+
return this.decode(reader, reader.uint32());
|
|
21221
|
+
};
|
|
21222
|
+
MediaCodecData2.verify = function verify(message) {
|
|
21223
|
+
if (typeof message !== "object" || message === null)
|
|
21224
|
+
return "object expected";
|
|
21225
|
+
if (message.codecType != null && message.hasOwnProperty("codecType"))
|
|
21226
|
+
switch (message.codecType) {
|
|
21227
|
+
default:
|
|
21228
|
+
return "codecType: enum value expected";
|
|
21229
|
+
case 0:
|
|
21230
|
+
case 1:
|
|
21231
|
+
case 2:
|
|
21232
|
+
case 3:
|
|
21233
|
+
case 4:
|
|
21234
|
+
case 5:
|
|
21235
|
+
case 64:
|
|
21236
|
+
case 65:
|
|
21237
|
+
case 66:
|
|
21238
|
+
break;
|
|
21239
|
+
}
|
|
21240
|
+
if (message.sampleRate != null && message.hasOwnProperty("sampleRate")) {
|
|
21241
|
+
if (!$util.isInteger(message.sampleRate))
|
|
21242
|
+
return "sampleRate: integer expected";
|
|
21243
|
+
}
|
|
21244
|
+
if (message.timebaseNum != null && message.hasOwnProperty("timebaseNum")) {
|
|
21245
|
+
if (!$util.isInteger(message.timebaseNum))
|
|
21246
|
+
return "timebaseNum: integer expected";
|
|
21247
|
+
}
|
|
21248
|
+
if (message.timebaseDen != null && message.hasOwnProperty("timebaseDen")) {
|
|
21249
|
+
if (!$util.isInteger(message.timebaseDen))
|
|
21250
|
+
return "timebaseDen: integer expected";
|
|
21251
|
+
}
|
|
21252
|
+
if (message.codecProfile != null && message.hasOwnProperty("codecProfile")) {
|
|
21253
|
+
if (!$util.isInteger(message.codecProfile))
|
|
21254
|
+
return "codecProfile: integer expected";
|
|
21255
|
+
}
|
|
21256
|
+
if (message.codecLevel != null && message.hasOwnProperty("codecLevel")) {
|
|
21257
|
+
if (!$util.isInteger(message.codecLevel))
|
|
21258
|
+
return "codecLevel: integer expected";
|
|
21259
|
+
}
|
|
21260
|
+
if (message.width != null && message.hasOwnProperty("width")) {
|
|
21261
|
+
if (!$util.isInteger(message.width))
|
|
21262
|
+
return "width: integer expected";
|
|
21263
|
+
}
|
|
21264
|
+
if (message.height != null && message.hasOwnProperty("height")) {
|
|
21265
|
+
if (!$util.isInteger(message.height))
|
|
21266
|
+
return "height: integer expected";
|
|
21267
|
+
}
|
|
21268
|
+
if (message.channels != null && message.hasOwnProperty("channels")) {
|
|
21269
|
+
if (!$util.isInteger(message.channels))
|
|
21270
|
+
return "channels: integer expected";
|
|
21271
|
+
}
|
|
21272
|
+
if (message.bitDepth != null && message.hasOwnProperty("bitDepth")) {
|
|
21273
|
+
if (!$util.isInteger(message.bitDepth))
|
|
21274
|
+
return "bitDepth: integer expected";
|
|
21275
|
+
}
|
|
21276
|
+
return null;
|
|
21277
|
+
};
|
|
21278
|
+
MediaCodecData2.fromObject = function fromObject(object) {
|
|
21279
|
+
if (object instanceof $root.sesame.v1.wire.MediaCodecData)
|
|
21280
|
+
return object;
|
|
21281
|
+
let message = new $root.sesame.v1.wire.MediaCodecData();
|
|
21282
|
+
switch (object.codecType) {
|
|
21283
|
+
default:
|
|
21284
|
+
if (typeof object.codecType === "number") {
|
|
21285
|
+
message.codecType = object.codecType;
|
|
21286
|
+
break;
|
|
21287
|
+
}
|
|
21288
|
+
break;
|
|
21289
|
+
case "CODEC_TYPE_UNSPECIFIED":
|
|
21290
|
+
case 0:
|
|
21291
|
+
message.codecType = 0;
|
|
21292
|
+
break;
|
|
21293
|
+
case "CODEC_TYPE_VIDEO_VP8":
|
|
21294
|
+
case 1:
|
|
21295
|
+
message.codecType = 1;
|
|
21296
|
+
break;
|
|
21297
|
+
case "CODEC_TYPE_VIDEO_VP9":
|
|
21298
|
+
case 2:
|
|
21299
|
+
message.codecType = 2;
|
|
21300
|
+
break;
|
|
21301
|
+
case "CODEC_TYPE_VIDEO_AVC":
|
|
21302
|
+
case 3:
|
|
21303
|
+
message.codecType = 3;
|
|
21304
|
+
break;
|
|
21305
|
+
case "CODEC_TYPE_VIDEO_HEVC":
|
|
21306
|
+
case 4:
|
|
21307
|
+
message.codecType = 4;
|
|
21308
|
+
break;
|
|
21309
|
+
case "CODEC_TYPE_VIDEO_AV1":
|
|
21310
|
+
case 5:
|
|
21311
|
+
message.codecType = 5;
|
|
21312
|
+
break;
|
|
21313
|
+
case "CODEC_TYPE_AUDIO_OPUS":
|
|
21314
|
+
case 64:
|
|
21315
|
+
message.codecType = 64;
|
|
21316
|
+
break;
|
|
21317
|
+
case "CODEC_TYPE_AUDIO_AAC":
|
|
21318
|
+
case 65:
|
|
21319
|
+
message.codecType = 65;
|
|
21320
|
+
break;
|
|
21321
|
+
case "CODEC_TYPE_AUDIO_PCM":
|
|
21322
|
+
case 66:
|
|
21323
|
+
message.codecType = 66;
|
|
21324
|
+
break;
|
|
21325
|
+
}
|
|
21326
|
+
if (object.sampleRate != null)
|
|
21327
|
+
message.sampleRate = object.sampleRate >>> 0;
|
|
21328
|
+
if (object.timebaseNum != null)
|
|
21329
|
+
message.timebaseNum = object.timebaseNum >>> 0;
|
|
21330
|
+
if (object.timebaseDen != null)
|
|
21331
|
+
message.timebaseDen = object.timebaseDen >>> 0;
|
|
21332
|
+
if (object.codecProfile != null)
|
|
21333
|
+
message.codecProfile = object.codecProfile >>> 0;
|
|
21334
|
+
if (object.codecLevel != null)
|
|
21335
|
+
message.codecLevel = object.codecLevel >>> 0;
|
|
21336
|
+
if (object.width != null)
|
|
21337
|
+
message.width = object.width >>> 0;
|
|
21338
|
+
if (object.height != null)
|
|
21339
|
+
message.height = object.height >>> 0;
|
|
21340
|
+
if (object.channels != null)
|
|
21341
|
+
message.channels = object.channels >>> 0;
|
|
21342
|
+
if (object.bitDepth != null)
|
|
21343
|
+
message.bitDepth = object.bitDepth >>> 0;
|
|
21344
|
+
return message;
|
|
21345
|
+
};
|
|
21346
|
+
MediaCodecData2.toObject = function toObject(message, options) {
|
|
21347
|
+
if (!options)
|
|
21348
|
+
options = {};
|
|
21349
|
+
let object = {};
|
|
21350
|
+
if (options.defaults) {
|
|
21351
|
+
object.codecType = options.enums === String ? "CODEC_TYPE_UNSPECIFIED" : 0;
|
|
21352
|
+
object.sampleRate = 0;
|
|
21353
|
+
object.timebaseNum = 0;
|
|
21354
|
+
object.timebaseDen = 0;
|
|
21355
|
+
object.codecProfile = 0;
|
|
21356
|
+
object.codecLevel = 0;
|
|
21357
|
+
object.width = 0;
|
|
21358
|
+
object.height = 0;
|
|
21359
|
+
object.channels = 0;
|
|
21360
|
+
object.bitDepth = 0;
|
|
21361
|
+
}
|
|
21362
|
+
if (message.codecType != null && message.hasOwnProperty("codecType"))
|
|
21363
|
+
object.codecType = options.enums === String ? $root.sesame.v1.wire.CodecType[message.codecType] === void 0 ? message.codecType : $root.sesame.v1.wire.CodecType[message.codecType] : message.codecType;
|
|
21364
|
+
if (message.sampleRate != null && message.hasOwnProperty("sampleRate"))
|
|
21365
|
+
object.sampleRate = message.sampleRate;
|
|
21366
|
+
if (message.timebaseNum != null && message.hasOwnProperty("timebaseNum"))
|
|
21367
|
+
object.timebaseNum = message.timebaseNum;
|
|
21368
|
+
if (message.timebaseDen != null && message.hasOwnProperty("timebaseDen"))
|
|
21369
|
+
object.timebaseDen = message.timebaseDen;
|
|
21370
|
+
if (message.codecProfile != null && message.hasOwnProperty("codecProfile"))
|
|
21371
|
+
object.codecProfile = message.codecProfile;
|
|
21372
|
+
if (message.codecLevel != null && message.hasOwnProperty("codecLevel"))
|
|
21373
|
+
object.codecLevel = message.codecLevel;
|
|
21374
|
+
if (message.width != null && message.hasOwnProperty("width"))
|
|
21375
|
+
object.width = message.width;
|
|
21376
|
+
if (message.height != null && message.hasOwnProperty("height"))
|
|
21377
|
+
object.height = message.height;
|
|
21378
|
+
if (message.channels != null && message.hasOwnProperty("channels"))
|
|
21379
|
+
object.channels = message.channels;
|
|
21380
|
+
if (message.bitDepth != null && message.hasOwnProperty("bitDepth"))
|
|
21381
|
+
object.bitDepth = message.bitDepth;
|
|
21382
|
+
return object;
|
|
21383
|
+
};
|
|
21384
|
+
MediaCodecData2.prototype.toJSON = function toJSON() {
|
|
21385
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
21386
|
+
};
|
|
21387
|
+
MediaCodecData2.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
21388
|
+
if (typeUrlPrefix === void 0) {
|
|
21389
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
21390
|
+
}
|
|
21391
|
+
return typeUrlPrefix + "/sesame.v1.wire.MediaCodecData";
|
|
21392
|
+
};
|
|
21393
|
+
return MediaCodecData2;
|
|
21394
|
+
}();
|
|
21395
|
+
wire.FrameHeader = function() {
|
|
21396
|
+
function FrameHeader2(properties) {
|
|
21397
|
+
if (properties) {
|
|
21398
|
+
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
21399
|
+
if (properties[keys[i]] != null)
|
|
21400
|
+
this[keys[i]] = properties[keys[i]];
|
|
21401
|
+
}
|
|
21402
|
+
}
|
|
21403
|
+
FrameHeader2.prototype.type = 0;
|
|
21404
|
+
FrameHeader2.prototype.pts = $util.Long ? $util.Long.fromBits(0, 0, true) : 0;
|
|
21405
|
+
FrameHeader2.prototype.id = $util.Long ? $util.Long.fromBits(0, 0, true) : 0;
|
|
21406
|
+
FrameHeader2.prototype.keyframe = false;
|
|
21407
|
+
FrameHeader2.prototype.codecData = null;
|
|
21408
|
+
FrameHeader2.prototype.routingMetadata = "";
|
|
21409
|
+
FrameHeader2.create = function create(properties) {
|
|
21410
|
+
return new FrameHeader2(properties);
|
|
21411
|
+
};
|
|
21412
|
+
FrameHeader2.encode = function encode(message, writer) {
|
|
21413
|
+
if (!writer)
|
|
21414
|
+
writer = $Writer.create();
|
|
21415
|
+
if (message.type != null && Object.hasOwnProperty.call(message, "type"))
|
|
21416
|
+
writer.uint32(
|
|
21417
|
+
/* id 1, wireType 0 =*/
|
|
21418
|
+
8
|
|
21419
|
+
).int32(message.type);
|
|
21420
|
+
if (message.pts != null && Object.hasOwnProperty.call(message, "pts"))
|
|
21421
|
+
writer.uint32(
|
|
21422
|
+
/* id 2, wireType 0 =*/
|
|
21423
|
+
16
|
|
21424
|
+
).uint64(message.pts);
|
|
21425
|
+
if (message.id != null && Object.hasOwnProperty.call(message, "id"))
|
|
21426
|
+
writer.uint32(
|
|
21427
|
+
/* id 3, wireType 0 =*/
|
|
21428
|
+
24
|
|
21429
|
+
).uint64(message.id);
|
|
21430
|
+
if (message.keyframe != null && Object.hasOwnProperty.call(message, "keyframe"))
|
|
21431
|
+
writer.uint32(
|
|
21432
|
+
/* id 4, wireType 0 =*/
|
|
21433
|
+
32
|
|
21434
|
+
).bool(message.keyframe);
|
|
21435
|
+
if (message.codecData != null && Object.hasOwnProperty.call(message, "codecData"))
|
|
21436
|
+
$root.sesame.v1.wire.MediaCodecData.encode(message.codecData, writer.uint32(
|
|
21437
|
+
/* id 5, wireType 2 =*/
|
|
21438
|
+
42
|
|
21439
|
+
).fork()).ldelim();
|
|
21440
|
+
if (message.routingMetadata != null && Object.hasOwnProperty.call(message, "routingMetadata"))
|
|
21441
|
+
writer.uint32(
|
|
21442
|
+
/* id 6, wireType 2 =*/
|
|
21443
|
+
50
|
|
21444
|
+
).string(message.routingMetadata);
|
|
21445
|
+
return writer;
|
|
21446
|
+
};
|
|
21447
|
+
FrameHeader2.encodeDelimited = function encodeDelimited(message, writer) {
|
|
21448
|
+
return this.encode(message, writer).ldelim();
|
|
21449
|
+
};
|
|
21450
|
+
FrameHeader2.decode = function decode(reader, length, error) {
|
|
21451
|
+
if (!(reader instanceof $Reader))
|
|
21452
|
+
reader = $Reader.create(reader);
|
|
21453
|
+
let end = length === void 0 ? reader.len : reader.pos + length, message = new $root.sesame.v1.wire.FrameHeader();
|
|
21454
|
+
while (reader.pos < end) {
|
|
21455
|
+
let tag = reader.uint32();
|
|
21456
|
+
if (tag === error)
|
|
21457
|
+
break;
|
|
21458
|
+
switch (tag >>> 3) {
|
|
21459
|
+
case 1: {
|
|
21460
|
+
message.type = reader.int32();
|
|
21461
|
+
break;
|
|
21462
|
+
}
|
|
21463
|
+
case 2: {
|
|
21464
|
+
message.pts = reader.uint64();
|
|
21465
|
+
break;
|
|
21466
|
+
}
|
|
21467
|
+
case 3: {
|
|
21468
|
+
message.id = reader.uint64();
|
|
21469
|
+
break;
|
|
21470
|
+
}
|
|
21471
|
+
case 4: {
|
|
21472
|
+
message.keyframe = reader.bool();
|
|
21473
|
+
break;
|
|
21474
|
+
}
|
|
21475
|
+
case 5: {
|
|
21476
|
+
message.codecData = $root.sesame.v1.wire.MediaCodecData.decode(reader, reader.uint32());
|
|
21477
|
+
break;
|
|
21478
|
+
}
|
|
21479
|
+
case 6: {
|
|
21480
|
+
message.routingMetadata = reader.string();
|
|
21481
|
+
break;
|
|
21482
|
+
}
|
|
21483
|
+
default:
|
|
21484
|
+
reader.skipType(tag & 7);
|
|
21485
|
+
break;
|
|
21486
|
+
}
|
|
21487
|
+
}
|
|
21488
|
+
return message;
|
|
21489
|
+
};
|
|
21490
|
+
FrameHeader2.decodeDelimited = function decodeDelimited(reader) {
|
|
21491
|
+
if (!(reader instanceof $Reader))
|
|
21492
|
+
reader = new $Reader(reader);
|
|
21493
|
+
return this.decode(reader, reader.uint32());
|
|
21494
|
+
};
|
|
21495
|
+
FrameHeader2.verify = function verify(message) {
|
|
21496
|
+
if (typeof message !== "object" || message === null)
|
|
21497
|
+
return "object expected";
|
|
21498
|
+
if (message.type != null && message.hasOwnProperty("type"))
|
|
21499
|
+
switch (message.type) {
|
|
21500
|
+
default:
|
|
21501
|
+
return "type: enum value expected";
|
|
21502
|
+
case 0:
|
|
21503
|
+
case 1:
|
|
21504
|
+
case 2:
|
|
21505
|
+
case 3:
|
|
21506
|
+
case 4:
|
|
21507
|
+
case 5:
|
|
21508
|
+
break;
|
|
21509
|
+
}
|
|
21510
|
+
if (message.pts != null && message.hasOwnProperty("pts")) {
|
|
21511
|
+
if (!$util.isInteger(message.pts) && !(message.pts && $util.isInteger(message.pts.low) && $util.isInteger(message.pts.high)))
|
|
21512
|
+
return "pts: integer|Long expected";
|
|
21513
|
+
}
|
|
21514
|
+
if (message.id != null && message.hasOwnProperty("id")) {
|
|
21515
|
+
if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high)))
|
|
21516
|
+
return "id: integer|Long expected";
|
|
21517
|
+
}
|
|
21518
|
+
if (message.keyframe != null && message.hasOwnProperty("keyframe")) {
|
|
21519
|
+
if (typeof message.keyframe !== "boolean")
|
|
21520
|
+
return "keyframe: boolean expected";
|
|
21521
|
+
}
|
|
21522
|
+
if (message.codecData != null && message.hasOwnProperty("codecData")) {
|
|
21523
|
+
let error = $root.sesame.v1.wire.MediaCodecData.verify(message.codecData);
|
|
21524
|
+
if (error)
|
|
21525
|
+
return "codecData." + error;
|
|
21526
|
+
}
|
|
21527
|
+
if (message.routingMetadata != null && message.hasOwnProperty("routingMetadata")) {
|
|
21528
|
+
if (!$util.isString(message.routingMetadata))
|
|
21529
|
+
return "routingMetadata: string expected";
|
|
21530
|
+
}
|
|
21531
|
+
return null;
|
|
21532
|
+
};
|
|
21533
|
+
FrameHeader2.fromObject = function fromObject(object) {
|
|
21534
|
+
if (object instanceof $root.sesame.v1.wire.FrameHeader)
|
|
21535
|
+
return object;
|
|
21536
|
+
let message = new $root.sesame.v1.wire.FrameHeader();
|
|
21537
|
+
switch (object.type) {
|
|
21538
|
+
default:
|
|
21539
|
+
if (typeof object.type === "number") {
|
|
21540
|
+
message.type = object.type;
|
|
21541
|
+
break;
|
|
21542
|
+
}
|
|
21543
|
+
break;
|
|
21544
|
+
case "FRAME_TYPE_UNSPECIFIED":
|
|
21545
|
+
case 0:
|
|
21546
|
+
message.type = 0;
|
|
21547
|
+
break;
|
|
21548
|
+
case "FRAME_TYPE_RPC":
|
|
21549
|
+
case 1:
|
|
21550
|
+
message.type = 1;
|
|
21551
|
+
break;
|
|
21552
|
+
case "FRAME_TYPE_VIDEO":
|
|
21553
|
+
case 2:
|
|
21554
|
+
message.type = 2;
|
|
21555
|
+
break;
|
|
21556
|
+
case "FRAME_TYPE_AUDIO":
|
|
21557
|
+
case 3:
|
|
21558
|
+
message.type = 3;
|
|
21559
|
+
break;
|
|
21560
|
+
case "FRAME_TYPE_MUXED":
|
|
21561
|
+
case 4:
|
|
21562
|
+
message.type = 4;
|
|
21563
|
+
break;
|
|
21564
|
+
case "FRAME_TYPE_DECODER_DATA":
|
|
21565
|
+
case 5:
|
|
21566
|
+
message.type = 5;
|
|
21567
|
+
break;
|
|
21568
|
+
}
|
|
21569
|
+
if (object.pts != null) {
|
|
21570
|
+
if ($util.Long)
|
|
21571
|
+
(message.pts = $util.Long.fromValue(object.pts)).unsigned = true;
|
|
21572
|
+
else if (typeof object.pts === "string")
|
|
21573
|
+
message.pts = parseInt(object.pts, 10);
|
|
21574
|
+
else if (typeof object.pts === "number")
|
|
21575
|
+
message.pts = object.pts;
|
|
21576
|
+
else if (typeof object.pts === "object")
|
|
21577
|
+
message.pts = new $util.LongBits(object.pts.low >>> 0, object.pts.high >>> 0).toNumber(true);
|
|
21578
|
+
}
|
|
21579
|
+
if (object.id != null) {
|
|
21580
|
+
if ($util.Long)
|
|
21581
|
+
(message.id = $util.Long.fromValue(object.id)).unsigned = true;
|
|
21582
|
+
else if (typeof object.id === "string")
|
|
21583
|
+
message.id = parseInt(object.id, 10);
|
|
21584
|
+
else if (typeof object.id === "number")
|
|
21585
|
+
message.id = object.id;
|
|
21586
|
+
else if (typeof object.id === "object")
|
|
21587
|
+
message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(true);
|
|
21588
|
+
}
|
|
21589
|
+
if (object.keyframe != null)
|
|
21590
|
+
message.keyframe = Boolean(object.keyframe);
|
|
21591
|
+
if (object.codecData != null) {
|
|
21592
|
+
if (typeof object.codecData !== "object")
|
|
21593
|
+
throw TypeError(".sesame.v1.wire.FrameHeader.codecData: object expected");
|
|
21594
|
+
message.codecData = $root.sesame.v1.wire.MediaCodecData.fromObject(object.codecData);
|
|
21595
|
+
}
|
|
21596
|
+
if (object.routingMetadata != null)
|
|
21597
|
+
message.routingMetadata = String(object.routingMetadata);
|
|
21598
|
+
return message;
|
|
21599
|
+
};
|
|
21600
|
+
FrameHeader2.toObject = function toObject(message, options) {
|
|
21601
|
+
if (!options)
|
|
21602
|
+
options = {};
|
|
21603
|
+
let object = {};
|
|
21604
|
+
if (options.defaults) {
|
|
21605
|
+
object.type = options.enums === String ? "FRAME_TYPE_UNSPECIFIED" : 0;
|
|
21606
|
+
if ($util.Long) {
|
|
21607
|
+
let long = new $util.Long(0, 0, true);
|
|
21608
|
+
object.pts = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
|
21609
|
+
} else
|
|
21610
|
+
object.pts = options.longs === String ? "0" : 0;
|
|
21611
|
+
if ($util.Long) {
|
|
21612
|
+
let long = new $util.Long(0, 0, true);
|
|
21613
|
+
object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
|
21614
|
+
} else
|
|
21615
|
+
object.id = options.longs === String ? "0" : 0;
|
|
21616
|
+
object.keyframe = false;
|
|
21617
|
+
object.codecData = null;
|
|
21618
|
+
object.routingMetadata = "";
|
|
21619
|
+
}
|
|
21620
|
+
if (message.type != null && message.hasOwnProperty("type"))
|
|
21621
|
+
object.type = options.enums === String ? $root.sesame.v1.wire.FrameType[message.type] === void 0 ? message.type : $root.sesame.v1.wire.FrameType[message.type] : message.type;
|
|
21622
|
+
if (message.pts != null && message.hasOwnProperty("pts"))
|
|
21623
|
+
if (typeof message.pts === "number")
|
|
21624
|
+
object.pts = options.longs === String ? String(message.pts) : message.pts;
|
|
21625
|
+
else
|
|
21626
|
+
object.pts = options.longs === String ? $util.Long.prototype.toString.call(message.pts) : options.longs === Number ? new $util.LongBits(message.pts.low >>> 0, message.pts.high >>> 0).toNumber(true) : message.pts;
|
|
21627
|
+
if (message.id != null && message.hasOwnProperty("id"))
|
|
21628
|
+
if (typeof message.id === "number")
|
|
21629
|
+
object.id = options.longs === String ? String(message.id) : message.id;
|
|
21630
|
+
else
|
|
21631
|
+
object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber(true) : message.id;
|
|
21632
|
+
if (message.keyframe != null && message.hasOwnProperty("keyframe"))
|
|
21633
|
+
object.keyframe = message.keyframe;
|
|
21634
|
+
if (message.codecData != null && message.hasOwnProperty("codecData"))
|
|
21635
|
+
object.codecData = $root.sesame.v1.wire.MediaCodecData.toObject(message.codecData, options);
|
|
21636
|
+
if (message.routingMetadata != null && message.hasOwnProperty("routingMetadata"))
|
|
21637
|
+
object.routingMetadata = message.routingMetadata;
|
|
21638
|
+
return object;
|
|
21639
|
+
};
|
|
21640
|
+
FrameHeader2.prototype.toJSON = function toJSON() {
|
|
21641
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
21642
|
+
};
|
|
21643
|
+
FrameHeader2.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
21644
|
+
if (typeUrlPrefix === void 0) {
|
|
21645
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
21646
|
+
}
|
|
21647
|
+
return typeUrlPrefix + "/sesame.v1.wire.FrameHeader";
|
|
21648
|
+
};
|
|
21649
|
+
return FrameHeader2;
|
|
21650
|
+
}();
|
|
21651
|
+
return wire;
|
|
21056
21652
|
}();
|
|
21057
21653
|
return v1;
|
|
21058
21654
|
}();
|
|
@@ -21068,7 +21664,7 @@ var CommandList = class {
|
|
|
21068
21664
|
add(item, timeOffsetMs, transaction) {
|
|
21069
21665
|
item.timeOffsetUs = (timeOffsetMs || 0) * 1e3;
|
|
21070
21666
|
if (transaction) {
|
|
21071
|
-
item.transactionDeps =
|
|
21667
|
+
item.transactionDeps = transaction?.dependencies || [];
|
|
21072
21668
|
item.transactionId = transaction.transactionId;
|
|
21073
21669
|
}
|
|
21074
21670
|
this.cl.commandList.push(item);
|
|
@@ -21105,7 +21701,7 @@ var CommandList = class {
|
|
|
21105
21701
|
this.cl.commandList.splice(this.cl.commandList.indexOf(item.del), 1);
|
|
21106
21702
|
});
|
|
21107
21703
|
}
|
|
21108
|
-
|
|
21704
|
+
getCommandListMsg() {
|
|
21109
21705
|
return this.cl;
|
|
21110
21706
|
}
|
|
21111
21707
|
callback(event, data, timeOffsetMs) {
|
|
@@ -21113,32 +21709,32 @@ var CommandList = class {
|
|
|
21113
21709
|
item.callback = { event, data };
|
|
21114
21710
|
return this.add(item, timeOffsetMs);
|
|
21115
21711
|
}
|
|
21116
|
-
|
|
21712
|
+
compositorAdd(id, width, height, multisample, timeOffsetMs) {
|
|
21117
21713
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21118
21714
|
item.addCompositor = { id, multisample, width, height };
|
|
21119
21715
|
return this.add(item, timeOffsetMs);
|
|
21120
21716
|
}
|
|
21121
|
-
|
|
21717
|
+
compositorRemove(id, timeOffsetMs) {
|
|
21122
21718
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21123
21719
|
item.removeCompositor = { id };
|
|
21124
21720
|
return this.add(item, timeOffsetMs);
|
|
21125
21721
|
}
|
|
21126
|
-
|
|
21722
|
+
compositorClear(id, timeOffsetMs) {
|
|
21127
21723
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21128
21724
|
item.clearCompositor = { id };
|
|
21129
21725
|
return this.add(item, timeOffsetMs);
|
|
21130
21726
|
}
|
|
21131
|
-
|
|
21727
|
+
sourceAdd(id, cfg, timeOffsetMs) {
|
|
21132
21728
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21133
21729
|
item.addSource = { id, config: cfg };
|
|
21134
21730
|
return this.add(item, timeOffsetMs);
|
|
21135
21731
|
}
|
|
21136
|
-
|
|
21732
|
+
sourceRemove(id, timeOffsetMs) {
|
|
21137
21733
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21138
21734
|
item.removeSource = { id };
|
|
21139
21735
|
return this.add(item, timeOffsetMs);
|
|
21140
21736
|
}
|
|
21141
|
-
|
|
21737
|
+
nodeAdd(id, cfg, timeOffsetMs) {
|
|
21142
21738
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21143
21739
|
item.addNode = {
|
|
21144
21740
|
compositorId: cfg.compositorId,
|
|
@@ -21148,12 +21744,12 @@ var CommandList = class {
|
|
|
21148
21744
|
};
|
|
21149
21745
|
return this.add(item, timeOffsetMs);
|
|
21150
21746
|
}
|
|
21151
|
-
|
|
21747
|
+
nodeRemove(compositorId, address, timeOffsetMs) {
|
|
21152
21748
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21153
21749
|
item.removeNode = { compositorId, address };
|
|
21154
21750
|
return this.add(item, timeOffsetMs);
|
|
21155
21751
|
}
|
|
21156
|
-
|
|
21752
|
+
propertySet(propertyDomain, addr, prop, val, timeOffsetMs) {
|
|
21157
21753
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21158
21754
|
item.setProperty = {
|
|
21159
21755
|
address: addr,
|
|
@@ -21163,7 +21759,7 @@ var CommandList = class {
|
|
|
21163
21759
|
};
|
|
21164
21760
|
return this.add(item, timeOffsetMs);
|
|
21165
21761
|
}
|
|
21166
|
-
|
|
21762
|
+
playlistLoad(sourceId, playlist) {
|
|
21167
21763
|
const item = new sesame.v1.commands.CommandListItem();
|
|
21168
21764
|
const loadPlaylistCmd = {
|
|
21169
21765
|
items: playlist.clips.map((clip) => ({
|
|
@@ -21186,13 +21782,13 @@ var CommandList = class {
|
|
|
21186
21782
|
item.loadPlaylist = loadPlaylistCmd;
|
|
21187
21783
|
return this.add(item, 0);
|
|
21188
21784
|
}
|
|
21189
|
-
|
|
21785
|
+
playlistEject(sourceId) {
|
|
21190
21786
|
const item = new sesame.v1.commands.CommandListItem();
|
|
21191
21787
|
const ejectPlaylistCmd = { sourceId };
|
|
21192
21788
|
item.ejectPlaylist = ejectPlaylistCmd;
|
|
21193
21789
|
return this.add(item, 0);
|
|
21194
21790
|
}
|
|
21195
|
-
|
|
21791
|
+
transportCommand(id, msg, timeOffsetMs) {
|
|
21196
21792
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21197
21793
|
let transportCmd = { sourceId: id };
|
|
21198
21794
|
let cmd;
|
|
@@ -21265,17 +21861,17 @@ var CommandList = class {
|
|
|
21265
21861
|
item.updateSourceTransport = transportCmd;
|
|
21266
21862
|
return this.add(item, timeOffsetMs, { transactionId: msg.transactionId, dependencies: [] });
|
|
21267
21863
|
}
|
|
21268
|
-
|
|
21864
|
+
sourceUpdate(id, cfg, timeOffsetMs) {
|
|
21269
21865
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21270
21866
|
item.updateSource = { id, config: cfg };
|
|
21271
21867
|
return this.add(item, timeOffsetMs);
|
|
21272
21868
|
}
|
|
21273
|
-
|
|
21869
|
+
sourceUpdateMetadata(id, metadata, timeOffsetMs) {
|
|
21274
21870
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21275
21871
|
item.setSourceMetadata = { sourceId: id, metadata };
|
|
21276
21872
|
return this.add(item, timeOffsetMs);
|
|
21277
21873
|
}
|
|
21278
|
-
|
|
21874
|
+
sourceUpdateTransport(id, cfg, timeOffsetMs) {
|
|
21279
21875
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21280
21876
|
item.updateSourceTransport = {
|
|
21281
21877
|
sourceId: id,
|
|
@@ -21284,47 +21880,47 @@ var CommandList = class {
|
|
|
21284
21880
|
};
|
|
21285
21881
|
return this.add(item, timeOffsetMs);
|
|
21286
21882
|
}
|
|
21287
|
-
|
|
21883
|
+
outputAdd(id, cfg, timeOffsetMs) {
|
|
21288
21884
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21289
21885
|
item.addOutput = { id, ...cfg };
|
|
21290
21886
|
return this.add(item, timeOffsetMs);
|
|
21291
21887
|
}
|
|
21292
|
-
|
|
21888
|
+
outputUpdate(id, cfg, timeOffsetMs) {
|
|
21293
21889
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21294
21890
|
item.updateOutput = { id, ...cfg };
|
|
21295
21891
|
return this.add(item, timeOffsetMs);
|
|
21296
21892
|
}
|
|
21297
|
-
|
|
21893
|
+
outputRemove(id, timeOffsetMs) {
|
|
21298
21894
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21299
21895
|
item.removeOutput = { id };
|
|
21300
21896
|
return this.add(item, timeOffsetMs);
|
|
21301
21897
|
}
|
|
21302
|
-
|
|
21898
|
+
audioMixerAdd(id, cfg, timeOffsetMs) {
|
|
21303
21899
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21304
21900
|
item.addAudioMixer = { id, config: cfg };
|
|
21305
21901
|
return this.add(item, timeOffsetMs);
|
|
21306
21902
|
}
|
|
21307
|
-
|
|
21903
|
+
audioMixerUpdate(id, cfg, timeOffsetMs) {
|
|
21308
21904
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21309
21905
|
item.updateAudioMixer = { id, config: cfg };
|
|
21310
21906
|
return this.add(item, timeOffsetMs);
|
|
21311
21907
|
}
|
|
21312
|
-
|
|
21908
|
+
audioMixerChannelAdd(mixerId, cfg, timeOffsetMs) {
|
|
21313
21909
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21314
21910
|
item.addAudioChannel = { mixerId, channelConfig: cfg };
|
|
21315
21911
|
return this.add(item, timeOffsetMs);
|
|
21316
21912
|
}
|
|
21317
|
-
|
|
21913
|
+
audioMixerRemove(mixerId, timeOffsetMs) {
|
|
21318
21914
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21319
21915
|
item.removeAudioMixer = { id: mixerId };
|
|
21320
21916
|
return this.add(item, timeOffsetMs);
|
|
21321
21917
|
}
|
|
21322
|
-
|
|
21918
|
+
audioMixerChannelRemove(mixerId, channelId, timeOffsetMs) {
|
|
21323
21919
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21324
21920
|
item.removeAudioChannel = { mixerId, channelId };
|
|
21325
21921
|
return this.add(item, timeOffsetMs);
|
|
21326
21922
|
}
|
|
21327
|
-
|
|
21923
|
+
propertyAnimate(propertyDomain, addr, prop, before, after, keyframes, timeOffsetMs) {
|
|
21328
21924
|
let item = new sesame.v1.commands.CommandListItem();
|
|
21329
21925
|
item.animateProperty = {
|
|
21330
21926
|
address: addr,
|
|
@@ -21340,7 +21936,6 @@ var CommandList = class {
|
|
|
21340
21936
|
|
|
21341
21937
|
// src/rpc-client.ts
|
|
21342
21938
|
import { EventEmitter } from "events";
|
|
21343
|
-
import * as WebSocket from "ws";
|
|
21344
21939
|
|
|
21345
21940
|
// src/logger.ts
|
|
21346
21941
|
var ConsoleLogger = class {
|
|
@@ -21494,7 +22089,8 @@ var RPCClient = class extends EventEmitter {
|
|
|
21494
22089
|
eventHandler(event) {
|
|
21495
22090
|
const topic = event.topic ?? 0;
|
|
21496
22091
|
if (topic === sesame.v1.common.EventTopic.EVENT_TOPIC_UNSPECIFIED) {
|
|
21497
|
-
|
|
22092
|
+
log.warn(`Ignoring event with unspecified topic: ${event.topic}`);
|
|
22093
|
+
return;
|
|
21498
22094
|
}
|
|
21499
22095
|
const type = this.eventTypes[topic];
|
|
21500
22096
|
let payload;
|
|
@@ -21519,257 +22115,59 @@ var RPCClient = class extends EventEmitter {
|
|
|
21519
22115
|
|
|
21520
22116
|
// src/sesame-connection.ts
|
|
21521
22117
|
import { EventEmitter as EventEmitter2 } from "events";
|
|
21522
|
-
import WebSocket2 from "ws";
|
|
21523
22118
|
|
|
21524
|
-
// src/sesame-
|
|
21525
|
-
var
|
|
21526
|
-
var
|
|
21527
|
-
var
|
|
21528
|
-
var
|
|
21529
|
-
var
|
|
21530
|
-
var
|
|
21531
|
-
var FLAG_HAS_METADATA = 1 << 1;
|
|
21532
|
-
var FLAG_IS_KEYFRAME = 1 << 2;
|
|
21533
|
-
var PacketType = /* @__PURE__ */ ((PacketType2) => {
|
|
21534
|
-
PacketType2[PacketType2["VIDEO_FRAME"] = 1] = "VIDEO_FRAME";
|
|
21535
|
-
PacketType2[PacketType2["AUDIO_FRAME"] = 2] = "AUDIO_FRAME";
|
|
21536
|
-
PacketType2[PacketType2["RPC"] = 3] = "RPC";
|
|
21537
|
-
PacketType2[PacketType2["MUXED_DATA"] = 4] = "MUXED_DATA";
|
|
21538
|
-
PacketType2[PacketType2["DECODER_DATA"] = 5] = "DECODER_DATA";
|
|
21539
|
-
return PacketType2;
|
|
21540
|
-
})(PacketType || {});
|
|
21541
|
-
var CodecType = /* @__PURE__ */ ((CodecType2) => {
|
|
21542
|
-
CodecType2[CodecType2["VIDEO_VP8"] = 1] = "VIDEO_VP8";
|
|
21543
|
-
CodecType2[CodecType2["VIDEO_VP9"] = 2] = "VIDEO_VP9";
|
|
21544
|
-
CodecType2[CodecType2["VIDEO_AVC"] = 3] = "VIDEO_AVC";
|
|
21545
|
-
CodecType2[CodecType2["VIDEO_HEVC"] = 4] = "VIDEO_HEVC";
|
|
21546
|
-
CodecType2[CodecType2["VIDEO_AV1"] = 5] = "VIDEO_AV1";
|
|
21547
|
-
CodecType2[CodecType2["AUDIO_OPUS"] = 64] = "AUDIO_OPUS";
|
|
21548
|
-
CodecType2[CodecType2["AUDIO_AAC"] = 65] = "AUDIO_AAC";
|
|
21549
|
-
CodecType2[CodecType2["AUDIO_PCM"] = 66] = "AUDIO_PCM";
|
|
21550
|
-
return CodecType2;
|
|
21551
|
-
})(CodecType || {});
|
|
21552
|
-
var SesameBinaryProtocol = class {
|
|
21553
|
-
/**
|
|
21554
|
-
* Initialize a header data structure with proper defaults
|
|
21555
|
-
*/
|
|
21556
|
-
static initHeader(type, flags, pts, id) {
|
|
21557
|
-
return {
|
|
21558
|
-
magic: PROTOCOL_MAGIC,
|
|
21559
|
-
version: PROTOCOL_VERSION,
|
|
21560
|
-
header_size: this.calculateHeaderSize(flags),
|
|
21561
|
-
type,
|
|
21562
|
-
flags,
|
|
21563
|
-
pts,
|
|
21564
|
-
id,
|
|
21565
|
-
reserved: 0
|
|
21566
|
-
// Always zero reserved fields
|
|
21567
|
-
};
|
|
21568
|
-
}
|
|
22119
|
+
// src/sesame-wire-protocol.ts
|
|
22120
|
+
var FrameType = sesame.v1.wire.FrameType;
|
|
22121
|
+
var FrameHeader = sesame.v1.wire.FrameHeader;
|
|
22122
|
+
var MediaCodecData = sesame.v1.wire.MediaCodecData;
|
|
22123
|
+
var CodecType = sesame.v1.wire.CodecType;
|
|
22124
|
+
var PREFIX_SIZE = 4;
|
|
22125
|
+
var WireProtocol = class {
|
|
21569
22126
|
/**
|
|
21570
|
-
*
|
|
22127
|
+
* Serialize a wire frame: 4-byte LE header_size + protobuf FrameHeader + payload.
|
|
21571
22128
|
*/
|
|
21572
|
-
static
|
|
21573
|
-
|
|
21574
|
-
|
|
21575
|
-
|
|
21576
|
-
|
|
21577
|
-
|
|
21578
|
-
|
|
21579
|
-
|
|
21580
|
-
|
|
21581
|
-
|
|
21582
|
-
|
|
21583
|
-
* Validate a header structure
|
|
21584
|
-
*/
|
|
21585
|
-
static validateHeader(header, totalSize) {
|
|
21586
|
-
if (header.magic !== PROTOCOL_MAGIC) {
|
|
21587
|
-
return false;
|
|
21588
|
-
}
|
|
21589
|
-
if (header.version !== PROTOCOL_VERSION) {
|
|
21590
|
-
return false;
|
|
21591
|
-
}
|
|
21592
|
-
const expectedHeaderSize = this.calculateHeaderSize(header.flags);
|
|
21593
|
-
if (header.header_size !== expectedHeaderSize) {
|
|
21594
|
-
return false;
|
|
21595
|
-
}
|
|
21596
|
-
if (totalSize < header.header_size) {
|
|
21597
|
-
return false;
|
|
21598
|
-
}
|
|
21599
|
-
return true;
|
|
21600
|
-
}
|
|
21601
|
-
/**
|
|
21602
|
-
* Serialize data into a Uint8Array buffer
|
|
21603
|
-
*/
|
|
21604
|
-
static serialize(header, metadata = null, codecData = null, payload = null) {
|
|
21605
|
-
const includeMetadata = metadata !== null && header.flags & FLAG_HAS_METADATA;
|
|
21606
|
-
const includeCodec = codecData !== null && header.flags & FLAG_HAS_CODEC_DATA;
|
|
21607
|
-
let totalSize = HEADER_DATA_SIZE;
|
|
21608
|
-
if (includeMetadata) totalSize += HEADER_METADATA_SIZE;
|
|
21609
|
-
if (includeCodec) totalSize += HEADER_CODEC_DATA_SIZE;
|
|
21610
|
-
if (payload) totalSize += payload.length;
|
|
21611
|
-
header.header_size = totalSize - (payload ? payload.length : 0);
|
|
21612
|
-
const buffer = new ArrayBuffer(totalSize);
|
|
21613
|
-
const view = new DataView(buffer);
|
|
21614
|
-
let offset = 0;
|
|
21615
|
-
view.setUint32(offset, header.magic, true);
|
|
21616
|
-
offset += 4;
|
|
21617
|
-
view.setUint32(offset, header.flags, true);
|
|
21618
|
-
offset += 4;
|
|
21619
|
-
view.setBigUint64(offset, header.pts, true);
|
|
21620
|
-
offset += 8;
|
|
21621
|
-
view.setBigUint64(offset, header.id, true);
|
|
21622
|
-
offset += 8;
|
|
21623
|
-
view.setUint16(offset, header.version, true);
|
|
21624
|
-
offset += 2;
|
|
21625
|
-
view.setUint16(offset, header.header_size, true);
|
|
21626
|
-
offset += 2;
|
|
21627
|
-
view.setUint16(offset, header.type, true);
|
|
21628
|
-
offset += 2;
|
|
21629
|
-
view.setUint16(offset, header.reserved, true);
|
|
21630
|
-
offset += 2;
|
|
21631
|
-
if (includeMetadata && metadata) {
|
|
21632
|
-
const metadataBytes = this.stringToFixedBytes(metadata.metadata, 64);
|
|
21633
|
-
new Uint8Array(buffer, offset, 64).set(metadataBytes);
|
|
21634
|
-
offset += 64;
|
|
21635
|
-
}
|
|
21636
|
-
if (includeCodec && codecData) {
|
|
21637
|
-
view.setUint32(offset, codecData.sample_rate, true);
|
|
21638
|
-
offset += 4;
|
|
21639
|
-
view.setUint32(offset, codecData.timebase_num, true);
|
|
21640
|
-
offset += 4;
|
|
21641
|
-
view.setUint32(offset, codecData.timebase_den, true);
|
|
21642
|
-
offset += 4;
|
|
21643
|
-
view.setUint16(offset, codecData.codec_profile, true);
|
|
21644
|
-
offset += 2;
|
|
21645
|
-
view.setUint16(offset, codecData.codec_level, true);
|
|
21646
|
-
offset += 2;
|
|
21647
|
-
view.setUint16(offset, codecData.width, true);
|
|
21648
|
-
offset += 2;
|
|
21649
|
-
view.setUint16(offset, codecData.height, true);
|
|
21650
|
-
offset += 2;
|
|
21651
|
-
view.setUint8(offset, codecData.codec_type);
|
|
21652
|
-
offset += 1;
|
|
21653
|
-
view.setUint8(offset, codecData.channels);
|
|
21654
|
-
offset += 1;
|
|
21655
|
-
view.setUint8(offset, codecData.bit_depth);
|
|
21656
|
-
offset += 1;
|
|
21657
|
-
view.setUint8(offset, codecData.reserved);
|
|
21658
|
-
offset += 1;
|
|
22129
|
+
static serialize(header, payload) {
|
|
22130
|
+
const headerBytes = sesame.v1.wire.FrameHeader.encode(header).finish();
|
|
22131
|
+
const headerSize = headerBytes.length;
|
|
22132
|
+
const payloadSize = payload ? payload.length : 0;
|
|
22133
|
+
const total = PREFIX_SIZE + headerSize + payloadSize;
|
|
22134
|
+
const buffer = new Uint8Array(total);
|
|
22135
|
+
const view = new DataView(buffer.buffer);
|
|
22136
|
+
view.setUint32(0, headerSize, true);
|
|
22137
|
+
buffer.set(headerBytes, PREFIX_SIZE);
|
|
22138
|
+
if (payload && payloadSize > 0) {
|
|
22139
|
+
buffer.set(payload, PREFIX_SIZE + headerSize);
|
|
21659
22140
|
}
|
|
21660
|
-
|
|
21661
|
-
new Uint8Array(buffer, offset).set(payload);
|
|
21662
|
-
}
|
|
21663
|
-
return new Uint8Array(buffer);
|
|
22141
|
+
return buffer;
|
|
21664
22142
|
}
|
|
21665
22143
|
/**
|
|
21666
|
-
* Parse incoming
|
|
22144
|
+
* Parse an incoming wire frame.
|
|
21667
22145
|
*/
|
|
21668
|
-
static
|
|
21669
|
-
const result = {
|
|
21670
|
-
|
|
21671
|
-
|
|
21672
|
-
|
|
21673
|
-
|
|
21674
|
-
|
|
21675
|
-
|
|
21676
|
-
|
|
21677
|
-
|
|
21678
|
-
|
|
21679
|
-
}
|
|
21680
|
-
const view = new DataView(data.buffer, data.byteOffset);
|
|
21681
|
-
let offset = 0;
|
|
21682
|
-
const header = {
|
|
21683
|
-
magic: view.getUint32(offset, true),
|
|
21684
|
-
flags: view.getUint32(offset + 4, true),
|
|
21685
|
-
pts: view.getBigUint64(offset + 8, true),
|
|
21686
|
-
id: view.getBigUint64(offset + 16, true),
|
|
21687
|
-
version: view.getUint16(offset + 24, true),
|
|
21688
|
-
header_size: view.getUint16(offset + 26, true),
|
|
21689
|
-
type: view.getUint16(offset + 28, true),
|
|
21690
|
-
reserved: view.getUint16(offset + 30, true)
|
|
21691
|
-
};
|
|
21692
|
-
offset += HEADER_DATA_SIZE;
|
|
21693
|
-
if (!this.validateHeader(header, data.length)) {
|
|
21694
|
-
return result;
|
|
22146
|
+
static parse(data) {
|
|
22147
|
+
const result = { valid: false, header: null, payload: null };
|
|
22148
|
+
if (!data || data.length < PREFIX_SIZE) return result;
|
|
22149
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
22150
|
+
const headerSize = view.getUint32(0, true);
|
|
22151
|
+
if (data.length < PREFIX_SIZE + headerSize) return result;
|
|
22152
|
+
try {
|
|
22153
|
+
const headerBytes = data.subarray(PREFIX_SIZE, PREFIX_SIZE + headerSize);
|
|
22154
|
+
result.header = sesame.v1.wire.FrameHeader.decode(headerBytes);
|
|
22155
|
+
result.payload = data.subarray(PREFIX_SIZE + headerSize);
|
|
22156
|
+
result.valid = true;
|
|
22157
|
+
} catch {
|
|
21695
22158
|
}
|
|
21696
|
-
result.header = header;
|
|
21697
|
-
if (header.flags & FLAG_HAS_METADATA) {
|
|
21698
|
-
if (data.length < offset + HEADER_METADATA_SIZE) {
|
|
21699
|
-
return result;
|
|
21700
|
-
}
|
|
21701
|
-
const metadataBytes = data.slice(offset, offset + HEADER_METADATA_SIZE);
|
|
21702
|
-
const metadataStr = this.fixedBytesToString(metadataBytes);
|
|
21703
|
-
result.metadata = { metadata: metadataStr };
|
|
21704
|
-
offset += HEADER_METADATA_SIZE;
|
|
21705
|
-
}
|
|
21706
|
-
if (header.flags & FLAG_HAS_CODEC_DATA) {
|
|
21707
|
-
if (data.length < offset + HEADER_CODEC_DATA_SIZE) {
|
|
21708
|
-
return result;
|
|
21709
|
-
}
|
|
21710
|
-
result.codec_data = {
|
|
21711
|
-
sample_rate: view.getUint32(offset, true),
|
|
21712
|
-
timebase_num: view.getUint32(offset + 4, true),
|
|
21713
|
-
timebase_den: view.getUint32(offset + 8, true),
|
|
21714
|
-
codec_profile: view.getUint16(offset + 12, true),
|
|
21715
|
-
codec_level: view.getUint16(offset + 14, true),
|
|
21716
|
-
width: view.getUint16(offset + 16, true),
|
|
21717
|
-
height: view.getUint16(offset + 18, true),
|
|
21718
|
-
codec_type: view.getUint8(offset + 20),
|
|
21719
|
-
channels: view.getUint8(offset + 21),
|
|
21720
|
-
bit_depth: view.getUint8(offset + 22),
|
|
21721
|
-
reserved: view.getUint8(offset + 23)
|
|
21722
|
-
};
|
|
21723
|
-
offset += HEADER_CODEC_DATA_SIZE;
|
|
21724
|
-
}
|
|
21725
|
-
if (offset < data.length) {
|
|
21726
|
-
result.payload = data.slice(offset);
|
|
21727
|
-
result.payload_size = result.payload.length;
|
|
21728
|
-
} else {
|
|
21729
|
-
result.payload = new Uint8Array(0);
|
|
21730
|
-
result.payload_size = 0;
|
|
21731
|
-
}
|
|
21732
|
-
result.valid = true;
|
|
21733
22159
|
return result;
|
|
21734
22160
|
}
|
|
21735
|
-
/**
|
|
21736
|
-
* Helper: Convert string to fixed-size byte array (null-terminated)
|
|
21737
|
-
*/
|
|
21738
|
-
static stringToFixedBytes(str, size) {
|
|
21739
|
-
const bytes = new Uint8Array(size);
|
|
21740
|
-
let encoded;
|
|
21741
|
-
if (typeof TextEncoder !== "undefined") {
|
|
21742
|
-
const encoder = new TextEncoder();
|
|
21743
|
-
encoded = encoder.encode(str);
|
|
21744
|
-
} else {
|
|
21745
|
-
encoded = new Uint8Array(Buffer.from(str, "utf8"));
|
|
21746
|
-
}
|
|
21747
|
-
const copyLen = Math.min(encoded.length, size - 1);
|
|
21748
|
-
bytes.set(encoded.slice(0, copyLen));
|
|
21749
|
-
bytes[copyLen] = 0;
|
|
21750
|
-
return bytes;
|
|
21751
|
-
}
|
|
21752
|
-
/**
|
|
21753
|
-
* Helper: Convert fixed-size byte array to string (null-terminated)
|
|
21754
|
-
*/
|
|
21755
|
-
static fixedBytesToString(bytes) {
|
|
21756
|
-
let len = bytes.length;
|
|
21757
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
21758
|
-
if (bytes[i] === 0) {
|
|
21759
|
-
len = i;
|
|
21760
|
-
break;
|
|
21761
|
-
}
|
|
21762
|
-
}
|
|
21763
|
-
if (typeof TextDecoder !== "undefined") {
|
|
21764
|
-
const decoder = new TextDecoder();
|
|
21765
|
-
return decoder.decode(bytes.slice(0, len));
|
|
21766
|
-
} else {
|
|
21767
|
-
return Buffer.from(bytes.slice(0, len)).toString("utf8");
|
|
21768
|
-
}
|
|
21769
|
-
}
|
|
21770
22161
|
};
|
|
21771
22162
|
|
|
21772
22163
|
// src/sesame-connection.ts
|
|
22164
|
+
var ConnectionState = /* @__PURE__ */ ((ConnectionState2) => {
|
|
22165
|
+
ConnectionState2["Disconnected"] = "disconnected";
|
|
22166
|
+
ConnectionState2["Connecting"] = "connecting";
|
|
22167
|
+
ConnectionState2["Connected"] = "connected";
|
|
22168
|
+
ConnectionState2["Reconnecting"] = "reconnecting";
|
|
22169
|
+
return ConnectionState2;
|
|
22170
|
+
})(ConnectionState || {});
|
|
21773
22171
|
function waitForEvent(emitter, eventName) {
|
|
21774
22172
|
return new Promise((resolve) => {
|
|
21775
22173
|
emitter.once(eventName, resolve);
|
|
@@ -21782,46 +22180,81 @@ var SesameConnection = class extends EventEmitter2 {
|
|
|
21782
22180
|
this.numRetries = 0;
|
|
21783
22181
|
this.url = "";
|
|
21784
22182
|
this.autoReconnect = true;
|
|
22183
|
+
this._state = "disconnected" /* Disconnected */;
|
|
22184
|
+
/* Bound listeners so we can removeEventListener later */
|
|
22185
|
+
this.boundMessageHandler = (event) => this.messageHandler(event);
|
|
22186
|
+
this.boundOpenHandler = () => this.openHandler();
|
|
22187
|
+
this.boundCloseHandler = () => this.closeHandler();
|
|
22188
|
+
this.boundErrorHandler = (event) => this.errorHandler(event);
|
|
21785
22189
|
this.openHandler = () => {
|
|
21786
22190
|
this.numRetries = 0;
|
|
22191
|
+
this.setState("connected" /* Connected */);
|
|
21787
22192
|
this.emit("open");
|
|
21788
22193
|
};
|
|
21789
22194
|
this.messageHandler = (event) => {
|
|
21790
|
-
var _a, _b, _c;
|
|
21791
22195
|
if (event.data instanceof ArrayBuffer) {
|
|
21792
|
-
const parsed =
|
|
21793
|
-
if (!parsed.valid)
|
|
21794
|
-
|
|
21795
|
-
|
|
21796
|
-
}
|
|
21797
|
-
|
|
21798
|
-
|
|
22196
|
+
const parsed = WireProtocol.parse(new Uint8Array(event.data));
|
|
22197
|
+
if (!parsed.valid) {
|
|
22198
|
+
this.emit("error", new Error("Invalid packet received"));
|
|
22199
|
+
return;
|
|
22200
|
+
}
|
|
22201
|
+
const frameType = parsed.header?.type;
|
|
22202
|
+
if (frameType === FrameType.FRAME_TYPE_RPC) {
|
|
21799
22203
|
this.emit("rpc", parsed.payload);
|
|
22204
|
+
} else {
|
|
22205
|
+
this.emit("media-packet", parsed);
|
|
21800
22206
|
}
|
|
21801
22207
|
}
|
|
21802
22208
|
};
|
|
21803
22209
|
this.url = options.url;
|
|
21804
22210
|
this.autoReconnect = options.autoReconnect;
|
|
21805
|
-
if (options.autoConnect) this.connect().catch(() =>
|
|
22211
|
+
if (options.autoConnect) this.connect().catch(() => {
|
|
22212
|
+
});
|
|
22213
|
+
}
|
|
22214
|
+
get state() {
|
|
22215
|
+
return this._state;
|
|
22216
|
+
}
|
|
22217
|
+
setState(newState) {
|
|
22218
|
+
if (this._state === newState) return;
|
|
22219
|
+
const prev = this._state;
|
|
22220
|
+
this._state = newState;
|
|
22221
|
+
switch (newState) {
|
|
22222
|
+
case "connected" /* Connected */:
|
|
22223
|
+
log.info("Connected to Sesame");
|
|
22224
|
+
break;
|
|
22225
|
+
case "reconnecting" /* Reconnecting */:
|
|
22226
|
+
if (prev === "connected" /* Connected */) {
|
|
22227
|
+
log.warn("Lost connection to Sesame, will try reconnect..");
|
|
22228
|
+
} else {
|
|
22229
|
+
log.warn("Failed to connect to Sesame, will try reconnect..");
|
|
22230
|
+
}
|
|
22231
|
+
break;
|
|
22232
|
+
case "disconnected" /* Disconnected */:
|
|
22233
|
+
log.info("Disconnected from Sesame");
|
|
22234
|
+
break;
|
|
22235
|
+
}
|
|
22236
|
+
this.emit("state", newState, prev);
|
|
21806
22237
|
}
|
|
21807
22238
|
isConnected() {
|
|
21808
|
-
return this.socket !== void 0 && this.socket.readyState ===
|
|
22239
|
+
return this.socket !== void 0 && this.socket.readyState === WebSocket.OPEN;
|
|
21809
22240
|
}
|
|
21810
22241
|
async send(data) {
|
|
21811
22242
|
if (!this.isConnected()) throw new Error("Not connected");
|
|
21812
|
-
const header =
|
|
21813
|
-
const
|
|
21814
|
-
|
|
21815
|
-
this.socket.send(data_to_send);
|
|
22243
|
+
const header = { type: sesame.v1.wire.FrameType.FRAME_TYPE_RPC };
|
|
22244
|
+
const frame = WireProtocol.serialize(header, data);
|
|
22245
|
+
this.socket.send(frame);
|
|
21816
22246
|
return Promise.resolve();
|
|
21817
22247
|
}
|
|
21818
22248
|
async connect() {
|
|
21819
22249
|
this.active = true;
|
|
21820
|
-
this.
|
|
21821
|
-
|
|
21822
|
-
|
|
21823
|
-
this.socket
|
|
21824
|
-
this.socket.addEventListener("
|
|
22250
|
+
if (this._state === "disconnected" /* Disconnected */) {
|
|
22251
|
+
this.setState("connecting" /* Connecting */);
|
|
22252
|
+
}
|
|
22253
|
+
this.socket = new WebSocket(this.url);
|
|
22254
|
+
this.socket.addEventListener("message", this.boundMessageHandler);
|
|
22255
|
+
this.socket.addEventListener("open", this.boundOpenHandler);
|
|
22256
|
+
this.socket.addEventListener("close", this.boundCloseHandler);
|
|
22257
|
+
this.socket.addEventListener("error", this.boundErrorHandler);
|
|
21825
22258
|
this.socket.binaryType = "arraybuffer";
|
|
21826
22259
|
await new Promise((resolve) => {
|
|
21827
22260
|
const done = () => {
|
|
@@ -21839,34 +22272,46 @@ var SesameConnection = class extends EventEmitter2 {
|
|
|
21839
22272
|
async disconnect() {
|
|
21840
22273
|
this.active = false;
|
|
21841
22274
|
if (!this.socket) {
|
|
22275
|
+
this.setState("disconnected" /* Disconnected */);
|
|
21842
22276
|
return;
|
|
21843
22277
|
}
|
|
21844
22278
|
const sock = this.socket;
|
|
21845
|
-
if (sock.readyState !==
|
|
22279
|
+
if (sock.readyState !== WebSocket.CLOSED) {
|
|
21846
22280
|
sock.close();
|
|
21847
22281
|
await waitForEvent(this, "close");
|
|
21848
22282
|
}
|
|
21849
|
-
|
|
22283
|
+
this.removeSocketListeners(sock);
|
|
22284
|
+
}
|
|
22285
|
+
removeSocketListeners(sock) {
|
|
22286
|
+
sock.removeEventListener("message", this.boundMessageHandler);
|
|
22287
|
+
sock.removeEventListener("open", this.boundOpenHandler);
|
|
22288
|
+
sock.removeEventListener("close", this.boundCloseHandler);
|
|
22289
|
+
sock.removeEventListener("error", this.boundErrorHandler);
|
|
21850
22290
|
}
|
|
21851
22291
|
retryHandler() {
|
|
21852
22292
|
if (this.active && this.autoReconnect) {
|
|
21853
|
-
this.connect().catch((
|
|
22293
|
+
this.connect().catch(() => {
|
|
22294
|
+
});
|
|
21854
22295
|
}
|
|
21855
22296
|
}
|
|
21856
22297
|
closeHandler() {
|
|
21857
22298
|
this.emit("close");
|
|
21858
22299
|
if (this.socket) {
|
|
21859
|
-
this.socket
|
|
22300
|
+
this.removeSocketListeners(this.socket);
|
|
21860
22301
|
}
|
|
21861
22302
|
this.socket = void 0;
|
|
21862
22303
|
if (this.active) {
|
|
21863
|
-
|
|
22304
|
+
if (this.autoReconnect) {
|
|
22305
|
+
this.setState("reconnecting" /* Reconnecting */);
|
|
21864
22306
|
setTimeout(() => {
|
|
21865
22307
|
this.retryHandler();
|
|
21866
22308
|
}, defaultBackoff(++this.numRetries));
|
|
21867
|
-
}
|
|
21868
|
-
|
|
22309
|
+
} else {
|
|
22310
|
+
this.active = false;
|
|
22311
|
+
this.setState("disconnected" /* Disconnected */);
|
|
21869
22312
|
}
|
|
22313
|
+
} else {
|
|
22314
|
+
this.setState("disconnected" /* Disconnected */);
|
|
21870
22315
|
}
|
|
21871
22316
|
}
|
|
21872
22317
|
errorHandler(error) {
|
|
@@ -21883,8 +22328,8 @@ import { EventEmitter as EventEmitter3 } from "events";
|
|
|
21883
22328
|
// src/status-api.ts
|
|
21884
22329
|
var StatusApi = class {
|
|
21885
22330
|
/** @internal */
|
|
21886
|
-
constructor(
|
|
21887
|
-
this.rpc =
|
|
22331
|
+
constructor(rpc) {
|
|
22332
|
+
this.rpc = rpc;
|
|
21888
22333
|
}
|
|
21889
22334
|
async getStatus() {
|
|
21890
22335
|
return this.rpc.service.requestStatus(new sesame.v1.common.Empty());
|
|
@@ -21892,16 +22337,13 @@ var StatusApi = class {
|
|
|
21892
22337
|
async getIODevices() {
|
|
21893
22338
|
return this.rpc.service.requestIODeviceList(new sesame.v1.common.Empty());
|
|
21894
22339
|
}
|
|
21895
|
-
async requestKeyframe(outputId) {
|
|
21896
|
-
await this.rpc.service.requestKeyframe({ id: outputId });
|
|
21897
|
-
}
|
|
21898
22340
|
};
|
|
21899
22341
|
|
|
21900
22342
|
// src/recorder-api.ts
|
|
21901
22343
|
var RecorderApi = class {
|
|
21902
22344
|
/** @internal */
|
|
21903
|
-
constructor(
|
|
21904
|
-
this.rpc =
|
|
22345
|
+
constructor(rpc) {
|
|
22346
|
+
this.rpc = rpc;
|
|
21905
22347
|
}
|
|
21906
22348
|
async addClip(recorderId, clip) {
|
|
21907
22349
|
const msg = sesame.v1.recorder.RecorderClipAddRequest.create({ clip });
|
|
@@ -21921,16 +22363,14 @@ var RecorderApi = class {
|
|
|
21921
22363
|
await this.rpc.service.requestRecorderOperation({ recorderId, clearClips: msg });
|
|
21922
22364
|
}
|
|
21923
22365
|
async verifyClips(recorderId) {
|
|
21924
|
-
var _a;
|
|
21925
22366
|
const msg = sesame.v1.recorder.RecorderClipsVerifyRequest.create();
|
|
21926
22367
|
const reply = await this.rpc.service.requestRecorderOperation({ recorderId, verifyClips: msg });
|
|
21927
|
-
return
|
|
22368
|
+
return reply.verifyClipsResponse?.errors || [];
|
|
21928
22369
|
}
|
|
21929
22370
|
async getClips(recorderId) {
|
|
21930
|
-
var _a;
|
|
21931
22371
|
const msg = sesame.v1.recorder.RecorderClipsGetRequest.create();
|
|
21932
22372
|
const reply = await this.rpc.service.requestRecorderOperation({ recorderId, getClips: msg });
|
|
21933
|
-
if (
|
|
22373
|
+
if (reply.getClipsResponse?.clips) {
|
|
21934
22374
|
return reply.getClipsResponse.clips;
|
|
21935
22375
|
} else {
|
|
21936
22376
|
throw new Error(`No clips returned: ${JSON.stringify(reply)}`);
|
|
@@ -21949,8 +22389,8 @@ var RecorderApi = class {
|
|
|
21949
22389
|
// src/jobs-api.ts
|
|
21950
22390
|
var JobsApi = class {
|
|
21951
22391
|
/** @internal */
|
|
21952
|
-
constructor(
|
|
21953
|
-
this.rpc =
|
|
22392
|
+
constructor(rpc) {
|
|
22393
|
+
this.rpc = rpc;
|
|
21954
22394
|
}
|
|
21955
22395
|
async importClip(config) {
|
|
21956
22396
|
const msg = sesame.v1.jobs.ImportStartRequest.create();
|
|
@@ -22045,10 +22485,7 @@ var SesameClient = class extends EventEmitter3 {
|
|
|
22045
22485
|
constructor(portOrUrl) {
|
|
22046
22486
|
super();
|
|
22047
22487
|
this.subscriptions = [];
|
|
22048
|
-
this.
|
|
22049
|
-
this.onVideoPacket = () => {
|
|
22050
|
-
};
|
|
22051
|
-
this.onAudioPacket = () => {
|
|
22488
|
+
this.onMediaPacket = () => {
|
|
22052
22489
|
};
|
|
22053
22490
|
this.onCallbackMessage = () => {
|
|
22054
22491
|
};
|
|
@@ -22059,10 +22496,6 @@ var SesameClient = class extends EventEmitter3 {
|
|
|
22059
22496
|
autoReconnect: true
|
|
22060
22497
|
});
|
|
22061
22498
|
this.conn.on("error", () => {
|
|
22062
|
-
if (!this.errorIsLogged) {
|
|
22063
|
-
log.warn("Could not connect to Sesame Engine, will keep trying..");
|
|
22064
|
-
this.errorIsLogged = true;
|
|
22065
|
-
}
|
|
22066
22499
|
});
|
|
22067
22500
|
let events = {
|
|
22068
22501
|
[sesame.v1.common.EventTopic.EVENT_TOPIC_ERROR]: sesame.v1.status.Event,
|
|
@@ -22087,18 +22520,18 @@ var SesameClient = class extends EventEmitter3 {
|
|
|
22087
22520
|
}
|
|
22088
22521
|
});
|
|
22089
22522
|
this.rpc.on("error", (err) => {
|
|
22090
|
-
|
|
22523
|
+
if (this.isConnected()) {
|
|
22524
|
+
log.error(`RPC error: ${err.message}`);
|
|
22525
|
+
}
|
|
22091
22526
|
});
|
|
22092
22527
|
this.conn.on("open", async () => {
|
|
22093
22528
|
this.sendSubscriptions();
|
|
22094
|
-
this.errorIsLogged = false;
|
|
22095
22529
|
this.emit("connected");
|
|
22096
22530
|
});
|
|
22097
22531
|
this.conn.on("close", () => {
|
|
22098
22532
|
this.emit("disconnected");
|
|
22099
22533
|
});
|
|
22100
|
-
this.conn.on("
|
|
22101
|
-
this.conn.on("audio-packet", (data) => this.onAudioPacket(this.videoSubscriptionId, data));
|
|
22534
|
+
this.conn.on("media-packet", (frame) => this.onMediaPacket(this.mediaSubscriptionId, frame));
|
|
22102
22535
|
this.subscriptions = [];
|
|
22103
22536
|
}
|
|
22104
22537
|
isConnected() {
|
|
@@ -22108,14 +22541,14 @@ var SesameClient = class extends EventEmitter3 {
|
|
|
22108
22541
|
if (!this.isConnected()) return;
|
|
22109
22542
|
const eventTopics = this.subscriptions.map((subscription) => subscription.topic);
|
|
22110
22543
|
const channels = [];
|
|
22111
|
-
if (this.
|
|
22544
|
+
if (this.mediaSubscriptionId) channels.push(`media-stream/${this.mediaSubscriptionId}`);
|
|
22112
22545
|
let subs = { eventTopics, channels };
|
|
22113
22546
|
this.rpc.service.updateSubscriptions(subs).catch((err) => {
|
|
22114
22547
|
log.error(`Failed to update subscriptions: ${err.message}`);
|
|
22115
22548
|
});
|
|
22116
22549
|
}
|
|
22117
|
-
|
|
22118
|
-
this.
|
|
22550
|
+
addMediaSubscription(id) {
|
|
22551
|
+
this.mediaSubscriptionId = id;
|
|
22119
22552
|
this.sendSubscriptions();
|
|
22120
22553
|
}
|
|
22121
22554
|
addSubscription(topic, callback) {
|
|
@@ -22134,10 +22567,13 @@ var SesameClient = class extends EventEmitter3 {
|
|
|
22134
22567
|
getService() {
|
|
22135
22568
|
return this.rpc;
|
|
22136
22569
|
}
|
|
22570
|
+
async requestKeyframe(outputId) {
|
|
22571
|
+
await this.rpc.service.requestKeyframe({ id: outputId });
|
|
22572
|
+
}
|
|
22137
22573
|
async execute(cl) {
|
|
22138
22574
|
cl.filterCreatedAndDestroyedSources();
|
|
22139
|
-
if (cl.
|
|
22140
|
-
await this.rpc.service.executeCommandList(cl.
|
|
22575
|
+
if (cl.getCommandListMsg().commandList.length > 0) {
|
|
22576
|
+
await this.rpc.service.executeCommandList(cl.getCommandListMsg());
|
|
22141
22577
|
}
|
|
22142
22578
|
}
|
|
22143
22579
|
disconnect() {
|
|
@@ -22153,19 +22589,21 @@ var Event = sesame.v1.rpc.Event;
|
|
|
22153
22589
|
export {
|
|
22154
22590
|
CodecType,
|
|
22155
22591
|
CommandList,
|
|
22592
|
+
ConnectionState,
|
|
22156
22593
|
EaseKind,
|
|
22157
22594
|
Event,
|
|
22595
|
+
FrameHeader,
|
|
22596
|
+
FrameType,
|
|
22158
22597
|
JobsApi,
|
|
22159
22598
|
Message,
|
|
22160
|
-
PacketType,
|
|
22161
22599
|
RPCClient,
|
|
22162
22600
|
RecorderApi,
|
|
22163
22601
|
Request,
|
|
22164
22602
|
Response,
|
|
22165
|
-
SesameBinaryProtocol,
|
|
22166
22603
|
SesameClient,
|
|
22167
22604
|
SesameConnection,
|
|
22168
22605
|
StatusApi,
|
|
22606
|
+
WireProtocol,
|
|
22169
22607
|
getLogger,
|
|
22170
22608
|
log,
|
|
22171
22609
|
sesame,
|