@mega-yfue/eufy-sdk 0.6.0-beta.36 → 0.6.0-beta.37
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
|
@@ -20199,18 +20199,28 @@ function decodeRecording(frames, station, eccPrivateKeyHex) {
|
|
|
20199
20199
|
const receivedNumbers = /* @__PURE__ */ new Set();
|
|
20200
20200
|
let firstStamp;
|
|
20201
20201
|
let lastStamp;
|
|
20202
|
+
let frameSize;
|
|
20203
|
+
let shift = 0;
|
|
20204
|
+
let sequence = 0;
|
|
20202
20205
|
for (const { commandId, raw } of frames) {
|
|
20203
20206
|
if (commandId === CommandType.CMD_VIDEO_FRAME) {
|
|
20204
20207
|
const header = parseVideoFrameHeader(raw);
|
|
20205
20208
|
if (!header)
|
|
20206
20209
|
continue;
|
|
20207
|
-
|
|
20210
|
+
const size = header.width && header.height ? `${header.width}x${header.height}` : void 0;
|
|
20211
|
+
if (header.keyframe && size && frameSize !== void 0 && size !== frameSize) {
|
|
20212
|
+
shift = sequence + 1 - header.sequence & 65535;
|
|
20213
|
+
}
|
|
20214
|
+
if (size)
|
|
20215
|
+
frameSize = size;
|
|
20216
|
+
sequence = header.sequence + shift & 65535;
|
|
20217
|
+
receivedNumbers.add(sequence);
|
|
20208
20218
|
const units = assembler.push(raw, (payload) => decoder && header.keyframe ? decoder.decodeFrame(payload)?.h264 : clearVideoPayload(payload, header));
|
|
20209
20219
|
for (const unit of units) {
|
|
20210
20220
|
video.push(unit.data);
|
|
20211
20221
|
if (unit.keyframe)
|
|
20212
20222
|
codec ??= sniffAnnexbCodec(unit.data);
|
|
20213
|
-
numbers.add(
|
|
20223
|
+
numbers.add(sequence);
|
|
20214
20224
|
const stamp = raw.readUIntLE(14, 6);
|
|
20215
20225
|
firstStamp ??= stamp;
|
|
20216
20226
|
lastStamp = stamp;
|