@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.browser.mjs
CHANGED
|
@@ -21449,6 +21449,602 @@ var sesame = $root.sesame = (() => {
|
|
|
21449
21449
|
}();
|
|
21450
21450
|
return rpc;
|
|
21451
21451
|
}();
|
|
21452
|
+
v1.wire = function() {
|
|
21453
|
+
const wire = {};
|
|
21454
|
+
wire.FrameType = function() {
|
|
21455
|
+
const valuesById = {}, values = Object.create(valuesById);
|
|
21456
|
+
values[valuesById[0] = "FRAME_TYPE_UNSPECIFIED"] = 0;
|
|
21457
|
+
values[valuesById[1] = "FRAME_TYPE_RPC"] = 1;
|
|
21458
|
+
values[valuesById[2] = "FRAME_TYPE_VIDEO"] = 2;
|
|
21459
|
+
values[valuesById[3] = "FRAME_TYPE_AUDIO"] = 3;
|
|
21460
|
+
values[valuesById[4] = "FRAME_TYPE_MUXED"] = 4;
|
|
21461
|
+
values[valuesById[5] = "FRAME_TYPE_DECODER_DATA"] = 5;
|
|
21462
|
+
return values;
|
|
21463
|
+
}();
|
|
21464
|
+
wire.CodecType = function() {
|
|
21465
|
+
const valuesById = {}, values = Object.create(valuesById);
|
|
21466
|
+
values[valuesById[0] = "CODEC_TYPE_UNSPECIFIED"] = 0;
|
|
21467
|
+
values[valuesById[1] = "CODEC_TYPE_VIDEO_VP8"] = 1;
|
|
21468
|
+
values[valuesById[2] = "CODEC_TYPE_VIDEO_VP9"] = 2;
|
|
21469
|
+
values[valuesById[3] = "CODEC_TYPE_VIDEO_AVC"] = 3;
|
|
21470
|
+
values[valuesById[4] = "CODEC_TYPE_VIDEO_HEVC"] = 4;
|
|
21471
|
+
values[valuesById[5] = "CODEC_TYPE_VIDEO_AV1"] = 5;
|
|
21472
|
+
values[valuesById[64] = "CODEC_TYPE_AUDIO_OPUS"] = 64;
|
|
21473
|
+
values[valuesById[65] = "CODEC_TYPE_AUDIO_AAC"] = 65;
|
|
21474
|
+
values[valuesById[66] = "CODEC_TYPE_AUDIO_PCM"] = 66;
|
|
21475
|
+
return values;
|
|
21476
|
+
}();
|
|
21477
|
+
wire.MediaCodecData = function() {
|
|
21478
|
+
function MediaCodecData2(properties) {
|
|
21479
|
+
if (properties) {
|
|
21480
|
+
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
21481
|
+
if (properties[keys[i]] != null)
|
|
21482
|
+
this[keys[i]] = properties[keys[i]];
|
|
21483
|
+
}
|
|
21484
|
+
}
|
|
21485
|
+
MediaCodecData2.prototype.codecType = 0;
|
|
21486
|
+
MediaCodecData2.prototype.sampleRate = 0;
|
|
21487
|
+
MediaCodecData2.prototype.timebaseNum = 0;
|
|
21488
|
+
MediaCodecData2.prototype.timebaseDen = 0;
|
|
21489
|
+
MediaCodecData2.prototype.codecProfile = 0;
|
|
21490
|
+
MediaCodecData2.prototype.codecLevel = 0;
|
|
21491
|
+
MediaCodecData2.prototype.width = 0;
|
|
21492
|
+
MediaCodecData2.prototype.height = 0;
|
|
21493
|
+
MediaCodecData2.prototype.channels = 0;
|
|
21494
|
+
MediaCodecData2.prototype.bitDepth = 0;
|
|
21495
|
+
MediaCodecData2.create = function create(properties) {
|
|
21496
|
+
return new MediaCodecData2(properties);
|
|
21497
|
+
};
|
|
21498
|
+
MediaCodecData2.encode = function encode(message, writer) {
|
|
21499
|
+
if (!writer)
|
|
21500
|
+
writer = $Writer.create();
|
|
21501
|
+
if (message.codecType != null && Object.hasOwnProperty.call(message, "codecType"))
|
|
21502
|
+
writer.uint32(
|
|
21503
|
+
/* id 1, wireType 0 =*/
|
|
21504
|
+
8
|
|
21505
|
+
).int32(message.codecType);
|
|
21506
|
+
if (message.sampleRate != null && Object.hasOwnProperty.call(message, "sampleRate"))
|
|
21507
|
+
writer.uint32(
|
|
21508
|
+
/* id 2, wireType 0 =*/
|
|
21509
|
+
16
|
|
21510
|
+
).uint32(message.sampleRate);
|
|
21511
|
+
if (message.timebaseNum != null && Object.hasOwnProperty.call(message, "timebaseNum"))
|
|
21512
|
+
writer.uint32(
|
|
21513
|
+
/* id 3, wireType 0 =*/
|
|
21514
|
+
24
|
|
21515
|
+
).uint32(message.timebaseNum);
|
|
21516
|
+
if (message.timebaseDen != null && Object.hasOwnProperty.call(message, "timebaseDen"))
|
|
21517
|
+
writer.uint32(
|
|
21518
|
+
/* id 4, wireType 0 =*/
|
|
21519
|
+
32
|
|
21520
|
+
).uint32(message.timebaseDen);
|
|
21521
|
+
if (message.codecProfile != null && Object.hasOwnProperty.call(message, "codecProfile"))
|
|
21522
|
+
writer.uint32(
|
|
21523
|
+
/* id 5, wireType 0 =*/
|
|
21524
|
+
40
|
|
21525
|
+
).uint32(message.codecProfile);
|
|
21526
|
+
if (message.codecLevel != null && Object.hasOwnProperty.call(message, "codecLevel"))
|
|
21527
|
+
writer.uint32(
|
|
21528
|
+
/* id 6, wireType 0 =*/
|
|
21529
|
+
48
|
|
21530
|
+
).uint32(message.codecLevel);
|
|
21531
|
+
if (message.width != null && Object.hasOwnProperty.call(message, "width"))
|
|
21532
|
+
writer.uint32(
|
|
21533
|
+
/* id 7, wireType 0 =*/
|
|
21534
|
+
56
|
|
21535
|
+
).uint32(message.width);
|
|
21536
|
+
if (message.height != null && Object.hasOwnProperty.call(message, "height"))
|
|
21537
|
+
writer.uint32(
|
|
21538
|
+
/* id 8, wireType 0 =*/
|
|
21539
|
+
64
|
|
21540
|
+
).uint32(message.height);
|
|
21541
|
+
if (message.channels != null && Object.hasOwnProperty.call(message, "channels"))
|
|
21542
|
+
writer.uint32(
|
|
21543
|
+
/* id 9, wireType 0 =*/
|
|
21544
|
+
72
|
|
21545
|
+
).uint32(message.channels);
|
|
21546
|
+
if (message.bitDepth != null && Object.hasOwnProperty.call(message, "bitDepth"))
|
|
21547
|
+
writer.uint32(
|
|
21548
|
+
/* id 10, wireType 0 =*/
|
|
21549
|
+
80
|
|
21550
|
+
).uint32(message.bitDepth);
|
|
21551
|
+
return writer;
|
|
21552
|
+
};
|
|
21553
|
+
MediaCodecData2.encodeDelimited = function encodeDelimited(message, writer) {
|
|
21554
|
+
return this.encode(message, writer).ldelim();
|
|
21555
|
+
};
|
|
21556
|
+
MediaCodecData2.decode = function decode(reader, length, error) {
|
|
21557
|
+
if (!(reader instanceof $Reader))
|
|
21558
|
+
reader = $Reader.create(reader);
|
|
21559
|
+
let end = length === void 0 ? reader.len : reader.pos + length, message = new $root.sesame.v1.wire.MediaCodecData();
|
|
21560
|
+
while (reader.pos < end) {
|
|
21561
|
+
let tag = reader.uint32();
|
|
21562
|
+
if (tag === error)
|
|
21563
|
+
break;
|
|
21564
|
+
switch (tag >>> 3) {
|
|
21565
|
+
case 1: {
|
|
21566
|
+
message.codecType = reader.int32();
|
|
21567
|
+
break;
|
|
21568
|
+
}
|
|
21569
|
+
case 2: {
|
|
21570
|
+
message.sampleRate = reader.uint32();
|
|
21571
|
+
break;
|
|
21572
|
+
}
|
|
21573
|
+
case 3: {
|
|
21574
|
+
message.timebaseNum = reader.uint32();
|
|
21575
|
+
break;
|
|
21576
|
+
}
|
|
21577
|
+
case 4: {
|
|
21578
|
+
message.timebaseDen = reader.uint32();
|
|
21579
|
+
break;
|
|
21580
|
+
}
|
|
21581
|
+
case 5: {
|
|
21582
|
+
message.codecProfile = reader.uint32();
|
|
21583
|
+
break;
|
|
21584
|
+
}
|
|
21585
|
+
case 6: {
|
|
21586
|
+
message.codecLevel = reader.uint32();
|
|
21587
|
+
break;
|
|
21588
|
+
}
|
|
21589
|
+
case 7: {
|
|
21590
|
+
message.width = reader.uint32();
|
|
21591
|
+
break;
|
|
21592
|
+
}
|
|
21593
|
+
case 8: {
|
|
21594
|
+
message.height = reader.uint32();
|
|
21595
|
+
break;
|
|
21596
|
+
}
|
|
21597
|
+
case 9: {
|
|
21598
|
+
message.channels = reader.uint32();
|
|
21599
|
+
break;
|
|
21600
|
+
}
|
|
21601
|
+
case 10: {
|
|
21602
|
+
message.bitDepth = reader.uint32();
|
|
21603
|
+
break;
|
|
21604
|
+
}
|
|
21605
|
+
default:
|
|
21606
|
+
reader.skipType(tag & 7);
|
|
21607
|
+
break;
|
|
21608
|
+
}
|
|
21609
|
+
}
|
|
21610
|
+
return message;
|
|
21611
|
+
};
|
|
21612
|
+
MediaCodecData2.decodeDelimited = function decodeDelimited(reader) {
|
|
21613
|
+
if (!(reader instanceof $Reader))
|
|
21614
|
+
reader = new $Reader(reader);
|
|
21615
|
+
return this.decode(reader, reader.uint32());
|
|
21616
|
+
};
|
|
21617
|
+
MediaCodecData2.verify = function verify(message) {
|
|
21618
|
+
if (typeof message !== "object" || message === null)
|
|
21619
|
+
return "object expected";
|
|
21620
|
+
if (message.codecType != null && message.hasOwnProperty("codecType"))
|
|
21621
|
+
switch (message.codecType) {
|
|
21622
|
+
default:
|
|
21623
|
+
return "codecType: enum value expected";
|
|
21624
|
+
case 0:
|
|
21625
|
+
case 1:
|
|
21626
|
+
case 2:
|
|
21627
|
+
case 3:
|
|
21628
|
+
case 4:
|
|
21629
|
+
case 5:
|
|
21630
|
+
case 64:
|
|
21631
|
+
case 65:
|
|
21632
|
+
case 66:
|
|
21633
|
+
break;
|
|
21634
|
+
}
|
|
21635
|
+
if (message.sampleRate != null && message.hasOwnProperty("sampleRate")) {
|
|
21636
|
+
if (!$util.isInteger(message.sampleRate))
|
|
21637
|
+
return "sampleRate: integer expected";
|
|
21638
|
+
}
|
|
21639
|
+
if (message.timebaseNum != null && message.hasOwnProperty("timebaseNum")) {
|
|
21640
|
+
if (!$util.isInteger(message.timebaseNum))
|
|
21641
|
+
return "timebaseNum: integer expected";
|
|
21642
|
+
}
|
|
21643
|
+
if (message.timebaseDen != null && message.hasOwnProperty("timebaseDen")) {
|
|
21644
|
+
if (!$util.isInteger(message.timebaseDen))
|
|
21645
|
+
return "timebaseDen: integer expected";
|
|
21646
|
+
}
|
|
21647
|
+
if (message.codecProfile != null && message.hasOwnProperty("codecProfile")) {
|
|
21648
|
+
if (!$util.isInteger(message.codecProfile))
|
|
21649
|
+
return "codecProfile: integer expected";
|
|
21650
|
+
}
|
|
21651
|
+
if (message.codecLevel != null && message.hasOwnProperty("codecLevel")) {
|
|
21652
|
+
if (!$util.isInteger(message.codecLevel))
|
|
21653
|
+
return "codecLevel: integer expected";
|
|
21654
|
+
}
|
|
21655
|
+
if (message.width != null && message.hasOwnProperty("width")) {
|
|
21656
|
+
if (!$util.isInteger(message.width))
|
|
21657
|
+
return "width: integer expected";
|
|
21658
|
+
}
|
|
21659
|
+
if (message.height != null && message.hasOwnProperty("height")) {
|
|
21660
|
+
if (!$util.isInteger(message.height))
|
|
21661
|
+
return "height: integer expected";
|
|
21662
|
+
}
|
|
21663
|
+
if (message.channels != null && message.hasOwnProperty("channels")) {
|
|
21664
|
+
if (!$util.isInteger(message.channels))
|
|
21665
|
+
return "channels: integer expected";
|
|
21666
|
+
}
|
|
21667
|
+
if (message.bitDepth != null && message.hasOwnProperty("bitDepth")) {
|
|
21668
|
+
if (!$util.isInteger(message.bitDepth))
|
|
21669
|
+
return "bitDepth: integer expected";
|
|
21670
|
+
}
|
|
21671
|
+
return null;
|
|
21672
|
+
};
|
|
21673
|
+
MediaCodecData2.fromObject = function fromObject(object) {
|
|
21674
|
+
if (object instanceof $root.sesame.v1.wire.MediaCodecData)
|
|
21675
|
+
return object;
|
|
21676
|
+
let message = new $root.sesame.v1.wire.MediaCodecData();
|
|
21677
|
+
switch (object.codecType) {
|
|
21678
|
+
default:
|
|
21679
|
+
if (typeof object.codecType === "number") {
|
|
21680
|
+
message.codecType = object.codecType;
|
|
21681
|
+
break;
|
|
21682
|
+
}
|
|
21683
|
+
break;
|
|
21684
|
+
case "CODEC_TYPE_UNSPECIFIED":
|
|
21685
|
+
case 0:
|
|
21686
|
+
message.codecType = 0;
|
|
21687
|
+
break;
|
|
21688
|
+
case "CODEC_TYPE_VIDEO_VP8":
|
|
21689
|
+
case 1:
|
|
21690
|
+
message.codecType = 1;
|
|
21691
|
+
break;
|
|
21692
|
+
case "CODEC_TYPE_VIDEO_VP9":
|
|
21693
|
+
case 2:
|
|
21694
|
+
message.codecType = 2;
|
|
21695
|
+
break;
|
|
21696
|
+
case "CODEC_TYPE_VIDEO_AVC":
|
|
21697
|
+
case 3:
|
|
21698
|
+
message.codecType = 3;
|
|
21699
|
+
break;
|
|
21700
|
+
case "CODEC_TYPE_VIDEO_HEVC":
|
|
21701
|
+
case 4:
|
|
21702
|
+
message.codecType = 4;
|
|
21703
|
+
break;
|
|
21704
|
+
case "CODEC_TYPE_VIDEO_AV1":
|
|
21705
|
+
case 5:
|
|
21706
|
+
message.codecType = 5;
|
|
21707
|
+
break;
|
|
21708
|
+
case "CODEC_TYPE_AUDIO_OPUS":
|
|
21709
|
+
case 64:
|
|
21710
|
+
message.codecType = 64;
|
|
21711
|
+
break;
|
|
21712
|
+
case "CODEC_TYPE_AUDIO_AAC":
|
|
21713
|
+
case 65:
|
|
21714
|
+
message.codecType = 65;
|
|
21715
|
+
break;
|
|
21716
|
+
case "CODEC_TYPE_AUDIO_PCM":
|
|
21717
|
+
case 66:
|
|
21718
|
+
message.codecType = 66;
|
|
21719
|
+
break;
|
|
21720
|
+
}
|
|
21721
|
+
if (object.sampleRate != null)
|
|
21722
|
+
message.sampleRate = object.sampleRate >>> 0;
|
|
21723
|
+
if (object.timebaseNum != null)
|
|
21724
|
+
message.timebaseNum = object.timebaseNum >>> 0;
|
|
21725
|
+
if (object.timebaseDen != null)
|
|
21726
|
+
message.timebaseDen = object.timebaseDen >>> 0;
|
|
21727
|
+
if (object.codecProfile != null)
|
|
21728
|
+
message.codecProfile = object.codecProfile >>> 0;
|
|
21729
|
+
if (object.codecLevel != null)
|
|
21730
|
+
message.codecLevel = object.codecLevel >>> 0;
|
|
21731
|
+
if (object.width != null)
|
|
21732
|
+
message.width = object.width >>> 0;
|
|
21733
|
+
if (object.height != null)
|
|
21734
|
+
message.height = object.height >>> 0;
|
|
21735
|
+
if (object.channels != null)
|
|
21736
|
+
message.channels = object.channels >>> 0;
|
|
21737
|
+
if (object.bitDepth != null)
|
|
21738
|
+
message.bitDepth = object.bitDepth >>> 0;
|
|
21739
|
+
return message;
|
|
21740
|
+
};
|
|
21741
|
+
MediaCodecData2.toObject = function toObject(message, options) {
|
|
21742
|
+
if (!options)
|
|
21743
|
+
options = {};
|
|
21744
|
+
let object = {};
|
|
21745
|
+
if (options.defaults) {
|
|
21746
|
+
object.codecType = options.enums === String ? "CODEC_TYPE_UNSPECIFIED" : 0;
|
|
21747
|
+
object.sampleRate = 0;
|
|
21748
|
+
object.timebaseNum = 0;
|
|
21749
|
+
object.timebaseDen = 0;
|
|
21750
|
+
object.codecProfile = 0;
|
|
21751
|
+
object.codecLevel = 0;
|
|
21752
|
+
object.width = 0;
|
|
21753
|
+
object.height = 0;
|
|
21754
|
+
object.channels = 0;
|
|
21755
|
+
object.bitDepth = 0;
|
|
21756
|
+
}
|
|
21757
|
+
if (message.codecType != null && message.hasOwnProperty("codecType"))
|
|
21758
|
+
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;
|
|
21759
|
+
if (message.sampleRate != null && message.hasOwnProperty("sampleRate"))
|
|
21760
|
+
object.sampleRate = message.sampleRate;
|
|
21761
|
+
if (message.timebaseNum != null && message.hasOwnProperty("timebaseNum"))
|
|
21762
|
+
object.timebaseNum = message.timebaseNum;
|
|
21763
|
+
if (message.timebaseDen != null && message.hasOwnProperty("timebaseDen"))
|
|
21764
|
+
object.timebaseDen = message.timebaseDen;
|
|
21765
|
+
if (message.codecProfile != null && message.hasOwnProperty("codecProfile"))
|
|
21766
|
+
object.codecProfile = message.codecProfile;
|
|
21767
|
+
if (message.codecLevel != null && message.hasOwnProperty("codecLevel"))
|
|
21768
|
+
object.codecLevel = message.codecLevel;
|
|
21769
|
+
if (message.width != null && message.hasOwnProperty("width"))
|
|
21770
|
+
object.width = message.width;
|
|
21771
|
+
if (message.height != null && message.hasOwnProperty("height"))
|
|
21772
|
+
object.height = message.height;
|
|
21773
|
+
if (message.channels != null && message.hasOwnProperty("channels"))
|
|
21774
|
+
object.channels = message.channels;
|
|
21775
|
+
if (message.bitDepth != null && message.hasOwnProperty("bitDepth"))
|
|
21776
|
+
object.bitDepth = message.bitDepth;
|
|
21777
|
+
return object;
|
|
21778
|
+
};
|
|
21779
|
+
MediaCodecData2.prototype.toJSON = function toJSON() {
|
|
21780
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
21781
|
+
};
|
|
21782
|
+
MediaCodecData2.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
21783
|
+
if (typeUrlPrefix === void 0) {
|
|
21784
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
21785
|
+
}
|
|
21786
|
+
return typeUrlPrefix + "/sesame.v1.wire.MediaCodecData";
|
|
21787
|
+
};
|
|
21788
|
+
return MediaCodecData2;
|
|
21789
|
+
}();
|
|
21790
|
+
wire.FrameHeader = function() {
|
|
21791
|
+
function FrameHeader2(properties) {
|
|
21792
|
+
if (properties) {
|
|
21793
|
+
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
21794
|
+
if (properties[keys[i]] != null)
|
|
21795
|
+
this[keys[i]] = properties[keys[i]];
|
|
21796
|
+
}
|
|
21797
|
+
}
|
|
21798
|
+
FrameHeader2.prototype.type = 0;
|
|
21799
|
+
FrameHeader2.prototype.pts = $util.Long ? $util.Long.fromBits(0, 0, true) : 0;
|
|
21800
|
+
FrameHeader2.prototype.id = $util.Long ? $util.Long.fromBits(0, 0, true) : 0;
|
|
21801
|
+
FrameHeader2.prototype.keyframe = false;
|
|
21802
|
+
FrameHeader2.prototype.codecData = null;
|
|
21803
|
+
FrameHeader2.prototype.routingMetadata = "";
|
|
21804
|
+
FrameHeader2.create = function create(properties) {
|
|
21805
|
+
return new FrameHeader2(properties);
|
|
21806
|
+
};
|
|
21807
|
+
FrameHeader2.encode = function encode(message, writer) {
|
|
21808
|
+
if (!writer)
|
|
21809
|
+
writer = $Writer.create();
|
|
21810
|
+
if (message.type != null && Object.hasOwnProperty.call(message, "type"))
|
|
21811
|
+
writer.uint32(
|
|
21812
|
+
/* id 1, wireType 0 =*/
|
|
21813
|
+
8
|
|
21814
|
+
).int32(message.type);
|
|
21815
|
+
if (message.pts != null && Object.hasOwnProperty.call(message, "pts"))
|
|
21816
|
+
writer.uint32(
|
|
21817
|
+
/* id 2, wireType 0 =*/
|
|
21818
|
+
16
|
|
21819
|
+
).uint64(message.pts);
|
|
21820
|
+
if (message.id != null && Object.hasOwnProperty.call(message, "id"))
|
|
21821
|
+
writer.uint32(
|
|
21822
|
+
/* id 3, wireType 0 =*/
|
|
21823
|
+
24
|
|
21824
|
+
).uint64(message.id);
|
|
21825
|
+
if (message.keyframe != null && Object.hasOwnProperty.call(message, "keyframe"))
|
|
21826
|
+
writer.uint32(
|
|
21827
|
+
/* id 4, wireType 0 =*/
|
|
21828
|
+
32
|
|
21829
|
+
).bool(message.keyframe);
|
|
21830
|
+
if (message.codecData != null && Object.hasOwnProperty.call(message, "codecData"))
|
|
21831
|
+
$root.sesame.v1.wire.MediaCodecData.encode(message.codecData, writer.uint32(
|
|
21832
|
+
/* id 5, wireType 2 =*/
|
|
21833
|
+
42
|
|
21834
|
+
).fork()).ldelim();
|
|
21835
|
+
if (message.routingMetadata != null && Object.hasOwnProperty.call(message, "routingMetadata"))
|
|
21836
|
+
writer.uint32(
|
|
21837
|
+
/* id 6, wireType 2 =*/
|
|
21838
|
+
50
|
|
21839
|
+
).string(message.routingMetadata);
|
|
21840
|
+
return writer;
|
|
21841
|
+
};
|
|
21842
|
+
FrameHeader2.encodeDelimited = function encodeDelimited(message, writer) {
|
|
21843
|
+
return this.encode(message, writer).ldelim();
|
|
21844
|
+
};
|
|
21845
|
+
FrameHeader2.decode = function decode(reader, length, error) {
|
|
21846
|
+
if (!(reader instanceof $Reader))
|
|
21847
|
+
reader = $Reader.create(reader);
|
|
21848
|
+
let end = length === void 0 ? reader.len : reader.pos + length, message = new $root.sesame.v1.wire.FrameHeader();
|
|
21849
|
+
while (reader.pos < end) {
|
|
21850
|
+
let tag = reader.uint32();
|
|
21851
|
+
if (tag === error)
|
|
21852
|
+
break;
|
|
21853
|
+
switch (tag >>> 3) {
|
|
21854
|
+
case 1: {
|
|
21855
|
+
message.type = reader.int32();
|
|
21856
|
+
break;
|
|
21857
|
+
}
|
|
21858
|
+
case 2: {
|
|
21859
|
+
message.pts = reader.uint64();
|
|
21860
|
+
break;
|
|
21861
|
+
}
|
|
21862
|
+
case 3: {
|
|
21863
|
+
message.id = reader.uint64();
|
|
21864
|
+
break;
|
|
21865
|
+
}
|
|
21866
|
+
case 4: {
|
|
21867
|
+
message.keyframe = reader.bool();
|
|
21868
|
+
break;
|
|
21869
|
+
}
|
|
21870
|
+
case 5: {
|
|
21871
|
+
message.codecData = $root.sesame.v1.wire.MediaCodecData.decode(reader, reader.uint32());
|
|
21872
|
+
break;
|
|
21873
|
+
}
|
|
21874
|
+
case 6: {
|
|
21875
|
+
message.routingMetadata = reader.string();
|
|
21876
|
+
break;
|
|
21877
|
+
}
|
|
21878
|
+
default:
|
|
21879
|
+
reader.skipType(tag & 7);
|
|
21880
|
+
break;
|
|
21881
|
+
}
|
|
21882
|
+
}
|
|
21883
|
+
return message;
|
|
21884
|
+
};
|
|
21885
|
+
FrameHeader2.decodeDelimited = function decodeDelimited(reader) {
|
|
21886
|
+
if (!(reader instanceof $Reader))
|
|
21887
|
+
reader = new $Reader(reader);
|
|
21888
|
+
return this.decode(reader, reader.uint32());
|
|
21889
|
+
};
|
|
21890
|
+
FrameHeader2.verify = function verify(message) {
|
|
21891
|
+
if (typeof message !== "object" || message === null)
|
|
21892
|
+
return "object expected";
|
|
21893
|
+
if (message.type != null && message.hasOwnProperty("type"))
|
|
21894
|
+
switch (message.type) {
|
|
21895
|
+
default:
|
|
21896
|
+
return "type: enum value expected";
|
|
21897
|
+
case 0:
|
|
21898
|
+
case 1:
|
|
21899
|
+
case 2:
|
|
21900
|
+
case 3:
|
|
21901
|
+
case 4:
|
|
21902
|
+
case 5:
|
|
21903
|
+
break;
|
|
21904
|
+
}
|
|
21905
|
+
if (message.pts != null && message.hasOwnProperty("pts")) {
|
|
21906
|
+
if (!$util.isInteger(message.pts) && !(message.pts && $util.isInteger(message.pts.low) && $util.isInteger(message.pts.high)))
|
|
21907
|
+
return "pts: integer|Long expected";
|
|
21908
|
+
}
|
|
21909
|
+
if (message.id != null && message.hasOwnProperty("id")) {
|
|
21910
|
+
if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high)))
|
|
21911
|
+
return "id: integer|Long expected";
|
|
21912
|
+
}
|
|
21913
|
+
if (message.keyframe != null && message.hasOwnProperty("keyframe")) {
|
|
21914
|
+
if (typeof message.keyframe !== "boolean")
|
|
21915
|
+
return "keyframe: boolean expected";
|
|
21916
|
+
}
|
|
21917
|
+
if (message.codecData != null && message.hasOwnProperty("codecData")) {
|
|
21918
|
+
let error = $root.sesame.v1.wire.MediaCodecData.verify(message.codecData);
|
|
21919
|
+
if (error)
|
|
21920
|
+
return "codecData." + error;
|
|
21921
|
+
}
|
|
21922
|
+
if (message.routingMetadata != null && message.hasOwnProperty("routingMetadata")) {
|
|
21923
|
+
if (!$util.isString(message.routingMetadata))
|
|
21924
|
+
return "routingMetadata: string expected";
|
|
21925
|
+
}
|
|
21926
|
+
return null;
|
|
21927
|
+
};
|
|
21928
|
+
FrameHeader2.fromObject = function fromObject(object) {
|
|
21929
|
+
if (object instanceof $root.sesame.v1.wire.FrameHeader)
|
|
21930
|
+
return object;
|
|
21931
|
+
let message = new $root.sesame.v1.wire.FrameHeader();
|
|
21932
|
+
switch (object.type) {
|
|
21933
|
+
default:
|
|
21934
|
+
if (typeof object.type === "number") {
|
|
21935
|
+
message.type = object.type;
|
|
21936
|
+
break;
|
|
21937
|
+
}
|
|
21938
|
+
break;
|
|
21939
|
+
case "FRAME_TYPE_UNSPECIFIED":
|
|
21940
|
+
case 0:
|
|
21941
|
+
message.type = 0;
|
|
21942
|
+
break;
|
|
21943
|
+
case "FRAME_TYPE_RPC":
|
|
21944
|
+
case 1:
|
|
21945
|
+
message.type = 1;
|
|
21946
|
+
break;
|
|
21947
|
+
case "FRAME_TYPE_VIDEO":
|
|
21948
|
+
case 2:
|
|
21949
|
+
message.type = 2;
|
|
21950
|
+
break;
|
|
21951
|
+
case "FRAME_TYPE_AUDIO":
|
|
21952
|
+
case 3:
|
|
21953
|
+
message.type = 3;
|
|
21954
|
+
break;
|
|
21955
|
+
case "FRAME_TYPE_MUXED":
|
|
21956
|
+
case 4:
|
|
21957
|
+
message.type = 4;
|
|
21958
|
+
break;
|
|
21959
|
+
case "FRAME_TYPE_DECODER_DATA":
|
|
21960
|
+
case 5:
|
|
21961
|
+
message.type = 5;
|
|
21962
|
+
break;
|
|
21963
|
+
}
|
|
21964
|
+
if (object.pts != null) {
|
|
21965
|
+
if ($util.Long)
|
|
21966
|
+
(message.pts = $util.Long.fromValue(object.pts)).unsigned = true;
|
|
21967
|
+
else if (typeof object.pts === "string")
|
|
21968
|
+
message.pts = parseInt(object.pts, 10);
|
|
21969
|
+
else if (typeof object.pts === "number")
|
|
21970
|
+
message.pts = object.pts;
|
|
21971
|
+
else if (typeof object.pts === "object")
|
|
21972
|
+
message.pts = new $util.LongBits(object.pts.low >>> 0, object.pts.high >>> 0).toNumber(true);
|
|
21973
|
+
}
|
|
21974
|
+
if (object.id != null) {
|
|
21975
|
+
if ($util.Long)
|
|
21976
|
+
(message.id = $util.Long.fromValue(object.id)).unsigned = true;
|
|
21977
|
+
else if (typeof object.id === "string")
|
|
21978
|
+
message.id = parseInt(object.id, 10);
|
|
21979
|
+
else if (typeof object.id === "number")
|
|
21980
|
+
message.id = object.id;
|
|
21981
|
+
else if (typeof object.id === "object")
|
|
21982
|
+
message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(true);
|
|
21983
|
+
}
|
|
21984
|
+
if (object.keyframe != null)
|
|
21985
|
+
message.keyframe = Boolean(object.keyframe);
|
|
21986
|
+
if (object.codecData != null) {
|
|
21987
|
+
if (typeof object.codecData !== "object")
|
|
21988
|
+
throw TypeError(".sesame.v1.wire.FrameHeader.codecData: object expected");
|
|
21989
|
+
message.codecData = $root.sesame.v1.wire.MediaCodecData.fromObject(object.codecData);
|
|
21990
|
+
}
|
|
21991
|
+
if (object.routingMetadata != null)
|
|
21992
|
+
message.routingMetadata = String(object.routingMetadata);
|
|
21993
|
+
return message;
|
|
21994
|
+
};
|
|
21995
|
+
FrameHeader2.toObject = function toObject(message, options) {
|
|
21996
|
+
if (!options)
|
|
21997
|
+
options = {};
|
|
21998
|
+
let object = {};
|
|
21999
|
+
if (options.defaults) {
|
|
22000
|
+
object.type = options.enums === String ? "FRAME_TYPE_UNSPECIFIED" : 0;
|
|
22001
|
+
if ($util.Long) {
|
|
22002
|
+
let long = new $util.Long(0, 0, true);
|
|
22003
|
+
object.pts = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
|
22004
|
+
} else
|
|
22005
|
+
object.pts = options.longs === String ? "0" : 0;
|
|
22006
|
+
if ($util.Long) {
|
|
22007
|
+
let long = new $util.Long(0, 0, true);
|
|
22008
|
+
object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
|
22009
|
+
} else
|
|
22010
|
+
object.id = options.longs === String ? "0" : 0;
|
|
22011
|
+
object.keyframe = false;
|
|
22012
|
+
object.codecData = null;
|
|
22013
|
+
object.routingMetadata = "";
|
|
22014
|
+
}
|
|
22015
|
+
if (message.type != null && message.hasOwnProperty("type"))
|
|
22016
|
+
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;
|
|
22017
|
+
if (message.pts != null && message.hasOwnProperty("pts"))
|
|
22018
|
+
if (typeof message.pts === "number")
|
|
22019
|
+
object.pts = options.longs === String ? String(message.pts) : message.pts;
|
|
22020
|
+
else
|
|
22021
|
+
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;
|
|
22022
|
+
if (message.id != null && message.hasOwnProperty("id"))
|
|
22023
|
+
if (typeof message.id === "number")
|
|
22024
|
+
object.id = options.longs === String ? String(message.id) : message.id;
|
|
22025
|
+
else
|
|
22026
|
+
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;
|
|
22027
|
+
if (message.keyframe != null && message.hasOwnProperty("keyframe"))
|
|
22028
|
+
object.keyframe = message.keyframe;
|
|
22029
|
+
if (message.codecData != null && message.hasOwnProperty("codecData"))
|
|
22030
|
+
object.codecData = $root.sesame.v1.wire.MediaCodecData.toObject(message.codecData, options);
|
|
22031
|
+
if (message.routingMetadata != null && message.hasOwnProperty("routingMetadata"))
|
|
22032
|
+
object.routingMetadata = message.routingMetadata;
|
|
22033
|
+
return object;
|
|
22034
|
+
};
|
|
22035
|
+
FrameHeader2.prototype.toJSON = function toJSON() {
|
|
22036
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
22037
|
+
};
|
|
22038
|
+
FrameHeader2.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
22039
|
+
if (typeUrlPrefix === void 0) {
|
|
22040
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
22041
|
+
}
|
|
22042
|
+
return typeUrlPrefix + "/sesame.v1.wire.FrameHeader";
|
|
22043
|
+
};
|
|
22044
|
+
return FrameHeader2;
|
|
22045
|
+
}();
|
|
22046
|
+
return wire;
|
|
22047
|
+
}();
|
|
21452
22048
|
return v1;
|
|
21453
22049
|
}();
|
|
21454
22050
|
return sesame2;
|
|
@@ -21914,252 +22510,48 @@ var RPCClient = class extends import_events.EventEmitter {
|
|
|
21914
22510
|
// src/sesame-connection.ts
|
|
21915
22511
|
var import_events2 = __toESM(require_events());
|
|
21916
22512
|
|
|
21917
|
-
// src/sesame-
|
|
21918
|
-
var
|
|
21919
|
-
var
|
|
21920
|
-
var
|
|
21921
|
-
var
|
|
21922
|
-
var
|
|
21923
|
-
var
|
|
21924
|
-
var FLAG_HAS_METADATA = 1 << 1;
|
|
21925
|
-
var FLAG_IS_KEYFRAME = 1 << 2;
|
|
21926
|
-
var PacketType = /* @__PURE__ */ ((PacketType2) => {
|
|
21927
|
-
PacketType2[PacketType2["VIDEO_FRAME"] = 1] = "VIDEO_FRAME";
|
|
21928
|
-
PacketType2[PacketType2["AUDIO_FRAME"] = 2] = "AUDIO_FRAME";
|
|
21929
|
-
PacketType2[PacketType2["RPC"] = 3] = "RPC";
|
|
21930
|
-
PacketType2[PacketType2["MUXED_DATA"] = 4] = "MUXED_DATA";
|
|
21931
|
-
PacketType2[PacketType2["DECODER_DATA"] = 5] = "DECODER_DATA";
|
|
21932
|
-
return PacketType2;
|
|
21933
|
-
})(PacketType || {});
|
|
21934
|
-
var CodecType = /* @__PURE__ */ ((CodecType2) => {
|
|
21935
|
-
CodecType2[CodecType2["VIDEO_VP8"] = 1] = "VIDEO_VP8";
|
|
21936
|
-
CodecType2[CodecType2["VIDEO_VP9"] = 2] = "VIDEO_VP9";
|
|
21937
|
-
CodecType2[CodecType2["VIDEO_AVC"] = 3] = "VIDEO_AVC";
|
|
21938
|
-
CodecType2[CodecType2["VIDEO_HEVC"] = 4] = "VIDEO_HEVC";
|
|
21939
|
-
CodecType2[CodecType2["VIDEO_AV1"] = 5] = "VIDEO_AV1";
|
|
21940
|
-
CodecType2[CodecType2["AUDIO_OPUS"] = 64] = "AUDIO_OPUS";
|
|
21941
|
-
CodecType2[CodecType2["AUDIO_AAC"] = 65] = "AUDIO_AAC";
|
|
21942
|
-
CodecType2[CodecType2["AUDIO_PCM"] = 66] = "AUDIO_PCM";
|
|
21943
|
-
return CodecType2;
|
|
21944
|
-
})(CodecType || {});
|
|
21945
|
-
var SesameBinaryProtocol = class {
|
|
21946
|
-
/**
|
|
21947
|
-
* Initialize a header data structure with proper defaults
|
|
21948
|
-
*/
|
|
21949
|
-
static initHeader(type, flags, pts, id) {
|
|
21950
|
-
return {
|
|
21951
|
-
magic: PROTOCOL_MAGIC,
|
|
21952
|
-
version: PROTOCOL_VERSION,
|
|
21953
|
-
header_size: this.calculateHeaderSize(flags),
|
|
21954
|
-
type,
|
|
21955
|
-
flags,
|
|
21956
|
-
pts,
|
|
21957
|
-
id,
|
|
21958
|
-
reserved: 0
|
|
21959
|
-
// Always zero reserved fields
|
|
21960
|
-
};
|
|
21961
|
-
}
|
|
22513
|
+
// src/sesame-wire-protocol.ts
|
|
22514
|
+
var FrameType = sesame.v1.wire.FrameType;
|
|
22515
|
+
var FrameHeader = sesame.v1.wire.FrameHeader;
|
|
22516
|
+
var MediaCodecData = sesame.v1.wire.MediaCodecData;
|
|
22517
|
+
var CodecType = sesame.v1.wire.CodecType;
|
|
22518
|
+
var PREFIX_SIZE = 4;
|
|
22519
|
+
var WireProtocol = class {
|
|
21962
22520
|
/**
|
|
21963
|
-
*
|
|
22521
|
+
* Serialize a wire frame: 4-byte LE header_size + protobuf FrameHeader + payload.
|
|
21964
22522
|
*/
|
|
21965
|
-
static
|
|
21966
|
-
|
|
21967
|
-
|
|
21968
|
-
|
|
22523
|
+
static serialize(header, payload) {
|
|
22524
|
+
const headerBytes = sesame.v1.wire.FrameHeader.encode(header).finish();
|
|
22525
|
+
const headerSize = headerBytes.length;
|
|
22526
|
+
const payloadSize = payload ? payload.length : 0;
|
|
22527
|
+
const total = PREFIX_SIZE + headerSize + payloadSize;
|
|
22528
|
+
const buffer = new Uint8Array(total);
|
|
22529
|
+
const view = new DataView(buffer.buffer);
|
|
22530
|
+
view.setUint32(0, headerSize, true);
|
|
22531
|
+
buffer.set(headerBytes, PREFIX_SIZE);
|
|
22532
|
+
if (payload && payloadSize > 0) {
|
|
22533
|
+
buffer.set(payload, PREFIX_SIZE + headerSize);
|
|
21969
22534
|
}
|
|
21970
|
-
|
|
21971
|
-
size += HEADER_CODEC_DATA_SIZE;
|
|
21972
|
-
}
|
|
21973
|
-
return size;
|
|
22535
|
+
return buffer;
|
|
21974
22536
|
}
|
|
21975
22537
|
/**
|
|
21976
|
-
*
|
|
22538
|
+
* Parse an incoming wire frame.
|
|
21977
22539
|
*/
|
|
21978
|
-
static
|
|
21979
|
-
|
|
21980
|
-
|
|
21981
|
-
|
|
21982
|
-
|
|
21983
|
-
|
|
22540
|
+
static parse(data) {
|
|
22541
|
+
const result = { valid: false, header: null, payload: null };
|
|
22542
|
+
if (!data || data.length < PREFIX_SIZE) return result;
|
|
22543
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
22544
|
+
const headerSize = view.getUint32(0, true);
|
|
22545
|
+
if (data.length < PREFIX_SIZE + headerSize) return result;
|
|
22546
|
+
try {
|
|
22547
|
+
const headerBytes = data.subarray(PREFIX_SIZE, PREFIX_SIZE + headerSize);
|
|
22548
|
+
result.header = sesame.v1.wire.FrameHeader.decode(headerBytes);
|
|
22549
|
+
result.payload = data.subarray(PREFIX_SIZE + headerSize);
|
|
22550
|
+
result.valid = true;
|
|
22551
|
+
} catch {
|
|
21984
22552
|
}
|
|
21985
|
-
const expectedHeaderSize = this.calculateHeaderSize(header.flags);
|
|
21986
|
-
if (header.header_size !== expectedHeaderSize) {
|
|
21987
|
-
return false;
|
|
21988
|
-
}
|
|
21989
|
-
if (totalSize < header.header_size) {
|
|
21990
|
-
return false;
|
|
21991
|
-
}
|
|
21992
|
-
return true;
|
|
21993
|
-
}
|
|
21994
|
-
/**
|
|
21995
|
-
* Serialize data into a Uint8Array buffer
|
|
21996
|
-
*/
|
|
21997
|
-
static serialize(header, metadata = null, codecData = null, payload = null) {
|
|
21998
|
-
const includeMetadata = metadata !== null && header.flags & FLAG_HAS_METADATA;
|
|
21999
|
-
const includeCodec = codecData !== null && header.flags & FLAG_HAS_CODEC_DATA;
|
|
22000
|
-
let totalSize = HEADER_DATA_SIZE;
|
|
22001
|
-
if (includeMetadata) totalSize += HEADER_METADATA_SIZE;
|
|
22002
|
-
if (includeCodec) totalSize += HEADER_CODEC_DATA_SIZE;
|
|
22003
|
-
if (payload) totalSize += payload.length;
|
|
22004
|
-
header.header_size = totalSize - (payload ? payload.length : 0);
|
|
22005
|
-
const buffer = new ArrayBuffer(totalSize);
|
|
22006
|
-
const view = new DataView(buffer);
|
|
22007
|
-
let offset = 0;
|
|
22008
|
-
view.setUint32(offset, header.magic, true);
|
|
22009
|
-
offset += 4;
|
|
22010
|
-
view.setUint32(offset, header.flags, true);
|
|
22011
|
-
offset += 4;
|
|
22012
|
-
view.setBigUint64(offset, header.pts, true);
|
|
22013
|
-
offset += 8;
|
|
22014
|
-
view.setBigUint64(offset, header.id, true);
|
|
22015
|
-
offset += 8;
|
|
22016
|
-
view.setUint16(offset, header.version, true);
|
|
22017
|
-
offset += 2;
|
|
22018
|
-
view.setUint16(offset, header.header_size, true);
|
|
22019
|
-
offset += 2;
|
|
22020
|
-
view.setUint16(offset, header.type, true);
|
|
22021
|
-
offset += 2;
|
|
22022
|
-
view.setUint16(offset, header.reserved, true);
|
|
22023
|
-
offset += 2;
|
|
22024
|
-
if (includeMetadata && metadata) {
|
|
22025
|
-
const metadataBytes = this.stringToFixedBytes(metadata.metadata, 64);
|
|
22026
|
-
new Uint8Array(buffer, offset, 64).set(metadataBytes);
|
|
22027
|
-
offset += 64;
|
|
22028
|
-
}
|
|
22029
|
-
if (includeCodec && codecData) {
|
|
22030
|
-
view.setUint32(offset, codecData.sample_rate, true);
|
|
22031
|
-
offset += 4;
|
|
22032
|
-
view.setUint32(offset, codecData.timebase_num, true);
|
|
22033
|
-
offset += 4;
|
|
22034
|
-
view.setUint32(offset, codecData.timebase_den, true);
|
|
22035
|
-
offset += 4;
|
|
22036
|
-
view.setUint16(offset, codecData.codec_profile, true);
|
|
22037
|
-
offset += 2;
|
|
22038
|
-
view.setUint16(offset, codecData.codec_level, true);
|
|
22039
|
-
offset += 2;
|
|
22040
|
-
view.setUint16(offset, codecData.width, true);
|
|
22041
|
-
offset += 2;
|
|
22042
|
-
view.setUint16(offset, codecData.height, true);
|
|
22043
|
-
offset += 2;
|
|
22044
|
-
view.setUint8(offset, codecData.codec_type);
|
|
22045
|
-
offset += 1;
|
|
22046
|
-
view.setUint8(offset, codecData.channels);
|
|
22047
|
-
offset += 1;
|
|
22048
|
-
view.setUint8(offset, codecData.bit_depth);
|
|
22049
|
-
offset += 1;
|
|
22050
|
-
view.setUint8(offset, codecData.reserved);
|
|
22051
|
-
offset += 1;
|
|
22052
|
-
}
|
|
22053
|
-
if (payload && payload.length > 0) {
|
|
22054
|
-
new Uint8Array(buffer, offset).set(payload);
|
|
22055
|
-
}
|
|
22056
|
-
return new Uint8Array(buffer);
|
|
22057
|
-
}
|
|
22058
|
-
/**
|
|
22059
|
-
* Parse incoming binary data
|
|
22060
|
-
*/
|
|
22061
|
-
static parseData(data) {
|
|
22062
|
-
const result = {
|
|
22063
|
-
valid: false,
|
|
22064
|
-
header: null,
|
|
22065
|
-
metadata: null,
|
|
22066
|
-
codec_data: null,
|
|
22067
|
-
payload: null,
|
|
22068
|
-
payload_size: 0
|
|
22069
|
-
};
|
|
22070
|
-
if (!data || data.length < 36) {
|
|
22071
|
-
return result;
|
|
22072
|
-
}
|
|
22073
|
-
const view = new DataView(data.buffer, data.byteOffset);
|
|
22074
|
-
let offset = 0;
|
|
22075
|
-
const header = {
|
|
22076
|
-
magic: view.getUint32(offset, true),
|
|
22077
|
-
flags: view.getUint32(offset + 4, true),
|
|
22078
|
-
pts: view.getBigUint64(offset + 8, true),
|
|
22079
|
-
id: view.getBigUint64(offset + 16, true),
|
|
22080
|
-
version: view.getUint16(offset + 24, true),
|
|
22081
|
-
header_size: view.getUint16(offset + 26, true),
|
|
22082
|
-
type: view.getUint16(offset + 28, true),
|
|
22083
|
-
reserved: view.getUint16(offset + 30, true)
|
|
22084
|
-
};
|
|
22085
|
-
offset += HEADER_DATA_SIZE;
|
|
22086
|
-
if (!this.validateHeader(header, data.length)) {
|
|
22087
|
-
return result;
|
|
22088
|
-
}
|
|
22089
|
-
result.header = header;
|
|
22090
|
-
if (header.flags & FLAG_HAS_METADATA) {
|
|
22091
|
-
if (data.length < offset + HEADER_METADATA_SIZE) {
|
|
22092
|
-
return result;
|
|
22093
|
-
}
|
|
22094
|
-
const metadataBytes = data.slice(offset, offset + HEADER_METADATA_SIZE);
|
|
22095
|
-
const metadataStr = this.fixedBytesToString(metadataBytes);
|
|
22096
|
-
result.metadata = { metadata: metadataStr };
|
|
22097
|
-
offset += HEADER_METADATA_SIZE;
|
|
22098
|
-
}
|
|
22099
|
-
if (header.flags & FLAG_HAS_CODEC_DATA) {
|
|
22100
|
-
if (data.length < offset + HEADER_CODEC_DATA_SIZE) {
|
|
22101
|
-
return result;
|
|
22102
|
-
}
|
|
22103
|
-
result.codec_data = {
|
|
22104
|
-
sample_rate: view.getUint32(offset, true),
|
|
22105
|
-
timebase_num: view.getUint32(offset + 4, true),
|
|
22106
|
-
timebase_den: view.getUint32(offset + 8, true),
|
|
22107
|
-
codec_profile: view.getUint16(offset + 12, true),
|
|
22108
|
-
codec_level: view.getUint16(offset + 14, true),
|
|
22109
|
-
width: view.getUint16(offset + 16, true),
|
|
22110
|
-
height: view.getUint16(offset + 18, true),
|
|
22111
|
-
codec_type: view.getUint8(offset + 20),
|
|
22112
|
-
channels: view.getUint8(offset + 21),
|
|
22113
|
-
bit_depth: view.getUint8(offset + 22),
|
|
22114
|
-
reserved: view.getUint8(offset + 23)
|
|
22115
|
-
};
|
|
22116
|
-
offset += HEADER_CODEC_DATA_SIZE;
|
|
22117
|
-
}
|
|
22118
|
-
if (offset < data.length) {
|
|
22119
|
-
result.payload = data.slice(offset);
|
|
22120
|
-
result.payload_size = result.payload.length;
|
|
22121
|
-
} else {
|
|
22122
|
-
result.payload = new Uint8Array(0);
|
|
22123
|
-
result.payload_size = 0;
|
|
22124
|
-
}
|
|
22125
|
-
result.valid = true;
|
|
22126
22553
|
return result;
|
|
22127
22554
|
}
|
|
22128
|
-
/**
|
|
22129
|
-
* Helper: Convert string to fixed-size byte array (null-terminated)
|
|
22130
|
-
*/
|
|
22131
|
-
static stringToFixedBytes(str, size) {
|
|
22132
|
-
const bytes = new Uint8Array(size);
|
|
22133
|
-
let encoded;
|
|
22134
|
-
if (typeof TextEncoder !== "undefined") {
|
|
22135
|
-
const encoder = new TextEncoder();
|
|
22136
|
-
encoded = encoder.encode(str);
|
|
22137
|
-
} else {
|
|
22138
|
-
encoded = new Uint8Array(Buffer.from(str, "utf8"));
|
|
22139
|
-
}
|
|
22140
|
-
const copyLen = Math.min(encoded.length, size - 1);
|
|
22141
|
-
bytes.set(encoded.slice(0, copyLen));
|
|
22142
|
-
bytes[copyLen] = 0;
|
|
22143
|
-
return bytes;
|
|
22144
|
-
}
|
|
22145
|
-
/**
|
|
22146
|
-
* Helper: Convert fixed-size byte array to string (null-terminated)
|
|
22147
|
-
*/
|
|
22148
|
-
static fixedBytesToString(bytes) {
|
|
22149
|
-
let len = bytes.length;
|
|
22150
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
22151
|
-
if (bytes[i] === 0) {
|
|
22152
|
-
len = i;
|
|
22153
|
-
break;
|
|
22154
|
-
}
|
|
22155
|
-
}
|
|
22156
|
-
if (typeof TextDecoder !== "undefined") {
|
|
22157
|
-
const decoder = new TextDecoder();
|
|
22158
|
-
return decoder.decode(bytes.slice(0, len));
|
|
22159
|
-
} else {
|
|
22160
|
-
return Buffer.from(bytes.slice(0, len)).toString("utf8");
|
|
22161
|
-
}
|
|
22162
|
-
}
|
|
22163
22555
|
};
|
|
22164
22556
|
|
|
22165
22557
|
// src/sesame-connection.ts
|
|
@@ -22195,14 +22587,16 @@ var SesameConnection = class extends import_events2.EventEmitter {
|
|
|
22195
22587
|
};
|
|
22196
22588
|
this.messageHandler = (event) => {
|
|
22197
22589
|
if (event.data instanceof ArrayBuffer) {
|
|
22198
|
-
const parsed =
|
|
22199
|
-
if (!parsed.valid)
|
|
22200
|
-
|
|
22201
|
-
|
|
22202
|
-
}
|
|
22203
|
-
|
|
22204
|
-
|
|
22590
|
+
const parsed = WireProtocol.parse(new Uint8Array(event.data));
|
|
22591
|
+
if (!parsed.valid) {
|
|
22592
|
+
this.emit("error", new Error("Invalid packet received"));
|
|
22593
|
+
return;
|
|
22594
|
+
}
|
|
22595
|
+
const frameType = parsed.header?.type;
|
|
22596
|
+
if (frameType === FrameType.FRAME_TYPE_RPC) {
|
|
22205
22597
|
this.emit("rpc", parsed.payload);
|
|
22598
|
+
} else {
|
|
22599
|
+
this.emit("media-packet", parsed);
|
|
22206
22600
|
}
|
|
22207
22601
|
}
|
|
22208
22602
|
};
|
|
@@ -22240,10 +22634,9 @@ var SesameConnection = class extends import_events2.EventEmitter {
|
|
|
22240
22634
|
}
|
|
22241
22635
|
async send(data) {
|
|
22242
22636
|
if (!this.isConnected()) throw new Error("Not connected");
|
|
22243
|
-
const header =
|
|
22244
|
-
const
|
|
22245
|
-
|
|
22246
|
-
this.socket.send(data_to_send);
|
|
22637
|
+
const header = { type: sesame.v1.wire.FrameType.FRAME_TYPE_RPC };
|
|
22638
|
+
const frame = WireProtocol.serialize(header, data);
|
|
22639
|
+
this.socket.send(frame);
|
|
22247
22640
|
return Promise.resolve();
|
|
22248
22641
|
}
|
|
22249
22642
|
async connect() {
|
|
@@ -22333,9 +22726,6 @@ var StatusApi = class {
|
|
|
22333
22726
|
async getIODevices() {
|
|
22334
22727
|
return this.rpc.service.requestIODeviceList(new sesame.v1.common.Empty());
|
|
22335
22728
|
}
|
|
22336
|
-
async requestKeyframe(outputId) {
|
|
22337
|
-
await this.rpc.service.requestKeyframe({ id: outputId });
|
|
22338
|
-
}
|
|
22339
22729
|
};
|
|
22340
22730
|
|
|
22341
22731
|
// src/recorder-api.ts
|
|
@@ -22484,9 +22874,7 @@ var SesameClient = class extends import_events3.EventEmitter {
|
|
|
22484
22874
|
constructor(portOrUrl) {
|
|
22485
22875
|
super();
|
|
22486
22876
|
this.subscriptions = [];
|
|
22487
|
-
this.
|
|
22488
|
-
};
|
|
22489
|
-
this.onAudioPacket = () => {
|
|
22877
|
+
this.onMediaPacket = () => {
|
|
22490
22878
|
};
|
|
22491
22879
|
this.onCallbackMessage = () => {
|
|
22492
22880
|
};
|
|
@@ -22532,8 +22920,7 @@ var SesameClient = class extends import_events3.EventEmitter {
|
|
|
22532
22920
|
this.conn.on("close", () => {
|
|
22533
22921
|
this.emit("disconnected");
|
|
22534
22922
|
});
|
|
22535
|
-
this.conn.on("
|
|
22536
|
-
this.conn.on("audio-packet", (data) => this.onAudioPacket(this.videoSubscriptionId, data));
|
|
22923
|
+
this.conn.on("media-packet", (frame) => this.onMediaPacket(this.mediaSubscriptionId, frame));
|
|
22537
22924
|
this.subscriptions = [];
|
|
22538
22925
|
}
|
|
22539
22926
|
isConnected() {
|
|
@@ -22543,14 +22930,14 @@ var SesameClient = class extends import_events3.EventEmitter {
|
|
|
22543
22930
|
if (!this.isConnected()) return;
|
|
22544
22931
|
const eventTopics = this.subscriptions.map((subscription) => subscription.topic);
|
|
22545
22932
|
const channels = [];
|
|
22546
|
-
if (this.
|
|
22933
|
+
if (this.mediaSubscriptionId) channels.push(`media-stream/${this.mediaSubscriptionId}`);
|
|
22547
22934
|
let subs = { eventTopics, channels };
|
|
22548
22935
|
this.rpc.service.updateSubscriptions(subs).catch((err) => {
|
|
22549
22936
|
log.error(`Failed to update subscriptions: ${err.message}`);
|
|
22550
22937
|
});
|
|
22551
22938
|
}
|
|
22552
|
-
|
|
22553
|
-
this.
|
|
22939
|
+
addMediaSubscription(id) {
|
|
22940
|
+
this.mediaSubscriptionId = id;
|
|
22554
22941
|
this.sendSubscriptions();
|
|
22555
22942
|
}
|
|
22556
22943
|
addSubscription(topic, callback) {
|
|
@@ -22569,6 +22956,9 @@ var SesameClient = class extends import_events3.EventEmitter {
|
|
|
22569
22956
|
getService() {
|
|
22570
22957
|
return this.rpc;
|
|
22571
22958
|
}
|
|
22959
|
+
async requestKeyframe(outputId) {
|
|
22960
|
+
await this.rpc.service.requestKeyframe({ id: outputId });
|
|
22961
|
+
}
|
|
22572
22962
|
async execute(cl) {
|
|
22573
22963
|
cl.filterCreatedAndDestroyedSources();
|
|
22574
22964
|
if (cl.getCommandListMsg().commandList.length > 0) {
|
|
@@ -22591,17 +22981,18 @@ export {
|
|
|
22591
22981
|
ConnectionState,
|
|
22592
22982
|
EaseKind,
|
|
22593
22983
|
Event,
|
|
22984
|
+
FrameHeader,
|
|
22985
|
+
FrameType,
|
|
22594
22986
|
JobsApi,
|
|
22595
22987
|
Message,
|
|
22596
|
-
PacketType,
|
|
22597
22988
|
RPCClient,
|
|
22598
22989
|
RecorderApi,
|
|
22599
22990
|
Request,
|
|
22600
22991
|
Response,
|
|
22601
|
-
SesameBinaryProtocol,
|
|
22602
22992
|
SesameClient,
|
|
22603
22993
|
SesameConnection,
|
|
22604
22994
|
StatusApi,
|
|
22995
|
+
WireProtocol,
|
|
22605
22996
|
getLogger,
|
|
22606
22997
|
log,
|
|
22607
22998
|
sesame,
|