matter-all-in-one-addon 2.1.2 → 2.3.1
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 +71 -274
- package/dist/camera/ai/camera-ai-detector.d.ts +6 -4
- package/dist/camera/ai/camera-ai-detector.js +62 -36
- package/dist/camera/ai/camera-ai-detector.js.map +1 -1
- package/dist/camera/ai/camera-diagnostics.d.ts +48 -0
- package/dist/camera/ai/camera-diagnostics.js +41 -0
- package/dist/camera/ai/camera-diagnostics.js.map +1 -0
- package/dist/camera/ai/diagnostics-auth.d.ts +2 -0
- package/dist/camera/ai/diagnostics-auth.js +13 -0
- package/dist/camera/ai/diagnostics-auth.js.map +1 -0
- package/dist/camera/camera-capabilities.js +7 -6
- package/dist/camera/camera-capabilities.js.map +1 -1
- package/dist/camera/camera-entity-control.d.ts +12 -0
- package/dist/camera/camera-entity-control.js +24 -0
- package/dist/camera/camera-entity-control.js.map +1 -0
- package/dist/camera/camera-source-resolver.d.ts +16 -0
- package/dist/camera/camera-source-resolver.js +123 -0
- package/dist/camera/camera-source-resolver.js.map +1 -1
- package/dist/camera/camera-types.d.ts +2 -0
- package/dist/camera/cameraui/cameraui-homekit-bridge.js +26 -6
- package/dist/camera/cameraui/cameraui-homekit-bridge.js.map +1 -1
- package/dist/camera/homekit/ffmpeg-helper.d.ts +1 -4
- package/dist/camera/homekit/ffmpeg-helper.js +65 -27
- package/dist/camera/homekit/ffmpeg-helper.js.map +1 -1
- package/dist/camera/homekit/hevc/bootstrap.d.ts +9 -0
- package/dist/camera/homekit/hevc/bootstrap.js +47 -0
- package/dist/camera/homekit/hevc/bootstrap.js.map +1 -0
- package/dist/camera/homekit/hevc/hevc-recording.d.ts +2 -0
- package/dist/camera/homekit/hevc/hevc-recording.js +70 -33
- package/dist/camera/homekit/hevc/hevc-recording.js.map +1 -1
- package/dist/camera/homekit/hevc/multi-tier-rtp.d.ts +15 -1
- package/dist/camera/homekit/hevc/multi-tier-rtp.js +229 -64
- package/dist/camera/homekit/hevc/multi-tier-rtp.js.map +1 -1
- package/dist/camera/homekit/hevc/recording-output.d.ts +2 -0
- package/dist/camera/homekit/hevc/recording-output.js +33 -0
- package/dist/camera/homekit/hevc/recording-output.js.map +1 -0
- package/dist/camera/homekit/hevc/sframe-rtp.d.ts +2 -0
- package/dist/camera/homekit/hevc/sframe-rtp.js +38 -4
- package/dist/camera/homekit/hevc/sframe-rtp.js.map +1 -1
- package/dist/camera/homekit/hevc/sframe.d.ts +11 -1
- package/dist/camera/homekit/hevc/sframe.js +195 -23
- package/dist/camera/homekit/hevc/sframe.js.map +1 -1
- package/dist/camera/homekit/hevc/webrtc-session.d.ts +17 -3
- package/dist/camera/homekit/hevc/webrtc-session.js +262 -63
- package/dist/camera/homekit/hevc/webrtc-session.js.map +1 -1
- package/dist/camera/homekit/homekit-camera-recording.delegate.d.ts +5 -0
- package/dist/camera/homekit/homekit-camera-recording.delegate.js +89 -111
- package/dist/camera/homekit/homekit-camera-recording.delegate.js.map +1 -1
- package/dist/camera/homekit/homekit-camera-stream.delegate.d.ts +10 -2
- package/dist/camera/homekit/homekit-camera-stream.delegate.js +339 -310
- package/dist/camera/homekit/homekit-camera-stream.delegate.js.map +1 -1
- package/dist/camera/homekit/homekit-camera.accessory.d.ts +42 -2
- package/dist/camera/homekit/homekit-camera.accessory.js +255 -162
- package/dist/camera/homekit/homekit-camera.accessory.js.map +1 -1
- package/dist/camera/homekit/live-view-telemetry.d.ts +4 -0
- package/dist/camera/homekit/live-view-telemetry.js.map +1 -1
- package/dist/camera/homekit/media-policy.d.ts +25 -0
- package/dist/camera/homekit/media-policy.js +102 -0
- package/dist/camera/homekit/media-policy.js.map +1 -0
- package/dist/camera/homekit/route-address.d.ts +2 -0
- package/dist/camera/homekit/route-address.js +27 -0
- package/dist/camera/homekit/route-address.js.map +1 -0
- package/dist/camera/homekit/rtp-relay.d.ts +21 -0
- package/dist/camera/homekit/rtp-relay.js +112 -0
- package/dist/camera/homekit/rtp-relay.js.map +1 -0
- package/dist/camera/homekit/startup-timing.d.ts +8 -0
- package/dist/camera/homekit/startup-timing.js +14 -0
- package/dist/camera/homekit/startup-timing.js.map +1 -0
- package/dist/camera/motion/ffmpeg-motion-detector.d.ts +10 -0
- package/dist/camera/motion/ffmpeg-motion-detector.js +126 -77
- package/dist/camera/motion/ffmpeg-motion-detector.js.map +1 -1
- package/dist/camera/scrypted/scrypted-stream-validator.d.ts +1 -1
- package/dist/camera/scrypted/scrypted-stream-validator.js +8 -3
- package/dist/camera/scrypted/scrypted-stream-validator.js.map +1 -1
- package/dist/camera/source-adapter.d.ts +132 -0
- package/dist/camera/source-adapter.js +282 -0
- package/dist/camera/source-adapter.js.map +1 -0
- package/dist/converters/vacuum.converter.d.ts +3 -2
- package/dist/converters/vacuum.converter.js +29 -4
- package/dist/converters/vacuum.converter.js.map +1 -1
- package/dist/device-profiles.d.ts +3 -3
- package/dist/device-profiles.js +26 -6
- package/dist/device-profiles.js.map +1 -1
- package/dist/device-registry.d.ts +1 -0
- package/dist/device-registry.js +11 -3
- package/dist/device-registry.js.map +1 -1
- package/dist/entities/base.entity.js +3 -1
- package/dist/entities/base.entity.js.map +1 -1
- package/dist/entities/camera.entity.d.ts +2 -0
- package/dist/entities/camera.entity.js +40 -1
- package/dist/entities/camera.entity.js.map +1 -1
- package/dist/entities/composite-device.entity.js +2 -1
- package/dist/entities/composite-device.entity.js.map +1 -1
- package/dist/entities/energy_tariff.entity.js +21 -8
- package/dist/entities/energy_tariff.entity.js.map +1 -1
- package/dist/entities/vacuum.entity.d.ts +8 -0
- package/dist/entities/vacuum.entity.js +300 -36
- package/dist/entities/vacuum.entity.js.map +1 -1
- package/dist/frontend/assets/index-Bka3TVAQ.js +21 -0
- package/dist/frontend/assets/{index-CJdlkpIy.css → index-NrzHqycm.css} +1 -1
- package/dist/frontend/index.html +2 -2
- package/dist/hap/hap-generic-accessory.d.ts +3 -1
- package/dist/hap/hap-generic-accessory.js +50 -0
- package/dist/hap/hap-generic-accessory.js.map +1 -1
- package/dist/homeAssistant.d.ts +13 -0
- package/dist/homeAssistant.js +54 -13
- package/dist/homeAssistant.js.map +1 -1
- package/dist/homekit.compat.d.ts +2 -1
- package/dist/homekit.compat.js +4 -1
- package/dist/homekit.compat.js.map +1 -1
- package/dist/platform.d.ts +19 -7
- package/dist/platform.js +865 -587
- package/dist/platform.js.map +1 -1
- package/dist/proxy.js +1 -11
- package/dist/proxy.js.map +1 -1
- package/dist/utils/atomic-json-store.d.ts +5 -0
- package/dist/utils/atomic-json-store.js +31 -0
- package/dist/utils/atomic-json-store.js.map +1 -0
- package/dist/utils/ha-entity-names.d.ts +21 -0
- package/dist/utils/ha-entity-names.js +26 -0
- package/dist/utils/ha-entity-names.js.map +1 -0
- package/package.json +22 -19
- package/vendor/hap-nodejs/LICENSE +176 -0
- package/vendor/hap-nodejs/MIAO.md +5 -0
- package/vendor/hap-nodejs/PATCH.md +37 -0
- package/vendor/hap-nodejs/README.md +86 -0
- package/vendor/hap-nodejs/dist/accessories/AirConditioner_accessory.d.ts +2 -0
- package/vendor/hap-nodejs/dist/accessories/AirConditioner_accessory.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/AirConditioner_accessory.js +128 -0
- package/vendor/hap-nodejs/dist/accessories/AirConditioner_accessory.js.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/AppleTVRemote_accessory.d.ts +2 -0
- package/vendor/hap-nodejs/dist/accessories/AppleTVRemote_accessory.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/AppleTVRemote_accessory.js +159 -0
- package/vendor/hap-nodejs/dist/accessories/AppleTVRemote_accessory.js.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Camera_accessory.d.ts +2 -0
- package/vendor/hap-nodejs/dist/accessories/Camera_accessory.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Camera_accessory.js +545 -0
- package/vendor/hap-nodejs/dist/accessories/Camera_accessory.js.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Fan_accessory.d.ts +2 -0
- package/vendor/hap-nodejs/dist/accessories/Fan_accessory.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Fan_accessory.js +74 -0
- package/vendor/hap-nodejs/dist/accessories/Fan_accessory.js.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/GarageDoorOpener_accessory.d.ts +2 -0
- package/vendor/hap-nodejs/dist/accessories/GarageDoorOpener_accessory.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/GarageDoorOpener_accessory.js +78 -0
- package/vendor/hap-nodejs/dist/accessories/GarageDoorOpener_accessory.js.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Light-AdaptiveLighting_accessory.d.ts +2 -0
- package/vendor/hap-nodejs/dist/accessories/Light-AdaptiveLighting_accessory.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Light-AdaptiveLighting_accessory.js +106 -0
- package/vendor/hap-nodejs/dist/accessories/Light-AdaptiveLighting_accessory.js.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Light_accessory.d.ts +2 -0
- package/vendor/hap-nodejs/dist/accessories/Light_accessory.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Light_accessory.js +145 -0
- package/vendor/hap-nodejs/dist/accessories/Light_accessory.js.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Lock_accessory.d.ts +2 -0
- package/vendor/hap-nodejs/dist/accessories/Lock_accessory.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Lock_accessory.js +76 -0
- package/vendor/hap-nodejs/dist/accessories/Lock_accessory.js.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/MotionSensor_accessory.d.ts +2 -0
- package/vendor/hap-nodejs/dist/accessories/MotionSensor_accessory.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/MotionSensor_accessory.js +45 -0
- package/vendor/hap-nodejs/dist/accessories/MotionSensor_accessory.js.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Outlet_accessory.d.ts +2 -0
- package/vendor/hap-nodejs/dist/accessories/Outlet_accessory.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Outlet_accessory.js +79 -0
- package/vendor/hap-nodejs/dist/accessories/Outlet_accessory.js.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/SmartSpeaker_accessory.d.ts +2 -0
- package/vendor/hap-nodejs/dist/accessories/SmartSpeaker_accessory.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/SmartSpeaker_accessory.js +44 -0
- package/vendor/hap-nodejs/dist/accessories/SmartSpeaker_accessory.js.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Sprinkler_accessory.d.ts +2 -0
- package/vendor/hap-nodejs/dist/accessories/Sprinkler_accessory.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Sprinkler_accessory.js +128 -0
- package/vendor/hap-nodejs/dist/accessories/Sprinkler_accessory.js.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/TV_accessory.d.ts +2 -0
- package/vendor/hap-nodejs/dist/accessories/TV_accessory.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/TV_accessory.js +101 -0
- package/vendor/hap-nodejs/dist/accessories/TV_accessory.js.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/TemperatureSensor_accessory.d.ts +2 -0
- package/vendor/hap-nodejs/dist/accessories/TemperatureSensor_accessory.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/TemperatureSensor_accessory.js +44 -0
- package/vendor/hap-nodejs/dist/accessories/TemperatureSensor_accessory.js.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Wi-FiRouter_accessory.d.ts +3 -0
- package/vendor/hap-nodejs/dist/accessories/Wi-FiRouter_accessory.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Wi-FiRouter_accessory.js +17 -0
- package/vendor/hap-nodejs/dist/accessories/Wi-FiRouter_accessory.js.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Wi-FiSatellite_accessory.d.ts +3 -0
- package/vendor/hap-nodejs/dist/accessories/Wi-FiSatellite_accessory.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/Wi-FiSatellite_accessory.js +19 -0
- package/vendor/hap-nodejs/dist/accessories/Wi-FiSatellite_accessory.js.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/gstreamer-audioProducer.d.ts +25 -0
- package/vendor/hap-nodejs/dist/accessories/gstreamer-audioProducer.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/gstreamer-audioProducer.js +145 -0
- package/vendor/hap-nodejs/dist/accessories/gstreamer-audioProducer.js.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/types.d.ts +78 -0
- package/vendor/hap-nodejs/dist/accessories/types.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/accessories/types.js +88 -0
- package/vendor/hap-nodejs/dist/accessories/types.js.map +1 -0
- package/vendor/hap-nodejs/dist/index.d.ts +50 -0
- package/vendor/hap-nodejs/dist/index.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/index.js +54 -0
- package/vendor/hap-nodejs/dist/index.js.map +1 -0
- package/vendor/hap-nodejs/dist/internal-types.d.ts +76 -0
- package/vendor/hap-nodejs/dist/internal-types.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/internal-types.js +80 -0
- package/vendor/hap-nodejs/dist/internal-types.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/Accessory.d.ts +521 -0
- package/vendor/hap-nodejs/dist/lib/Accessory.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/Accessory.js +1762 -0
- package/vendor/hap-nodejs/dist/lib/Accessory.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/Advertiser.d.ts +190 -0
- package/vendor/hap-nodejs/dist/lib/Advertiser.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/Advertiser.js +592 -0
- package/vendor/hap-nodejs/dist/lib/Advertiser.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/Bridge.d.ts +12 -0
- package/vendor/hap-nodejs/dist/lib/Bridge.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/Bridge.js +19 -0
- package/vendor/hap-nodejs/dist/lib/Bridge.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/Characteristic.d.ts +1768 -0
- package/vendor/hap-nodejs/dist/lib/Characteristic.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/Characteristic.js +2532 -0
- package/vendor/hap-nodejs/dist/lib/Characteristic.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/HAPServer.d.ts +299 -0
- package/vendor/hap-nodejs/dist/lib/HAPServer.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/HAPServer.js +968 -0
- package/vendor/hap-nodejs/dist/lib/HAPServer.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/Service.d.ts +598 -0
- package/vendor/hap-nodejs/dist/lib/Service.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/Service.js +797 -0
- package/vendor/hap-nodejs/dist/lib/Service.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/camera/CMAFIngest.d.ts +102 -0
- package/vendor/hap-nodejs/dist/lib/camera/CMAFIngest.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/camera/CMAFIngest.js +317 -0
- package/vendor/hap-nodejs/dist/lib/camera/CMAFIngest.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/camera/HDSSnapshotTransport.d.ts +38 -0
- package/vendor/hap-nodejs/dist/lib/camera/HDSSnapshotTransport.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/camera/HDSSnapshotTransport.js +174 -0
- package/vendor/hap-nodejs/dist/lib/camera/HDSSnapshotTransport.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/camera/RTPProxy.d.ts +59 -0
- package/vendor/hap-nodejs/dist/lib/camera/RTPProxy.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/camera/RTPProxy.js +267 -0
- package/vendor/hap-nodejs/dist/lib/camera/RTPProxy.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/camera/RTPStreamManagement.d.ts +379 -0
- package/vendor/hap-nodejs/dist/lib/camera/RTPStreamManagement.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/camera/RTPStreamManagement.js +1021 -0
- package/vendor/hap-nodejs/dist/lib/camera/RTPStreamManagement.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/camera/RecordingManagement.d.ts +325 -0
- package/vendor/hap-nodejs/dist/lib/camera/RecordingManagement.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/camera/RecordingManagement.js +800 -0
- package/vendor/hap-nodejs/dist/lib/camera/RecordingManagement.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoCredentials.d.ts +20 -0
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoCredentials.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoCredentials.js +48 -0
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoCredentials.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoTypes.d.ts +618 -0
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoTypes.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoTypes.js +911 -0
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoTypes.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/camera/index.d.ts +8 -0
- package/vendor/hap-nodejs/dist/lib/camera/index.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/camera/index.js +11 -0
- package/vendor/hap-nodejs/dist/lib/camera/index.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/controller/AdaptiveLightingController.d.ts +452 -0
- package/vendor/hap-nodejs/dist/lib/controller/AdaptiveLightingController.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/controller/AdaptiveLightingController.js +868 -0
- package/vendor/hap-nodejs/dist/lib/controller/AdaptiveLightingController.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/controller/CameraController.d.ts +410 -0
- package/vendor/hap-nodejs/dist/lib/controller/CameraController.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/controller/CameraController.js +658 -0
- package/vendor/hap-nodejs/dist/lib/controller/CameraController.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/controller/Controller.d.ts +197 -0
- package/vendor/hap-nodejs/dist/lib/controller/Controller.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/controller/Controller.js +32 -0
- package/vendor/hap-nodejs/dist/lib/controller/Controller.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/controller/DoorbellController.d.ts +59 -0
- package/vendor/hap-nodejs/dist/lib/controller/DoorbellController.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/controller/DoorbellController.js +102 -0
- package/vendor/hap-nodejs/dist/lib/controller/DoorbellController.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/controller/RemoteController.d.ts +434 -0
- package/vendor/hap-nodejs/dist/lib/controller/RemoteController.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/controller/RemoteController.js +1178 -0
- package/vendor/hap-nodejs/dist/lib/controller/RemoteController.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/controller/SecureVideoController.d.ts +380 -0
- package/vendor/hap-nodejs/dist/lib/controller/SecureVideoController.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/controller/SecureVideoController.js +947 -0
- package/vendor/hap-nodejs/dist/lib/controller/SecureVideoController.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/controller/index.d.ts +7 -0
- package/vendor/hap-nodejs/dist/lib/controller/index.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/controller/index.js +10 -0
- package/vendor/hap-nodejs/dist/lib/controller/index.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamManagement.d.ts +73 -0
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamManagement.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamManagement.js +205 -0
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamManagement.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamParser.d.ts +186 -0
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamParser.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamParser.js +880 -0
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamParser.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamServer.d.ts +351 -0
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamServer.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamServer.js +878 -0
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamServer.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/datastream/index.d.ts +4 -0
- package/vendor/hap-nodejs/dist/lib/datastream/index.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/datastream/index.js +7 -0
- package/vendor/hap-nodejs/dist/lib/datastream/index.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/definitions/CharacteristicDefinitions.d.ts +2245 -0
- package/vendor/hap-nodejs/dist/lib/definitions/CharacteristicDefinitions.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/definitions/CharacteristicDefinitions.js +4957 -0
- package/vendor/hap-nodejs/dist/lib/definitions/CharacteristicDefinitions.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/definitions/ServiceDefinitions.d.ts +584 -0
- package/vendor/hap-nodejs/dist/lib/definitions/ServiceDefinitions.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/definitions/ServiceDefinitions.js +1518 -0
- package/vendor/hap-nodejs/dist/lib/definitions/ServiceDefinitions.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/definitions/generate-definitions.d.ts +34 -0
- package/vendor/hap-nodejs/dist/lib/definitions/generate-definitions.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/definitions/generate-definitions.js +624 -0
- package/vendor/hap-nodejs/dist/lib/definitions/generate-definitions.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/definitions/generator-configuration.d.ts +22 -0
- package/vendor/hap-nodejs/dist/lib/definitions/generator-configuration.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/definitions/generator-configuration.js +734 -0
- package/vendor/hap-nodejs/dist/lib/definitions/generator-configuration.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/definitions/index.d.ts +3 -0
- package/vendor/hap-nodejs/dist/lib/definitions/index.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/definitions/index.js +6 -0
- package/vendor/hap-nodejs/dist/lib/definitions/index.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/gen/HomeKit.d.ts +8 -0
- package/vendor/hap-nodejs/dist/lib/gen/HomeKit.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/gen/HomeKit.js +9 -0
- package/vendor/hap-nodejs/dist/lib/gen/HomeKit.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/model/AccessoryInfo.d.ts +91 -0
- package/vendor/hap-nodejs/dist/lib/model/AccessoryInfo.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/model/AccessoryInfo.js +311 -0
- package/vendor/hap-nodejs/dist/lib/model/AccessoryInfo.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/model/ControllerStorage.d.ts +46 -0
- package/vendor/hap-nodejs/dist/lib/model/ControllerStorage.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/model/ControllerStorage.js +277 -0
- package/vendor/hap-nodejs/dist/lib/model/ControllerStorage.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/model/HAPFileStorage.d.ts +75 -0
- package/vendor/hap-nodejs/dist/lib/model/HAPFileStorage.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/model/HAPFileStorage.js +190 -0
- package/vendor/hap-nodejs/dist/lib/model/HAPFileStorage.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/model/HAPStorage.d.ts +26 -0
- package/vendor/hap-nodejs/dist/lib/model/HAPStorage.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/model/HAPStorage.js +79 -0
- package/vendor/hap-nodejs/dist/lib/model/HAPStorage.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/model/IdentifierCache.d.ts +33 -0
- package/vendor/hap-nodejs/dist/lib/model/IdentifierCache.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/model/IdentifierCache.js +114 -0
- package/vendor/hap-nodejs/dist/lib/model/IdentifierCache.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/tv/AccessControlManagement.d.ts +83 -0
- package/vendor/hap-nodejs/dist/lib/tv/AccessControlManagement.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/tv/AccessControlManagement.js +127 -0
- package/vendor/hap-nodejs/dist/lib/tv/AccessControlManagement.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/checkName.d.ts +8 -0
- package/vendor/hap-nodejs/dist/lib/util/checkName.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/checkName.js +28 -0
- package/vendor/hap-nodejs/dist/lib/util/checkName.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/clone.d.ts +7 -0
- package/vendor/hap-nodejs/dist/lib/util/clone.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/clone.js +22 -0
- package/vendor/hap-nodejs/dist/lib/util/clone.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/color-utils.d.ts +18 -0
- package/vendor/hap-nodejs/dist/lib/util/color-utils.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/color-utils.js +442 -0
- package/vendor/hap-nodejs/dist/lib/util/color-utils.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/eventedhttp.d.ts +251 -0
- package/vendor/hap-nodejs/dist/lib/util/eventedhttp.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/eventedhttp.js +714 -0
- package/vendor/hap-nodejs/dist/lib/util/eventedhttp.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/hapCrypto.d.ts +50 -0
- package/vendor/hap-nodejs/dist/lib/util/hapCrypto.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/hapCrypto.js +185 -0
- package/vendor/hap-nodejs/dist/lib/util/hapCrypto.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/hapStatusError.d.ts +16 -0
- package/vendor/hap-nodejs/dist/lib/util/hapStatusError.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/hapStatusError.js +29 -0
- package/vendor/hap-nodejs/dist/lib/util/hapStatusError.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/net-utils.d.ts +21 -0
- package/vendor/hap-nodejs/dist/lib/util/net-utils.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/net-utils.js +79 -0
- package/vendor/hap-nodejs/dist/lib/util/net-utils.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/once.d.ts +7 -0
- package/vendor/hap-nodejs/dist/lib/util/once.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/once.js +22 -0
- package/vendor/hap-nodejs/dist/lib/util/once.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/promise-utils.d.ts +14 -0
- package/vendor/hap-nodejs/dist/lib/util/promise-utils.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/promise-utils.js +29 -0
- package/vendor/hap-nodejs/dist/lib/util/promise-utils.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/request-util.d.ts +36 -0
- package/vendor/hap-nodejs/dist/lib/util/request-util.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/request-util.js +108 -0
- package/vendor/hap-nodejs/dist/lib/util/request-util.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/time.d.ts +9 -0
- package/vendor/hap-nodejs/dist/lib/util/time.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/time.js +23 -0
- package/vendor/hap-nodejs/dist/lib/util/time.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/tlv.d.ts +90 -0
- package/vendor/hap-nodejs/dist/lib/util/tlv.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/tlv.js +318 -0
- package/vendor/hap-nodejs/dist/lib/util/tlv.js.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/uuid.d.ts +23 -0
- package/vendor/hap-nodejs/dist/lib/util/uuid.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/lib/util/uuid.js +78 -0
- package/vendor/hap-nodejs/dist/lib/util/uuid.js.map +1 -0
- package/vendor/hap-nodejs/dist/types.d.ts +276 -0
- package/vendor/hap-nodejs/dist/types.d.ts.map +1 -0
- package/vendor/hap-nodejs/dist/types.js +11 -0
- package/vendor/hap-nodejs/dist/types.js.map +1 -0
- package/vendor/hap-nodejs/package.json +53 -0
- package/vendor/hap-nodejs/src/lib/util/hapCrypto.ts +208 -0
- package/dist/frontend/assets/index-8tQZaFmi.js +0 -28
|
@@ -0,0 +1,1021 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RTPStreamManagement = exports.StreamRequestTypes = exports.AudioStreamingSamplerate = exports.AudioStreamingCodecType = exports.SRTPCryptoSuites = exports.AudioSamplerate = exports.AudioBitrate = exports.VideoCodecPacketizationMode = exports.H264Level = exports.H264Profile = exports.VideoCodecType = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
|
+
const crypto_1 = tslib_1.__importDefault(require("crypto"));
|
|
7
|
+
const debug_1 = tslib_1.__importDefault(require("debug"));
|
|
8
|
+
const net_1 = tslib_1.__importDefault(require("net"));
|
|
9
|
+
const Characteristic_1 = require("../Characteristic");
|
|
10
|
+
const controller_1 = require("../controller");
|
|
11
|
+
const Service_1 = require("../Service");
|
|
12
|
+
const hapStatusError_1 = require("../util/hapStatusError");
|
|
13
|
+
const once_1 = require("../util/once");
|
|
14
|
+
const tlv = tslib_1.__importStar(require("../util/tlv"));
|
|
15
|
+
const uuid = tslib_1.__importStar(require("../util/uuid"));
|
|
16
|
+
const RTPProxy_1 = tslib_1.__importDefault(require("./RTPProxy"));
|
|
17
|
+
const debug = (0, debug_1.default)("HAP-NodeJS:Camera:RTPStreamManagement");
|
|
18
|
+
// ---------------------------------- TLV DEFINITIONS START ----------------------------------
|
|
19
|
+
var StreamingStatusTypes;
|
|
20
|
+
(function (StreamingStatusTypes) {
|
|
21
|
+
StreamingStatusTypes[StreamingStatusTypes["STATUS"] = 1] = "STATUS";
|
|
22
|
+
})(StreamingStatusTypes || (StreamingStatusTypes = {}));
|
|
23
|
+
var StreamingStatus;
|
|
24
|
+
(function (StreamingStatus) {
|
|
25
|
+
StreamingStatus[StreamingStatus["AVAILABLE"] = 0] = "AVAILABLE";
|
|
26
|
+
StreamingStatus[StreamingStatus["IN_USE"] = 1] = "IN_USE";
|
|
27
|
+
StreamingStatus[StreamingStatus["UNAVAILABLE"] = 2] = "UNAVAILABLE";
|
|
28
|
+
})(StreamingStatus || (StreamingStatus = {}));
|
|
29
|
+
// ----------
|
|
30
|
+
var SupportedVideoStreamConfigurationTypes;
|
|
31
|
+
(function (SupportedVideoStreamConfigurationTypes) {
|
|
32
|
+
SupportedVideoStreamConfigurationTypes[SupportedVideoStreamConfigurationTypes["VIDEO_CODEC_CONFIGURATION"] = 1] = "VIDEO_CODEC_CONFIGURATION";
|
|
33
|
+
})(SupportedVideoStreamConfigurationTypes || (SupportedVideoStreamConfigurationTypes = {}));
|
|
34
|
+
var VideoCodecConfigurationTypes;
|
|
35
|
+
(function (VideoCodecConfigurationTypes) {
|
|
36
|
+
VideoCodecConfigurationTypes[VideoCodecConfigurationTypes["CODEC_TYPE"] = 1] = "CODEC_TYPE";
|
|
37
|
+
VideoCodecConfigurationTypes[VideoCodecConfigurationTypes["CODEC_PARAMETERS"] = 2] = "CODEC_PARAMETERS";
|
|
38
|
+
VideoCodecConfigurationTypes[VideoCodecConfigurationTypes["ATTRIBUTES"] = 3] = "ATTRIBUTES";
|
|
39
|
+
})(VideoCodecConfigurationTypes || (VideoCodecConfigurationTypes = {}));
|
|
40
|
+
var VideoCodecParametersTypes;
|
|
41
|
+
(function (VideoCodecParametersTypes) {
|
|
42
|
+
VideoCodecParametersTypes[VideoCodecParametersTypes["PROFILE_ID"] = 1] = "PROFILE_ID";
|
|
43
|
+
VideoCodecParametersTypes[VideoCodecParametersTypes["LEVEL"] = 2] = "LEVEL";
|
|
44
|
+
VideoCodecParametersTypes[VideoCodecParametersTypes["PACKETIZATION_MODE"] = 3] = "PACKETIZATION_MODE";
|
|
45
|
+
VideoCodecParametersTypes[VideoCodecParametersTypes["CVO_ENABLED"] = 4] = "CVO_ENABLED";
|
|
46
|
+
VideoCodecParametersTypes[VideoCodecParametersTypes["CVO_ID"] = 5] = "CVO_ID";
|
|
47
|
+
})(VideoCodecParametersTypes || (VideoCodecParametersTypes = {}));
|
|
48
|
+
var VideoAttributesTypes;
|
|
49
|
+
(function (VideoAttributesTypes) {
|
|
50
|
+
VideoAttributesTypes[VideoAttributesTypes["IMAGE_WIDTH"] = 1] = "IMAGE_WIDTH";
|
|
51
|
+
VideoAttributesTypes[VideoAttributesTypes["IMAGE_HEIGHT"] = 2] = "IMAGE_HEIGHT";
|
|
52
|
+
VideoAttributesTypes[VideoAttributesTypes["FRAME_RATE"] = 3] = "FRAME_RATE";
|
|
53
|
+
})(VideoAttributesTypes || (VideoAttributesTypes = {}));
|
|
54
|
+
/**
|
|
55
|
+
* @group Camera
|
|
56
|
+
*/
|
|
57
|
+
var VideoCodecType;
|
|
58
|
+
(function (VideoCodecType) {
|
|
59
|
+
VideoCodecType[VideoCodecType["H264"] = 0] = "H264";
|
|
60
|
+
// while the namespace is already reserved for H265 it isn't currently supported.
|
|
61
|
+
// H265 = 0x01,
|
|
62
|
+
})(VideoCodecType || (exports.VideoCodecType = VideoCodecType = {}));
|
|
63
|
+
/**
|
|
64
|
+
* @group Camera
|
|
65
|
+
*/
|
|
66
|
+
var H264Profile;
|
|
67
|
+
(function (H264Profile) {
|
|
68
|
+
H264Profile[H264Profile["BASELINE"] = 0] = "BASELINE";
|
|
69
|
+
H264Profile[H264Profile["MAIN"] = 1] = "MAIN";
|
|
70
|
+
H264Profile[H264Profile["HIGH"] = 2] = "HIGH";
|
|
71
|
+
})(H264Profile || (exports.H264Profile = H264Profile = {}));
|
|
72
|
+
/**
|
|
73
|
+
* @group Camera
|
|
74
|
+
*/
|
|
75
|
+
var H264Level;
|
|
76
|
+
(function (H264Level) {
|
|
77
|
+
H264Level[H264Level["LEVEL3_1"] = 0] = "LEVEL3_1";
|
|
78
|
+
H264Level[H264Level["LEVEL3_2"] = 1] = "LEVEL3_2";
|
|
79
|
+
H264Level[H264Level["LEVEL4_0"] = 2] = "LEVEL4_0";
|
|
80
|
+
})(H264Level || (exports.H264Level = H264Level = {}));
|
|
81
|
+
/**
|
|
82
|
+
* @group Camera
|
|
83
|
+
*/
|
|
84
|
+
var VideoCodecPacketizationMode;
|
|
85
|
+
(function (VideoCodecPacketizationMode) {
|
|
86
|
+
VideoCodecPacketizationMode[VideoCodecPacketizationMode["NON_INTERLEAVED"] = 0] = "NON_INTERLEAVED";
|
|
87
|
+
})(VideoCodecPacketizationMode || (exports.VideoCodecPacketizationMode = VideoCodecPacketizationMode = {}));
|
|
88
|
+
var VideoCodecCVO;
|
|
89
|
+
(function (VideoCodecCVO) {
|
|
90
|
+
VideoCodecCVO[VideoCodecCVO["UNSUPPORTED"] = 0] = "UNSUPPORTED";
|
|
91
|
+
VideoCodecCVO[VideoCodecCVO["SUPPORTED"] = 1] = "SUPPORTED";
|
|
92
|
+
})(VideoCodecCVO || (VideoCodecCVO = {}));
|
|
93
|
+
// ----------
|
|
94
|
+
var SupportedAudioStreamConfigurationTypes;
|
|
95
|
+
(function (SupportedAudioStreamConfigurationTypes) {
|
|
96
|
+
SupportedAudioStreamConfigurationTypes[SupportedAudioStreamConfigurationTypes["AUDIO_CODEC_CONFIGURATION"] = 1] = "AUDIO_CODEC_CONFIGURATION";
|
|
97
|
+
SupportedAudioStreamConfigurationTypes[SupportedAudioStreamConfigurationTypes["COMFORT_NOISE_SUPPORT"] = 2] = "COMFORT_NOISE_SUPPORT";
|
|
98
|
+
})(SupportedAudioStreamConfigurationTypes || (SupportedAudioStreamConfigurationTypes = {}));
|
|
99
|
+
var AudioCodecConfigurationTypes;
|
|
100
|
+
(function (AudioCodecConfigurationTypes) {
|
|
101
|
+
AudioCodecConfigurationTypes[AudioCodecConfigurationTypes["CODEC_TYPE"] = 1] = "CODEC_TYPE";
|
|
102
|
+
AudioCodecConfigurationTypes[AudioCodecConfigurationTypes["CODEC_PARAMETERS"] = 2] = "CODEC_PARAMETERS";
|
|
103
|
+
})(AudioCodecConfigurationTypes || (AudioCodecConfigurationTypes = {}));
|
|
104
|
+
var AudioCodecTypes;
|
|
105
|
+
(function (AudioCodecTypes) {
|
|
106
|
+
AudioCodecTypes[AudioCodecTypes["PCMU"] = 0] = "PCMU";
|
|
107
|
+
AudioCodecTypes[AudioCodecTypes["PCMA"] = 1] = "PCMA";
|
|
108
|
+
AudioCodecTypes[AudioCodecTypes["AAC_ELD"] = 2] = "AAC_ELD";
|
|
109
|
+
AudioCodecTypes[AudioCodecTypes["OPUS"] = 3] = "OPUS";
|
|
110
|
+
AudioCodecTypes[AudioCodecTypes["MSBC"] = 4] = "MSBC";
|
|
111
|
+
AudioCodecTypes[AudioCodecTypes["AMR"] = 5] = "AMR";
|
|
112
|
+
AudioCodecTypes[AudioCodecTypes["AMR_WB"] = 6] = "AMR_WB";
|
|
113
|
+
})(AudioCodecTypes || (AudioCodecTypes = {}));
|
|
114
|
+
var AudioCodecParametersTypes;
|
|
115
|
+
(function (AudioCodecParametersTypes) {
|
|
116
|
+
AudioCodecParametersTypes[AudioCodecParametersTypes["CHANNEL"] = 1] = "CHANNEL";
|
|
117
|
+
AudioCodecParametersTypes[AudioCodecParametersTypes["BIT_RATE"] = 2] = "BIT_RATE";
|
|
118
|
+
AudioCodecParametersTypes[AudioCodecParametersTypes["SAMPLE_RATE"] = 3] = "SAMPLE_RATE";
|
|
119
|
+
AudioCodecParametersTypes[AudioCodecParametersTypes["PACKET_TIME"] = 4] = "PACKET_TIME"; // only present in selected audio codec parameters tlv
|
|
120
|
+
})(AudioCodecParametersTypes || (AudioCodecParametersTypes = {}));
|
|
121
|
+
/**
|
|
122
|
+
* @group Camera
|
|
123
|
+
*/
|
|
124
|
+
var AudioBitrate;
|
|
125
|
+
(function (AudioBitrate) {
|
|
126
|
+
AudioBitrate[AudioBitrate["VARIABLE"] = 0] = "VARIABLE";
|
|
127
|
+
AudioBitrate[AudioBitrate["CONSTANT"] = 1] = "CONSTANT";
|
|
128
|
+
})(AudioBitrate || (exports.AudioBitrate = AudioBitrate = {}));
|
|
129
|
+
/**
|
|
130
|
+
* @group Camera
|
|
131
|
+
*/
|
|
132
|
+
var AudioSamplerate;
|
|
133
|
+
(function (AudioSamplerate) {
|
|
134
|
+
AudioSamplerate[AudioSamplerate["KHZ_8"] = 0] = "KHZ_8";
|
|
135
|
+
AudioSamplerate[AudioSamplerate["KHZ_16"] = 1] = "KHZ_16";
|
|
136
|
+
AudioSamplerate[AudioSamplerate["KHZ_24"] = 2] = "KHZ_24";
|
|
137
|
+
// 3, 4, 5 are theoretically defined, but no idea to what kHz value they correspond to
|
|
138
|
+
// probably KHZ_32, KHZ_44_1, KHZ_48 (as supported by Secure Video recordings)
|
|
139
|
+
})(AudioSamplerate || (exports.AudioSamplerate = AudioSamplerate = {}));
|
|
140
|
+
// ----------
|
|
141
|
+
var SupportedRTPConfigurationTypes;
|
|
142
|
+
(function (SupportedRTPConfigurationTypes) {
|
|
143
|
+
SupportedRTPConfigurationTypes[SupportedRTPConfigurationTypes["SRTP_CRYPTO_SUITE"] = 2] = "SRTP_CRYPTO_SUITE";
|
|
144
|
+
})(SupportedRTPConfigurationTypes || (SupportedRTPConfigurationTypes = {}));
|
|
145
|
+
/**
|
|
146
|
+
* @group Camera
|
|
147
|
+
*/
|
|
148
|
+
var SRTPCryptoSuites;
|
|
149
|
+
(function (SRTPCryptoSuites) {
|
|
150
|
+
SRTPCryptoSuites[SRTPCryptoSuites["AES_CM_128_HMAC_SHA1_80"] = 0] = "AES_CM_128_HMAC_SHA1_80";
|
|
151
|
+
SRTPCryptoSuites[SRTPCryptoSuites["AES_CM_256_HMAC_SHA1_80"] = 1] = "AES_CM_256_HMAC_SHA1_80";
|
|
152
|
+
SRTPCryptoSuites[SRTPCryptoSuites["NONE"] = 2] = "NONE";
|
|
153
|
+
})(SRTPCryptoSuites || (exports.SRTPCryptoSuites = SRTPCryptoSuites = {}));
|
|
154
|
+
// ----------
|
|
155
|
+
var SetupEndpointsTypes;
|
|
156
|
+
(function (SetupEndpointsTypes) {
|
|
157
|
+
SetupEndpointsTypes[SetupEndpointsTypes["SESSION_ID"] = 1] = "SESSION_ID";
|
|
158
|
+
SetupEndpointsTypes[SetupEndpointsTypes["CONTROLLER_ADDRESS"] = 3] = "CONTROLLER_ADDRESS";
|
|
159
|
+
SetupEndpointsTypes[SetupEndpointsTypes["VIDEO_SRTP_PARAMETERS"] = 4] = "VIDEO_SRTP_PARAMETERS";
|
|
160
|
+
SetupEndpointsTypes[SetupEndpointsTypes["AUDIO_SRTP_PARAMETERS"] = 5] = "AUDIO_SRTP_PARAMETERS";
|
|
161
|
+
})(SetupEndpointsTypes || (SetupEndpointsTypes = {}));
|
|
162
|
+
var AddressTypes;
|
|
163
|
+
(function (AddressTypes) {
|
|
164
|
+
AddressTypes[AddressTypes["ADDRESS_VERSION"] = 1] = "ADDRESS_VERSION";
|
|
165
|
+
AddressTypes[AddressTypes["ADDRESS"] = 2] = "ADDRESS";
|
|
166
|
+
AddressTypes[AddressTypes["VIDEO_RTP_PORT"] = 3] = "VIDEO_RTP_PORT";
|
|
167
|
+
AddressTypes[AddressTypes["AUDIO_RTP_PORT"] = 4] = "AUDIO_RTP_PORT";
|
|
168
|
+
})(AddressTypes || (AddressTypes = {}));
|
|
169
|
+
var IPAddressVersion;
|
|
170
|
+
(function (IPAddressVersion) {
|
|
171
|
+
IPAddressVersion[IPAddressVersion["IPV4"] = 0] = "IPV4";
|
|
172
|
+
IPAddressVersion[IPAddressVersion["IPV6"] = 1] = "IPV6";
|
|
173
|
+
})(IPAddressVersion || (IPAddressVersion = {}));
|
|
174
|
+
var SRTPParametersTypes;
|
|
175
|
+
(function (SRTPParametersTypes) {
|
|
176
|
+
SRTPParametersTypes[SRTPParametersTypes["SRTP_CRYPTO_SUITE"] = 1] = "SRTP_CRYPTO_SUITE";
|
|
177
|
+
SRTPParametersTypes[SRTPParametersTypes["MASTER_KEY"] = 2] = "MASTER_KEY";
|
|
178
|
+
SRTPParametersTypes[SRTPParametersTypes["MASTER_SALT"] = 3] = "MASTER_SALT"; // 14 bytes
|
|
179
|
+
})(SRTPParametersTypes || (SRTPParametersTypes = {}));
|
|
180
|
+
var SetupEndpointsResponseTypes;
|
|
181
|
+
(function (SetupEndpointsResponseTypes) {
|
|
182
|
+
SetupEndpointsResponseTypes[SetupEndpointsResponseTypes["SESSION_ID"] = 1] = "SESSION_ID";
|
|
183
|
+
SetupEndpointsResponseTypes[SetupEndpointsResponseTypes["STATUS"] = 2] = "STATUS";
|
|
184
|
+
SetupEndpointsResponseTypes[SetupEndpointsResponseTypes["ACCESSORY_ADDRESS"] = 3] = "ACCESSORY_ADDRESS";
|
|
185
|
+
SetupEndpointsResponseTypes[SetupEndpointsResponseTypes["VIDEO_SRTP_PARAMETERS"] = 4] = "VIDEO_SRTP_PARAMETERS";
|
|
186
|
+
SetupEndpointsResponseTypes[SetupEndpointsResponseTypes["AUDIO_SRTP_PARAMETERS"] = 5] = "AUDIO_SRTP_PARAMETERS";
|
|
187
|
+
SetupEndpointsResponseTypes[SetupEndpointsResponseTypes["VIDEO_SSRC"] = 6] = "VIDEO_SSRC";
|
|
188
|
+
SetupEndpointsResponseTypes[SetupEndpointsResponseTypes["AUDIO_SSRC"] = 7] = "AUDIO_SSRC";
|
|
189
|
+
})(SetupEndpointsResponseTypes || (SetupEndpointsResponseTypes = {}));
|
|
190
|
+
var SetupEndpointsStatus;
|
|
191
|
+
(function (SetupEndpointsStatus) {
|
|
192
|
+
SetupEndpointsStatus[SetupEndpointsStatus["SUCCESS"] = 0] = "SUCCESS";
|
|
193
|
+
SetupEndpointsStatus[SetupEndpointsStatus["BUSY"] = 1] = "BUSY";
|
|
194
|
+
SetupEndpointsStatus[SetupEndpointsStatus["ERROR"] = 2] = "ERROR";
|
|
195
|
+
})(SetupEndpointsStatus || (SetupEndpointsStatus = {}));
|
|
196
|
+
// ----------
|
|
197
|
+
var SelectedRTPStreamConfigurationTypes;
|
|
198
|
+
(function (SelectedRTPStreamConfigurationTypes) {
|
|
199
|
+
SelectedRTPStreamConfigurationTypes[SelectedRTPStreamConfigurationTypes["SESSION_CONTROL"] = 1] = "SESSION_CONTROL";
|
|
200
|
+
SelectedRTPStreamConfigurationTypes[SelectedRTPStreamConfigurationTypes["SELECTED_VIDEO_PARAMETERS"] = 2] = "SELECTED_VIDEO_PARAMETERS";
|
|
201
|
+
SelectedRTPStreamConfigurationTypes[SelectedRTPStreamConfigurationTypes["SELECTED_AUDIO_PARAMETERS"] = 3] = "SELECTED_AUDIO_PARAMETERS";
|
|
202
|
+
})(SelectedRTPStreamConfigurationTypes || (SelectedRTPStreamConfigurationTypes = {}));
|
|
203
|
+
var SessionControlTypes;
|
|
204
|
+
(function (SessionControlTypes) {
|
|
205
|
+
SessionControlTypes[SessionControlTypes["SESSION_IDENTIFIER"] = 1] = "SESSION_IDENTIFIER";
|
|
206
|
+
SessionControlTypes[SessionControlTypes["COMMAND"] = 2] = "COMMAND";
|
|
207
|
+
})(SessionControlTypes || (SessionControlTypes = {}));
|
|
208
|
+
var SessionControlCommand;
|
|
209
|
+
(function (SessionControlCommand) {
|
|
210
|
+
SessionControlCommand[SessionControlCommand["END_SESSION"] = 0] = "END_SESSION";
|
|
211
|
+
SessionControlCommand[SessionControlCommand["START_SESSION"] = 1] = "START_SESSION";
|
|
212
|
+
SessionControlCommand[SessionControlCommand["SUSPEND_SESSION"] = 2] = "SUSPEND_SESSION";
|
|
213
|
+
SessionControlCommand[SessionControlCommand["RESUME_SESSION"] = 3] = "RESUME_SESSION";
|
|
214
|
+
SessionControlCommand[SessionControlCommand["RECONFIGURE_SESSION"] = 4] = "RECONFIGURE_SESSION";
|
|
215
|
+
})(SessionControlCommand || (SessionControlCommand = {}));
|
|
216
|
+
var SelectedVideoParametersTypes;
|
|
217
|
+
(function (SelectedVideoParametersTypes) {
|
|
218
|
+
SelectedVideoParametersTypes[SelectedVideoParametersTypes["CODEC_TYPE"] = 1] = "CODEC_TYPE";
|
|
219
|
+
SelectedVideoParametersTypes[SelectedVideoParametersTypes["CODEC_PARAMETERS"] = 2] = "CODEC_PARAMETERS";
|
|
220
|
+
SelectedVideoParametersTypes[SelectedVideoParametersTypes["ATTRIBUTES"] = 3] = "ATTRIBUTES";
|
|
221
|
+
SelectedVideoParametersTypes[SelectedVideoParametersTypes["RTP_PARAMETERS"] = 4] = "RTP_PARAMETERS";
|
|
222
|
+
})(SelectedVideoParametersTypes || (SelectedVideoParametersTypes = {}));
|
|
223
|
+
var VideoRTPParametersTypes;
|
|
224
|
+
(function (VideoRTPParametersTypes) {
|
|
225
|
+
VideoRTPParametersTypes[VideoRTPParametersTypes["PAYLOAD_TYPE"] = 1] = "PAYLOAD_TYPE";
|
|
226
|
+
VideoRTPParametersTypes[VideoRTPParametersTypes["SYNCHRONIZATION_SOURCE"] = 2] = "SYNCHRONIZATION_SOURCE";
|
|
227
|
+
VideoRTPParametersTypes[VideoRTPParametersTypes["MAX_BIT_RATE"] = 3] = "MAX_BIT_RATE";
|
|
228
|
+
VideoRTPParametersTypes[VideoRTPParametersTypes["MIN_RTCP_INTERVAL"] = 4] = "MIN_RTCP_INTERVAL";
|
|
229
|
+
VideoRTPParametersTypes[VideoRTPParametersTypes["MAX_MTU"] = 5] = "MAX_MTU";
|
|
230
|
+
})(VideoRTPParametersTypes || (VideoRTPParametersTypes = {}));
|
|
231
|
+
var SelectedAudioParametersTypes;
|
|
232
|
+
(function (SelectedAudioParametersTypes) {
|
|
233
|
+
SelectedAudioParametersTypes[SelectedAudioParametersTypes["CODEC_TYPE"] = 1] = "CODEC_TYPE";
|
|
234
|
+
SelectedAudioParametersTypes[SelectedAudioParametersTypes["CODEC_PARAMETERS"] = 2] = "CODEC_PARAMETERS";
|
|
235
|
+
SelectedAudioParametersTypes[SelectedAudioParametersTypes["RTP_PARAMETERS"] = 3] = "RTP_PARAMETERS";
|
|
236
|
+
SelectedAudioParametersTypes[SelectedAudioParametersTypes["COMFORT_NOISE"] = 4] = "COMFORT_NOISE";
|
|
237
|
+
})(SelectedAudioParametersTypes || (SelectedAudioParametersTypes = {}));
|
|
238
|
+
var AudioRTPParametersTypes;
|
|
239
|
+
(function (AudioRTPParametersTypes) {
|
|
240
|
+
AudioRTPParametersTypes[AudioRTPParametersTypes["PAYLOAD_TYPE"] = 1] = "PAYLOAD_TYPE";
|
|
241
|
+
AudioRTPParametersTypes[AudioRTPParametersTypes["SYNCHRONIZATION_SOURCE"] = 2] = "SYNCHRONIZATION_SOURCE";
|
|
242
|
+
AudioRTPParametersTypes[AudioRTPParametersTypes["MAX_BIT_RATE"] = 3] = "MAX_BIT_RATE";
|
|
243
|
+
AudioRTPParametersTypes[AudioRTPParametersTypes["MIN_RTCP_INTERVAL"] = 4] = "MIN_RTCP_INTERVAL";
|
|
244
|
+
AudioRTPParametersTypes[AudioRTPParametersTypes["COMFORT_NOISE_PAYLOAD_TYPE"] = 6] = "COMFORT_NOISE_PAYLOAD_TYPE";
|
|
245
|
+
})(AudioRTPParametersTypes || (AudioRTPParametersTypes = {}));
|
|
246
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
247
|
+
function isLegacySRTPOptions(options) {
|
|
248
|
+
return "srtp" in options;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* @group Camera
|
|
252
|
+
*/
|
|
253
|
+
var AudioStreamingCodecType;
|
|
254
|
+
(function (AudioStreamingCodecType) {
|
|
255
|
+
AudioStreamingCodecType["PCMU"] = "PCMU";
|
|
256
|
+
AudioStreamingCodecType["PCMA"] = "PCMA";
|
|
257
|
+
AudioStreamingCodecType["AAC_ELD"] = "AAC-eld";
|
|
258
|
+
AudioStreamingCodecType["OPUS"] = "OPUS";
|
|
259
|
+
AudioStreamingCodecType["MSBC"] = "mSBC";
|
|
260
|
+
AudioStreamingCodecType["AMR"] = "AMR";
|
|
261
|
+
AudioStreamingCodecType["AMR_WB"] = "AMR-WB";
|
|
262
|
+
})(AudioStreamingCodecType || (exports.AudioStreamingCodecType = AudioStreamingCodecType = {}));
|
|
263
|
+
/**
|
|
264
|
+
* @group Camera
|
|
265
|
+
*/
|
|
266
|
+
var AudioStreamingSamplerate;
|
|
267
|
+
(function (AudioStreamingSamplerate) {
|
|
268
|
+
AudioStreamingSamplerate[AudioStreamingSamplerate["KHZ_8"] = 8] = "KHZ_8";
|
|
269
|
+
AudioStreamingSamplerate[AudioStreamingSamplerate["KHZ_16"] = 16] = "KHZ_16";
|
|
270
|
+
AudioStreamingSamplerate[AudioStreamingSamplerate["KHZ_24"] = 24] = "KHZ_24";
|
|
271
|
+
})(AudioStreamingSamplerate || (exports.AudioStreamingSamplerate = AudioStreamingSamplerate = {}));
|
|
272
|
+
/**
|
|
273
|
+
* @group Camera
|
|
274
|
+
*/
|
|
275
|
+
var StreamRequestTypes;
|
|
276
|
+
(function (StreamRequestTypes) {
|
|
277
|
+
StreamRequestTypes["RECONFIGURE"] = "reconfigure";
|
|
278
|
+
StreamRequestTypes["START"] = "start";
|
|
279
|
+
StreamRequestTypes["STOP"] = "stop";
|
|
280
|
+
})(StreamRequestTypes || (exports.StreamRequestTypes = StreamRequestTypes = {}));
|
|
281
|
+
/**
|
|
282
|
+
* @group Camera
|
|
283
|
+
*/
|
|
284
|
+
class RTPStreamManagement {
|
|
285
|
+
id;
|
|
286
|
+
delegate;
|
|
287
|
+
service;
|
|
288
|
+
stateChangeDelegate;
|
|
289
|
+
requireProxy;
|
|
290
|
+
disableAudioProxy;
|
|
291
|
+
supportedCryptoSuites;
|
|
292
|
+
videoOnly = false;
|
|
293
|
+
supportedRTPConfiguration;
|
|
294
|
+
supportedVideoStreamConfiguration;
|
|
295
|
+
supportedAudioStreamConfiguration;
|
|
296
|
+
activeConnection;
|
|
297
|
+
activeConnectionClosedListener;
|
|
298
|
+
sessionIdentifier = undefined;
|
|
299
|
+
/**
|
|
300
|
+
* @private private API
|
|
301
|
+
*/
|
|
302
|
+
streamStatus = 0 /* StreamingStatus.AVAILABLE */; // use _updateStreamStatus to update this property
|
|
303
|
+
ipVersion; // ip version for the current session
|
|
304
|
+
selectedConfiguration = ""; // base64 representation of the currently selected configuration
|
|
305
|
+
setupEndpointsResponse = ""; // response of the SetupEndpoints Characteristic
|
|
306
|
+
/**
|
|
307
|
+
* @private deprecated API
|
|
308
|
+
*/
|
|
309
|
+
audioProxy;
|
|
310
|
+
/**
|
|
311
|
+
* @private deprecated API
|
|
312
|
+
*/
|
|
313
|
+
videoProxy;
|
|
314
|
+
/**
|
|
315
|
+
* A RTPStreamManagement is considered disabled if `HomeKitCameraActive` is set to false.
|
|
316
|
+
* We use a closure based approach to retrieve the value of this characteristic.
|
|
317
|
+
* The characteristic is managed by the RecordingManagement.
|
|
318
|
+
*/
|
|
319
|
+
disabledThroughOperatingMode;
|
|
320
|
+
constructor(id, options, delegate, service, disabledThroughOperatingMode) {
|
|
321
|
+
this.id = id;
|
|
322
|
+
this.delegate = delegate;
|
|
323
|
+
this.requireProxy = options.proxy || false;
|
|
324
|
+
this.disableAudioProxy = options.disable_audio_proxy || false;
|
|
325
|
+
if (isLegacySRTPOptions(options)) {
|
|
326
|
+
this.supportedCryptoSuites = [options.srtp ? 0 /* SRTPCryptoSuites.AES_CM_128_HMAC_SHA1_80 */ : 2 /* SRTPCryptoSuites.NONE */];
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
this.supportedCryptoSuites = options.supportedCryptoSuites;
|
|
330
|
+
}
|
|
331
|
+
if (this.supportedCryptoSuites.length === 0) {
|
|
332
|
+
this.supportedCryptoSuites.push(2 /* SRTPCryptoSuites.NONE */);
|
|
333
|
+
}
|
|
334
|
+
if (!options.video) {
|
|
335
|
+
throw new Error("Video parameters cannot be undefined in options");
|
|
336
|
+
}
|
|
337
|
+
this.supportedRTPConfiguration = RTPStreamManagement._supportedRTPConfiguration(this.supportedCryptoSuites);
|
|
338
|
+
this.supportedVideoStreamConfiguration = RTPStreamManagement._supportedVideoStreamConfiguration(options.video);
|
|
339
|
+
this.supportedAudioStreamConfiguration = this._supportedAudioStreamConfiguration(options.audio);
|
|
340
|
+
this.activeConnectionClosedListener = this._handleStopStream.bind(this);
|
|
341
|
+
this.service = service || this.constructService(id);
|
|
342
|
+
this.setupServiceHandlers();
|
|
343
|
+
this.resetSetupEndpointsResponse();
|
|
344
|
+
this.resetSelectedStreamConfiguration();
|
|
345
|
+
this.disabledThroughOperatingMode = disabledThroughOperatingMode;
|
|
346
|
+
}
|
|
347
|
+
forceStop() {
|
|
348
|
+
this.handleSessionClosed();
|
|
349
|
+
}
|
|
350
|
+
getService() {
|
|
351
|
+
return this.service;
|
|
352
|
+
}
|
|
353
|
+
handleFactoryReset() {
|
|
354
|
+
this.resetSelectedStreamConfiguration();
|
|
355
|
+
this.resetSetupEndpointsResponse();
|
|
356
|
+
this.service.updateCharacteristic(Characteristic_1.Characteristic.Active, true);
|
|
357
|
+
// on a factory reset the assumption is that all connections were already terminated and thus "handleStopStream" was already called
|
|
358
|
+
}
|
|
359
|
+
destroy() {
|
|
360
|
+
if (this.activeConnection) {
|
|
361
|
+
this._handleStopStream();
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
constructService(id) {
|
|
365
|
+
const managementService = new Service_1.Service.CameraRTPStreamManagement("", id.toString());
|
|
366
|
+
// this service is required only when recording is enabled. We don't really have access to this info here,
|
|
367
|
+
// so we just add the characteristic. Doesn't really hurt.
|
|
368
|
+
managementService.setCharacteristic(Characteristic_1.Characteristic.Active, true);
|
|
369
|
+
return managementService;
|
|
370
|
+
}
|
|
371
|
+
setupServiceHandlers() {
|
|
372
|
+
if (!this.service.testCharacteristic(Characteristic_1.Characteristic.Active)) {
|
|
373
|
+
// the active characteristic might not be present on some older configurations.
|
|
374
|
+
this.service.setCharacteristic(Characteristic_1.Characteristic.Active, true);
|
|
375
|
+
}
|
|
376
|
+
this.service.getCharacteristic(Characteristic_1.Characteristic.Active)
|
|
377
|
+
.on("change" /* CharacteristicEventTypes.CHANGE */, () => this.stateChangeDelegate?.())
|
|
378
|
+
.setProps({ adminOnlyAccess: [1 /* Access.WRITE */] });
|
|
379
|
+
// ensure that configurations are up-to-date and reflected in the characteristic values
|
|
380
|
+
this.service.setCharacteristic(Characteristic_1.Characteristic.SupportedRTPConfiguration, this.supportedRTPConfiguration);
|
|
381
|
+
this.service.setCharacteristic(Characteristic_1.Characteristic.SupportedVideoStreamConfiguration, this.supportedVideoStreamConfiguration);
|
|
382
|
+
this.service.setCharacteristic(Characteristic_1.Characteristic.SupportedAudioStreamConfiguration, this.supportedAudioStreamConfiguration);
|
|
383
|
+
this._updateStreamStatus(0 /* StreamingStatus.AVAILABLE */); // reset streaming status to available
|
|
384
|
+
this.service.setCharacteristic(Characteristic_1.Characteristic.SetupEndpoints, this.setupEndpointsResponse); // reset SetupEndpoints to default
|
|
385
|
+
this.service.getCharacteristic(Characteristic_1.Characteristic.SelectedRTPStreamConfiguration)
|
|
386
|
+
.on("get" /* CharacteristicEventTypes.GET */, callback => {
|
|
387
|
+
if (this.streamingIsDisabled()) {
|
|
388
|
+
callback(null, tlv.encode(1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */, tlv.encode(2 /* SessionControlTypes.COMMAND */, SessionControlCommand.SUSPEND_SESSION)).toString("base64"));
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
callback(null, this.selectedConfiguration);
|
|
392
|
+
})
|
|
393
|
+
.on("set" /* CharacteristicEventTypes.SET */, this._handleSelectedStreamConfigurationWrite.bind(this));
|
|
394
|
+
this.service.getCharacteristic(Characteristic_1.Characteristic.SetupEndpoints)
|
|
395
|
+
.on("get" /* CharacteristicEventTypes.GET */, callback => {
|
|
396
|
+
if (this.streamingIsDisabled()) {
|
|
397
|
+
callback(null, tlv.encode(2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString("base64"));
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
callback(null, this.setupEndpointsResponse);
|
|
401
|
+
})
|
|
402
|
+
.on("set" /* CharacteristicEventTypes.SET */, (value, callback, context, connection) => {
|
|
403
|
+
if (!connection) {
|
|
404
|
+
debug("Set event handler for SetupEndpoints cannot be called from plugin. Connection undefined!");
|
|
405
|
+
callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
this.handleSetupEndpoints(value, callback, connection);
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
handleSessionClosed() {
|
|
412
|
+
this.resetSelectedStreamConfiguration();
|
|
413
|
+
this.resetSetupEndpointsResponse();
|
|
414
|
+
if (this.activeConnection) {
|
|
415
|
+
this.activeConnection.removeListener("closed" /* HAPConnectionEvent.CLOSED */, this.activeConnectionClosedListener);
|
|
416
|
+
this.activeConnection.setMaxListeners(this.activeConnection.getMaxListeners() - 1);
|
|
417
|
+
this.activeConnection = undefined;
|
|
418
|
+
}
|
|
419
|
+
this._updateStreamStatus(0 /* StreamingStatus.AVAILABLE */);
|
|
420
|
+
this.sessionIdentifier = undefined;
|
|
421
|
+
this.ipVersion = undefined;
|
|
422
|
+
if (this.videoProxy) {
|
|
423
|
+
this.videoProxy.destroy();
|
|
424
|
+
this.videoProxy = undefined;
|
|
425
|
+
}
|
|
426
|
+
if (this.audioProxy) {
|
|
427
|
+
this.audioProxy.destroy();
|
|
428
|
+
this.audioProxy = undefined;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
streamingIsDisabled(callback) {
|
|
432
|
+
if (!this.service.getCharacteristic(Characteristic_1.Characteristic.Active).value) {
|
|
433
|
+
if (callback) {
|
|
434
|
+
callback(new hapStatusError_1.HapStatusError(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */));
|
|
435
|
+
}
|
|
436
|
+
return true;
|
|
437
|
+
}
|
|
438
|
+
if (this.disabledThroughOperatingMode?.()) {
|
|
439
|
+
if (callback) {
|
|
440
|
+
callback(new hapStatusError_1.HapStatusError(-70412 /* HAPStatus.NOT_ALLOWED_IN_CURRENT_STATE */));
|
|
441
|
+
}
|
|
442
|
+
return true;
|
|
443
|
+
}
|
|
444
|
+
return false;
|
|
445
|
+
}
|
|
446
|
+
_handleSelectedStreamConfigurationWrite(value, callback) {
|
|
447
|
+
if (this.streamingIsDisabled(callback)) {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
const data = Buffer.from(value, "base64");
|
|
451
|
+
const objects = tlv.decode(data);
|
|
452
|
+
const sessionControl = tlv.decode(objects[1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */]);
|
|
453
|
+
const sessionIdentifier = uuid.unparse(sessionControl[1 /* SessionControlTypes.SESSION_IDENTIFIER */]);
|
|
454
|
+
const requestType = sessionControl[2 /* SessionControlTypes.COMMAND */][0];
|
|
455
|
+
if (sessionIdentifier !== this.sessionIdentifier) {
|
|
456
|
+
debug(`Received unknown session Identifier with request to ${SessionControlCommand[requestType]}`);
|
|
457
|
+
callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
this.selectedConfiguration = value;
|
|
461
|
+
// intercept the callback chain to check if an error occurred.
|
|
462
|
+
const streamCallback = (error, writeResponse) => {
|
|
463
|
+
callback(error, writeResponse); // does not support writeResponse, but how knows what comes in the future.
|
|
464
|
+
if (error) {
|
|
465
|
+
this.handleSessionClosed();
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
switch (requestType) {
|
|
469
|
+
case SessionControlCommand.START_SESSION: {
|
|
470
|
+
const selectedVideoParameters = tlv.decode(objects[2 /* SelectedRTPStreamConfigurationTypes.SELECTED_VIDEO_PARAMETERS */]);
|
|
471
|
+
const selectedAudioParameters = tlv.decode(objects[3 /* SelectedRTPStreamConfigurationTypes.SELECTED_AUDIO_PARAMETERS */]);
|
|
472
|
+
this._handleStartStream(selectedVideoParameters, selectedAudioParameters, streamCallback);
|
|
473
|
+
break;
|
|
474
|
+
}
|
|
475
|
+
case SessionControlCommand.RECONFIGURE_SESSION: {
|
|
476
|
+
const reconfiguredVideoParameters = tlv.decode(objects[2 /* SelectedRTPStreamConfigurationTypes.SELECTED_VIDEO_PARAMETERS */]);
|
|
477
|
+
this.handleReconfigureStream(reconfiguredVideoParameters, streamCallback);
|
|
478
|
+
break;
|
|
479
|
+
}
|
|
480
|
+
case SessionControlCommand.END_SESSION:
|
|
481
|
+
this._handleStopStream(streamCallback);
|
|
482
|
+
break;
|
|
483
|
+
case SessionControlCommand.RESUME_SESSION:
|
|
484
|
+
case SessionControlCommand.SUSPEND_SESSION:
|
|
485
|
+
default:
|
|
486
|
+
debug(`Unhandled request type ${SessionControlCommand[requestType]}`);
|
|
487
|
+
callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
_handleStartStream(videoConfiguration, audioConfiguration, callback) {
|
|
492
|
+
try {
|
|
493
|
+
this._handleStartStreamInner(videoConfiguration, audioConfiguration, callback);
|
|
494
|
+
}
|
|
495
|
+
catch (error) {
|
|
496
|
+
debug("Failed to parse stream start request: %s", error.message);
|
|
497
|
+
callback(-70410 /* HAPStatus.INVALID_VALUE_IN_REQUEST */);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
_handleStartStreamInner(videoConfiguration, audioConfiguration, callback) {
|
|
501
|
+
// selected video configuration
|
|
502
|
+
// noinspection JSUnusedLocalSymbols
|
|
503
|
+
const videoCodec = videoConfiguration[1 /* SelectedVideoParametersTypes.CODEC_TYPE */]; // always 0x00 for h264
|
|
504
|
+
const videoParametersTLV = videoConfiguration[2 /* SelectedVideoParametersTypes.CODEC_PARAMETERS */];
|
|
505
|
+
const videoAttributesTLV = videoConfiguration[3 /* SelectedVideoParametersTypes.ATTRIBUTES */];
|
|
506
|
+
const videoRTPParametersTLV = videoConfiguration[4 /* SelectedVideoParametersTypes.RTP_PARAMETERS */];
|
|
507
|
+
// video parameters
|
|
508
|
+
const videoParameters = tlv.decode(videoParametersTLV);
|
|
509
|
+
const h264Profile = videoParameters[1 /* VideoCodecParametersTypes.PROFILE_ID */][0];
|
|
510
|
+
const h264Level = videoParameters[2 /* VideoCodecParametersTypes.LEVEL */][0];
|
|
511
|
+
const packetizationMode = videoParameters[3 /* VideoCodecParametersTypes.PACKETIZATION_MODE */][0];
|
|
512
|
+
const cvoEnabled = videoParameters[4 /* VideoCodecParametersTypes.CVO_ENABLED */];
|
|
513
|
+
let cvoId = undefined;
|
|
514
|
+
if (cvoEnabled && cvoEnabled[0] === 1 /* VideoCodecCVO.SUPPORTED */) {
|
|
515
|
+
cvoId = videoParameters[5 /* VideoCodecParametersTypes.CVO_ID */].readUInt8(0);
|
|
516
|
+
}
|
|
517
|
+
// video attributes
|
|
518
|
+
const videoAttributes = tlv.decode(videoAttributesTLV);
|
|
519
|
+
const width = videoAttributes[1 /* VideoAttributesTypes.IMAGE_WIDTH */].readUInt16LE(0);
|
|
520
|
+
const height = videoAttributes[2 /* VideoAttributesTypes.IMAGE_HEIGHT */].readUInt16LE(0);
|
|
521
|
+
const frameRate = videoAttributes[3 /* VideoAttributesTypes.FRAME_RATE */].readUInt8(0);
|
|
522
|
+
// video rtp parameters
|
|
523
|
+
const videoRTPParameters = tlv.decode(videoRTPParametersTLV);
|
|
524
|
+
const videoPayloadType = videoRTPParameters[1 /* VideoRTPParametersTypes.PAYLOAD_TYPE */].readUInt8(0); // 99
|
|
525
|
+
const videoSSRC = videoRTPParameters[2 /* VideoRTPParametersTypes.SYNCHRONIZATION_SOURCE */].readUInt32LE(0);
|
|
526
|
+
const videoMaximumBitrate = videoRTPParameters[3 /* VideoRTPParametersTypes.MAX_BIT_RATE */].readUInt16LE(0);
|
|
527
|
+
const videoRTCPInterval = videoRTPParameters[4 /* VideoRTPParametersTypes.MIN_RTCP_INTERVAL */].readFloatLE(0);
|
|
528
|
+
let maxMTU = this.ipVersion === "ipv6" ? 1228 : 1378; // default values ipv4: 1378 bytes; ipv6: 1228 bytes
|
|
529
|
+
if (videoRTPParameters[5 /* VideoRTPParametersTypes.MAX_MTU */]) {
|
|
530
|
+
maxMTU = videoRTPParameters[5 /* VideoRTPParametersTypes.MAX_MTU */].readUInt16LE(0);
|
|
531
|
+
}
|
|
532
|
+
// selected audio configuration
|
|
533
|
+
const audioCodec = audioConfiguration[1 /* SelectedAudioParametersTypes.CODEC_TYPE */][0];
|
|
534
|
+
const audioParametersTLV = audioConfiguration[2 /* SelectedAudioParametersTypes.CODEC_PARAMETERS */];
|
|
535
|
+
const audioRTPParametersTLV = audioConfiguration[3 /* SelectedAudioParametersTypes.RTP_PARAMETERS */];
|
|
536
|
+
const comfortNoise = !!audioConfiguration[4 /* SelectedAudioParametersTypes.COMFORT_NOISE */].readUInt8(0);
|
|
537
|
+
// audio parameters
|
|
538
|
+
const audioParameters = tlv.decode(audioParametersTLV);
|
|
539
|
+
const channels = audioParameters[1 /* AudioCodecParametersTypes.CHANNEL */][0];
|
|
540
|
+
const audioBitrate = audioParameters[2 /* AudioCodecParametersTypes.BIT_RATE */][0];
|
|
541
|
+
const samplerate = audioParameters[3 /* AudioCodecParametersTypes.SAMPLE_RATE */][0];
|
|
542
|
+
const rtpPacketTime = audioParameters[4 /* AudioCodecParametersTypes.PACKET_TIME */].readUInt8(0);
|
|
543
|
+
// audio rtp parameters
|
|
544
|
+
const audioRTPParameters = tlv.decode(audioRTPParametersTLV);
|
|
545
|
+
const audioPayloadType = audioRTPParameters[1 /* AudioRTPParametersTypes.PAYLOAD_TYPE */].readUInt8(0); // 110
|
|
546
|
+
const audioSSRC = audioRTPParameters[2 /* AudioRTPParametersTypes.SYNCHRONIZATION_SOURCE */].readUInt32LE(0);
|
|
547
|
+
const audioMaximumBitrate = audioRTPParameters[3 /* AudioRTPParametersTypes.MAX_BIT_RATE */].readUInt16LE(0);
|
|
548
|
+
const audioRTCPInterval = audioRTPParameters[4 /* AudioRTPParametersTypes.MIN_RTCP_INTERVAL */].readFloatLE(0);
|
|
549
|
+
const comfortNoisePayloadType = audioRTPParameters[6 /* AudioRTPParametersTypes.COMFORT_NOISE_PAYLOAD_TYPE */].readUInt8(0); // 13
|
|
550
|
+
if (this.requireProxy) {
|
|
551
|
+
this.videoProxy.setOutgoingPayloadType(videoPayloadType);
|
|
552
|
+
if (!this.disableAudioProxy) {
|
|
553
|
+
this.audioProxy.setOutgoingPayloadType(audioPayloadType);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
const videoInfo = {
|
|
557
|
+
codec: videoCodec.readUInt8(0),
|
|
558
|
+
profile: h264Profile,
|
|
559
|
+
level: h264Level,
|
|
560
|
+
packetizationMode: packetizationMode,
|
|
561
|
+
cvoId: cvoId,
|
|
562
|
+
width: width,
|
|
563
|
+
height: height,
|
|
564
|
+
fps: frameRate,
|
|
565
|
+
pt: videoPayloadType,
|
|
566
|
+
ssrc: videoSSRC,
|
|
567
|
+
max_bit_rate: videoMaximumBitrate,
|
|
568
|
+
rtcp_interval: videoRTCPInterval,
|
|
569
|
+
mtu: maxMTU,
|
|
570
|
+
};
|
|
571
|
+
let audioCodecName;
|
|
572
|
+
let samplerateNum;
|
|
573
|
+
switch (audioCodec) {
|
|
574
|
+
case 0 /* AudioCodecTypes.PCMU */:
|
|
575
|
+
audioCodecName = "PCMU" /* AudioStreamingCodecType.PCMU */;
|
|
576
|
+
break;
|
|
577
|
+
case 1 /* AudioCodecTypes.PCMA */:
|
|
578
|
+
audioCodecName = "PCMA" /* AudioStreamingCodecType.PCMA */;
|
|
579
|
+
break;
|
|
580
|
+
case 2 /* AudioCodecTypes.AAC_ELD */:
|
|
581
|
+
audioCodecName = "AAC-eld" /* AudioStreamingCodecType.AAC_ELD */;
|
|
582
|
+
break;
|
|
583
|
+
case 3 /* AudioCodecTypes.OPUS */:
|
|
584
|
+
audioCodecName = "OPUS" /* AudioStreamingCodecType.OPUS */;
|
|
585
|
+
break;
|
|
586
|
+
case 4 /* AudioCodecTypes.MSBC */:
|
|
587
|
+
audioCodecName = "mSBC" /* AudioStreamingCodecType.MSBC */;
|
|
588
|
+
break;
|
|
589
|
+
case 5 /* AudioCodecTypes.AMR */:
|
|
590
|
+
audioCodecName = "AMR" /* AudioStreamingCodecType.AMR */;
|
|
591
|
+
break;
|
|
592
|
+
case 6 /* AudioCodecTypes.AMR_WB */:
|
|
593
|
+
audioCodecName = "AMR-WB" /* AudioStreamingCodecType.AMR_WB */;
|
|
594
|
+
break;
|
|
595
|
+
default:
|
|
596
|
+
throw new Error(`Encountered unknown selected audio codec ${audioCodec}`);
|
|
597
|
+
}
|
|
598
|
+
switch (samplerate) {
|
|
599
|
+
case 0 /* AudioSamplerate.KHZ_8 */:
|
|
600
|
+
samplerateNum = 8;
|
|
601
|
+
break;
|
|
602
|
+
case 1 /* AudioSamplerate.KHZ_16 */:
|
|
603
|
+
samplerateNum = 16;
|
|
604
|
+
break;
|
|
605
|
+
case 2 /* AudioSamplerate.KHZ_24 */:
|
|
606
|
+
samplerateNum = 24;
|
|
607
|
+
break;
|
|
608
|
+
default:
|
|
609
|
+
throw new Error(`Encountered unknown selected audio samplerate ${samplerate}`);
|
|
610
|
+
}
|
|
611
|
+
const audioInfo = {
|
|
612
|
+
codec: audioCodecName,
|
|
613
|
+
channel: channels,
|
|
614
|
+
bit_rate: audioBitrate,
|
|
615
|
+
sample_rate: samplerateNum,
|
|
616
|
+
packet_time: rtpPacketTime,
|
|
617
|
+
pt: audioPayloadType,
|
|
618
|
+
ssrc: audioSSRC,
|
|
619
|
+
max_bit_rate: audioMaximumBitrate,
|
|
620
|
+
rtcp_interval: audioRTCPInterval,
|
|
621
|
+
comfort_pt: comfortNoisePayloadType,
|
|
622
|
+
comfortNoiseEnabled: comfortNoise,
|
|
623
|
+
};
|
|
624
|
+
const request = {
|
|
625
|
+
sessionID: this.sessionIdentifier,
|
|
626
|
+
type: "start" /* StreamRequestTypes.START */,
|
|
627
|
+
video: videoInfo,
|
|
628
|
+
audio: audioInfo,
|
|
629
|
+
};
|
|
630
|
+
this.delegate.handleStreamRequest(request, error => callback(error));
|
|
631
|
+
}
|
|
632
|
+
handleReconfigureStream(videoConfiguration, callback) {
|
|
633
|
+
// selected video configuration
|
|
634
|
+
const videoAttributesTLV = videoConfiguration[3 /* SelectedVideoParametersTypes.ATTRIBUTES */];
|
|
635
|
+
const videoRTPParametersTLV = videoConfiguration[4 /* SelectedVideoParametersTypes.RTP_PARAMETERS */];
|
|
636
|
+
// video attributes
|
|
637
|
+
const videoAttributes = tlv.decode(videoAttributesTLV);
|
|
638
|
+
const width = videoAttributes[1 /* VideoAttributesTypes.IMAGE_WIDTH */].readUInt16LE(0);
|
|
639
|
+
const height = videoAttributes[2 /* VideoAttributesTypes.IMAGE_HEIGHT */].readUInt16LE(0);
|
|
640
|
+
const frameRate = videoAttributes[3 /* VideoAttributesTypes.FRAME_RATE */].readUInt8(0);
|
|
641
|
+
// video rtp parameters
|
|
642
|
+
const videoRTPParameters = tlv.decode(videoRTPParametersTLV);
|
|
643
|
+
const videoMaximumBitrate = videoRTPParameters[3 /* VideoRTPParametersTypes.MAX_BIT_RATE */].readUInt16LE(0);
|
|
644
|
+
// seems to be always zero, use default of 0.5
|
|
645
|
+
const videoRTCPInterval = videoRTPParameters[4 /* VideoRTPParametersTypes.MIN_RTCP_INTERVAL */].readFloatLE(0) || 0.5;
|
|
646
|
+
const reconfiguredVideoInfo = {
|
|
647
|
+
width: width,
|
|
648
|
+
height: height,
|
|
649
|
+
fps: frameRate,
|
|
650
|
+
max_bit_rate: videoMaximumBitrate,
|
|
651
|
+
rtcp_interval: videoRTCPInterval,
|
|
652
|
+
};
|
|
653
|
+
const request = {
|
|
654
|
+
sessionID: this.sessionIdentifier,
|
|
655
|
+
type: "reconfigure" /* StreamRequestTypes.RECONFIGURE */,
|
|
656
|
+
video: reconfiguredVideoInfo,
|
|
657
|
+
};
|
|
658
|
+
this.delegate.handleStreamRequest(request, error => callback(error));
|
|
659
|
+
}
|
|
660
|
+
_handleStopStream(callback) {
|
|
661
|
+
const request = {
|
|
662
|
+
sessionID: this.sessionIdentifier, // save sessionIdentifier before handleSessionClosed is called
|
|
663
|
+
type: "stop" /* StreamRequestTypes.STOP */,
|
|
664
|
+
};
|
|
665
|
+
this.handleSessionClosed();
|
|
666
|
+
this.delegate.handleStreamRequest(request, error => callback ? callback(error) : undefined);
|
|
667
|
+
}
|
|
668
|
+
handleSetupEndpoints(value, callback, connection) {
|
|
669
|
+
if (this.streamingIsDisabled(callback)) {
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
672
|
+
const data = Buffer.from(value, "base64");
|
|
673
|
+
const objects = tlv.decode(data);
|
|
674
|
+
const sessionIdentifier = uuid.unparse(objects[1 /* SetupEndpointsTypes.SESSION_ID */]);
|
|
675
|
+
if (this.streamStatus !== 0 /* StreamingStatus.AVAILABLE */) {
|
|
676
|
+
this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 1 /* SetupEndpointsStatus.BUSY */).toString("base64");
|
|
677
|
+
callback();
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
(0, assert_1.default)(this.activeConnection == null, "Found non-nil `activeConnection` when trying to setup streaming endpoints, even though streamStatus is reported to be AVAILABLE!");
|
|
681
|
+
this.activeConnection = connection;
|
|
682
|
+
this.activeConnection.setMaxListeners(this.activeConnection.getMaxListeners() + 1);
|
|
683
|
+
this.activeConnection.on("closed" /* HAPConnectionEvent.CLOSED */, this.activeConnectionClosedListener);
|
|
684
|
+
this.sessionIdentifier = sessionIdentifier;
|
|
685
|
+
this._updateStreamStatus(1 /* StreamingStatus.IN_USE */);
|
|
686
|
+
// Address
|
|
687
|
+
const targetAddressPayload = objects[3 /* SetupEndpointsTypes.CONTROLLER_ADDRESS */];
|
|
688
|
+
const processedAddressInfo = tlv.decode(targetAddressPayload);
|
|
689
|
+
const addressVersion = processedAddressInfo[1 /* AddressTypes.ADDRESS_VERSION */][0];
|
|
690
|
+
const controllerAddress = processedAddressInfo[2 /* AddressTypes.ADDRESS */].toString("utf8");
|
|
691
|
+
const targetVideoPort = processedAddressInfo[3 /* AddressTypes.VIDEO_RTP_PORT */].readUInt16LE(0);
|
|
692
|
+
const targetAudioPort = processedAddressInfo[4 /* AddressTypes.AUDIO_RTP_PORT */].readUInt16LE(0);
|
|
693
|
+
// Video SRTP Params
|
|
694
|
+
const videoSRTPPayload = objects[4 /* SetupEndpointsTypes.VIDEO_SRTP_PARAMETERS */];
|
|
695
|
+
const processedVideoInfo = tlv.decode(videoSRTPPayload);
|
|
696
|
+
const videoCryptoSuite = processedVideoInfo[1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */][0];
|
|
697
|
+
const videoMasterKey = processedVideoInfo[2 /* SRTPParametersTypes.MASTER_KEY */];
|
|
698
|
+
const videoMasterSalt = processedVideoInfo[3 /* SRTPParametersTypes.MASTER_SALT */];
|
|
699
|
+
// Audio SRTP Params
|
|
700
|
+
const audioSRTPPayload = objects[5 /* SetupEndpointsTypes.AUDIO_SRTP_PARAMETERS */];
|
|
701
|
+
const processedAudioInfo = tlv.decode(audioSRTPPayload);
|
|
702
|
+
const audioCryptoSuite = processedAudioInfo[1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */][0];
|
|
703
|
+
const audioMasterKey = processedAudioInfo[2 /* SRTPParametersTypes.MASTER_KEY */];
|
|
704
|
+
const audioMasterSalt = processedAudioInfo[3 /* SRTPParametersTypes.MASTER_SALT */];
|
|
705
|
+
debug("Session: ", sessionIdentifier, "\nControllerAddress: ", controllerAddress, "\nVideoPort: ", targetVideoPort, "\nAudioPort: ", targetAudioPort, "\nVideo Crypto: ", videoCryptoSuite, "\nVideo Master Key: ", videoMasterKey, "\nVideo Master Salt: ", videoMasterSalt, "\nAudio Crypto: ", audioCryptoSuite, "\nAudio Master Key: ", audioMasterKey, "\nAudio Master Salt: ", audioMasterSalt);
|
|
706
|
+
const prepareRequest = {
|
|
707
|
+
sessionID: sessionIdentifier,
|
|
708
|
+
sourceAddress: connection.localAddress,
|
|
709
|
+
targetAddress: controllerAddress,
|
|
710
|
+
addressVersion: addressVersion === 1 /* IPAddressVersion.IPV6 */ ? "ipv6" : "ipv4",
|
|
711
|
+
video: {
|
|
712
|
+
port: targetVideoPort,
|
|
713
|
+
srtpCryptoSuite: videoCryptoSuite,
|
|
714
|
+
srtp_key: videoMasterKey,
|
|
715
|
+
srtp_salt: videoMasterSalt,
|
|
716
|
+
},
|
|
717
|
+
audio: {
|
|
718
|
+
port: targetAudioPort,
|
|
719
|
+
srtpCryptoSuite: audioCryptoSuite,
|
|
720
|
+
srtp_key: audioMasterKey,
|
|
721
|
+
srtp_salt: audioMasterSalt,
|
|
722
|
+
},
|
|
723
|
+
};
|
|
724
|
+
const promises = [];
|
|
725
|
+
if (this.requireProxy) {
|
|
726
|
+
prepareRequest.targetAddress = connection.getLocalAddress(addressVersion === 1 /* IPAddressVersion.IPV6 */ ? "ipv6" : "ipv4"); // ip versions must be the same
|
|
727
|
+
this.videoProxy = new RTPProxy_1.default({
|
|
728
|
+
outgoingAddress: controllerAddress,
|
|
729
|
+
outgoingPort: targetVideoPort,
|
|
730
|
+
outgoingSSRC: crypto_1.default.randomBytes(4).readUInt32LE(0), // videoSSRC
|
|
731
|
+
disabled: false,
|
|
732
|
+
});
|
|
733
|
+
promises.push(this.videoProxy.setup().then(() => {
|
|
734
|
+
prepareRequest.video.proxy_rtp = this.videoProxy.incomingRTPPort();
|
|
735
|
+
prepareRequest.video.proxy_rtcp = this.videoProxy.incomingRTCPPort();
|
|
736
|
+
}));
|
|
737
|
+
if (!this.disableAudioProxy) {
|
|
738
|
+
this.audioProxy = new RTPProxy_1.default({
|
|
739
|
+
outgoingAddress: controllerAddress,
|
|
740
|
+
outgoingPort: targetAudioPort,
|
|
741
|
+
outgoingSSRC: crypto_1.default.randomBytes(4).readUInt32LE(0), // audioSSRC
|
|
742
|
+
disabled: this.videoOnly,
|
|
743
|
+
});
|
|
744
|
+
promises.push(this.audioProxy.setup().then(() => {
|
|
745
|
+
prepareRequest.audio.proxy_rtp = this.audioProxy.incomingRTPPort();
|
|
746
|
+
prepareRequest.audio.proxy_rtcp = this.audioProxy.incomingRTCPPort();
|
|
747
|
+
}));
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
Promise.all(promises).then(() => {
|
|
751
|
+
this.delegate.prepareStream(prepareRequest, (0, once_1.once)((error, response) => {
|
|
752
|
+
if (error || !response) {
|
|
753
|
+
debug(`PrepareStream request encountered an error: ${error ? error.message : undefined}`);
|
|
754
|
+
this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString("base64");
|
|
755
|
+
this.handleSessionClosed();
|
|
756
|
+
callback(error);
|
|
757
|
+
}
|
|
758
|
+
else {
|
|
759
|
+
this.generateSetupEndpointResponse(connection, sessionIdentifier, prepareRequest, response, callback);
|
|
760
|
+
}
|
|
761
|
+
}));
|
|
762
|
+
}).catch((error) => {
|
|
763
|
+
debug(`RTP proxy setup failed: ${error.message}`);
|
|
764
|
+
this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(sessionIdentifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString("base64");
|
|
765
|
+
this.handleSessionClosed();
|
|
766
|
+
callback(error);
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
generateSetupEndpointResponse(connection, identifier, request, response, callback) {
|
|
770
|
+
let address;
|
|
771
|
+
let addressVersion = request.addressVersion;
|
|
772
|
+
let videoPort;
|
|
773
|
+
let audioPort;
|
|
774
|
+
let videoCryptoSuite;
|
|
775
|
+
let videoSRTPKey;
|
|
776
|
+
let videoSRTPSalt;
|
|
777
|
+
let audioCryptoSuite;
|
|
778
|
+
let audioSRTPKey;
|
|
779
|
+
let audioSRTPSalt;
|
|
780
|
+
let videoSSRC;
|
|
781
|
+
let audioSSRC;
|
|
782
|
+
if (!this.videoOnly && !response.audio) {
|
|
783
|
+
throw new Error("Audio was enabled but not supplied in PrepareStreamResponse!");
|
|
784
|
+
}
|
|
785
|
+
// Provide default values if audio was not supplied
|
|
786
|
+
const audio = response.audio || {
|
|
787
|
+
port: request.audio.port,
|
|
788
|
+
ssrc: controller_1.CameraController.generateSynchronisationSource(),
|
|
789
|
+
srtp_key: request.audio.srtp_key,
|
|
790
|
+
srtp_salt: request.audio.srtp_salt,
|
|
791
|
+
};
|
|
792
|
+
if (!this.requireProxy) {
|
|
793
|
+
const videoInfo = response.video;
|
|
794
|
+
const audioInfo = audio;
|
|
795
|
+
if (response.addressOverride) {
|
|
796
|
+
addressVersion = net_1.default.isIPv4(response.addressOverride) ? "ipv4" : "ipv6";
|
|
797
|
+
address = response.addressOverride;
|
|
798
|
+
}
|
|
799
|
+
else {
|
|
800
|
+
address = connection.getLocalAddress(addressVersion);
|
|
801
|
+
}
|
|
802
|
+
if (request.addressVersion !== addressVersion) {
|
|
803
|
+
throw new Error(`Incoming and outgoing ip address versions must match! Expected ${request.addressVersion} but got ${addressVersion}`);
|
|
804
|
+
}
|
|
805
|
+
videoPort = videoInfo.port;
|
|
806
|
+
audioPort = audioInfo.port;
|
|
807
|
+
if (request.video.srtpCryptoSuite !== 2 /* SRTPCryptoSuites.NONE */
|
|
808
|
+
&& (videoInfo.srtp_key === undefined || videoInfo.srtp_salt === undefined)) {
|
|
809
|
+
throw new Error("SRTP was selected for the prepared video stream, but no 'srtp_key' or 'srtp_salt' was specified!");
|
|
810
|
+
}
|
|
811
|
+
if (request.audio.srtpCryptoSuite !== 2 /* SRTPCryptoSuites.NONE */
|
|
812
|
+
&& (audioInfo.srtp_key === undefined || audioInfo.srtp_salt === undefined)) {
|
|
813
|
+
throw new Error("SRTP was selected for the prepared audio stream, but no 'srtp_key' or 'srtp_salt' was specified!");
|
|
814
|
+
}
|
|
815
|
+
videoCryptoSuite = request.video.srtpCryptoSuite;
|
|
816
|
+
videoSRTPKey = videoInfo.srtp_key || Buffer.alloc(0); // key and salt are zero-length for cryptoSuite = NONE
|
|
817
|
+
videoSRTPSalt = videoInfo.srtp_salt || Buffer.alloc(0);
|
|
818
|
+
audioCryptoSuite = request.audio.srtpCryptoSuite;
|
|
819
|
+
audioSRTPKey = audioInfo.srtp_key || Buffer.alloc(0); // key and salt are zero-length for cryptoSuite = NONE
|
|
820
|
+
audioSRTPSalt = audioInfo.srtp_salt || Buffer.alloc(0);
|
|
821
|
+
videoSSRC = videoInfo.ssrc;
|
|
822
|
+
audioSSRC = audioInfo.ssrc;
|
|
823
|
+
}
|
|
824
|
+
else {
|
|
825
|
+
const videoInfo = response.video;
|
|
826
|
+
address = connection.getLocalAddress(request.addressVersion);
|
|
827
|
+
videoCryptoSuite = 2 /* SRTPCryptoSuites.NONE */;
|
|
828
|
+
videoSRTPKey = Buffer.alloc(0);
|
|
829
|
+
videoSRTPSalt = Buffer.alloc(0);
|
|
830
|
+
audioCryptoSuite = 2 /* SRTPCryptoSuites.NONE */;
|
|
831
|
+
audioSRTPKey = Buffer.alloc(0);
|
|
832
|
+
audioSRTPSalt = Buffer.alloc(0);
|
|
833
|
+
this.videoProxy.setIncomingPayloadType(videoInfo.proxy_pt);
|
|
834
|
+
this.videoProxy.setServerAddress(videoInfo.proxy_server_address);
|
|
835
|
+
this.videoProxy.setServerRTPPort(videoInfo.proxy_server_rtp);
|
|
836
|
+
this.videoProxy.setServerRTCPPort(videoInfo.proxy_server_rtcp);
|
|
837
|
+
videoPort = this.videoProxy.outgoingLocalPort();
|
|
838
|
+
videoSSRC = this.videoProxy.outgoingSSRC;
|
|
839
|
+
if (!this.disableAudioProxy) {
|
|
840
|
+
const audioInfo = response.audio;
|
|
841
|
+
this.audioProxy.setIncomingPayloadType(audioInfo.proxy_pt);
|
|
842
|
+
this.audioProxy.setServerAddress(audioInfo.proxy_server_address);
|
|
843
|
+
this.audioProxy.setServerRTPPort(audioInfo.proxy_server_rtp);
|
|
844
|
+
this.audioProxy.setServerRTCPPort(audioInfo.proxy_server_rtcp);
|
|
845
|
+
audioPort = this.audioProxy.outgoingLocalPort();
|
|
846
|
+
audioSSRC = this.audioProxy.outgoingSSRC;
|
|
847
|
+
}
|
|
848
|
+
else {
|
|
849
|
+
const audioInfo = response.audio;
|
|
850
|
+
audioPort = audioInfo.port;
|
|
851
|
+
audioSSRC = audioInfo.ssrc;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
this.ipVersion = addressVersion; // we need to save this in order to calculate some default mtu values later
|
|
855
|
+
const accessoryAddress = tlv.encode(1 /* AddressTypes.ADDRESS_VERSION */, addressVersion === "ipv4" ? 0 /* IPAddressVersion.IPV4 */ : 1 /* IPAddressVersion.IPV6 */, 2 /* AddressTypes.ADDRESS */, address, 3 /* AddressTypes.VIDEO_RTP_PORT */, tlv.writeUInt16(videoPort), 4 /* AddressTypes.AUDIO_RTP_PORT */, tlv.writeUInt16(audioPort));
|
|
856
|
+
const videoSRTPParameters = tlv.encode(1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */, videoCryptoSuite, 2 /* SRTPParametersTypes.MASTER_KEY */, videoSRTPKey, 3 /* SRTPParametersTypes.MASTER_SALT */, videoSRTPSalt);
|
|
857
|
+
const audioSRTPParameters = tlv.encode(1 /* SRTPParametersTypes.SRTP_CRYPTO_SUITE */, audioCryptoSuite, 2 /* SRTPParametersTypes.MASTER_KEY */, audioSRTPKey, 3 /* SRTPParametersTypes.MASTER_SALT */, audioSRTPSalt);
|
|
858
|
+
this.setupEndpointsResponse = tlv.encode(1 /* SetupEndpointsResponseTypes.SESSION_ID */, uuid.write(identifier), 2 /* SetupEndpointsResponseTypes.STATUS */, 0 /* SetupEndpointsStatus.SUCCESS */, 3 /* SetupEndpointsResponseTypes.ACCESSORY_ADDRESS */, accessoryAddress, 4 /* SetupEndpointsResponseTypes.VIDEO_SRTP_PARAMETERS */, videoSRTPParameters, 5 /* SetupEndpointsResponseTypes.AUDIO_SRTP_PARAMETERS */, audioSRTPParameters, 6 /* SetupEndpointsResponseTypes.VIDEO_SSRC */, tlv.writeUInt32(videoSSRC), 7 /* SetupEndpointsResponseTypes.AUDIO_SSRC */, tlv.writeUInt32(audioSSRC)).toString("base64");
|
|
859
|
+
callback();
|
|
860
|
+
}
|
|
861
|
+
_updateStreamStatus(status) {
|
|
862
|
+
this.streamStatus = status;
|
|
863
|
+
this.service.updateCharacteristic(Characteristic_1.Characteristic.StreamingStatus, tlv.encode(1 /* StreamingStatusTypes.STATUS */, this.streamStatus).toString("base64"));
|
|
864
|
+
}
|
|
865
|
+
static _supportedRTPConfiguration(supportedCryptoSuites) {
|
|
866
|
+
if (supportedCryptoSuites.length === 1 && supportedCryptoSuites[0] === 2 /* SRTPCryptoSuites.NONE */) {
|
|
867
|
+
debug("Client claims it doesn't support SRTP. The stream may stops working with future iOS releases.");
|
|
868
|
+
}
|
|
869
|
+
return tlv.encode(2 /* SupportedRTPConfigurationTypes.SRTP_CRYPTO_SUITE */, supportedCryptoSuites).toString("base64");
|
|
870
|
+
}
|
|
871
|
+
static _supportedVideoStreamConfiguration(videoOptions) {
|
|
872
|
+
if (!videoOptions.codec) {
|
|
873
|
+
throw new Error("Video codec cannot be undefined");
|
|
874
|
+
}
|
|
875
|
+
if (!videoOptions.resolutions) {
|
|
876
|
+
throw new Error("Video resolutions cannot be undefined");
|
|
877
|
+
}
|
|
878
|
+
let codecParameters = tlv.encode(1 /* VideoCodecParametersTypes.PROFILE_ID */, videoOptions.codec.profiles, 2 /* VideoCodecParametersTypes.LEVEL */, videoOptions.codec.levels, 3 /* VideoCodecParametersTypes.PACKETIZATION_MODE */, 0 /* VideoCodecPacketizationMode.NON_INTERLEAVED */);
|
|
879
|
+
if (videoOptions.cvoId != null) {
|
|
880
|
+
codecParameters = Buffer.concat([
|
|
881
|
+
codecParameters,
|
|
882
|
+
tlv.encode(4 /* VideoCodecParametersTypes.CVO_ENABLED */, 1 /* VideoCodecCVO.SUPPORTED */, 5 /* VideoCodecParametersTypes.CVO_ID */, videoOptions.cvoId),
|
|
883
|
+
]);
|
|
884
|
+
}
|
|
885
|
+
const videoStreamConfiguration = tlv.encode(1 /* VideoCodecConfigurationTypes.CODEC_TYPE */, 0 /* VideoCodecType.H264 */, 2 /* VideoCodecConfigurationTypes.CODEC_PARAMETERS */, codecParameters, 3 /* VideoCodecConfigurationTypes.ATTRIBUTES */, videoOptions.resolutions.map(resolution => {
|
|
886
|
+
if (resolution.length !== 3) {
|
|
887
|
+
throw new Error("Unexpected video resolution");
|
|
888
|
+
}
|
|
889
|
+
const width = Buffer.alloc(2);
|
|
890
|
+
const height = Buffer.alloc(2);
|
|
891
|
+
const frameRate = Buffer.alloc(1);
|
|
892
|
+
width.writeUInt16LE(resolution[0], 0);
|
|
893
|
+
height.writeUInt16LE(resolution[1], 0);
|
|
894
|
+
frameRate.writeUInt8(resolution[2], 0);
|
|
895
|
+
return tlv.encode(1 /* VideoAttributesTypes.IMAGE_WIDTH */, width, 2 /* VideoAttributesTypes.IMAGE_HEIGHT */, height, 3 /* VideoAttributesTypes.FRAME_RATE */, frameRate);
|
|
896
|
+
}));
|
|
897
|
+
return tlv.encode(1 /* SupportedVideoStreamConfigurationTypes.VIDEO_CODEC_CONFIGURATION */, videoStreamConfiguration).toString("base64");
|
|
898
|
+
}
|
|
899
|
+
checkForLegacyAudioCodecRepresentation(codecs) {
|
|
900
|
+
const codecMap = {};
|
|
901
|
+
codecs.slice().forEach(codec => {
|
|
902
|
+
const previous = codecMap[codec.type];
|
|
903
|
+
if (previous) {
|
|
904
|
+
if (typeof previous.samplerate === "number") {
|
|
905
|
+
previous.samplerate = [previous.samplerate];
|
|
906
|
+
}
|
|
907
|
+
previous.samplerate = previous.samplerate.concat(codec.samplerate);
|
|
908
|
+
const index = codecs.indexOf(codec);
|
|
909
|
+
if (index >= 0) {
|
|
910
|
+
codecs.splice(index, 1);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
else {
|
|
914
|
+
codecMap[codec.type] = codec;
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
_supportedAudioStreamConfiguration(audioOptions) {
|
|
919
|
+
// Only AAC-ELD and OPUS are accepted by iOS currently, and we need to give it something it will accept
|
|
920
|
+
// for it to start the video stream.
|
|
921
|
+
const comfortNoise = audioOptions && !!audioOptions.comfort_noise;
|
|
922
|
+
const supportedCodecs = (audioOptions && audioOptions.codecs) || [];
|
|
923
|
+
this.checkForLegacyAudioCodecRepresentation(supportedCodecs);
|
|
924
|
+
if (supportedCodecs.length === 0) { // Fake a Codec if we haven't got anything
|
|
925
|
+
debug("Client doesn't support any audio codec that HomeKit supports.");
|
|
926
|
+
this.videoOnly = true;
|
|
927
|
+
supportedCodecs.push({
|
|
928
|
+
type: "OPUS" /* AudioStreamingCodecType.OPUS */, // Opus @16K required by Apple Watch AFAIK
|
|
929
|
+
samplerate: [16 /* AudioStreamingSamplerate.KHZ_16 */, 24 /* AudioStreamingSamplerate.KHZ_24 */], // 16 and 24 must be supported
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
const codecConfigurations = supportedCodecs.map(codec => {
|
|
933
|
+
let type;
|
|
934
|
+
switch (codec.type) {
|
|
935
|
+
case "OPUS" /* AudioStreamingCodecType.OPUS */:
|
|
936
|
+
type = 3 /* AudioCodecTypes.OPUS */;
|
|
937
|
+
break;
|
|
938
|
+
case "AAC-eld" /* AudioStreamingCodecType.AAC_ELD */:
|
|
939
|
+
type = 2 /* AudioCodecTypes.AAC_ELD */;
|
|
940
|
+
break;
|
|
941
|
+
case "PCMA" /* AudioStreamingCodecType.PCMA */:
|
|
942
|
+
type = 1 /* AudioCodecTypes.PCMA */;
|
|
943
|
+
break;
|
|
944
|
+
case "PCMU" /* AudioStreamingCodecType.PCMU */:
|
|
945
|
+
type = 0 /* AudioCodecTypes.PCMU */;
|
|
946
|
+
break;
|
|
947
|
+
case "mSBC" /* AudioStreamingCodecType.MSBC */:
|
|
948
|
+
type = 4 /* AudioCodecTypes.MSBC */;
|
|
949
|
+
break;
|
|
950
|
+
case "AMR" /* AudioStreamingCodecType.AMR */:
|
|
951
|
+
type = 5 /* AudioCodecTypes.AMR */;
|
|
952
|
+
break;
|
|
953
|
+
case "AMR-WB" /* AudioStreamingCodecType.AMR_WB */:
|
|
954
|
+
type = 6 /* AudioCodecTypes.AMR_WB */;
|
|
955
|
+
break;
|
|
956
|
+
default:
|
|
957
|
+
throw new Error("Unsupported codec: " + codec.type);
|
|
958
|
+
}
|
|
959
|
+
const providedSamplerates = (typeof codec.samplerate === "number" ? [codec.samplerate] : codec.samplerate).map(rate => {
|
|
960
|
+
let samplerate;
|
|
961
|
+
switch (rate) {
|
|
962
|
+
case 8 /* AudioStreamingSamplerate.KHZ_8 */:
|
|
963
|
+
samplerate = 0 /* AudioSamplerate.KHZ_8 */;
|
|
964
|
+
break;
|
|
965
|
+
case 16 /* AudioStreamingSamplerate.KHZ_16 */:
|
|
966
|
+
samplerate = 1 /* AudioSamplerate.KHZ_16 */;
|
|
967
|
+
break;
|
|
968
|
+
case 24 /* AudioStreamingSamplerate.KHZ_24 */:
|
|
969
|
+
samplerate = 2 /* AudioSamplerate.KHZ_24 */;
|
|
970
|
+
break;
|
|
971
|
+
default:
|
|
972
|
+
console.log("Unsupported sample rate: ", codec.samplerate);
|
|
973
|
+
samplerate = -1;
|
|
974
|
+
}
|
|
975
|
+
return samplerate;
|
|
976
|
+
}).filter(rate => rate !== -1);
|
|
977
|
+
if (providedSamplerates.length === 0) {
|
|
978
|
+
throw new Error("Audio samplerate cannot be empty!");
|
|
979
|
+
}
|
|
980
|
+
const audioParameters = tlv.encode(1 /* AudioCodecParametersTypes.CHANNEL */, Math.max(1, codec.audioChannels || 1), 2 /* AudioCodecParametersTypes.BIT_RATE */, codec.bitrate || 0 /* AudioBitrate.VARIABLE */, 3 /* AudioCodecParametersTypes.SAMPLE_RATE */, providedSamplerates);
|
|
981
|
+
return tlv.encode(1 /* AudioCodecConfigurationTypes.CODEC_TYPE */, type, 2 /* AudioCodecConfigurationTypes.CODEC_PARAMETERS */, audioParameters);
|
|
982
|
+
});
|
|
983
|
+
return tlv.encode(1 /* SupportedAudioStreamConfigurationTypes.AUDIO_CODEC_CONFIGURATION */, codecConfigurations, 2 /* SupportedAudioStreamConfigurationTypes.COMFORT_NOISE_SUPPORT */, comfortNoise ? 1 : 0).toString("base64");
|
|
984
|
+
}
|
|
985
|
+
resetSetupEndpointsResponse() {
|
|
986
|
+
this.setupEndpointsResponse = tlv.encode(2 /* SetupEndpointsResponseTypes.STATUS */, 2 /* SetupEndpointsStatus.ERROR */).toString("base64");
|
|
987
|
+
this.service.updateCharacteristic(Characteristic_1.Characteristic.SetupEndpoints, this.setupEndpointsResponse);
|
|
988
|
+
}
|
|
989
|
+
resetSelectedStreamConfiguration() {
|
|
990
|
+
this.selectedConfiguration = tlv.encode(1 /* SelectedRTPStreamConfigurationTypes.SESSION_CONTROL */, tlv.encode(2 /* SessionControlTypes.COMMAND */, SessionControlCommand.SUSPEND_SESSION)).toString("base64");
|
|
991
|
+
this.service.updateCharacteristic(Characteristic_1.Characteristic.SelectedRTPStreamConfiguration, this.selectedConfiguration);
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
* @private
|
|
995
|
+
*/
|
|
996
|
+
serialize() {
|
|
997
|
+
const characteristicValue = this.service.getCharacteristic(Characteristic_1.Characteristic.Active).value;
|
|
998
|
+
if (characteristicValue === true) {
|
|
999
|
+
return undefined;
|
|
1000
|
+
}
|
|
1001
|
+
return {
|
|
1002
|
+
id: this.id,
|
|
1003
|
+
active: !!characteristicValue,
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* @private
|
|
1008
|
+
*/
|
|
1009
|
+
deserialize(serialized) {
|
|
1010
|
+
(0, assert_1.default)(serialized.id === this.id, `Tried to initialize RTPStreamManagement ${this.id} with data from management with id ${serialized.id}!`);
|
|
1011
|
+
this.service.updateCharacteristic(Characteristic_1.Characteristic.Active, serialized.active);
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* @private
|
|
1015
|
+
*/
|
|
1016
|
+
setupStateChangeDelegate(delegate) {
|
|
1017
|
+
this.stateChangeDelegate = delegate;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
exports.RTPStreamManagement = RTPStreamManagement;
|
|
1021
|
+
//# sourceMappingURL=RTPStreamManagement.js.map
|