@apocaliss92/nodelink-js 0.3.4 → 0.3.9

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/index.d.cts CHANGED
@@ -1961,6 +1961,22 @@ declare class BaichuanClient extends EventEmitter<{
1961
1961
  private static readonly coverPreviewBackoffMs;
1962
1962
  private static readonly COVER_PREVIEW_INITIAL_BACKOFF_MS;
1963
1963
  private static readonly COVER_PREVIEW_MAX_BACKOFF_MS;
1964
+ /**
1965
+ * Per-client snapshot (cmd_id=109) serialization queue.
1966
+ *
1967
+ * WHY: On NVR/multi-camera devices sharing one socket, concurrent snapshot requests
1968
+ * can cause JPEG data to mix (even with per-request msgNum filtering):
1969
+ * - Camera A and B both send frames on same socket
1970
+ * - Frame listener is global per socket
1971
+ * - Timing quirks can cause chunk reordering or listener confusion
1972
+ *
1973
+ * FIX: Serialize all cmd_id=109 requests on THIS client instance.
1974
+ * Each snapshot waits for previous one to complete before starting.
1975
+ * This ensures clean frame sequences per request, zero data corruption.
1976
+ *
1977
+ * Impact: Snapshots are ~0–50ms slower per camera (negligible for users).
1978
+ */
1979
+ private snapshotQueueTail;
1964
1980
  private readonly opts;
1965
1981
  private readonly debugCfg;
1966
1982
  private readonly logger;
@@ -2307,6 +2323,7 @@ declare class BaichuanClient extends EventEmitter<{
2307
2323
  private sendBinaryFileDownload6482;
2308
2324
  private sendBinaryFileInfoListReplay5;
2309
2325
  private sendBinarySnapshot109;
2326
+ private sendBinarySnapshot109Impl;
2310
2327
  /**
2311
2328
  * Send CoverPreview command (cmd_id=298) to get an I-frame from a past recording.
2312
2329
  * Similar to sendBinarySnapshot109 but handles the stream header + frame format
@@ -3849,6 +3866,42 @@ declare function runAllDiagnosticsConsecutively(params: RunAllDiagnosticsConsecu
3849
3866
  diagnosticsPath: string;
3850
3867
  streamsDir: string;
3851
3868
  }>;
3869
+ interface ModelFixtureCaptureResult {
3870
+ /** Per-call results: command name → ok/error */
3871
+ calls: Record<string, {
3872
+ ok: true;
3873
+ value?: unknown;
3874
+ } | {
3875
+ ok: false;
3876
+ error: string;
3877
+ }>;
3878
+ /** Output directory where fixtures were written */
3879
+ outDir: string;
3880
+ /** Summary counters */
3881
+ summary: {
3882
+ total: number;
3883
+ ok: number;
3884
+ failed: number;
3885
+ errors: string[];
3886
+ };
3887
+ }
3888
+ /**
3889
+ * Capture all relevant API responses from a single device (or NVR channel)
3890
+ * and write them as JSON/XML fixtures into `outDir`.
3891
+ *
3892
+ * This is the library-level building block used by both:
3893
+ * - `test/capture-model-fixtures.ts` (CLI)
3894
+ * - the Scrypted plugin's "Dump Model Fixtures" setting action
3895
+ *
3896
+ * For NVR/Hub devices, call once per active channel.
3897
+ */
3898
+ declare function captureModelFixtures(params: {
3899
+ api: ReolinkBaichuanApi;
3900
+ channel: number;
3901
+ outDir: string;
3902
+ /** Logger (defaults to console) */
3903
+ log?: (...args: unknown[]) => void;
3904
+ }): Promise<ModelFixtureCaptureResult>;
3852
3905
 
3853
3906
  /**
3854
3907
  * Multifocal Camera Composite Stream
@@ -7241,6 +7294,17 @@ declare function computeDeviceCapabilities(params: {
7241
7294
  abilities?: DeviceAbilities;
7242
7295
  support?: SupportInfo;
7243
7296
  }): DeviceCapabilities;
7297
+ /**
7298
+ * Determine whether a cmd 289 (GetWhiteLed) XML response indicates
7299
+ * controllable floodlight/spotlight hardware.
7300
+ *
7301
+ * `<FloodlightTask>`, `<FloodlightManual>`, and `<FloodlightStatusList>` are
7302
+ * conclusive. `<WhiteLed>` is ambiguous — doorbells (e.g. D340W) return it
7303
+ * for their status-indicator LED which is NOT a floodlight. Only treat
7304
+ * `<WhiteLed>` as floodlight when brightness or scheduling controls are
7305
+ * present (`brightness_cur`, `bright`, `LightingSchedule`).
7306
+ */
7307
+ declare function xmlIndicatesFloodlight(xml: string): boolean;
7244
7308
 
7245
7309
  type RtspStreamProfile = "main" | "sub" | "ext";
7246
7310
  declare function buildRtspPath(channel: number, stream: RtspStreamProfile): string;
@@ -7784,6 +7848,125 @@ interface ReplayHttpServer {
7784
7848
  */
7785
7849
  declare function createReplayHttpServer(options: ReplayHttpServerOptions): Promise<ReplayHttpServer>;
7786
7850
 
7851
+ /**
7852
+ * Go2rtcTcpServer — Lightweight TCP server that feeds raw Annex-B video
7853
+ * (H.264 / H.265) and ADTS AAC audio frames to go2rtc via a plain TCP
7854
+ * connection.
7855
+ *
7856
+ * go2rtc configuration example:
7857
+ * streams:
7858
+ * camera_main: tcp://127.0.0.1:{port}
7859
+ *
7860
+ * go2rtc auto-detects the codec from the bitstream (SPS/PPS/VPS NALUs).
7861
+ *
7862
+ * Lifecycle:
7863
+ * 1. Server starts listening immediately on the configured port.
7864
+ * 2. When the first TCP client connects the native camera stream is started.
7865
+ * 3. Frames are fan-out to every connected client (go2rtc typically opens
7866
+ * one connection, but multiple are supported).
7867
+ * 4. When the last client disconnects a grace period runs before stopping
7868
+ * the native stream (avoids thrashing on rapid reconnects).
7869
+ * 5. A prebuffer ring keeps the last few seconds of frames so new clients
7870
+ * get IDR-aligned fast startup without waiting for the next keyframe.
7871
+ */
7872
+
7873
+ interface Go2rtcTcpServerOptions {
7874
+ /** API instance (required). */
7875
+ api: ReolinkBaichuanApi;
7876
+ /** Channel number (required). */
7877
+ channel: number;
7878
+ /** Stream profile (required). */
7879
+ profile: StreamProfile;
7880
+ /** TrackMix tele/autotrack variant. */
7881
+ variant?: NativeVideoStreamVariant;
7882
+ /** Host to listen on (default: "127.0.0.1"). */
7883
+ listenHost?: string;
7884
+ /** Port to listen on (default: 0 = OS picks). */
7885
+ listenPort?: number;
7886
+ /** Logger. */
7887
+ logger?: Logger;
7888
+ /**
7889
+ * External identifier for dedicated socket session.
7890
+ * When provided, a dedicated BaichuanClient is created for the stream,
7891
+ * isolating it from other streams on the shared socket.
7892
+ */
7893
+ deviceId?: string;
7894
+ /** Grace period in ms before stopping native stream after last client disconnects (default: 30 000). */
7895
+ gracePeriodMs?: number;
7896
+ /** Maximum prebuffer window in ms (default: 3 000). */
7897
+ prebufferMs?: number;
7898
+ /** Maximum write buffer per client before dropping the connection (default: 100 MB). */
7899
+ maxBufferBytes?: number;
7900
+ /**
7901
+ * When true, the native camera stream is started immediately on start()
7902
+ * rather than waiting for the first TCP client. This ensures frames are
7903
+ * already flowing (and the prebuffer is warm) when go2rtc connects.
7904
+ * Default: true.
7905
+ */
7906
+ prestartStream?: boolean;
7907
+ }
7908
+ declare class Go2rtcTcpServer extends EventEmitter<{
7909
+ client: [string];
7910
+ clientDisconnected: [string];
7911
+ error: [Error];
7912
+ close: [];
7913
+ listening: [{
7914
+ host: string;
7915
+ port: number;
7916
+ }];
7917
+ }> {
7918
+ private readonly api;
7919
+ private readonly channel;
7920
+ private readonly profile;
7921
+ private readonly variant;
7922
+ private readonly listenHost;
7923
+ private readonly listenPort;
7924
+ private readonly logger;
7925
+ private readonly deviceId;
7926
+ private readonly gracePeriodMs;
7927
+ private readonly prebufferMaxMs;
7928
+ private readonly maxBufferBytes;
7929
+ private readonly prestartStream;
7930
+ private active;
7931
+ private server;
7932
+ private resolvedPort;
7933
+ private nativeFanout;
7934
+ private nativeStreamActive;
7935
+ private dedicatedSessionRelease;
7936
+ private detectedVideoType;
7937
+ private connectedClients;
7938
+ private clientSockets;
7939
+ private stopGraceTimer;
7940
+ private prebuffer;
7941
+ constructor(options: Go2rtcTcpServerOptions);
7942
+ /** Start listening. Resolves once the TCP server is bound. */
7943
+ start(): Promise<void>;
7944
+ /** Stop the server and all active streams. */
7945
+ stop(): Promise<void>;
7946
+ /** The actual port the server is listening on (available after start()). */
7947
+ get port(): number | undefined;
7948
+ /** The go2rtc-compatible source URL. */
7949
+ get go2rtcSourceUrl(): string | undefined;
7950
+ /** Number of currently connected clients. */
7951
+ get clientCount(): number;
7952
+ private handleClient;
7953
+ private feedClient;
7954
+ /**
7955
+ * Convert a native frame to wire-ready Annex-B.
7956
+ * Audio frames are skipped — raw TCP carries only video (Annex-B).
7957
+ * go2rtc auto-detects the codec from SPS/PPS/VPS NALUs.
7958
+ */
7959
+ private convertFrame;
7960
+ /** Check if an Annex-B buffer contains a keyframe (IDR for H.264, IRAP for H.265). */
7961
+ private isAnnexBKeyframe;
7962
+ /** Split Annex-B byte stream into individual NAL units. */
7963
+ private static splitAnnexBNals;
7964
+ private startNativeStream;
7965
+ private stopNativeStream;
7966
+ private removeClient;
7967
+ private scheduleStop;
7968
+ }
7969
+
7787
7970
  /**
7788
7971
  * Baichuan HTTP Stream Server - Serves a Baichuan video stream over HTTP (MPEG-TS).
7789
7972
  * A simpler alternative to an RTSP server.
@@ -8756,4 +8939,4 @@ declare class CompositeRtspServer extends EventEmitter<{
8756
8939
  getClientCount(): number;
8757
8940
  }
8758
8941
 
8759
- export { type AIDetectionState, type AIEvent, type AIState, type AbilityInfo, type AccessUserListConfig, AesStreamDecryptor, type AiAlarmConfig, type AiConfig, type AiDenoiseConfig, type AiKey, type AiTypesCacheEntry, type AnyBuffer, type AudioAlarmParams, type AudioCfgConfig, type AudioConfig, type AudioTaskConfig, type AutoDetectInputs, type AutoDetectMode, type AutoDetectResult, AutodiscoveryClient, type AutodiscoveryClientOptions, BC_AES_IV, BC_CLASS_FILE_DOWNLOAD, BC_CLASS_LEGACY, BC_CLASS_MODERN_20, BC_CLASS_MODERN_24, BC_CLASS_MODERN_24_ALT, BC_CMD_ID_ABILITY_INFO, BC_CMD_ID_ALARM_EVENT_LIST, BC_CMD_ID_AUDIO_ALARM_PLAY, BC_CMD_ID_CHANNEL_INFO_ALL, BC_CMD_ID_CMD_123, BC_CMD_ID_CMD_209, BC_CMD_ID_CMD_265, BC_CMD_ID_CMD_440, BC_CMD_ID_COVER_PREVIEW, BC_CMD_ID_COVER_RESPONSE, BC_CMD_ID_COVER_STANDALONE_458, BC_CMD_ID_COVER_STANDALONE_459, BC_CMD_ID_COVER_STANDALONE_460, BC_CMD_ID_COVER_STANDALONE_461, BC_CMD_ID_COVER_STANDALONE_462, BC_CMD_ID_DING_DONG_CTRL, BC_CMD_ID_DING_DONG_OPT, BC_CMD_ID_FILE_INFO_LIST_CLOSE, BC_CMD_ID_FILE_INFO_LIST_DL_VIDEO, BC_CMD_ID_FILE_INFO_LIST_DOWNLOAD, BC_CMD_ID_FILE_INFO_LIST_GET, BC_CMD_ID_FILE_INFO_LIST_OPEN, BC_CMD_ID_FILE_INFO_LIST_REPLAY, BC_CMD_ID_FILE_INFO_LIST_STOP, BC_CMD_ID_FIND_REC_VIDEO_CLOSE, BC_CMD_ID_FIND_REC_VIDEO_GET, BC_CMD_ID_FIND_REC_VIDEO_OPEN, BC_CMD_ID_FLOODLIGHT_STATUS_LIST, BC_CMD_ID_GET_ABILITY_SUPPORT, BC_CMD_ID_GET_ACCESS_USER_LIST, BC_CMD_ID_GET_AI_ALARM, BC_CMD_ID_GET_AI_CFG, BC_CMD_ID_GET_AI_DENOISE, BC_CMD_ID_GET_AUDIO_ALARM, BC_CMD_ID_GET_AUDIO_CFG, BC_CMD_ID_GET_AUDIO_TASK, BC_CMD_ID_GET_BATTERY_INFO, BC_CMD_ID_GET_BATTERY_INFO_LIST, BC_CMD_ID_GET_DAY_NIGHT_THRESHOLD, BC_CMD_ID_GET_DAY_RECORDS, BC_CMD_ID_GET_DING_DONG_CFG, BC_CMD_ID_GET_DING_DONG_LIST, BC_CMD_ID_GET_DING_DONG_SILENT, BC_CMD_ID_GET_EMAIL_TASK, BC_CMD_ID_GET_FTP_TASK, BC_CMD_ID_GET_HDD_INFO_LIST, BC_CMD_ID_GET_KIT_AP_CFG, BC_CMD_ID_GET_LED_STATE, BC_CMD_ID_GET_MOTION_ALARM, BC_CMD_ID_GET_ONLINE_USER_LIST, BC_CMD_ID_GET_OSD_DATETIME, BC_CMD_ID_GET_PIR_INFO, BC_CMD_ID_GET_PTZ_POSITION, BC_CMD_ID_GET_PTZ_PRESET, BC_CMD_ID_GET_RECORD, BC_CMD_ID_GET_RECORD_CFG, BC_CMD_ID_GET_REC_ENC_CFG, BC_CMD_ID_GET_SIREN_STATUS, BC_CMD_ID_GET_SLEEP_STATE, BC_CMD_ID_GET_STREAM_INFO_LIST, BC_CMD_ID_GET_SUPPORT, BC_CMD_ID_GET_SYSTEM_GENERAL, BC_CMD_ID_GET_TIMELAPSE_CFG, BC_CMD_ID_GET_VIDEO_INPUT, BC_CMD_ID_GET_WHITE_LED, BC_CMD_ID_GET_WIFI, BC_CMD_ID_GET_WIFI_SIGNAL, BC_CMD_ID_GET_ZOOM_FOCUS, BC_CMD_ID_LOGIN, BC_CMD_ID_LOGOUT, BC_CMD_ID_PING, BC_CMD_ID_PTZ_CONTROL, BC_CMD_ID_PTZ_CONTROL_PRESET, BC_CMD_ID_PUSH_COORDINATE_POINT_LIST, BC_CMD_ID_PUSH_DINGDONG_LIST, BC_CMD_ID_PUSH_NET_INFO, BC_CMD_ID_PUSH_SERIAL, BC_CMD_ID_PUSH_SLEEP_STATUS, BC_CMD_ID_PUSH_VIDEO_INPUT, BC_CMD_ID_QUICK_REPLY_PLAY, BC_CMD_ID_SET_AI_ALARM, BC_CMD_ID_SET_AI_CFG, BC_CMD_ID_SET_AUDIO_TASK, BC_CMD_ID_SET_DING_DONG_CFG, BC_CMD_ID_SET_DING_DONG_SILENT, BC_CMD_ID_SET_MOTION_ALARM, BC_CMD_ID_SET_PIR_INFO, BC_CMD_ID_SET_WHITE_LED_STATE, BC_CMD_ID_SET_WHITE_LED_TASK, BC_CMD_ID_SET_ZOOM_FOCUS, BC_CMD_ID_SUPPORT, BC_CMD_ID_TALK, BC_CMD_ID_TALK_ABILITY, BC_CMD_ID_TALK_CONFIG, BC_CMD_ID_TALK_RESET, BC_CMD_ID_UDP_KEEP_ALIVE, BC_CMD_ID_VIDEO, BC_CMD_ID_VIDEO_STOP, BC_MAGIC, BC_MAGIC_REV, BC_TCP_DEFAULT_PORT, BC_XML_KEY, type BaichuanCachedPush, BaichuanClient, type BaichuanClientOptions, type BaichuanCoordinatePointListPush, type BaichuanDingdongListPush, type BaichuanEndpointsServerOptions, BaichuanEventEmitter, type BaichuanFrame, BaichuanFrameParser, type BaichuanGetOsdDatetimeResult, type BaichuanHeader, BaichuanHlsServer, type BaichuanHlsServerOptions, BaichuanHttpStreamServer, type BaichuanHttpStreamServerOptions, type BaichuanLedState, BaichuanMjpegServer, type BaichuanMjpegServerOptions, type BaichuanNetInfoPush, type BaichuanOsdChannelName, type BaichuanOsdDatetime, type BaichuanRecordCfg, type BaichuanRecordSchedule, BaichuanRtspServer, type BaichuanRtspServerOptions, type BaichuanSerialPush, type BaichuanSettingsPushCacheEntry, type BaichuanSleepState, type BaichuanSleepStatusPush, type BaichuanStreamEncodeTable, type BaichuanStreamInfo, type BaichuanStreamInfoList, type BaichuanTransport, type BaichuanVideoInputPush, BaichuanVideoStream, type BaichuanVideoStreamOptions, BaichuanWebRTCServer, type BaichuanWebRTCServerOptions, type BaichuanWifi, type BaichuanWifiSignal, type BatteryInfo, type BatteryInfoResponse, type BcMedia, type BcMediaAac, type BcMediaAdpcm, BcMediaAnnexBDecoder, type BcMediaAnnexBDecoderStats, type BcMediaAnnexBInfo, type BcMediaAudioFrame, type BcMediaAudioType, BcMediaCodec, type BcMediaIframe, type BcMediaInfoV1, type BcMediaInfoV2, type BcMediaPframe, type BcMediaType, type BcMediaVideoFrame, type BcMediaVideoType, type BcUdpDiscoveryMethod, BcUdpStream, type BcUdpStreamOptions, type CgiAbility, type CgiAbilityChn, type CgiAbilityLeaf, type CgiAiKey, type CgiAiStateValue, type CgiAudioAlarmPlayParam, type CgiBattery, type CgiChannelStatusEntry, type CgiChnTypeInfoValue, type CgiDetectionState, type CgiDevInfo, type CgiDeviceInfoEntries, type CgiEnc, type CgiEncStream, type CgiEncValue, type CgiGetAbilityResponse, type CgiGetAbilityValue, type CgiGetAiStateResponse, type CgiGetChannelstatusResponse, type CgiGetChannelstatusValue, type CgiGetChnTypeInfoResponse, type CgiGetDevInfoResponse, type CgiGetDevInfoValue, type CgiGetEncResponse, type CgiGetOsdValue, type CgiGetRtspUrlResponse, type CgiGetRtspUrlValue, type CgiGetVideoclipsParams, type CgiNetPort, type CgiOsd, type CgiPirInfo, type CgiPtzPreset, type CgiSetOsdParam, type CgiSetPirInfoParam, type CgiSetWhiteLedParam, type CgiWhiteLed, type ChannelPushCacheEntry, type ChannelPushDataEntry, type ChannelRecordingFile, type ChannelStreamMetadata, type ChimeAlarmCfg, type ChimeCfg, type ChimeDevice, type ChimeParams, type CollectNvrDiagnosticsOptions, CompositeRtspServer, type CompositeRtspServerOptions, CompositeStream, type CompositeStreamOptions, type CompositeStreamPipOptions, DUAL_LENS_DUAL_MOTION_MODELS, DUAL_LENS_MODELS, DUAL_LENS_SINGLE_MOTION_MODELS, type DayNightThresholdConfig, type DebugConfig, type DebugOptions, type DeviceAbilities, type DeviceCapabilities, type DeviceCapabilitiesCacheEntry, type DeviceCapabilitiesDebugInfo, type DeviceCapabilitiesResult, type DeviceInfoResponse, type DeviceInputData, type DeviceObjectType, type DeviceStatusResponse, type DeviceSupportFlags, type DeviceType, type DiagnosticsCollectorResult, type DiagnosticsStreamKind, type DiscoveredDevice, type DiscoveryOptions, type DownloadRecordingParams, type DualLensChannelAnalysis, type DualLensChannelInfo, type EmailTaskConfig, type EncryptionProtocol, type Events, type EventsResponse, type FloodlightTaskConfig, type FtpTaskConfig, type GetRecordingVideoResult, type GetRecordingVideoStats, type GetVideoclipsParams, type GetVodUrlParams, H264RtpDepacketizer, H265RtpDepacketizer, type HardwiredChimeState, type HddInfoListConfig, type HlsCodec, type HlsHttpResponse, type HlsServerStatus, type HlsSession, HlsSessionManager, type HlsSessionManagerOptions, type HlsSessionParams, Intercom, type IntercomOptions, type JsonObject, type JsonPrimitive, type JsonValue, type LastSleepProbe, type LogLevel, type Logger, type LoggerCallback, type LoginResponseValue, type MaxEncryption, type MediaStream, type MjpegFrame, MjpegTransformer, type MjpegTransformerOptions, type MotionAlarmConfig, type MotionEvent, NVR_HUB_EXACT_TYPES, NVR_HUB_MODEL_PATTERNS, type NativeVideoStreamVariant, type NvrChannelsSummaryCacheEntry, type OnlineUserListConfig, type OsdChannel, type OsdConfig, type OsdTime, type ParsedRecordingFileName, type PipPosition, type PirConfig, type PirState, type PlaybackSnapshotStreamInfo, type PtzCommand, type PtzPosition, type PtzPreset, type RecEncConfig, type RecordingAudioCodec, type RecordingDetectionClass, type RecordingDevType, type RecordingFile, type RecordingPlaybackUrls, type RecordingStreamType, type RecordingVideoCodec, type RecordingVodFlags, type RecordingVodStreamHint, type RecordingsCacheEntry, type RecordingsQueueItem, type ReolinkAiNotification, ReolinkBaichuanApi, type ReolinkBaichuanChannelIdentity, type ReolinkBaichuanChannelInfo, type ReolinkBaichuanDeviceSummary, type ReolinkBaichuanNetworkInfo, type ReolinkBaichuanPorts, ReolinkCgiApi, type ReolinkCmdRequest, type ReolinkCmdResponse, type ReolinkCmdResponseExt, type ReolinkDayNightNotification, type ReolinkDeviceInfo, type ReolinkDeviceInfoTag, type ReolinkEvent, ReolinkHttpClient, type ReolinkHttpClientOptions, type ReolinkJson, type ReolinkMotionNotification, type ReolinkNvrChannelInfo, type ReolinkNvrDeviceGroupSummary, type ReolinkNvrDeviceGroupsResult, type ReolinkSimpleEvent, type ReolinkSimpleEventType, type ReolinkSupportedStream, type ReolinkVideoStreamOptionsResult, type ReolinkVisitorNotification, type ReplayHttpServer, type ReplayHttpServerOptions, type ResponseMediaStreamOptions, type Rfc4571ApiFactoryContext, type Rfc4571Client, Rfc4571Muxer, type Rfc4571ReplayServer, type Rfc4571ReplayServerOptions, type Rfc4571TcpServer, type Rfc4571TcpServerOptions, type RtpPacketizationOptions, type RtspCreateOptions, type RtspProxyServerOptions, type RtspStreamProfile, type RunAllDiagnosticsConsecutivelyParams, type RunAllDiagnosticsConsecutivelyResult, type RunMultifocalDiagnosticsConsecutivelyParams, type RunMultifocalDiagnosticsConsecutivelyResult, type SirenState, type SirenStatusConfig, type SleepState, type SleepStatus, type StreamMetadata, type StreamProfile, type StreamSamplingOptions, type StreamSamplingSelection, type SupportConfig, type SupportInfo, type SupportItem, type SystemGeneralConfig, type TalkAbility$1 as TalkAbility, type TalkAudioConfig, type TalkConfig, type TalkSession$1 as TalkSession, type TalkSessionInfo, type TimelapseCfgConfig, type TwoWayAudioConfig, type VideoCodec, type VideoInputConfig, type VideoParamSets, type VideoStreamOptions, type VideoStreamOptionsCacheEntry, type VideoType, type VideoclipClientInfo, type VideoclipModeDecision, type VideoclipThumbnailResult, type VideoclipTranscodeMode, type VodFile, type VodSearchResponse, type VodSearchResult, type VodSearchStatus, type WakeUpOptions, type WebRTCAnswer, type WebRTCIceCandidate, type WebRTCOffer, type WebRTCSessionInfo, type WhiteLedConfig, type WhiteLedState, type WirelessChimeSilentState, type ZoomFocusStatus, type ZoomFocusTriplet, abilitiesHasAny, aesDecrypt, aesEncrypt, asLogger, autoDetectDeviceType, bcDecrypt, bcEncrypt, bcHeaderHasPayloadOffset, buildAacAudioSpecificConfigHex, buildAbilityInfoExtensionXml, buildBinaryExtensionXml, buildChannelExtensionXml, buildFloodlightManualXml, buildHlsRedirectUrl, buildLoginXml, buildLogoutXml, buildPreviewStopXml, buildPreviewStopXmlV11, buildPreviewXml, buildPreviewXmlV11, buildPtzControlXml, buildPtzPresetXml, buildPtzPresetXmlV2, buildRfc4571Sdp, buildRtspPath, buildRtspUrl, buildSirenManualXml, buildSirenTimesXml, buildStartZoomFocusXml, buildWhiteLedStateXml, collectCgiDiagnostics, collectMultifocalDiagnostics, collectNativeDiagnostics, collectNvrDiagnostics, computeDeviceCapabilities, convertToAnnexB as convertH265ToAnnexB, convertToAnnexB$1 as convertToAnnexB, convertToLengthPrefixed, createBaichuanEndpointsServer, createDebugGateLogger, createDiagnosticsBundle, createLogger, createMjpegBoundary, createNativeStream, createNullLogger, createReplayHttpServer, createRfc4571TcpServer, createRfc4571TcpServerForReplay, createRtspProxyServer, createTaggedLogger, decideVideoclipTranscodeMode, decodeHeader, deriveAesKey, detectIosClient, detectVideoCodecFromNal, discoverReolinkDevices, discoverViaArpTable, discoverViaDhcpListener, discoverViaHttpScan, discoverViaOnvif, discoverViaTcpPortScan, discoverViaUdpBroadcast, discoverViaUdpDirect, encodeHeader, extractH264ParamSetsFromAccessUnit, extractH265ParamSetsFromAccessUnit, extractPpsFromAnnexB, extractSpsFromAnnexB, extractVpsFromAnnexB, flattenAbilitiesForChannel, formatMjpegFrame, getConstructedVideoStreamOptions, getGlobalLogger, getH265NalType, getMjpegContentType, getSupportItemForChannel, getVideoStream, getVideoclipClientInfo, getXmlText, hasStartCodes as hasH265StartCodes, hasStartCodes$1 as hasStartCodes, isDualLenseModel, isH264KeyframeAnnexB, isH265Irap, isH265KeyframeAnnexB, isNvrHubModel, isTcpFailureThatShouldFallbackToUdp, isValidH264AnnexBAccessUnit, isValidH265AnnexBAccessUnit, maskUid, md5HexUpper, md5StrModern, normalizeUid, packetizeAacAdtsFrame, packetizeAacRawFrame, packetizeH264, packetizeH265, parseAdtsHeader, parseBcMedia, parseRecordingFileName, parseSupportXml, printNvrDiagnostics, runAllDiagnosticsConsecutively, runMultifocalDiagnosticsConsecutively, sampleStreams, setGlobalLogger, splitAnnexBToNalPayloads$1 as splitAnnexBToNalPayloads, splitAnnexBToNals, splitAnnexBToNalPayloads as splitH265AnnexBToNalPayloads, testChannelStreams, xmlEscape, zipDirectory };
8942
+ export { type AIDetectionState, type AIEvent, type AIState, type AbilityInfo, type AccessUserListConfig, AesStreamDecryptor, type AiAlarmConfig, type AiConfig, type AiDenoiseConfig, type AiKey, type AiTypesCacheEntry, type AnyBuffer, type AudioAlarmParams, type AudioCfgConfig, type AudioConfig, type AudioTaskConfig, type AutoDetectInputs, type AutoDetectMode, type AutoDetectResult, AutodiscoveryClient, type AutodiscoveryClientOptions, BC_AES_IV, BC_CLASS_FILE_DOWNLOAD, BC_CLASS_LEGACY, BC_CLASS_MODERN_20, BC_CLASS_MODERN_24, BC_CLASS_MODERN_24_ALT, BC_CMD_ID_ABILITY_INFO, BC_CMD_ID_ALARM_EVENT_LIST, BC_CMD_ID_AUDIO_ALARM_PLAY, BC_CMD_ID_CHANNEL_INFO_ALL, BC_CMD_ID_CMD_123, BC_CMD_ID_CMD_209, BC_CMD_ID_CMD_265, BC_CMD_ID_CMD_440, BC_CMD_ID_COVER_PREVIEW, BC_CMD_ID_COVER_RESPONSE, BC_CMD_ID_COVER_STANDALONE_458, BC_CMD_ID_COVER_STANDALONE_459, BC_CMD_ID_COVER_STANDALONE_460, BC_CMD_ID_COVER_STANDALONE_461, BC_CMD_ID_COVER_STANDALONE_462, BC_CMD_ID_DING_DONG_CTRL, BC_CMD_ID_DING_DONG_OPT, BC_CMD_ID_FILE_INFO_LIST_CLOSE, BC_CMD_ID_FILE_INFO_LIST_DL_VIDEO, BC_CMD_ID_FILE_INFO_LIST_DOWNLOAD, BC_CMD_ID_FILE_INFO_LIST_GET, BC_CMD_ID_FILE_INFO_LIST_OPEN, BC_CMD_ID_FILE_INFO_LIST_REPLAY, BC_CMD_ID_FILE_INFO_LIST_STOP, BC_CMD_ID_FIND_REC_VIDEO_CLOSE, BC_CMD_ID_FIND_REC_VIDEO_GET, BC_CMD_ID_FIND_REC_VIDEO_OPEN, BC_CMD_ID_FLOODLIGHT_STATUS_LIST, BC_CMD_ID_GET_ABILITY_SUPPORT, BC_CMD_ID_GET_ACCESS_USER_LIST, BC_CMD_ID_GET_AI_ALARM, BC_CMD_ID_GET_AI_CFG, BC_CMD_ID_GET_AI_DENOISE, BC_CMD_ID_GET_AUDIO_ALARM, BC_CMD_ID_GET_AUDIO_CFG, BC_CMD_ID_GET_AUDIO_TASK, BC_CMD_ID_GET_BATTERY_INFO, BC_CMD_ID_GET_BATTERY_INFO_LIST, BC_CMD_ID_GET_DAY_NIGHT_THRESHOLD, BC_CMD_ID_GET_DAY_RECORDS, BC_CMD_ID_GET_DING_DONG_CFG, BC_CMD_ID_GET_DING_DONG_LIST, BC_CMD_ID_GET_DING_DONG_SILENT, BC_CMD_ID_GET_EMAIL_TASK, BC_CMD_ID_GET_FTP_TASK, BC_CMD_ID_GET_HDD_INFO_LIST, BC_CMD_ID_GET_KIT_AP_CFG, BC_CMD_ID_GET_LED_STATE, BC_CMD_ID_GET_MOTION_ALARM, BC_CMD_ID_GET_ONLINE_USER_LIST, BC_CMD_ID_GET_OSD_DATETIME, BC_CMD_ID_GET_PIR_INFO, BC_CMD_ID_GET_PTZ_POSITION, BC_CMD_ID_GET_PTZ_PRESET, BC_CMD_ID_GET_RECORD, BC_CMD_ID_GET_RECORD_CFG, BC_CMD_ID_GET_REC_ENC_CFG, BC_CMD_ID_GET_SIREN_STATUS, BC_CMD_ID_GET_SLEEP_STATE, BC_CMD_ID_GET_STREAM_INFO_LIST, BC_CMD_ID_GET_SUPPORT, BC_CMD_ID_GET_SYSTEM_GENERAL, BC_CMD_ID_GET_TIMELAPSE_CFG, BC_CMD_ID_GET_VIDEO_INPUT, BC_CMD_ID_GET_WHITE_LED, BC_CMD_ID_GET_WIFI, BC_CMD_ID_GET_WIFI_SIGNAL, BC_CMD_ID_GET_ZOOM_FOCUS, BC_CMD_ID_LOGIN, BC_CMD_ID_LOGOUT, BC_CMD_ID_PING, BC_CMD_ID_PTZ_CONTROL, BC_CMD_ID_PTZ_CONTROL_PRESET, BC_CMD_ID_PUSH_COORDINATE_POINT_LIST, BC_CMD_ID_PUSH_DINGDONG_LIST, BC_CMD_ID_PUSH_NET_INFO, BC_CMD_ID_PUSH_SERIAL, BC_CMD_ID_PUSH_SLEEP_STATUS, BC_CMD_ID_PUSH_VIDEO_INPUT, BC_CMD_ID_QUICK_REPLY_PLAY, BC_CMD_ID_SET_AI_ALARM, BC_CMD_ID_SET_AI_CFG, BC_CMD_ID_SET_AUDIO_TASK, BC_CMD_ID_SET_DING_DONG_CFG, BC_CMD_ID_SET_DING_DONG_SILENT, BC_CMD_ID_SET_MOTION_ALARM, BC_CMD_ID_SET_PIR_INFO, BC_CMD_ID_SET_WHITE_LED_STATE, BC_CMD_ID_SET_WHITE_LED_TASK, BC_CMD_ID_SET_ZOOM_FOCUS, BC_CMD_ID_SUPPORT, BC_CMD_ID_TALK, BC_CMD_ID_TALK_ABILITY, BC_CMD_ID_TALK_CONFIG, BC_CMD_ID_TALK_RESET, BC_CMD_ID_UDP_KEEP_ALIVE, BC_CMD_ID_VIDEO, BC_CMD_ID_VIDEO_STOP, BC_MAGIC, BC_MAGIC_REV, BC_TCP_DEFAULT_PORT, BC_XML_KEY, type BaichuanCachedPush, BaichuanClient, type BaichuanClientOptions, type BaichuanCoordinatePointListPush, type BaichuanDingdongListPush, type BaichuanEndpointsServerOptions, BaichuanEventEmitter, type BaichuanFrame, BaichuanFrameParser, type BaichuanGetOsdDatetimeResult, type BaichuanHeader, BaichuanHlsServer, type BaichuanHlsServerOptions, BaichuanHttpStreamServer, type BaichuanHttpStreamServerOptions, type BaichuanLedState, BaichuanMjpegServer, type BaichuanMjpegServerOptions, type BaichuanNetInfoPush, type BaichuanOsdChannelName, type BaichuanOsdDatetime, type BaichuanRecordCfg, type BaichuanRecordSchedule, BaichuanRtspServer, type BaichuanRtspServerOptions, type BaichuanSerialPush, type BaichuanSettingsPushCacheEntry, type BaichuanSleepState, type BaichuanSleepStatusPush, type BaichuanStreamEncodeTable, type BaichuanStreamInfo, type BaichuanStreamInfoList, type BaichuanTransport, type BaichuanVideoInputPush, BaichuanVideoStream, type BaichuanVideoStreamOptions, BaichuanWebRTCServer, type BaichuanWebRTCServerOptions, type BaichuanWifi, type BaichuanWifiSignal, type BatteryInfo, type BatteryInfoResponse, type BcMedia, type BcMediaAac, type BcMediaAdpcm, BcMediaAnnexBDecoder, type BcMediaAnnexBDecoderStats, type BcMediaAnnexBInfo, type BcMediaAudioFrame, type BcMediaAudioType, BcMediaCodec, type BcMediaIframe, type BcMediaInfoV1, type BcMediaInfoV2, type BcMediaPframe, type BcMediaType, type BcMediaVideoFrame, type BcMediaVideoType, type BcUdpDiscoveryMethod, BcUdpStream, type BcUdpStreamOptions, type CgiAbility, type CgiAbilityChn, type CgiAbilityLeaf, type CgiAiKey, type CgiAiStateValue, type CgiAudioAlarmPlayParam, type CgiBattery, type CgiChannelStatusEntry, type CgiChnTypeInfoValue, type CgiDetectionState, type CgiDevInfo, type CgiDeviceInfoEntries, type CgiEnc, type CgiEncStream, type CgiEncValue, type CgiGetAbilityResponse, type CgiGetAbilityValue, type CgiGetAiStateResponse, type CgiGetChannelstatusResponse, type CgiGetChannelstatusValue, type CgiGetChnTypeInfoResponse, type CgiGetDevInfoResponse, type CgiGetDevInfoValue, type CgiGetEncResponse, type CgiGetOsdValue, type CgiGetRtspUrlResponse, type CgiGetRtspUrlValue, type CgiGetVideoclipsParams, type CgiNetPort, type CgiOsd, type CgiPirInfo, type CgiPtzPreset, type CgiSetOsdParam, type CgiSetPirInfoParam, type CgiSetWhiteLedParam, type CgiWhiteLed, type ChannelPushCacheEntry, type ChannelPushDataEntry, type ChannelRecordingFile, type ChannelStreamMetadata, type ChimeAlarmCfg, type ChimeCfg, type ChimeDevice, type ChimeParams, type CollectNvrDiagnosticsOptions, CompositeRtspServer, type CompositeRtspServerOptions, CompositeStream, type CompositeStreamOptions, type CompositeStreamPipOptions, DUAL_LENS_DUAL_MOTION_MODELS, DUAL_LENS_MODELS, DUAL_LENS_SINGLE_MOTION_MODELS, type DayNightThresholdConfig, type DebugConfig, type DebugOptions, type DeviceAbilities, type DeviceCapabilities, type DeviceCapabilitiesCacheEntry, type DeviceCapabilitiesDebugInfo, type DeviceCapabilitiesResult, type DeviceInfoResponse, type DeviceInputData, type DeviceObjectType, type DeviceStatusResponse, type DeviceSupportFlags, type DeviceType, type DiagnosticsCollectorResult, type DiagnosticsStreamKind, type DiscoveredDevice, type DiscoveryOptions, type DownloadRecordingParams, type DualLensChannelAnalysis, type DualLensChannelInfo, type EmailTaskConfig, type EncryptionProtocol, type Events, type EventsResponse, type FloodlightTaskConfig, type FtpTaskConfig, type GetRecordingVideoResult, type GetRecordingVideoStats, type GetVideoclipsParams, type GetVodUrlParams, Go2rtcTcpServer, type Go2rtcTcpServerOptions, H264RtpDepacketizer, H265RtpDepacketizer, type HardwiredChimeState, type HddInfoListConfig, type HlsCodec, type HlsHttpResponse, type HlsServerStatus, type HlsSession, HlsSessionManager, type HlsSessionManagerOptions, type HlsSessionParams, Intercom, type IntercomOptions, type JsonObject, type JsonPrimitive, type JsonValue, type LastSleepProbe, type LogLevel, type Logger, type LoggerCallback, type LoginResponseValue, type MaxEncryption, type MediaStream, type MjpegFrame, MjpegTransformer, type MjpegTransformerOptions, type ModelFixtureCaptureResult, type MotionAlarmConfig, type MotionEvent, NVR_HUB_EXACT_TYPES, NVR_HUB_MODEL_PATTERNS, type NativeVideoStreamVariant, type NvrChannelsSummaryCacheEntry, type OnlineUserListConfig, type OsdChannel, type OsdConfig, type OsdTime, type ParsedRecordingFileName, type PipPosition, type PirConfig, type PirState, type PlaybackSnapshotStreamInfo, type PtzCommand, type PtzPosition, type PtzPreset, type RecEncConfig, type RecordingAudioCodec, type RecordingDetectionClass, type RecordingDevType, type RecordingFile, type RecordingPlaybackUrls, type RecordingStreamType, type RecordingVideoCodec, type RecordingVodFlags, type RecordingVodStreamHint, type RecordingsCacheEntry, type RecordingsQueueItem, type ReolinkAiNotification, ReolinkBaichuanApi, type ReolinkBaichuanChannelIdentity, type ReolinkBaichuanChannelInfo, type ReolinkBaichuanDeviceSummary, type ReolinkBaichuanNetworkInfo, type ReolinkBaichuanPorts, ReolinkCgiApi, type ReolinkCmdRequest, type ReolinkCmdResponse, type ReolinkCmdResponseExt, type ReolinkDayNightNotification, type ReolinkDeviceInfo, type ReolinkDeviceInfoTag, type ReolinkEvent, ReolinkHttpClient, type ReolinkHttpClientOptions, type ReolinkJson, type ReolinkMotionNotification, type ReolinkNvrChannelInfo, type ReolinkNvrDeviceGroupSummary, type ReolinkNvrDeviceGroupsResult, type ReolinkSimpleEvent, type ReolinkSimpleEventType, type ReolinkSupportedStream, type ReolinkVideoStreamOptionsResult, type ReolinkVisitorNotification, type ReplayHttpServer, type ReplayHttpServerOptions, type ResponseMediaStreamOptions, type Rfc4571ApiFactoryContext, type Rfc4571Client, Rfc4571Muxer, type Rfc4571ReplayServer, type Rfc4571ReplayServerOptions, type Rfc4571TcpServer, type Rfc4571TcpServerOptions, type RtpPacketizationOptions, type RtspCreateOptions, type RtspProxyServerOptions, type RtspStreamProfile, type RunAllDiagnosticsConsecutivelyParams, type RunAllDiagnosticsConsecutivelyResult, type RunMultifocalDiagnosticsConsecutivelyParams, type RunMultifocalDiagnosticsConsecutivelyResult, type SirenState, type SirenStatusConfig, type SleepState, type SleepStatus, type StreamMetadata, type StreamProfile, type StreamSamplingOptions, type StreamSamplingSelection, type SupportConfig, type SupportInfo, type SupportItem, type SystemGeneralConfig, type TalkAbility$1 as TalkAbility, type TalkAudioConfig, type TalkConfig, type TalkSession$1 as TalkSession, type TalkSessionInfo, type TimelapseCfgConfig, type TwoWayAudioConfig, type VideoCodec, type VideoInputConfig, type VideoParamSets, type VideoStreamOptions, type VideoStreamOptionsCacheEntry, type VideoType, type VideoclipClientInfo, type VideoclipModeDecision, type VideoclipThumbnailResult, type VideoclipTranscodeMode, type VodFile, type VodSearchResponse, type VodSearchResult, type VodSearchStatus, type WakeUpOptions, type WebRTCAnswer, type WebRTCIceCandidate, type WebRTCOffer, type WebRTCSessionInfo, type WhiteLedConfig, type WhiteLedState, type WirelessChimeSilentState, type ZoomFocusStatus, type ZoomFocusTriplet, abilitiesHasAny, aesDecrypt, aesEncrypt, asLogger, autoDetectDeviceType, bcDecrypt, bcEncrypt, bcHeaderHasPayloadOffset, buildAacAudioSpecificConfigHex, buildAbilityInfoExtensionXml, buildBinaryExtensionXml, buildChannelExtensionXml, buildFloodlightManualXml, buildHlsRedirectUrl, buildLoginXml, buildLogoutXml, buildPreviewStopXml, buildPreviewStopXmlV11, buildPreviewXml, buildPreviewXmlV11, buildPtzControlXml, buildPtzPresetXml, buildPtzPresetXmlV2, buildRfc4571Sdp, buildRtspPath, buildRtspUrl, buildSirenManualXml, buildSirenTimesXml, buildStartZoomFocusXml, buildWhiteLedStateXml, captureModelFixtures, collectCgiDiagnostics, collectMultifocalDiagnostics, collectNativeDiagnostics, collectNvrDiagnostics, computeDeviceCapabilities, convertToAnnexB as convertH265ToAnnexB, convertToAnnexB$1 as convertToAnnexB, convertToLengthPrefixed, createBaichuanEndpointsServer, createDebugGateLogger, createDiagnosticsBundle, createLogger, createMjpegBoundary, createNativeStream, createNullLogger, createReplayHttpServer, createRfc4571TcpServer, createRfc4571TcpServerForReplay, createRtspProxyServer, createTaggedLogger, decideVideoclipTranscodeMode, decodeHeader, deriveAesKey, detectIosClient, detectVideoCodecFromNal, discoverReolinkDevices, discoverViaArpTable, discoverViaDhcpListener, discoverViaHttpScan, discoverViaOnvif, discoverViaTcpPortScan, discoverViaUdpBroadcast, discoverViaUdpDirect, encodeHeader, extractH264ParamSetsFromAccessUnit, extractH265ParamSetsFromAccessUnit, extractPpsFromAnnexB, extractSpsFromAnnexB, extractVpsFromAnnexB, flattenAbilitiesForChannel, formatMjpegFrame, getConstructedVideoStreamOptions, getGlobalLogger, getH265NalType, getMjpegContentType, getSupportItemForChannel, getVideoStream, getVideoclipClientInfo, getXmlText, hasStartCodes as hasH265StartCodes, hasStartCodes$1 as hasStartCodes, isDualLenseModel, isH264KeyframeAnnexB, isH265Irap, isH265KeyframeAnnexB, isNvrHubModel, isTcpFailureThatShouldFallbackToUdp, isValidH264AnnexBAccessUnit, isValidH265AnnexBAccessUnit, maskUid, md5HexUpper, md5StrModern, normalizeUid, packetizeAacAdtsFrame, packetizeAacRawFrame, packetizeH264, packetizeH265, parseAdtsHeader, parseBcMedia, parseRecordingFileName, parseSupportXml, printNvrDiagnostics, runAllDiagnosticsConsecutively, runMultifocalDiagnosticsConsecutively, sampleStreams, setGlobalLogger, splitAnnexBToNalPayloads$1 as splitAnnexBToNalPayloads, splitAnnexBToNals, splitAnnexBToNalPayloads as splitH265AnnexBToNalPayloads, testChannelStreams, xmlEscape, xmlIndicatesFloodlight, zipDirectory };
package/dist/index.d.ts CHANGED
@@ -422,6 +422,22 @@ export declare class BaichuanClient extends EventEmitter<{
422
422
  private static readonly coverPreviewBackoffMs;
423
423
  private static readonly COVER_PREVIEW_INITIAL_BACKOFF_MS;
424
424
  private static readonly COVER_PREVIEW_MAX_BACKOFF_MS;
425
+ /**
426
+ * Per-client snapshot (cmd_id=109) serialization queue.
427
+ *
428
+ * WHY: On NVR/multi-camera devices sharing one socket, concurrent snapshot requests
429
+ * can cause JPEG data to mix (even with per-request msgNum filtering):
430
+ * - Camera A and B both send frames on same socket
431
+ * - Frame listener is global per socket
432
+ * - Timing quirks can cause chunk reordering or listener confusion
433
+ *
434
+ * FIX: Serialize all cmd_id=109 requests on THIS client instance.
435
+ * Each snapshot waits for previous one to complete before starting.
436
+ * This ensures clean frame sequences per request, zero data corruption.
437
+ *
438
+ * Impact: Snapshots are ~0–50ms slower per camera (negligible for users).
439
+ */
440
+ private snapshotQueueTail;
425
441
  private readonly opts;
426
442
  private readonly debugCfg;
427
443
  private readonly logger;
@@ -768,6 +784,7 @@ export declare class BaichuanClient extends EventEmitter<{
768
784
  private sendBinaryFileDownload6482;
769
785
  private sendBinaryFileInfoListReplay5;
770
786
  private sendBinarySnapshot109;
787
+ private sendBinarySnapshot109Impl;
771
788
  /**
772
789
  * Send CoverPreview command (cmd_id=298) to get an I-frame from a past recording.
773
790
  * Similar to sendBinarySnapshot109 but handles the stream header + frame format
@@ -2487,6 +2504,24 @@ export declare function buildStartZoomFocusXml(channelId: number, movePos: numbe
2487
2504
  */
2488
2505
  export declare function buildWhiteLedStateXml(channelId: number, state: number): string;
2489
2506
 
2507
+ /**
2508
+ * Capture all relevant API responses from a single device (or NVR channel)
2509
+ * and write them as JSON/XML fixtures into `outDir`.
2510
+ *
2511
+ * This is the library-level building block used by both:
2512
+ * - `test/capture-model-fixtures.ts` (CLI)
2513
+ * - the Scrypted plugin's "Dump Model Fixtures" setting action
2514
+ *
2515
+ * For NVR/Hub devices, call once per active channel.
2516
+ */
2517
+ export declare function captureModelFixtures(params: {
2518
+ api: ReolinkBaichuanApi;
2519
+ channel: number;
2520
+ outDir: string;
2521
+ /** Logger (defaults to console) */
2522
+ log?: (...args: unknown[]) => void;
2523
+ }): Promise<ModelFixtureCaptureResult>;
2524
+
2490
2525
  export declare type CgiAbility = {
2491
2526
  Ability: {
2492
2527
  abilityChn?: CgiAbilityChn[];
@@ -4040,6 +4075,104 @@ export declare interface GetVodUrlParams {
4040
4075
  */
4041
4076
  export declare function getXmlText(xml: string, tagName: string): string | undefined;
4042
4077
 
4078
+ export declare class Go2rtcTcpServer extends EventEmitter<{
4079
+ client: [string];
4080
+ clientDisconnected: [string];
4081
+ error: [Error];
4082
+ close: [];
4083
+ listening: [{
4084
+ host: string;
4085
+ port: number;
4086
+ }];
4087
+ }> {
4088
+ private readonly api;
4089
+ private readonly channel;
4090
+ private readonly profile;
4091
+ private readonly variant;
4092
+ private readonly listenHost;
4093
+ private readonly listenPort;
4094
+ private readonly logger;
4095
+ private readonly deviceId;
4096
+ private readonly gracePeriodMs;
4097
+ private readonly prebufferMaxMs;
4098
+ private readonly maxBufferBytes;
4099
+ private readonly prestartStream;
4100
+ private active;
4101
+ private server;
4102
+ private resolvedPort;
4103
+ private nativeFanout;
4104
+ private nativeStreamActive;
4105
+ private dedicatedSessionRelease;
4106
+ private detectedVideoType;
4107
+ private connectedClients;
4108
+ private clientSockets;
4109
+ private stopGraceTimer;
4110
+ private prebuffer;
4111
+ constructor(options: Go2rtcTcpServerOptions);
4112
+ /** Start listening. Resolves once the TCP server is bound. */
4113
+ start(): Promise<void>;
4114
+ /** Stop the server and all active streams. */
4115
+ stop(): Promise<void>;
4116
+ /** The actual port the server is listening on (available after start()). */
4117
+ get port(): number | undefined;
4118
+ /** The go2rtc-compatible source URL. */
4119
+ get go2rtcSourceUrl(): string | undefined;
4120
+ /** Number of currently connected clients. */
4121
+ get clientCount(): number;
4122
+ private handleClient;
4123
+ private feedClient;
4124
+ /**
4125
+ * Convert a native frame to wire-ready Annex-B.
4126
+ * Audio frames are skipped — raw TCP carries only video (Annex-B).
4127
+ * go2rtc auto-detects the codec from SPS/PPS/VPS NALUs.
4128
+ */
4129
+ private convertFrame;
4130
+ /** Check if an Annex-B buffer contains a keyframe (IDR for H.264, IRAP for H.265). */
4131
+ private isAnnexBKeyframe;
4132
+ /** Split Annex-B byte stream into individual NAL units. */
4133
+ private static splitAnnexBNals;
4134
+ private startNativeStream;
4135
+ private stopNativeStream;
4136
+ private removeClient;
4137
+ private scheduleStop;
4138
+ }
4139
+
4140
+ export declare interface Go2rtcTcpServerOptions {
4141
+ /** API instance (required). */
4142
+ api: ReolinkBaichuanApi;
4143
+ /** Channel number (required). */
4144
+ channel: number;
4145
+ /** Stream profile (required). */
4146
+ profile: StreamProfile;
4147
+ /** TrackMix tele/autotrack variant. */
4148
+ variant?: NativeVideoStreamVariant;
4149
+ /** Host to listen on (default: "127.0.0.1"). */
4150
+ listenHost?: string;
4151
+ /** Port to listen on (default: 0 = OS picks). */
4152
+ listenPort?: number;
4153
+ /** Logger. */
4154
+ logger?: Logger;
4155
+ /**
4156
+ * External identifier for dedicated socket session.
4157
+ * When provided, a dedicated BaichuanClient is created for the stream,
4158
+ * isolating it from other streams on the shared socket.
4159
+ */
4160
+ deviceId?: string;
4161
+ /** Grace period in ms before stopping native stream after last client disconnects (default: 30 000). */
4162
+ gracePeriodMs?: number;
4163
+ /** Maximum prebuffer window in ms (default: 3 000). */
4164
+ prebufferMs?: number;
4165
+ /** Maximum write buffer per client before dropping the connection (default: 100 MB). */
4166
+ maxBufferBytes?: number;
4167
+ /**
4168
+ * When true, the native camera stream is started immediately on start()
4169
+ * rather than waiting for the first TCP client. This ensures frames are
4170
+ * already flowing (and the prebuffer is warm) when go2rtc connects.
4171
+ * Default: true.
4172
+ */
4173
+ prestartStream?: boolean;
4174
+ }
4175
+
4043
4176
  /**
4044
4177
  * Depacketizer for H.264 "RTP-like" payloads (RFC 6184) when the camera sends single NAL units,
4045
4178
  * STAP/MTAP aggregation or FU-A/FU-B fragmentation inside a BcMedia frame payload.
@@ -4482,6 +4615,26 @@ export declare interface MjpegTransformerOptions {
4482
4615
  logger?: LoggerCallback | undefined;
4483
4616
  }
4484
4617
 
4618
+ export declare interface ModelFixtureCaptureResult {
4619
+ /** Per-call results: command name → ok/error */
4620
+ calls: Record<string, {
4621
+ ok: true;
4622
+ value?: unknown;
4623
+ } | {
4624
+ ok: false;
4625
+ error: string;
4626
+ }>;
4627
+ /** Output directory where fixtures were written */
4628
+ outDir: string;
4629
+ /** Summary counters */
4630
+ summary: {
4631
+ total: number;
4632
+ ok: number;
4633
+ failed: number;
4634
+ errors: string[];
4635
+ };
4636
+ }
4637
+
4485
4638
  /**
4486
4639
  * Motion alarm configuration (getMotionAlarm response).
4487
4640
  * cmdId=46 (GetMdAlarm)
@@ -9064,6 +9217,18 @@ export declare interface WirelessChimeSilentState {
9064
9217
 
9065
9218
  export declare function xmlEscape(text: string | undefined | null): string;
9066
9219
 
9220
+ /**
9221
+ * Determine whether a cmd 289 (GetWhiteLed) XML response indicates
9222
+ * controllable floodlight/spotlight hardware.
9223
+ *
9224
+ * `<FloodlightTask>`, `<FloodlightManual>`, and `<FloodlightStatusList>` are
9225
+ * conclusive. `<WhiteLed>` is ambiguous — doorbells (e.g. D340W) return it
9226
+ * for their status-indicator LED which is NOT a floodlight. Only treat
9227
+ * `<WhiteLed>` as floodlight when brightness or scheduling controls are
9228
+ * present (`brightness_cur`, `bright`, `LightingSchedule`).
9229
+ */
9230
+ export declare function xmlIndicatesFloodlight(xml: string): boolean;
9231
+
9067
9232
  declare type XmlJsonObject = {
9068
9233
  [key: string]: XmlJsonValue;
9069
9234
  };