@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.mjs
CHANGED
|
@@ -21054,6 +21054,602 @@ var sesame = $root.sesame = (() => {
|
|
|
21054
21054
|
}();
|
|
21055
21055
|
return rpc;
|
|
21056
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;
|
|
21652
|
+
}();
|
|
21057
21653
|
return v1;
|
|
21058
21654
|
}();
|
|
21059
21655
|
return sesame2;
|
|
@@ -21519,252 +22115,48 @@ var RPCClient = class extends EventEmitter {
|
|
|
21519
22115
|
// src/sesame-connection.ts
|
|
21520
22116
|
import { EventEmitter as EventEmitter2 } from "events";
|
|
21521
22117
|
|
|
21522
|
-
// src/sesame-
|
|
21523
|
-
var
|
|
21524
|
-
var
|
|
21525
|
-
var
|
|
21526
|
-
var
|
|
21527
|
-
var
|
|
21528
|
-
var
|
|
21529
|
-
var FLAG_HAS_METADATA = 1 << 1;
|
|
21530
|
-
var FLAG_IS_KEYFRAME = 1 << 2;
|
|
21531
|
-
var PacketType = /* @__PURE__ */ ((PacketType2) => {
|
|
21532
|
-
PacketType2[PacketType2["VIDEO_FRAME"] = 1] = "VIDEO_FRAME";
|
|
21533
|
-
PacketType2[PacketType2["AUDIO_FRAME"] = 2] = "AUDIO_FRAME";
|
|
21534
|
-
PacketType2[PacketType2["RPC"] = 3] = "RPC";
|
|
21535
|
-
PacketType2[PacketType2["MUXED_DATA"] = 4] = "MUXED_DATA";
|
|
21536
|
-
PacketType2[PacketType2["DECODER_DATA"] = 5] = "DECODER_DATA";
|
|
21537
|
-
return PacketType2;
|
|
21538
|
-
})(PacketType || {});
|
|
21539
|
-
var CodecType = /* @__PURE__ */ ((CodecType2) => {
|
|
21540
|
-
CodecType2[CodecType2["VIDEO_VP8"] = 1] = "VIDEO_VP8";
|
|
21541
|
-
CodecType2[CodecType2["VIDEO_VP9"] = 2] = "VIDEO_VP9";
|
|
21542
|
-
CodecType2[CodecType2["VIDEO_AVC"] = 3] = "VIDEO_AVC";
|
|
21543
|
-
CodecType2[CodecType2["VIDEO_HEVC"] = 4] = "VIDEO_HEVC";
|
|
21544
|
-
CodecType2[CodecType2["VIDEO_AV1"] = 5] = "VIDEO_AV1";
|
|
21545
|
-
CodecType2[CodecType2["AUDIO_OPUS"] = 64] = "AUDIO_OPUS";
|
|
21546
|
-
CodecType2[CodecType2["AUDIO_AAC"] = 65] = "AUDIO_AAC";
|
|
21547
|
-
CodecType2[CodecType2["AUDIO_PCM"] = 66] = "AUDIO_PCM";
|
|
21548
|
-
return CodecType2;
|
|
21549
|
-
})(CodecType || {});
|
|
21550
|
-
var SesameBinaryProtocol = class {
|
|
21551
|
-
/**
|
|
21552
|
-
* Initialize a header data structure with proper defaults
|
|
21553
|
-
*/
|
|
21554
|
-
static initHeader(type, flags, pts, id) {
|
|
21555
|
-
return {
|
|
21556
|
-
magic: PROTOCOL_MAGIC,
|
|
21557
|
-
version: PROTOCOL_VERSION,
|
|
21558
|
-
header_size: this.calculateHeaderSize(flags),
|
|
21559
|
-
type,
|
|
21560
|
-
flags,
|
|
21561
|
-
pts,
|
|
21562
|
-
id,
|
|
21563
|
-
reserved: 0
|
|
21564
|
-
// Always zero reserved fields
|
|
21565
|
-
};
|
|
21566
|
-
}
|
|
22118
|
+
// src/sesame-wire-protocol.ts
|
|
22119
|
+
var FrameType = sesame.v1.wire.FrameType;
|
|
22120
|
+
var FrameHeader = sesame.v1.wire.FrameHeader;
|
|
22121
|
+
var MediaCodecData = sesame.v1.wire.MediaCodecData;
|
|
22122
|
+
var CodecType = sesame.v1.wire.CodecType;
|
|
22123
|
+
var PREFIX_SIZE = 4;
|
|
22124
|
+
var WireProtocol = class {
|
|
21567
22125
|
/**
|
|
21568
|
-
*
|
|
22126
|
+
* Serialize a wire frame: 4-byte LE header_size + protobuf FrameHeader + payload.
|
|
21569
22127
|
*/
|
|
21570
|
-
static
|
|
21571
|
-
|
|
21572
|
-
|
|
21573
|
-
|
|
22128
|
+
static serialize(header, payload) {
|
|
22129
|
+
const headerBytes = sesame.v1.wire.FrameHeader.encode(header).finish();
|
|
22130
|
+
const headerSize = headerBytes.length;
|
|
22131
|
+
const payloadSize = payload ? payload.length : 0;
|
|
22132
|
+
const total = PREFIX_SIZE + headerSize + payloadSize;
|
|
22133
|
+
const buffer = new Uint8Array(total);
|
|
22134
|
+
const view = new DataView(buffer.buffer);
|
|
22135
|
+
view.setUint32(0, headerSize, true);
|
|
22136
|
+
buffer.set(headerBytes, PREFIX_SIZE);
|
|
22137
|
+
if (payload && payloadSize > 0) {
|
|
22138
|
+
buffer.set(payload, PREFIX_SIZE + headerSize);
|
|
21574
22139
|
}
|
|
21575
|
-
|
|
21576
|
-
size += HEADER_CODEC_DATA_SIZE;
|
|
21577
|
-
}
|
|
21578
|
-
return size;
|
|
22140
|
+
return buffer;
|
|
21579
22141
|
}
|
|
21580
22142
|
/**
|
|
21581
|
-
*
|
|
22143
|
+
* Parse an incoming wire frame.
|
|
21582
22144
|
*/
|
|
21583
|
-
static
|
|
21584
|
-
|
|
21585
|
-
|
|
21586
|
-
|
|
21587
|
-
|
|
21588
|
-
|
|
22145
|
+
static parse(data) {
|
|
22146
|
+
const result = { valid: false, header: null, payload: null };
|
|
22147
|
+
if (!data || data.length < PREFIX_SIZE) return result;
|
|
22148
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
22149
|
+
const headerSize = view.getUint32(0, true);
|
|
22150
|
+
if (data.length < PREFIX_SIZE + headerSize) return result;
|
|
22151
|
+
try {
|
|
22152
|
+
const headerBytes = data.subarray(PREFIX_SIZE, PREFIX_SIZE + headerSize);
|
|
22153
|
+
result.header = sesame.v1.wire.FrameHeader.decode(headerBytes);
|
|
22154
|
+
result.payload = data.subarray(PREFIX_SIZE + headerSize);
|
|
22155
|
+
result.valid = true;
|
|
22156
|
+
} catch {
|
|
21589
22157
|
}
|
|
21590
|
-
const expectedHeaderSize = this.calculateHeaderSize(header.flags);
|
|
21591
|
-
if (header.header_size !== expectedHeaderSize) {
|
|
21592
|
-
return false;
|
|
21593
|
-
}
|
|
21594
|
-
if (totalSize < header.header_size) {
|
|
21595
|
-
return false;
|
|
21596
|
-
}
|
|
21597
|
-
return true;
|
|
21598
|
-
}
|
|
21599
|
-
/**
|
|
21600
|
-
* Serialize data into a Uint8Array buffer
|
|
21601
|
-
*/
|
|
21602
|
-
static serialize(header, metadata = null, codecData = null, payload = null) {
|
|
21603
|
-
const includeMetadata = metadata !== null && header.flags & FLAG_HAS_METADATA;
|
|
21604
|
-
const includeCodec = codecData !== null && header.flags & FLAG_HAS_CODEC_DATA;
|
|
21605
|
-
let totalSize = HEADER_DATA_SIZE;
|
|
21606
|
-
if (includeMetadata) totalSize += HEADER_METADATA_SIZE;
|
|
21607
|
-
if (includeCodec) totalSize += HEADER_CODEC_DATA_SIZE;
|
|
21608
|
-
if (payload) totalSize += payload.length;
|
|
21609
|
-
header.header_size = totalSize - (payload ? payload.length : 0);
|
|
21610
|
-
const buffer = new ArrayBuffer(totalSize);
|
|
21611
|
-
const view = new DataView(buffer);
|
|
21612
|
-
let offset = 0;
|
|
21613
|
-
view.setUint32(offset, header.magic, true);
|
|
21614
|
-
offset += 4;
|
|
21615
|
-
view.setUint32(offset, header.flags, true);
|
|
21616
|
-
offset += 4;
|
|
21617
|
-
view.setBigUint64(offset, header.pts, true);
|
|
21618
|
-
offset += 8;
|
|
21619
|
-
view.setBigUint64(offset, header.id, true);
|
|
21620
|
-
offset += 8;
|
|
21621
|
-
view.setUint16(offset, header.version, true);
|
|
21622
|
-
offset += 2;
|
|
21623
|
-
view.setUint16(offset, header.header_size, true);
|
|
21624
|
-
offset += 2;
|
|
21625
|
-
view.setUint16(offset, header.type, true);
|
|
21626
|
-
offset += 2;
|
|
21627
|
-
view.setUint16(offset, header.reserved, true);
|
|
21628
|
-
offset += 2;
|
|
21629
|
-
if (includeMetadata && metadata) {
|
|
21630
|
-
const metadataBytes = this.stringToFixedBytes(metadata.metadata, 64);
|
|
21631
|
-
new Uint8Array(buffer, offset, 64).set(metadataBytes);
|
|
21632
|
-
offset += 64;
|
|
21633
|
-
}
|
|
21634
|
-
if (includeCodec && codecData) {
|
|
21635
|
-
view.setUint32(offset, codecData.sample_rate, true);
|
|
21636
|
-
offset += 4;
|
|
21637
|
-
view.setUint32(offset, codecData.timebase_num, true);
|
|
21638
|
-
offset += 4;
|
|
21639
|
-
view.setUint32(offset, codecData.timebase_den, true);
|
|
21640
|
-
offset += 4;
|
|
21641
|
-
view.setUint16(offset, codecData.codec_profile, true);
|
|
21642
|
-
offset += 2;
|
|
21643
|
-
view.setUint16(offset, codecData.codec_level, true);
|
|
21644
|
-
offset += 2;
|
|
21645
|
-
view.setUint16(offset, codecData.width, true);
|
|
21646
|
-
offset += 2;
|
|
21647
|
-
view.setUint16(offset, codecData.height, true);
|
|
21648
|
-
offset += 2;
|
|
21649
|
-
view.setUint8(offset, codecData.codec_type);
|
|
21650
|
-
offset += 1;
|
|
21651
|
-
view.setUint8(offset, codecData.channels);
|
|
21652
|
-
offset += 1;
|
|
21653
|
-
view.setUint8(offset, codecData.bit_depth);
|
|
21654
|
-
offset += 1;
|
|
21655
|
-
view.setUint8(offset, codecData.reserved);
|
|
21656
|
-
offset += 1;
|
|
21657
|
-
}
|
|
21658
|
-
if (payload && payload.length > 0) {
|
|
21659
|
-
new Uint8Array(buffer, offset).set(payload);
|
|
21660
|
-
}
|
|
21661
|
-
return new Uint8Array(buffer);
|
|
21662
|
-
}
|
|
21663
|
-
/**
|
|
21664
|
-
* Parse incoming binary data
|
|
21665
|
-
*/
|
|
21666
|
-
static parseData(data) {
|
|
21667
|
-
const result = {
|
|
21668
|
-
valid: false,
|
|
21669
|
-
header: null,
|
|
21670
|
-
metadata: null,
|
|
21671
|
-
codec_data: null,
|
|
21672
|
-
payload: null,
|
|
21673
|
-
payload_size: 0
|
|
21674
|
-
};
|
|
21675
|
-
if (!data || data.length < 36) {
|
|
21676
|
-
return result;
|
|
21677
|
-
}
|
|
21678
|
-
const view = new DataView(data.buffer, data.byteOffset);
|
|
21679
|
-
let offset = 0;
|
|
21680
|
-
const header = {
|
|
21681
|
-
magic: view.getUint32(offset, true),
|
|
21682
|
-
flags: view.getUint32(offset + 4, true),
|
|
21683
|
-
pts: view.getBigUint64(offset + 8, true),
|
|
21684
|
-
id: view.getBigUint64(offset + 16, true),
|
|
21685
|
-
version: view.getUint16(offset + 24, true),
|
|
21686
|
-
header_size: view.getUint16(offset + 26, true),
|
|
21687
|
-
type: view.getUint16(offset + 28, true),
|
|
21688
|
-
reserved: view.getUint16(offset + 30, true)
|
|
21689
|
-
};
|
|
21690
|
-
offset += HEADER_DATA_SIZE;
|
|
21691
|
-
if (!this.validateHeader(header, data.length)) {
|
|
21692
|
-
return result;
|
|
21693
|
-
}
|
|
21694
|
-
result.header = header;
|
|
21695
|
-
if (header.flags & FLAG_HAS_METADATA) {
|
|
21696
|
-
if (data.length < offset + HEADER_METADATA_SIZE) {
|
|
21697
|
-
return result;
|
|
21698
|
-
}
|
|
21699
|
-
const metadataBytes = data.slice(offset, offset + HEADER_METADATA_SIZE);
|
|
21700
|
-
const metadataStr = this.fixedBytesToString(metadataBytes);
|
|
21701
|
-
result.metadata = { metadata: metadataStr };
|
|
21702
|
-
offset += HEADER_METADATA_SIZE;
|
|
21703
|
-
}
|
|
21704
|
-
if (header.flags & FLAG_HAS_CODEC_DATA) {
|
|
21705
|
-
if (data.length < offset + HEADER_CODEC_DATA_SIZE) {
|
|
21706
|
-
return result;
|
|
21707
|
-
}
|
|
21708
|
-
result.codec_data = {
|
|
21709
|
-
sample_rate: view.getUint32(offset, true),
|
|
21710
|
-
timebase_num: view.getUint32(offset + 4, true),
|
|
21711
|
-
timebase_den: view.getUint32(offset + 8, true),
|
|
21712
|
-
codec_profile: view.getUint16(offset + 12, true),
|
|
21713
|
-
codec_level: view.getUint16(offset + 14, true),
|
|
21714
|
-
width: view.getUint16(offset + 16, true),
|
|
21715
|
-
height: view.getUint16(offset + 18, true),
|
|
21716
|
-
codec_type: view.getUint8(offset + 20),
|
|
21717
|
-
channels: view.getUint8(offset + 21),
|
|
21718
|
-
bit_depth: view.getUint8(offset + 22),
|
|
21719
|
-
reserved: view.getUint8(offset + 23)
|
|
21720
|
-
};
|
|
21721
|
-
offset += HEADER_CODEC_DATA_SIZE;
|
|
21722
|
-
}
|
|
21723
|
-
if (offset < data.length) {
|
|
21724
|
-
result.payload = data.slice(offset);
|
|
21725
|
-
result.payload_size = result.payload.length;
|
|
21726
|
-
} else {
|
|
21727
|
-
result.payload = new Uint8Array(0);
|
|
21728
|
-
result.payload_size = 0;
|
|
21729
|
-
}
|
|
21730
|
-
result.valid = true;
|
|
21731
22158
|
return result;
|
|
21732
22159
|
}
|
|
21733
|
-
/**
|
|
21734
|
-
* Helper: Convert string to fixed-size byte array (null-terminated)
|
|
21735
|
-
*/
|
|
21736
|
-
static stringToFixedBytes(str, size) {
|
|
21737
|
-
const bytes = new Uint8Array(size);
|
|
21738
|
-
let encoded;
|
|
21739
|
-
if (typeof TextEncoder !== "undefined") {
|
|
21740
|
-
const encoder = new TextEncoder();
|
|
21741
|
-
encoded = encoder.encode(str);
|
|
21742
|
-
} else {
|
|
21743
|
-
encoded = new Uint8Array(Buffer.from(str, "utf8"));
|
|
21744
|
-
}
|
|
21745
|
-
const copyLen = Math.min(encoded.length, size - 1);
|
|
21746
|
-
bytes.set(encoded.slice(0, copyLen));
|
|
21747
|
-
bytes[copyLen] = 0;
|
|
21748
|
-
return bytes;
|
|
21749
|
-
}
|
|
21750
|
-
/**
|
|
21751
|
-
* Helper: Convert fixed-size byte array to string (null-terminated)
|
|
21752
|
-
*/
|
|
21753
|
-
static fixedBytesToString(bytes) {
|
|
21754
|
-
let len = bytes.length;
|
|
21755
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
21756
|
-
if (bytes[i] === 0) {
|
|
21757
|
-
len = i;
|
|
21758
|
-
break;
|
|
21759
|
-
}
|
|
21760
|
-
}
|
|
21761
|
-
if (typeof TextDecoder !== "undefined") {
|
|
21762
|
-
const decoder = new TextDecoder();
|
|
21763
|
-
return decoder.decode(bytes.slice(0, len));
|
|
21764
|
-
} else {
|
|
21765
|
-
return Buffer.from(bytes.slice(0, len)).toString("utf8");
|
|
21766
|
-
}
|
|
21767
|
-
}
|
|
21768
22160
|
};
|
|
21769
22161
|
|
|
21770
22162
|
// src/sesame-connection.ts
|
|
@@ -21800,14 +22192,16 @@ var SesameConnection = class extends EventEmitter2 {
|
|
|
21800
22192
|
};
|
|
21801
22193
|
this.messageHandler = (event) => {
|
|
21802
22194
|
if (event.data instanceof ArrayBuffer) {
|
|
21803
|
-
const parsed =
|
|
21804
|
-
if (!parsed.valid)
|
|
21805
|
-
|
|
21806
|
-
|
|
21807
|
-
}
|
|
21808
|
-
|
|
21809
|
-
|
|
22195
|
+
const parsed = WireProtocol.parse(new Uint8Array(event.data));
|
|
22196
|
+
if (!parsed.valid) {
|
|
22197
|
+
this.emit("error", new Error("Invalid packet received"));
|
|
22198
|
+
return;
|
|
22199
|
+
}
|
|
22200
|
+
const frameType = parsed.header?.type;
|
|
22201
|
+
if (frameType === FrameType.FRAME_TYPE_RPC) {
|
|
21810
22202
|
this.emit("rpc", parsed.payload);
|
|
22203
|
+
} else {
|
|
22204
|
+
this.emit("media-packet", parsed);
|
|
21811
22205
|
}
|
|
21812
22206
|
}
|
|
21813
22207
|
};
|
|
@@ -21845,10 +22239,9 @@ var SesameConnection = class extends EventEmitter2 {
|
|
|
21845
22239
|
}
|
|
21846
22240
|
async send(data) {
|
|
21847
22241
|
if (!this.isConnected()) throw new Error("Not connected");
|
|
21848
|
-
const header =
|
|
21849
|
-
const
|
|
21850
|
-
|
|
21851
|
-
this.socket.send(data_to_send);
|
|
22242
|
+
const header = { type: sesame.v1.wire.FrameType.FRAME_TYPE_RPC };
|
|
22243
|
+
const frame = WireProtocol.serialize(header, data);
|
|
22244
|
+
this.socket.send(frame);
|
|
21852
22245
|
return Promise.resolve();
|
|
21853
22246
|
}
|
|
21854
22247
|
async connect() {
|
|
@@ -21938,9 +22331,6 @@ var StatusApi = class {
|
|
|
21938
22331
|
async getIODevices() {
|
|
21939
22332
|
return this.rpc.service.requestIODeviceList(new sesame.v1.common.Empty());
|
|
21940
22333
|
}
|
|
21941
|
-
async requestKeyframe(outputId) {
|
|
21942
|
-
await this.rpc.service.requestKeyframe({ id: outputId });
|
|
21943
|
-
}
|
|
21944
22334
|
};
|
|
21945
22335
|
|
|
21946
22336
|
// src/recorder-api.ts
|
|
@@ -22089,9 +22479,7 @@ var SesameClient = class extends EventEmitter3 {
|
|
|
22089
22479
|
constructor(portOrUrl) {
|
|
22090
22480
|
super();
|
|
22091
22481
|
this.subscriptions = [];
|
|
22092
|
-
this.
|
|
22093
|
-
};
|
|
22094
|
-
this.onAudioPacket = () => {
|
|
22482
|
+
this.onMediaPacket = () => {
|
|
22095
22483
|
};
|
|
22096
22484
|
this.onCallbackMessage = () => {
|
|
22097
22485
|
};
|
|
@@ -22137,8 +22525,7 @@ var SesameClient = class extends EventEmitter3 {
|
|
|
22137
22525
|
this.conn.on("close", () => {
|
|
22138
22526
|
this.emit("disconnected");
|
|
22139
22527
|
});
|
|
22140
|
-
this.conn.on("
|
|
22141
|
-
this.conn.on("audio-packet", (data) => this.onAudioPacket(this.videoSubscriptionId, data));
|
|
22528
|
+
this.conn.on("media-packet", (frame) => this.onMediaPacket(this.mediaSubscriptionId, frame));
|
|
22142
22529
|
this.subscriptions = [];
|
|
22143
22530
|
}
|
|
22144
22531
|
isConnected() {
|
|
@@ -22148,14 +22535,14 @@ var SesameClient = class extends EventEmitter3 {
|
|
|
22148
22535
|
if (!this.isConnected()) return;
|
|
22149
22536
|
const eventTopics = this.subscriptions.map((subscription) => subscription.topic);
|
|
22150
22537
|
const channels = [];
|
|
22151
|
-
if (this.
|
|
22538
|
+
if (this.mediaSubscriptionId) channels.push(`media-stream/${this.mediaSubscriptionId}`);
|
|
22152
22539
|
let subs = { eventTopics, channels };
|
|
22153
22540
|
this.rpc.service.updateSubscriptions(subs).catch((err) => {
|
|
22154
22541
|
log.error(`Failed to update subscriptions: ${err.message}`);
|
|
22155
22542
|
});
|
|
22156
22543
|
}
|
|
22157
|
-
|
|
22158
|
-
this.
|
|
22544
|
+
addMediaSubscription(id) {
|
|
22545
|
+
this.mediaSubscriptionId = id;
|
|
22159
22546
|
this.sendSubscriptions();
|
|
22160
22547
|
}
|
|
22161
22548
|
addSubscription(topic, callback) {
|
|
@@ -22174,6 +22561,9 @@ var SesameClient = class extends EventEmitter3 {
|
|
|
22174
22561
|
getService() {
|
|
22175
22562
|
return this.rpc;
|
|
22176
22563
|
}
|
|
22564
|
+
async requestKeyframe(outputId) {
|
|
22565
|
+
await this.rpc.service.requestKeyframe({ id: outputId });
|
|
22566
|
+
}
|
|
22177
22567
|
async execute(cl) {
|
|
22178
22568
|
cl.filterCreatedAndDestroyedSources();
|
|
22179
22569
|
if (cl.getCommandListMsg().commandList.length > 0) {
|
|
@@ -22196,17 +22586,18 @@ export {
|
|
|
22196
22586
|
ConnectionState,
|
|
22197
22587
|
EaseKind,
|
|
22198
22588
|
Event,
|
|
22589
|
+
FrameHeader,
|
|
22590
|
+
FrameType,
|
|
22199
22591
|
JobsApi,
|
|
22200
22592
|
Message,
|
|
22201
|
-
PacketType,
|
|
22202
22593
|
RPCClient,
|
|
22203
22594
|
RecorderApi,
|
|
22204
22595
|
Request,
|
|
22205
22596
|
Response,
|
|
22206
|
-
SesameBinaryProtocol,
|
|
22207
22597
|
SesameClient,
|
|
22208
22598
|
SesameConnection,
|
|
22209
22599
|
StatusApi,
|
|
22600
|
+
WireProtocol,
|
|
22210
22601
|
getLogger,
|
|
22211
22602
|
log,
|
|
22212
22603
|
sesame,
|