@stinkycomputing/sesame-api-client 1.4.1-alpha.10 → 1.4.1-alpha.12
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 +59 -137
- package/dist/index.browser.mjs +652 -261
- package/dist/index.browser.mjs.map +4 -4
- package/dist/index.cjs +655 -263
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +652 -261
- package/dist/index.mjs.map +4 -4
- package/dist/proto/api.d.ts +305 -0
- package/dist/proto/api.js +922 -0
- package/dist/sesame-api-client.d.ts +5 -5
- package/dist/sesame-api-client.d.ts.map +1 -1
- package/dist/sesame-binary-protocol.d.ts +17 -87
- package/dist/sesame-binary-protocol.d.ts.map +1 -1
- package/dist/sesame-connection.d.ts +2 -2
- 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 +1 -1
package/dist/index.cjs
CHANGED
|
@@ -35,17 +35,18 @@ __export(index_exports, {
|
|
|
35
35
|
ConnectionState: () => ConnectionState,
|
|
36
36
|
EaseKind: () => EaseKind,
|
|
37
37
|
Event: () => Event,
|
|
38
|
+
FrameHeader: () => FrameHeader,
|
|
39
|
+
FrameType: () => FrameType,
|
|
38
40
|
JobsApi: () => JobsApi,
|
|
39
41
|
Message: () => Message,
|
|
40
|
-
PacketType: () => PacketType,
|
|
41
42
|
RPCClient: () => RPCClient,
|
|
42
43
|
RecorderApi: () => RecorderApi,
|
|
43
44
|
Request: () => Request,
|
|
44
45
|
Response: () => Response,
|
|
45
|
-
SesameBinaryProtocol: () => SesameBinaryProtocol,
|
|
46
46
|
SesameClient: () => SesameClient,
|
|
47
47
|
SesameConnection: () => SesameConnection,
|
|
48
48
|
StatusApi: () => StatusApi,
|
|
49
|
+
WireProtocol: () => WireProtocol,
|
|
49
50
|
getLogger: () => getLogger,
|
|
50
51
|
log: () => log,
|
|
51
52
|
sesame: () => sesame,
|
|
@@ -21110,6 +21111,602 @@ var sesame = $root.sesame = (() => {
|
|
|
21110
21111
|
}();
|
|
21111
21112
|
return rpc;
|
|
21112
21113
|
}();
|
|
21114
|
+
v1.wire = function() {
|
|
21115
|
+
const wire = {};
|
|
21116
|
+
wire.FrameType = function() {
|
|
21117
|
+
const valuesById = {}, values = Object.create(valuesById);
|
|
21118
|
+
values[valuesById[0] = "FRAME_TYPE_UNSPECIFIED"] = 0;
|
|
21119
|
+
values[valuesById[1] = "FRAME_TYPE_RPC"] = 1;
|
|
21120
|
+
values[valuesById[2] = "FRAME_TYPE_VIDEO"] = 2;
|
|
21121
|
+
values[valuesById[3] = "FRAME_TYPE_AUDIO"] = 3;
|
|
21122
|
+
values[valuesById[4] = "FRAME_TYPE_MUXED"] = 4;
|
|
21123
|
+
values[valuesById[5] = "FRAME_TYPE_DECODER_DATA"] = 5;
|
|
21124
|
+
return values;
|
|
21125
|
+
}();
|
|
21126
|
+
wire.CodecType = function() {
|
|
21127
|
+
const valuesById = {}, values = Object.create(valuesById);
|
|
21128
|
+
values[valuesById[0] = "CODEC_TYPE_UNSPECIFIED"] = 0;
|
|
21129
|
+
values[valuesById[1] = "CODEC_TYPE_VIDEO_VP8"] = 1;
|
|
21130
|
+
values[valuesById[2] = "CODEC_TYPE_VIDEO_VP9"] = 2;
|
|
21131
|
+
values[valuesById[3] = "CODEC_TYPE_VIDEO_AVC"] = 3;
|
|
21132
|
+
values[valuesById[4] = "CODEC_TYPE_VIDEO_HEVC"] = 4;
|
|
21133
|
+
values[valuesById[5] = "CODEC_TYPE_VIDEO_AV1"] = 5;
|
|
21134
|
+
values[valuesById[64] = "CODEC_TYPE_AUDIO_OPUS"] = 64;
|
|
21135
|
+
values[valuesById[65] = "CODEC_TYPE_AUDIO_AAC"] = 65;
|
|
21136
|
+
values[valuesById[66] = "CODEC_TYPE_AUDIO_PCM"] = 66;
|
|
21137
|
+
return values;
|
|
21138
|
+
}();
|
|
21139
|
+
wire.MediaCodecData = function() {
|
|
21140
|
+
function MediaCodecData2(properties) {
|
|
21141
|
+
if (properties) {
|
|
21142
|
+
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
21143
|
+
if (properties[keys[i]] != null)
|
|
21144
|
+
this[keys[i]] = properties[keys[i]];
|
|
21145
|
+
}
|
|
21146
|
+
}
|
|
21147
|
+
MediaCodecData2.prototype.codecType = 0;
|
|
21148
|
+
MediaCodecData2.prototype.sampleRate = 0;
|
|
21149
|
+
MediaCodecData2.prototype.timebaseNum = 0;
|
|
21150
|
+
MediaCodecData2.prototype.timebaseDen = 0;
|
|
21151
|
+
MediaCodecData2.prototype.codecProfile = 0;
|
|
21152
|
+
MediaCodecData2.prototype.codecLevel = 0;
|
|
21153
|
+
MediaCodecData2.prototype.width = 0;
|
|
21154
|
+
MediaCodecData2.prototype.height = 0;
|
|
21155
|
+
MediaCodecData2.prototype.channels = 0;
|
|
21156
|
+
MediaCodecData2.prototype.bitDepth = 0;
|
|
21157
|
+
MediaCodecData2.create = function create(properties) {
|
|
21158
|
+
return new MediaCodecData2(properties);
|
|
21159
|
+
};
|
|
21160
|
+
MediaCodecData2.encode = function encode(message, writer) {
|
|
21161
|
+
if (!writer)
|
|
21162
|
+
writer = $Writer.create();
|
|
21163
|
+
if (message.codecType != null && Object.hasOwnProperty.call(message, "codecType"))
|
|
21164
|
+
writer.uint32(
|
|
21165
|
+
/* id 1, wireType 0 =*/
|
|
21166
|
+
8
|
|
21167
|
+
).int32(message.codecType);
|
|
21168
|
+
if (message.sampleRate != null && Object.hasOwnProperty.call(message, "sampleRate"))
|
|
21169
|
+
writer.uint32(
|
|
21170
|
+
/* id 2, wireType 0 =*/
|
|
21171
|
+
16
|
|
21172
|
+
).uint32(message.sampleRate);
|
|
21173
|
+
if (message.timebaseNum != null && Object.hasOwnProperty.call(message, "timebaseNum"))
|
|
21174
|
+
writer.uint32(
|
|
21175
|
+
/* id 3, wireType 0 =*/
|
|
21176
|
+
24
|
|
21177
|
+
).uint32(message.timebaseNum);
|
|
21178
|
+
if (message.timebaseDen != null && Object.hasOwnProperty.call(message, "timebaseDen"))
|
|
21179
|
+
writer.uint32(
|
|
21180
|
+
/* id 4, wireType 0 =*/
|
|
21181
|
+
32
|
|
21182
|
+
).uint32(message.timebaseDen);
|
|
21183
|
+
if (message.codecProfile != null && Object.hasOwnProperty.call(message, "codecProfile"))
|
|
21184
|
+
writer.uint32(
|
|
21185
|
+
/* id 5, wireType 0 =*/
|
|
21186
|
+
40
|
|
21187
|
+
).uint32(message.codecProfile);
|
|
21188
|
+
if (message.codecLevel != null && Object.hasOwnProperty.call(message, "codecLevel"))
|
|
21189
|
+
writer.uint32(
|
|
21190
|
+
/* id 6, wireType 0 =*/
|
|
21191
|
+
48
|
|
21192
|
+
).uint32(message.codecLevel);
|
|
21193
|
+
if (message.width != null && Object.hasOwnProperty.call(message, "width"))
|
|
21194
|
+
writer.uint32(
|
|
21195
|
+
/* id 7, wireType 0 =*/
|
|
21196
|
+
56
|
|
21197
|
+
).uint32(message.width);
|
|
21198
|
+
if (message.height != null && Object.hasOwnProperty.call(message, "height"))
|
|
21199
|
+
writer.uint32(
|
|
21200
|
+
/* id 8, wireType 0 =*/
|
|
21201
|
+
64
|
|
21202
|
+
).uint32(message.height);
|
|
21203
|
+
if (message.channels != null && Object.hasOwnProperty.call(message, "channels"))
|
|
21204
|
+
writer.uint32(
|
|
21205
|
+
/* id 9, wireType 0 =*/
|
|
21206
|
+
72
|
|
21207
|
+
).uint32(message.channels);
|
|
21208
|
+
if (message.bitDepth != null && Object.hasOwnProperty.call(message, "bitDepth"))
|
|
21209
|
+
writer.uint32(
|
|
21210
|
+
/* id 10, wireType 0 =*/
|
|
21211
|
+
80
|
|
21212
|
+
).uint32(message.bitDepth);
|
|
21213
|
+
return writer;
|
|
21214
|
+
};
|
|
21215
|
+
MediaCodecData2.encodeDelimited = function encodeDelimited(message, writer) {
|
|
21216
|
+
return this.encode(message, writer).ldelim();
|
|
21217
|
+
};
|
|
21218
|
+
MediaCodecData2.decode = function decode(reader, length, error) {
|
|
21219
|
+
if (!(reader instanceof $Reader))
|
|
21220
|
+
reader = $Reader.create(reader);
|
|
21221
|
+
let end = length === void 0 ? reader.len : reader.pos + length, message = new $root.sesame.v1.wire.MediaCodecData();
|
|
21222
|
+
while (reader.pos < end) {
|
|
21223
|
+
let tag = reader.uint32();
|
|
21224
|
+
if (tag === error)
|
|
21225
|
+
break;
|
|
21226
|
+
switch (tag >>> 3) {
|
|
21227
|
+
case 1: {
|
|
21228
|
+
message.codecType = reader.int32();
|
|
21229
|
+
break;
|
|
21230
|
+
}
|
|
21231
|
+
case 2: {
|
|
21232
|
+
message.sampleRate = reader.uint32();
|
|
21233
|
+
break;
|
|
21234
|
+
}
|
|
21235
|
+
case 3: {
|
|
21236
|
+
message.timebaseNum = reader.uint32();
|
|
21237
|
+
break;
|
|
21238
|
+
}
|
|
21239
|
+
case 4: {
|
|
21240
|
+
message.timebaseDen = reader.uint32();
|
|
21241
|
+
break;
|
|
21242
|
+
}
|
|
21243
|
+
case 5: {
|
|
21244
|
+
message.codecProfile = reader.uint32();
|
|
21245
|
+
break;
|
|
21246
|
+
}
|
|
21247
|
+
case 6: {
|
|
21248
|
+
message.codecLevel = reader.uint32();
|
|
21249
|
+
break;
|
|
21250
|
+
}
|
|
21251
|
+
case 7: {
|
|
21252
|
+
message.width = reader.uint32();
|
|
21253
|
+
break;
|
|
21254
|
+
}
|
|
21255
|
+
case 8: {
|
|
21256
|
+
message.height = reader.uint32();
|
|
21257
|
+
break;
|
|
21258
|
+
}
|
|
21259
|
+
case 9: {
|
|
21260
|
+
message.channels = reader.uint32();
|
|
21261
|
+
break;
|
|
21262
|
+
}
|
|
21263
|
+
case 10: {
|
|
21264
|
+
message.bitDepth = reader.uint32();
|
|
21265
|
+
break;
|
|
21266
|
+
}
|
|
21267
|
+
default:
|
|
21268
|
+
reader.skipType(tag & 7);
|
|
21269
|
+
break;
|
|
21270
|
+
}
|
|
21271
|
+
}
|
|
21272
|
+
return message;
|
|
21273
|
+
};
|
|
21274
|
+
MediaCodecData2.decodeDelimited = function decodeDelimited(reader) {
|
|
21275
|
+
if (!(reader instanceof $Reader))
|
|
21276
|
+
reader = new $Reader(reader);
|
|
21277
|
+
return this.decode(reader, reader.uint32());
|
|
21278
|
+
};
|
|
21279
|
+
MediaCodecData2.verify = function verify(message) {
|
|
21280
|
+
if (typeof message !== "object" || message === null)
|
|
21281
|
+
return "object expected";
|
|
21282
|
+
if (message.codecType != null && message.hasOwnProperty("codecType"))
|
|
21283
|
+
switch (message.codecType) {
|
|
21284
|
+
default:
|
|
21285
|
+
return "codecType: enum value expected";
|
|
21286
|
+
case 0:
|
|
21287
|
+
case 1:
|
|
21288
|
+
case 2:
|
|
21289
|
+
case 3:
|
|
21290
|
+
case 4:
|
|
21291
|
+
case 5:
|
|
21292
|
+
case 64:
|
|
21293
|
+
case 65:
|
|
21294
|
+
case 66:
|
|
21295
|
+
break;
|
|
21296
|
+
}
|
|
21297
|
+
if (message.sampleRate != null && message.hasOwnProperty("sampleRate")) {
|
|
21298
|
+
if (!$util.isInteger(message.sampleRate))
|
|
21299
|
+
return "sampleRate: integer expected";
|
|
21300
|
+
}
|
|
21301
|
+
if (message.timebaseNum != null && message.hasOwnProperty("timebaseNum")) {
|
|
21302
|
+
if (!$util.isInteger(message.timebaseNum))
|
|
21303
|
+
return "timebaseNum: integer expected";
|
|
21304
|
+
}
|
|
21305
|
+
if (message.timebaseDen != null && message.hasOwnProperty("timebaseDen")) {
|
|
21306
|
+
if (!$util.isInteger(message.timebaseDen))
|
|
21307
|
+
return "timebaseDen: integer expected";
|
|
21308
|
+
}
|
|
21309
|
+
if (message.codecProfile != null && message.hasOwnProperty("codecProfile")) {
|
|
21310
|
+
if (!$util.isInteger(message.codecProfile))
|
|
21311
|
+
return "codecProfile: integer expected";
|
|
21312
|
+
}
|
|
21313
|
+
if (message.codecLevel != null && message.hasOwnProperty("codecLevel")) {
|
|
21314
|
+
if (!$util.isInteger(message.codecLevel))
|
|
21315
|
+
return "codecLevel: integer expected";
|
|
21316
|
+
}
|
|
21317
|
+
if (message.width != null && message.hasOwnProperty("width")) {
|
|
21318
|
+
if (!$util.isInteger(message.width))
|
|
21319
|
+
return "width: integer expected";
|
|
21320
|
+
}
|
|
21321
|
+
if (message.height != null && message.hasOwnProperty("height")) {
|
|
21322
|
+
if (!$util.isInteger(message.height))
|
|
21323
|
+
return "height: integer expected";
|
|
21324
|
+
}
|
|
21325
|
+
if (message.channels != null && message.hasOwnProperty("channels")) {
|
|
21326
|
+
if (!$util.isInteger(message.channels))
|
|
21327
|
+
return "channels: integer expected";
|
|
21328
|
+
}
|
|
21329
|
+
if (message.bitDepth != null && message.hasOwnProperty("bitDepth")) {
|
|
21330
|
+
if (!$util.isInteger(message.bitDepth))
|
|
21331
|
+
return "bitDepth: integer expected";
|
|
21332
|
+
}
|
|
21333
|
+
return null;
|
|
21334
|
+
};
|
|
21335
|
+
MediaCodecData2.fromObject = function fromObject(object) {
|
|
21336
|
+
if (object instanceof $root.sesame.v1.wire.MediaCodecData)
|
|
21337
|
+
return object;
|
|
21338
|
+
let message = new $root.sesame.v1.wire.MediaCodecData();
|
|
21339
|
+
switch (object.codecType) {
|
|
21340
|
+
default:
|
|
21341
|
+
if (typeof object.codecType === "number") {
|
|
21342
|
+
message.codecType = object.codecType;
|
|
21343
|
+
break;
|
|
21344
|
+
}
|
|
21345
|
+
break;
|
|
21346
|
+
case "CODEC_TYPE_UNSPECIFIED":
|
|
21347
|
+
case 0:
|
|
21348
|
+
message.codecType = 0;
|
|
21349
|
+
break;
|
|
21350
|
+
case "CODEC_TYPE_VIDEO_VP8":
|
|
21351
|
+
case 1:
|
|
21352
|
+
message.codecType = 1;
|
|
21353
|
+
break;
|
|
21354
|
+
case "CODEC_TYPE_VIDEO_VP9":
|
|
21355
|
+
case 2:
|
|
21356
|
+
message.codecType = 2;
|
|
21357
|
+
break;
|
|
21358
|
+
case "CODEC_TYPE_VIDEO_AVC":
|
|
21359
|
+
case 3:
|
|
21360
|
+
message.codecType = 3;
|
|
21361
|
+
break;
|
|
21362
|
+
case "CODEC_TYPE_VIDEO_HEVC":
|
|
21363
|
+
case 4:
|
|
21364
|
+
message.codecType = 4;
|
|
21365
|
+
break;
|
|
21366
|
+
case "CODEC_TYPE_VIDEO_AV1":
|
|
21367
|
+
case 5:
|
|
21368
|
+
message.codecType = 5;
|
|
21369
|
+
break;
|
|
21370
|
+
case "CODEC_TYPE_AUDIO_OPUS":
|
|
21371
|
+
case 64:
|
|
21372
|
+
message.codecType = 64;
|
|
21373
|
+
break;
|
|
21374
|
+
case "CODEC_TYPE_AUDIO_AAC":
|
|
21375
|
+
case 65:
|
|
21376
|
+
message.codecType = 65;
|
|
21377
|
+
break;
|
|
21378
|
+
case "CODEC_TYPE_AUDIO_PCM":
|
|
21379
|
+
case 66:
|
|
21380
|
+
message.codecType = 66;
|
|
21381
|
+
break;
|
|
21382
|
+
}
|
|
21383
|
+
if (object.sampleRate != null)
|
|
21384
|
+
message.sampleRate = object.sampleRate >>> 0;
|
|
21385
|
+
if (object.timebaseNum != null)
|
|
21386
|
+
message.timebaseNum = object.timebaseNum >>> 0;
|
|
21387
|
+
if (object.timebaseDen != null)
|
|
21388
|
+
message.timebaseDen = object.timebaseDen >>> 0;
|
|
21389
|
+
if (object.codecProfile != null)
|
|
21390
|
+
message.codecProfile = object.codecProfile >>> 0;
|
|
21391
|
+
if (object.codecLevel != null)
|
|
21392
|
+
message.codecLevel = object.codecLevel >>> 0;
|
|
21393
|
+
if (object.width != null)
|
|
21394
|
+
message.width = object.width >>> 0;
|
|
21395
|
+
if (object.height != null)
|
|
21396
|
+
message.height = object.height >>> 0;
|
|
21397
|
+
if (object.channels != null)
|
|
21398
|
+
message.channels = object.channels >>> 0;
|
|
21399
|
+
if (object.bitDepth != null)
|
|
21400
|
+
message.bitDepth = object.bitDepth >>> 0;
|
|
21401
|
+
return message;
|
|
21402
|
+
};
|
|
21403
|
+
MediaCodecData2.toObject = function toObject(message, options) {
|
|
21404
|
+
if (!options)
|
|
21405
|
+
options = {};
|
|
21406
|
+
let object = {};
|
|
21407
|
+
if (options.defaults) {
|
|
21408
|
+
object.codecType = options.enums === String ? "CODEC_TYPE_UNSPECIFIED" : 0;
|
|
21409
|
+
object.sampleRate = 0;
|
|
21410
|
+
object.timebaseNum = 0;
|
|
21411
|
+
object.timebaseDen = 0;
|
|
21412
|
+
object.codecProfile = 0;
|
|
21413
|
+
object.codecLevel = 0;
|
|
21414
|
+
object.width = 0;
|
|
21415
|
+
object.height = 0;
|
|
21416
|
+
object.channels = 0;
|
|
21417
|
+
object.bitDepth = 0;
|
|
21418
|
+
}
|
|
21419
|
+
if (message.codecType != null && message.hasOwnProperty("codecType"))
|
|
21420
|
+
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;
|
|
21421
|
+
if (message.sampleRate != null && message.hasOwnProperty("sampleRate"))
|
|
21422
|
+
object.sampleRate = message.sampleRate;
|
|
21423
|
+
if (message.timebaseNum != null && message.hasOwnProperty("timebaseNum"))
|
|
21424
|
+
object.timebaseNum = message.timebaseNum;
|
|
21425
|
+
if (message.timebaseDen != null && message.hasOwnProperty("timebaseDen"))
|
|
21426
|
+
object.timebaseDen = message.timebaseDen;
|
|
21427
|
+
if (message.codecProfile != null && message.hasOwnProperty("codecProfile"))
|
|
21428
|
+
object.codecProfile = message.codecProfile;
|
|
21429
|
+
if (message.codecLevel != null && message.hasOwnProperty("codecLevel"))
|
|
21430
|
+
object.codecLevel = message.codecLevel;
|
|
21431
|
+
if (message.width != null && message.hasOwnProperty("width"))
|
|
21432
|
+
object.width = message.width;
|
|
21433
|
+
if (message.height != null && message.hasOwnProperty("height"))
|
|
21434
|
+
object.height = message.height;
|
|
21435
|
+
if (message.channels != null && message.hasOwnProperty("channels"))
|
|
21436
|
+
object.channels = message.channels;
|
|
21437
|
+
if (message.bitDepth != null && message.hasOwnProperty("bitDepth"))
|
|
21438
|
+
object.bitDepth = message.bitDepth;
|
|
21439
|
+
return object;
|
|
21440
|
+
};
|
|
21441
|
+
MediaCodecData2.prototype.toJSON = function toJSON() {
|
|
21442
|
+
return this.constructor.toObject(this, import_minimal.default.util.toJSONOptions);
|
|
21443
|
+
};
|
|
21444
|
+
MediaCodecData2.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
21445
|
+
if (typeUrlPrefix === void 0) {
|
|
21446
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
21447
|
+
}
|
|
21448
|
+
return typeUrlPrefix + "/sesame.v1.wire.MediaCodecData";
|
|
21449
|
+
};
|
|
21450
|
+
return MediaCodecData2;
|
|
21451
|
+
}();
|
|
21452
|
+
wire.FrameHeader = function() {
|
|
21453
|
+
function FrameHeader2(properties) {
|
|
21454
|
+
if (properties) {
|
|
21455
|
+
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
21456
|
+
if (properties[keys[i]] != null)
|
|
21457
|
+
this[keys[i]] = properties[keys[i]];
|
|
21458
|
+
}
|
|
21459
|
+
}
|
|
21460
|
+
FrameHeader2.prototype.type = 0;
|
|
21461
|
+
FrameHeader2.prototype.pts = $util.Long ? $util.Long.fromBits(0, 0, true) : 0;
|
|
21462
|
+
FrameHeader2.prototype.id = $util.Long ? $util.Long.fromBits(0, 0, true) : 0;
|
|
21463
|
+
FrameHeader2.prototype.keyframe = false;
|
|
21464
|
+
FrameHeader2.prototype.codecData = null;
|
|
21465
|
+
FrameHeader2.prototype.routingMetadata = "";
|
|
21466
|
+
FrameHeader2.create = function create(properties) {
|
|
21467
|
+
return new FrameHeader2(properties);
|
|
21468
|
+
};
|
|
21469
|
+
FrameHeader2.encode = function encode(message, writer) {
|
|
21470
|
+
if (!writer)
|
|
21471
|
+
writer = $Writer.create();
|
|
21472
|
+
if (message.type != null && Object.hasOwnProperty.call(message, "type"))
|
|
21473
|
+
writer.uint32(
|
|
21474
|
+
/* id 1, wireType 0 =*/
|
|
21475
|
+
8
|
|
21476
|
+
).int32(message.type);
|
|
21477
|
+
if (message.pts != null && Object.hasOwnProperty.call(message, "pts"))
|
|
21478
|
+
writer.uint32(
|
|
21479
|
+
/* id 2, wireType 0 =*/
|
|
21480
|
+
16
|
|
21481
|
+
).uint64(message.pts);
|
|
21482
|
+
if (message.id != null && Object.hasOwnProperty.call(message, "id"))
|
|
21483
|
+
writer.uint32(
|
|
21484
|
+
/* id 3, wireType 0 =*/
|
|
21485
|
+
24
|
|
21486
|
+
).uint64(message.id);
|
|
21487
|
+
if (message.keyframe != null && Object.hasOwnProperty.call(message, "keyframe"))
|
|
21488
|
+
writer.uint32(
|
|
21489
|
+
/* id 4, wireType 0 =*/
|
|
21490
|
+
32
|
|
21491
|
+
).bool(message.keyframe);
|
|
21492
|
+
if (message.codecData != null && Object.hasOwnProperty.call(message, "codecData"))
|
|
21493
|
+
$root.sesame.v1.wire.MediaCodecData.encode(message.codecData, writer.uint32(
|
|
21494
|
+
/* id 5, wireType 2 =*/
|
|
21495
|
+
42
|
|
21496
|
+
).fork()).ldelim();
|
|
21497
|
+
if (message.routingMetadata != null && Object.hasOwnProperty.call(message, "routingMetadata"))
|
|
21498
|
+
writer.uint32(
|
|
21499
|
+
/* id 6, wireType 2 =*/
|
|
21500
|
+
50
|
|
21501
|
+
).string(message.routingMetadata);
|
|
21502
|
+
return writer;
|
|
21503
|
+
};
|
|
21504
|
+
FrameHeader2.encodeDelimited = function encodeDelimited(message, writer) {
|
|
21505
|
+
return this.encode(message, writer).ldelim();
|
|
21506
|
+
};
|
|
21507
|
+
FrameHeader2.decode = function decode(reader, length, error) {
|
|
21508
|
+
if (!(reader instanceof $Reader))
|
|
21509
|
+
reader = $Reader.create(reader);
|
|
21510
|
+
let end = length === void 0 ? reader.len : reader.pos + length, message = new $root.sesame.v1.wire.FrameHeader();
|
|
21511
|
+
while (reader.pos < end) {
|
|
21512
|
+
let tag = reader.uint32();
|
|
21513
|
+
if (tag === error)
|
|
21514
|
+
break;
|
|
21515
|
+
switch (tag >>> 3) {
|
|
21516
|
+
case 1: {
|
|
21517
|
+
message.type = reader.int32();
|
|
21518
|
+
break;
|
|
21519
|
+
}
|
|
21520
|
+
case 2: {
|
|
21521
|
+
message.pts = reader.uint64();
|
|
21522
|
+
break;
|
|
21523
|
+
}
|
|
21524
|
+
case 3: {
|
|
21525
|
+
message.id = reader.uint64();
|
|
21526
|
+
break;
|
|
21527
|
+
}
|
|
21528
|
+
case 4: {
|
|
21529
|
+
message.keyframe = reader.bool();
|
|
21530
|
+
break;
|
|
21531
|
+
}
|
|
21532
|
+
case 5: {
|
|
21533
|
+
message.codecData = $root.sesame.v1.wire.MediaCodecData.decode(reader, reader.uint32());
|
|
21534
|
+
break;
|
|
21535
|
+
}
|
|
21536
|
+
case 6: {
|
|
21537
|
+
message.routingMetadata = reader.string();
|
|
21538
|
+
break;
|
|
21539
|
+
}
|
|
21540
|
+
default:
|
|
21541
|
+
reader.skipType(tag & 7);
|
|
21542
|
+
break;
|
|
21543
|
+
}
|
|
21544
|
+
}
|
|
21545
|
+
return message;
|
|
21546
|
+
};
|
|
21547
|
+
FrameHeader2.decodeDelimited = function decodeDelimited(reader) {
|
|
21548
|
+
if (!(reader instanceof $Reader))
|
|
21549
|
+
reader = new $Reader(reader);
|
|
21550
|
+
return this.decode(reader, reader.uint32());
|
|
21551
|
+
};
|
|
21552
|
+
FrameHeader2.verify = function verify(message) {
|
|
21553
|
+
if (typeof message !== "object" || message === null)
|
|
21554
|
+
return "object expected";
|
|
21555
|
+
if (message.type != null && message.hasOwnProperty("type"))
|
|
21556
|
+
switch (message.type) {
|
|
21557
|
+
default:
|
|
21558
|
+
return "type: enum value expected";
|
|
21559
|
+
case 0:
|
|
21560
|
+
case 1:
|
|
21561
|
+
case 2:
|
|
21562
|
+
case 3:
|
|
21563
|
+
case 4:
|
|
21564
|
+
case 5:
|
|
21565
|
+
break;
|
|
21566
|
+
}
|
|
21567
|
+
if (message.pts != null && message.hasOwnProperty("pts")) {
|
|
21568
|
+
if (!$util.isInteger(message.pts) && !(message.pts && $util.isInteger(message.pts.low) && $util.isInteger(message.pts.high)))
|
|
21569
|
+
return "pts: integer|Long expected";
|
|
21570
|
+
}
|
|
21571
|
+
if (message.id != null && message.hasOwnProperty("id")) {
|
|
21572
|
+
if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high)))
|
|
21573
|
+
return "id: integer|Long expected";
|
|
21574
|
+
}
|
|
21575
|
+
if (message.keyframe != null && message.hasOwnProperty("keyframe")) {
|
|
21576
|
+
if (typeof message.keyframe !== "boolean")
|
|
21577
|
+
return "keyframe: boolean expected";
|
|
21578
|
+
}
|
|
21579
|
+
if (message.codecData != null && message.hasOwnProperty("codecData")) {
|
|
21580
|
+
let error = $root.sesame.v1.wire.MediaCodecData.verify(message.codecData);
|
|
21581
|
+
if (error)
|
|
21582
|
+
return "codecData." + error;
|
|
21583
|
+
}
|
|
21584
|
+
if (message.routingMetadata != null && message.hasOwnProperty("routingMetadata")) {
|
|
21585
|
+
if (!$util.isString(message.routingMetadata))
|
|
21586
|
+
return "routingMetadata: string expected";
|
|
21587
|
+
}
|
|
21588
|
+
return null;
|
|
21589
|
+
};
|
|
21590
|
+
FrameHeader2.fromObject = function fromObject(object) {
|
|
21591
|
+
if (object instanceof $root.sesame.v1.wire.FrameHeader)
|
|
21592
|
+
return object;
|
|
21593
|
+
let message = new $root.sesame.v1.wire.FrameHeader();
|
|
21594
|
+
switch (object.type) {
|
|
21595
|
+
default:
|
|
21596
|
+
if (typeof object.type === "number") {
|
|
21597
|
+
message.type = object.type;
|
|
21598
|
+
break;
|
|
21599
|
+
}
|
|
21600
|
+
break;
|
|
21601
|
+
case "FRAME_TYPE_UNSPECIFIED":
|
|
21602
|
+
case 0:
|
|
21603
|
+
message.type = 0;
|
|
21604
|
+
break;
|
|
21605
|
+
case "FRAME_TYPE_RPC":
|
|
21606
|
+
case 1:
|
|
21607
|
+
message.type = 1;
|
|
21608
|
+
break;
|
|
21609
|
+
case "FRAME_TYPE_VIDEO":
|
|
21610
|
+
case 2:
|
|
21611
|
+
message.type = 2;
|
|
21612
|
+
break;
|
|
21613
|
+
case "FRAME_TYPE_AUDIO":
|
|
21614
|
+
case 3:
|
|
21615
|
+
message.type = 3;
|
|
21616
|
+
break;
|
|
21617
|
+
case "FRAME_TYPE_MUXED":
|
|
21618
|
+
case 4:
|
|
21619
|
+
message.type = 4;
|
|
21620
|
+
break;
|
|
21621
|
+
case "FRAME_TYPE_DECODER_DATA":
|
|
21622
|
+
case 5:
|
|
21623
|
+
message.type = 5;
|
|
21624
|
+
break;
|
|
21625
|
+
}
|
|
21626
|
+
if (object.pts != null) {
|
|
21627
|
+
if ($util.Long)
|
|
21628
|
+
(message.pts = $util.Long.fromValue(object.pts)).unsigned = true;
|
|
21629
|
+
else if (typeof object.pts === "string")
|
|
21630
|
+
message.pts = parseInt(object.pts, 10);
|
|
21631
|
+
else if (typeof object.pts === "number")
|
|
21632
|
+
message.pts = object.pts;
|
|
21633
|
+
else if (typeof object.pts === "object")
|
|
21634
|
+
message.pts = new $util.LongBits(object.pts.low >>> 0, object.pts.high >>> 0).toNumber(true);
|
|
21635
|
+
}
|
|
21636
|
+
if (object.id != null) {
|
|
21637
|
+
if ($util.Long)
|
|
21638
|
+
(message.id = $util.Long.fromValue(object.id)).unsigned = true;
|
|
21639
|
+
else if (typeof object.id === "string")
|
|
21640
|
+
message.id = parseInt(object.id, 10);
|
|
21641
|
+
else if (typeof object.id === "number")
|
|
21642
|
+
message.id = object.id;
|
|
21643
|
+
else if (typeof object.id === "object")
|
|
21644
|
+
message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(true);
|
|
21645
|
+
}
|
|
21646
|
+
if (object.keyframe != null)
|
|
21647
|
+
message.keyframe = Boolean(object.keyframe);
|
|
21648
|
+
if (object.codecData != null) {
|
|
21649
|
+
if (typeof object.codecData !== "object")
|
|
21650
|
+
throw TypeError(".sesame.v1.wire.FrameHeader.codecData: object expected");
|
|
21651
|
+
message.codecData = $root.sesame.v1.wire.MediaCodecData.fromObject(object.codecData);
|
|
21652
|
+
}
|
|
21653
|
+
if (object.routingMetadata != null)
|
|
21654
|
+
message.routingMetadata = String(object.routingMetadata);
|
|
21655
|
+
return message;
|
|
21656
|
+
};
|
|
21657
|
+
FrameHeader2.toObject = function toObject(message, options) {
|
|
21658
|
+
if (!options)
|
|
21659
|
+
options = {};
|
|
21660
|
+
let object = {};
|
|
21661
|
+
if (options.defaults) {
|
|
21662
|
+
object.type = options.enums === String ? "FRAME_TYPE_UNSPECIFIED" : 0;
|
|
21663
|
+
if ($util.Long) {
|
|
21664
|
+
let long = new $util.Long(0, 0, true);
|
|
21665
|
+
object.pts = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
|
21666
|
+
} else
|
|
21667
|
+
object.pts = options.longs === String ? "0" : 0;
|
|
21668
|
+
if ($util.Long) {
|
|
21669
|
+
let long = new $util.Long(0, 0, true);
|
|
21670
|
+
object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
|
21671
|
+
} else
|
|
21672
|
+
object.id = options.longs === String ? "0" : 0;
|
|
21673
|
+
object.keyframe = false;
|
|
21674
|
+
object.codecData = null;
|
|
21675
|
+
object.routingMetadata = "";
|
|
21676
|
+
}
|
|
21677
|
+
if (message.type != null && message.hasOwnProperty("type"))
|
|
21678
|
+
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;
|
|
21679
|
+
if (message.pts != null && message.hasOwnProperty("pts"))
|
|
21680
|
+
if (typeof message.pts === "number")
|
|
21681
|
+
object.pts = options.longs === String ? String(message.pts) : message.pts;
|
|
21682
|
+
else
|
|
21683
|
+
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;
|
|
21684
|
+
if (message.id != null && message.hasOwnProperty("id"))
|
|
21685
|
+
if (typeof message.id === "number")
|
|
21686
|
+
object.id = options.longs === String ? String(message.id) : message.id;
|
|
21687
|
+
else
|
|
21688
|
+
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;
|
|
21689
|
+
if (message.keyframe != null && message.hasOwnProperty("keyframe"))
|
|
21690
|
+
object.keyframe = message.keyframe;
|
|
21691
|
+
if (message.codecData != null && message.hasOwnProperty("codecData"))
|
|
21692
|
+
object.codecData = $root.sesame.v1.wire.MediaCodecData.toObject(message.codecData, options);
|
|
21693
|
+
if (message.routingMetadata != null && message.hasOwnProperty("routingMetadata"))
|
|
21694
|
+
object.routingMetadata = message.routingMetadata;
|
|
21695
|
+
return object;
|
|
21696
|
+
};
|
|
21697
|
+
FrameHeader2.prototype.toJSON = function toJSON() {
|
|
21698
|
+
return this.constructor.toObject(this, import_minimal.default.util.toJSONOptions);
|
|
21699
|
+
};
|
|
21700
|
+
FrameHeader2.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
21701
|
+
if (typeUrlPrefix === void 0) {
|
|
21702
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
21703
|
+
}
|
|
21704
|
+
return typeUrlPrefix + "/sesame.v1.wire.FrameHeader";
|
|
21705
|
+
};
|
|
21706
|
+
return FrameHeader2;
|
|
21707
|
+
}();
|
|
21708
|
+
return wire;
|
|
21709
|
+
}();
|
|
21113
21710
|
return v1;
|
|
21114
21711
|
}();
|
|
21115
21712
|
return sesame2;
|
|
@@ -21575,252 +22172,48 @@ var RPCClient = class extends import_events.EventEmitter {
|
|
|
21575
22172
|
// src/sesame-connection.ts
|
|
21576
22173
|
var import_events2 = require("events");
|
|
21577
22174
|
|
|
21578
|
-
// src/sesame-
|
|
21579
|
-
var
|
|
21580
|
-
var
|
|
21581
|
-
var
|
|
21582
|
-
var
|
|
21583
|
-
var
|
|
21584
|
-
var
|
|
21585
|
-
var FLAG_HAS_METADATA = 1 << 1;
|
|
21586
|
-
var FLAG_IS_KEYFRAME = 1 << 2;
|
|
21587
|
-
var PacketType = /* @__PURE__ */ ((PacketType2) => {
|
|
21588
|
-
PacketType2[PacketType2["VIDEO_FRAME"] = 1] = "VIDEO_FRAME";
|
|
21589
|
-
PacketType2[PacketType2["AUDIO_FRAME"] = 2] = "AUDIO_FRAME";
|
|
21590
|
-
PacketType2[PacketType2["RPC"] = 3] = "RPC";
|
|
21591
|
-
PacketType2[PacketType2["MUXED_DATA"] = 4] = "MUXED_DATA";
|
|
21592
|
-
PacketType2[PacketType2["DECODER_DATA"] = 5] = "DECODER_DATA";
|
|
21593
|
-
return PacketType2;
|
|
21594
|
-
})(PacketType || {});
|
|
21595
|
-
var CodecType = /* @__PURE__ */ ((CodecType2) => {
|
|
21596
|
-
CodecType2[CodecType2["VIDEO_VP8"] = 1] = "VIDEO_VP8";
|
|
21597
|
-
CodecType2[CodecType2["VIDEO_VP9"] = 2] = "VIDEO_VP9";
|
|
21598
|
-
CodecType2[CodecType2["VIDEO_AVC"] = 3] = "VIDEO_AVC";
|
|
21599
|
-
CodecType2[CodecType2["VIDEO_HEVC"] = 4] = "VIDEO_HEVC";
|
|
21600
|
-
CodecType2[CodecType2["VIDEO_AV1"] = 5] = "VIDEO_AV1";
|
|
21601
|
-
CodecType2[CodecType2["AUDIO_OPUS"] = 64] = "AUDIO_OPUS";
|
|
21602
|
-
CodecType2[CodecType2["AUDIO_AAC"] = 65] = "AUDIO_AAC";
|
|
21603
|
-
CodecType2[CodecType2["AUDIO_PCM"] = 66] = "AUDIO_PCM";
|
|
21604
|
-
return CodecType2;
|
|
21605
|
-
})(CodecType || {});
|
|
21606
|
-
var SesameBinaryProtocol = class {
|
|
21607
|
-
/**
|
|
21608
|
-
* Initialize a header data structure with proper defaults
|
|
21609
|
-
*/
|
|
21610
|
-
static initHeader(type, flags, pts, id) {
|
|
21611
|
-
return {
|
|
21612
|
-
magic: PROTOCOL_MAGIC,
|
|
21613
|
-
version: PROTOCOL_VERSION,
|
|
21614
|
-
header_size: this.calculateHeaderSize(flags),
|
|
21615
|
-
type,
|
|
21616
|
-
flags,
|
|
21617
|
-
pts,
|
|
21618
|
-
id,
|
|
21619
|
-
reserved: 0
|
|
21620
|
-
// Always zero reserved fields
|
|
21621
|
-
};
|
|
21622
|
-
}
|
|
22175
|
+
// src/sesame-wire-protocol.ts
|
|
22176
|
+
var FrameType = sesame.v1.wire.FrameType;
|
|
22177
|
+
var FrameHeader = sesame.v1.wire.FrameHeader;
|
|
22178
|
+
var MediaCodecData = sesame.v1.wire.MediaCodecData;
|
|
22179
|
+
var CodecType = sesame.v1.wire.CodecType;
|
|
22180
|
+
var PREFIX_SIZE = 4;
|
|
22181
|
+
var WireProtocol = class {
|
|
21623
22182
|
/**
|
|
21624
|
-
*
|
|
22183
|
+
* Serialize a wire frame: 4-byte LE header_size + protobuf FrameHeader + payload.
|
|
21625
22184
|
*/
|
|
21626
|
-
static
|
|
21627
|
-
|
|
21628
|
-
|
|
21629
|
-
|
|
22185
|
+
static serialize(header, payload) {
|
|
22186
|
+
const headerBytes = sesame.v1.wire.FrameHeader.encode(header).finish();
|
|
22187
|
+
const headerSize = headerBytes.length;
|
|
22188
|
+
const payloadSize = payload ? payload.length : 0;
|
|
22189
|
+
const total = PREFIX_SIZE + headerSize + payloadSize;
|
|
22190
|
+
const buffer = new Uint8Array(total);
|
|
22191
|
+
const view = new DataView(buffer.buffer);
|
|
22192
|
+
view.setUint32(0, headerSize, true);
|
|
22193
|
+
buffer.set(headerBytes, PREFIX_SIZE);
|
|
22194
|
+
if (payload && payloadSize > 0) {
|
|
22195
|
+
buffer.set(payload, PREFIX_SIZE + headerSize);
|
|
21630
22196
|
}
|
|
21631
|
-
|
|
21632
|
-
size += HEADER_CODEC_DATA_SIZE;
|
|
21633
|
-
}
|
|
21634
|
-
return size;
|
|
22197
|
+
return buffer;
|
|
21635
22198
|
}
|
|
21636
22199
|
/**
|
|
21637
|
-
*
|
|
22200
|
+
* Parse an incoming wire frame.
|
|
21638
22201
|
*/
|
|
21639
|
-
static
|
|
21640
|
-
|
|
21641
|
-
|
|
21642
|
-
|
|
21643
|
-
|
|
21644
|
-
|
|
22202
|
+
static parse(data) {
|
|
22203
|
+
const result = { valid: false, header: null, payload: null };
|
|
22204
|
+
if (!data || data.length < PREFIX_SIZE) return result;
|
|
22205
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
22206
|
+
const headerSize = view.getUint32(0, true);
|
|
22207
|
+
if (data.length < PREFIX_SIZE + headerSize) return result;
|
|
22208
|
+
try {
|
|
22209
|
+
const headerBytes = data.subarray(PREFIX_SIZE, PREFIX_SIZE + headerSize);
|
|
22210
|
+
result.header = sesame.v1.wire.FrameHeader.decode(headerBytes);
|
|
22211
|
+
result.payload = data.subarray(PREFIX_SIZE + headerSize);
|
|
22212
|
+
result.valid = true;
|
|
22213
|
+
} catch {
|
|
21645
22214
|
}
|
|
21646
|
-
const expectedHeaderSize = this.calculateHeaderSize(header.flags);
|
|
21647
|
-
if (header.header_size !== expectedHeaderSize) {
|
|
21648
|
-
return false;
|
|
21649
|
-
}
|
|
21650
|
-
if (totalSize < header.header_size) {
|
|
21651
|
-
return false;
|
|
21652
|
-
}
|
|
21653
|
-
return true;
|
|
21654
|
-
}
|
|
21655
|
-
/**
|
|
21656
|
-
* Serialize data into a Uint8Array buffer
|
|
21657
|
-
*/
|
|
21658
|
-
static serialize(header, metadata = null, codecData = null, payload = null) {
|
|
21659
|
-
const includeMetadata = metadata !== null && header.flags & FLAG_HAS_METADATA;
|
|
21660
|
-
const includeCodec = codecData !== null && header.flags & FLAG_HAS_CODEC_DATA;
|
|
21661
|
-
let totalSize = HEADER_DATA_SIZE;
|
|
21662
|
-
if (includeMetadata) totalSize += HEADER_METADATA_SIZE;
|
|
21663
|
-
if (includeCodec) totalSize += HEADER_CODEC_DATA_SIZE;
|
|
21664
|
-
if (payload) totalSize += payload.length;
|
|
21665
|
-
header.header_size = totalSize - (payload ? payload.length : 0);
|
|
21666
|
-
const buffer = new ArrayBuffer(totalSize);
|
|
21667
|
-
const view = new DataView(buffer);
|
|
21668
|
-
let offset = 0;
|
|
21669
|
-
view.setUint32(offset, header.magic, true);
|
|
21670
|
-
offset += 4;
|
|
21671
|
-
view.setUint32(offset, header.flags, true);
|
|
21672
|
-
offset += 4;
|
|
21673
|
-
view.setBigUint64(offset, header.pts, true);
|
|
21674
|
-
offset += 8;
|
|
21675
|
-
view.setBigUint64(offset, header.id, true);
|
|
21676
|
-
offset += 8;
|
|
21677
|
-
view.setUint16(offset, header.version, true);
|
|
21678
|
-
offset += 2;
|
|
21679
|
-
view.setUint16(offset, header.header_size, true);
|
|
21680
|
-
offset += 2;
|
|
21681
|
-
view.setUint16(offset, header.type, true);
|
|
21682
|
-
offset += 2;
|
|
21683
|
-
view.setUint16(offset, header.reserved, true);
|
|
21684
|
-
offset += 2;
|
|
21685
|
-
if (includeMetadata && metadata) {
|
|
21686
|
-
const metadataBytes = this.stringToFixedBytes(metadata.metadata, 64);
|
|
21687
|
-
new Uint8Array(buffer, offset, 64).set(metadataBytes);
|
|
21688
|
-
offset += 64;
|
|
21689
|
-
}
|
|
21690
|
-
if (includeCodec && codecData) {
|
|
21691
|
-
view.setUint32(offset, codecData.sample_rate, true);
|
|
21692
|
-
offset += 4;
|
|
21693
|
-
view.setUint32(offset, codecData.timebase_num, true);
|
|
21694
|
-
offset += 4;
|
|
21695
|
-
view.setUint32(offset, codecData.timebase_den, true);
|
|
21696
|
-
offset += 4;
|
|
21697
|
-
view.setUint16(offset, codecData.codec_profile, true);
|
|
21698
|
-
offset += 2;
|
|
21699
|
-
view.setUint16(offset, codecData.codec_level, true);
|
|
21700
|
-
offset += 2;
|
|
21701
|
-
view.setUint16(offset, codecData.width, true);
|
|
21702
|
-
offset += 2;
|
|
21703
|
-
view.setUint16(offset, codecData.height, true);
|
|
21704
|
-
offset += 2;
|
|
21705
|
-
view.setUint8(offset, codecData.codec_type);
|
|
21706
|
-
offset += 1;
|
|
21707
|
-
view.setUint8(offset, codecData.channels);
|
|
21708
|
-
offset += 1;
|
|
21709
|
-
view.setUint8(offset, codecData.bit_depth);
|
|
21710
|
-
offset += 1;
|
|
21711
|
-
view.setUint8(offset, codecData.reserved);
|
|
21712
|
-
offset += 1;
|
|
21713
|
-
}
|
|
21714
|
-
if (payload && payload.length > 0) {
|
|
21715
|
-
new Uint8Array(buffer, offset).set(payload);
|
|
21716
|
-
}
|
|
21717
|
-
return new Uint8Array(buffer);
|
|
21718
|
-
}
|
|
21719
|
-
/**
|
|
21720
|
-
* Parse incoming binary data
|
|
21721
|
-
*/
|
|
21722
|
-
static parseData(data) {
|
|
21723
|
-
const result = {
|
|
21724
|
-
valid: false,
|
|
21725
|
-
header: null,
|
|
21726
|
-
metadata: null,
|
|
21727
|
-
codec_data: null,
|
|
21728
|
-
payload: null,
|
|
21729
|
-
payload_size: 0
|
|
21730
|
-
};
|
|
21731
|
-
if (!data || data.length < 36) {
|
|
21732
|
-
return result;
|
|
21733
|
-
}
|
|
21734
|
-
const view = new DataView(data.buffer, data.byteOffset);
|
|
21735
|
-
let offset = 0;
|
|
21736
|
-
const header = {
|
|
21737
|
-
magic: view.getUint32(offset, true),
|
|
21738
|
-
flags: view.getUint32(offset + 4, true),
|
|
21739
|
-
pts: view.getBigUint64(offset + 8, true),
|
|
21740
|
-
id: view.getBigUint64(offset + 16, true),
|
|
21741
|
-
version: view.getUint16(offset + 24, true),
|
|
21742
|
-
header_size: view.getUint16(offset + 26, true),
|
|
21743
|
-
type: view.getUint16(offset + 28, true),
|
|
21744
|
-
reserved: view.getUint16(offset + 30, true)
|
|
21745
|
-
};
|
|
21746
|
-
offset += HEADER_DATA_SIZE;
|
|
21747
|
-
if (!this.validateHeader(header, data.length)) {
|
|
21748
|
-
return result;
|
|
21749
|
-
}
|
|
21750
|
-
result.header = header;
|
|
21751
|
-
if (header.flags & FLAG_HAS_METADATA) {
|
|
21752
|
-
if (data.length < offset + HEADER_METADATA_SIZE) {
|
|
21753
|
-
return result;
|
|
21754
|
-
}
|
|
21755
|
-
const metadataBytes = data.slice(offset, offset + HEADER_METADATA_SIZE);
|
|
21756
|
-
const metadataStr = this.fixedBytesToString(metadataBytes);
|
|
21757
|
-
result.metadata = { metadata: metadataStr };
|
|
21758
|
-
offset += HEADER_METADATA_SIZE;
|
|
21759
|
-
}
|
|
21760
|
-
if (header.flags & FLAG_HAS_CODEC_DATA) {
|
|
21761
|
-
if (data.length < offset + HEADER_CODEC_DATA_SIZE) {
|
|
21762
|
-
return result;
|
|
21763
|
-
}
|
|
21764
|
-
result.codec_data = {
|
|
21765
|
-
sample_rate: view.getUint32(offset, true),
|
|
21766
|
-
timebase_num: view.getUint32(offset + 4, true),
|
|
21767
|
-
timebase_den: view.getUint32(offset + 8, true),
|
|
21768
|
-
codec_profile: view.getUint16(offset + 12, true),
|
|
21769
|
-
codec_level: view.getUint16(offset + 14, true),
|
|
21770
|
-
width: view.getUint16(offset + 16, true),
|
|
21771
|
-
height: view.getUint16(offset + 18, true),
|
|
21772
|
-
codec_type: view.getUint8(offset + 20),
|
|
21773
|
-
channels: view.getUint8(offset + 21),
|
|
21774
|
-
bit_depth: view.getUint8(offset + 22),
|
|
21775
|
-
reserved: view.getUint8(offset + 23)
|
|
21776
|
-
};
|
|
21777
|
-
offset += HEADER_CODEC_DATA_SIZE;
|
|
21778
|
-
}
|
|
21779
|
-
if (offset < data.length) {
|
|
21780
|
-
result.payload = data.slice(offset);
|
|
21781
|
-
result.payload_size = result.payload.length;
|
|
21782
|
-
} else {
|
|
21783
|
-
result.payload = new Uint8Array(0);
|
|
21784
|
-
result.payload_size = 0;
|
|
21785
|
-
}
|
|
21786
|
-
result.valid = true;
|
|
21787
22215
|
return result;
|
|
21788
22216
|
}
|
|
21789
|
-
/**
|
|
21790
|
-
* Helper: Convert string to fixed-size byte array (null-terminated)
|
|
21791
|
-
*/
|
|
21792
|
-
static stringToFixedBytes(str, size) {
|
|
21793
|
-
const bytes = new Uint8Array(size);
|
|
21794
|
-
let encoded;
|
|
21795
|
-
if (typeof TextEncoder !== "undefined") {
|
|
21796
|
-
const encoder = new TextEncoder();
|
|
21797
|
-
encoded = encoder.encode(str);
|
|
21798
|
-
} else {
|
|
21799
|
-
encoded = new Uint8Array(Buffer.from(str, "utf8"));
|
|
21800
|
-
}
|
|
21801
|
-
const copyLen = Math.min(encoded.length, size - 1);
|
|
21802
|
-
bytes.set(encoded.slice(0, copyLen));
|
|
21803
|
-
bytes[copyLen] = 0;
|
|
21804
|
-
return bytes;
|
|
21805
|
-
}
|
|
21806
|
-
/**
|
|
21807
|
-
* Helper: Convert fixed-size byte array to string (null-terminated)
|
|
21808
|
-
*/
|
|
21809
|
-
static fixedBytesToString(bytes) {
|
|
21810
|
-
let len = bytes.length;
|
|
21811
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
21812
|
-
if (bytes[i] === 0) {
|
|
21813
|
-
len = i;
|
|
21814
|
-
break;
|
|
21815
|
-
}
|
|
21816
|
-
}
|
|
21817
|
-
if (typeof TextDecoder !== "undefined") {
|
|
21818
|
-
const decoder = new TextDecoder();
|
|
21819
|
-
return decoder.decode(bytes.slice(0, len));
|
|
21820
|
-
} else {
|
|
21821
|
-
return Buffer.from(bytes.slice(0, len)).toString("utf8");
|
|
21822
|
-
}
|
|
21823
|
-
}
|
|
21824
22217
|
};
|
|
21825
22218
|
|
|
21826
22219
|
// src/sesame-connection.ts
|
|
@@ -21856,14 +22249,16 @@ var SesameConnection = class extends import_events2.EventEmitter {
|
|
|
21856
22249
|
};
|
|
21857
22250
|
this.messageHandler = (event) => {
|
|
21858
22251
|
if (event.data instanceof ArrayBuffer) {
|
|
21859
|
-
const parsed =
|
|
21860
|
-
if (!parsed.valid)
|
|
21861
|
-
|
|
21862
|
-
|
|
21863
|
-
}
|
|
21864
|
-
|
|
21865
|
-
|
|
22252
|
+
const parsed = WireProtocol.parse(new Uint8Array(event.data));
|
|
22253
|
+
if (!parsed.valid) {
|
|
22254
|
+
this.emit("error", new Error("Invalid packet received"));
|
|
22255
|
+
return;
|
|
22256
|
+
}
|
|
22257
|
+
const frameType = parsed.header?.type;
|
|
22258
|
+
if (frameType === FrameType.FRAME_TYPE_RPC) {
|
|
21866
22259
|
this.emit("rpc", parsed.payload);
|
|
22260
|
+
} else {
|
|
22261
|
+
this.emit("media-packet", parsed);
|
|
21867
22262
|
}
|
|
21868
22263
|
}
|
|
21869
22264
|
};
|
|
@@ -21901,10 +22296,9 @@ var SesameConnection = class extends import_events2.EventEmitter {
|
|
|
21901
22296
|
}
|
|
21902
22297
|
async send(data) {
|
|
21903
22298
|
if (!this.isConnected()) throw new Error("Not connected");
|
|
21904
|
-
const header =
|
|
21905
|
-
const
|
|
21906
|
-
|
|
21907
|
-
this.socket.send(data_to_send);
|
|
22299
|
+
const header = { type: sesame.v1.wire.FrameType.FRAME_TYPE_RPC };
|
|
22300
|
+
const frame = WireProtocol.serialize(header, data);
|
|
22301
|
+
this.socket.send(frame);
|
|
21908
22302
|
return Promise.resolve();
|
|
21909
22303
|
}
|
|
21910
22304
|
async connect() {
|
|
@@ -21994,9 +22388,6 @@ var StatusApi = class {
|
|
|
21994
22388
|
async getIODevices() {
|
|
21995
22389
|
return this.rpc.service.requestIODeviceList(new sesame.v1.common.Empty());
|
|
21996
22390
|
}
|
|
21997
|
-
async requestKeyframe(outputId) {
|
|
21998
|
-
await this.rpc.service.requestKeyframe({ id: outputId });
|
|
21999
|
-
}
|
|
22000
22391
|
};
|
|
22001
22392
|
|
|
22002
22393
|
// src/recorder-api.ts
|
|
@@ -22145,9 +22536,7 @@ var SesameClient = class extends import_events3.EventEmitter {
|
|
|
22145
22536
|
constructor(portOrUrl) {
|
|
22146
22537
|
super();
|
|
22147
22538
|
this.subscriptions = [];
|
|
22148
|
-
this.
|
|
22149
|
-
};
|
|
22150
|
-
this.onAudioPacket = () => {
|
|
22539
|
+
this.onMediaPacket = () => {
|
|
22151
22540
|
};
|
|
22152
22541
|
this.onCallbackMessage = () => {
|
|
22153
22542
|
};
|
|
@@ -22193,8 +22582,7 @@ var SesameClient = class extends import_events3.EventEmitter {
|
|
|
22193
22582
|
this.conn.on("close", () => {
|
|
22194
22583
|
this.emit("disconnected");
|
|
22195
22584
|
});
|
|
22196
|
-
this.conn.on("
|
|
22197
|
-
this.conn.on("audio-packet", (data) => this.onAudioPacket(this.videoSubscriptionId, data));
|
|
22585
|
+
this.conn.on("media-packet", (frame) => this.onMediaPacket(this.mediaSubscriptionId, frame));
|
|
22198
22586
|
this.subscriptions = [];
|
|
22199
22587
|
}
|
|
22200
22588
|
isConnected() {
|
|
@@ -22204,14 +22592,14 @@ var SesameClient = class extends import_events3.EventEmitter {
|
|
|
22204
22592
|
if (!this.isConnected()) return;
|
|
22205
22593
|
const eventTopics = this.subscriptions.map((subscription) => subscription.topic);
|
|
22206
22594
|
const channels = [];
|
|
22207
|
-
if (this.
|
|
22595
|
+
if (this.mediaSubscriptionId) channels.push(`media-stream/${this.mediaSubscriptionId}`);
|
|
22208
22596
|
let subs = { eventTopics, channels };
|
|
22209
22597
|
this.rpc.service.updateSubscriptions(subs).catch((err) => {
|
|
22210
22598
|
log.error(`Failed to update subscriptions: ${err.message}`);
|
|
22211
22599
|
});
|
|
22212
22600
|
}
|
|
22213
|
-
|
|
22214
|
-
this.
|
|
22601
|
+
addMediaSubscription(id) {
|
|
22602
|
+
this.mediaSubscriptionId = id;
|
|
22215
22603
|
this.sendSubscriptions();
|
|
22216
22604
|
}
|
|
22217
22605
|
addSubscription(topic, callback) {
|
|
@@ -22230,6 +22618,9 @@ var SesameClient = class extends import_events3.EventEmitter {
|
|
|
22230
22618
|
getService() {
|
|
22231
22619
|
return this.rpc;
|
|
22232
22620
|
}
|
|
22621
|
+
async requestKeyframe(outputId) {
|
|
22622
|
+
await this.rpc.service.requestKeyframe({ id: outputId });
|
|
22623
|
+
}
|
|
22233
22624
|
async execute(cl) {
|
|
22234
22625
|
cl.filterCreatedAndDestroyedSources();
|
|
22235
22626
|
if (cl.getCommandListMsg().commandList.length > 0) {
|
|
@@ -22253,17 +22644,18 @@ var Event = sesame.v1.rpc.Event;
|
|
|
22253
22644
|
ConnectionState,
|
|
22254
22645
|
EaseKind,
|
|
22255
22646
|
Event,
|
|
22647
|
+
FrameHeader,
|
|
22648
|
+
FrameType,
|
|
22256
22649
|
JobsApi,
|
|
22257
22650
|
Message,
|
|
22258
|
-
PacketType,
|
|
22259
22651
|
RPCClient,
|
|
22260
22652
|
RecorderApi,
|
|
22261
22653
|
Request,
|
|
22262
22654
|
Response,
|
|
22263
|
-
SesameBinaryProtocol,
|
|
22264
22655
|
SesameClient,
|
|
22265
22656
|
SesameConnection,
|
|
22266
22657
|
StatusApi,
|
|
22658
|
+
WireProtocol,
|
|
22267
22659
|
getLogger,
|
|
22268
22660
|
log,
|
|
22269
22661
|
sesame,
|