@mega-yfue/eufy-sdk 0.6.0-beta.36 → 0.6.0-beta.38
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/dist/core/contracts.d.ts
CHANGED
|
@@ -173,10 +173,10 @@ export declare class RecordingDownloadError extends Error {
|
|
|
173
173
|
*
|
|
174
174
|
* `video` is Annex-B H.264 or H.265 in decode order, `audio` AAC-LC 16 kHz mono in ADTS framing (absent
|
|
175
175
|
* when the recording carried none that could be decoded). `codec` is the codec of `video`, read off the parameter
|
|
176
|
-
* sets of its first keyframe that carries them, and is absent when no keyframe does. `frames` counts the
|
|
177
|
-
*
|
|
178
|
-
* usable picture, including at either end. `durationMs`
|
|
179
|
-
* camera's own timestamps; `fps` is derived from those stamps.
|
|
176
|
+
* sets of its first keyframe that carries them, and is absent when no keyframe does. `frames` counts the pictures
|
|
177
|
+
* emitted, numbered by the camera's frame numbers counted on across a change of frame size. `missingFrames` counts
|
|
178
|
+
* gaps in that numbering and numbered frames that yielded no usable picture, including at either end. `durationMs`
|
|
179
|
+
* spans the first to the last emitted picture by the camera's own timestamps; `fps` is derived from those stamps.
|
|
180
180
|
*/
|
|
181
181
|
export interface RecordingDownload {
|
|
182
182
|
video: Buffer;
|
package/dist/index.js
CHANGED
|
@@ -4800,11 +4800,20 @@ function cellGated(members) {
|
|
|
4800
4800
|
});
|
|
4801
4801
|
return Object.fromEntries(gated);
|
|
4802
4802
|
}
|
|
4803
|
+
var notSensor = (ctx) => ctx.codec !== "sensor";
|
|
4804
|
+
function notOnSensor(members) {
|
|
4805
|
+
const gated = Object.entries(members).map(([name, m]) => {
|
|
4806
|
+
const own = m.available;
|
|
4807
|
+
const available = own ? (ctx) => notSensor(ctx) && own(ctx) : notSensor;
|
|
4808
|
+
return [name, { ...m, available }];
|
|
4809
|
+
});
|
|
4810
|
+
return Object.fromEntries(gated);
|
|
4811
|
+
}
|
|
4803
4812
|
function isChargingState(v) {
|
|
4804
4813
|
const n = Number(v);
|
|
4805
4814
|
return n !== 0 && n !== 2;
|
|
4806
4815
|
}
|
|
4807
|
-
var
|
|
4816
|
+
var CAMERA_BATTERY_MEMBERS = cellGated({
|
|
4808
4817
|
/**
|
|
4809
4818
|
* The headline percentage, and this capability's detection evidence: reporting 1101 is what proves a
|
|
4810
4819
|
* device is battery-powered, which is also the fact `MediaProvider` reads to decide a stream needs a
|
|
@@ -5031,6 +5040,7 @@ var BATTERY_MEMBERS = cellGated({
|
|
|
5031
5040
|
description: "Raw GET_CAMERA_INFO value (1103), meaning unevidenced \u2014 read live as the constant 5 on a T8170 at 92% and a T8171 at 27%, so it is NOT a low-battery flag."
|
|
5032
5041
|
}
|
|
5033
5042
|
});
|
|
5043
|
+
var BATTERY_MEMBERS = notOnSensor(CAMERA_BATTERY_MEMBERS);
|
|
5034
5044
|
var BATTERY = {
|
|
5035
5045
|
capability: "battery",
|
|
5036
5046
|
description: "Battery level, charging, health, temperature, and solar input.",
|
|
@@ -20199,18 +20209,28 @@ function decodeRecording(frames, station, eccPrivateKeyHex) {
|
|
|
20199
20209
|
const receivedNumbers = /* @__PURE__ */ new Set();
|
|
20200
20210
|
let firstStamp;
|
|
20201
20211
|
let lastStamp;
|
|
20212
|
+
let frameSize;
|
|
20213
|
+
let shift = 0;
|
|
20214
|
+
let sequence = 0;
|
|
20202
20215
|
for (const { commandId, raw } of frames) {
|
|
20203
20216
|
if (commandId === CommandType.CMD_VIDEO_FRAME) {
|
|
20204
20217
|
const header = parseVideoFrameHeader(raw);
|
|
20205
20218
|
if (!header)
|
|
20206
20219
|
continue;
|
|
20207
|
-
|
|
20220
|
+
const size = header.width && header.height ? `${header.width}x${header.height}` : void 0;
|
|
20221
|
+
if (header.keyframe && size && frameSize !== void 0 && size !== frameSize) {
|
|
20222
|
+
shift = sequence + 1 - header.sequence & 65535;
|
|
20223
|
+
}
|
|
20224
|
+
if (size)
|
|
20225
|
+
frameSize = size;
|
|
20226
|
+
sequence = header.sequence + shift & 65535;
|
|
20227
|
+
receivedNumbers.add(sequence);
|
|
20208
20228
|
const units = assembler.push(raw, (payload) => decoder && header.keyframe ? decoder.decodeFrame(payload)?.h264 : clearVideoPayload(payload, header));
|
|
20209
20229
|
for (const unit of units) {
|
|
20210
20230
|
video.push(unit.data);
|
|
20211
20231
|
if (unit.keyframe)
|
|
20212
20232
|
codec ??= sniffAnnexbCodec(unit.data);
|
|
20213
|
-
numbers.add(
|
|
20233
|
+
numbers.add(sequence);
|
|
20214
20234
|
const stamp = raw.readUIntLE(14, 6);
|
|
20215
20235
|
firstStamp ??= stamp;
|
|
20216
20236
|
lastStamp = stamp;
|