Commit Graph

980 Commits

Author SHA1 Message Date
Sergey Krashevich 9c901dc995 feat(hksv): add example CLI application for exporting RTSP cameras as HKSV 2026-03-06 20:54:53 +03:00
Sergey Krashevich c1ff7464d0 Add unit tests for HKSV 2026-03-06 20:48:32 +03:00
Sergey Krashevich c5b7ba7162 feat(hksv): add example CLI application for RTSP to HomeKit Secure Video streaming 2026-03-06 20:39:47 +03:00
Sergey Krashevich c567831c91 feat: add motion detection feature with EMA-based P-frame size analysis
- Implemented MotionDetector for detecting motion based on H.264 P-frame sizes.
- Introduced adjustable sensitivity threshold for motion detection.
- Added tests for various scenarios including motion detection, hold time, cooldown, and baseline adaptation.
- Created hksvSession to manage HDS DataStream connections for HKSV recording.
- Updated schema.json to include a new speaker option for 2-way audio support.
2026-03-06 19:58:15 +03:00
Sergey Krashevich 593dce6eb9 feat(homekit): add Speaker service and enhance Consumer with backtrack audio handling 2026-03-06 09:07:26 +03:00
Sergey Krashevich a591186da6 test(homekit): add tests and benchmarks for HDS protocol and HKSV consumer
HDS protocol tests (15 tests, 4 benchmarks):
- Message structure for SendMediaInit and SendMediaFragment
- Multi-chunk splitting for fragments > 256KB
- Chunk boundary handling and sequence preservation
- WriteEvent/WriteResponse/WriteRequest round-trip
- opack helper functions

HKSV consumer tests (14 tests, 3 benchmarks):
- Consumer creation and field initialization
- GOP buffer flush with sequence numbering
- Activate with init segment and seqNum=2
- Activate timeout and error handling
- Stop safety (double-stop, deactivation)
- WriteTo blocking until Stop

Also fixes broken hds_test.go (undefined Client → NewConn).
2026-03-05 06:43:11 +03:00
Sergey Krashevich 1856b7ace4 fix(homekit): fix HKSV recording by correcting HDS protocol and adding GOP buffering
The HKSV recording was failing because:
1. The dataSend.data message structure was wrong - `packets` was a flat integer
   instead of an array of objects with `data` and `metadata` fields matching
   the HAP-NodeJS specification
2. Each video/audio frame was sent as a separate mediaFragment, but Home Hub
   expects GOP-based fragments (~2-4 seconds of accumulated data)
3. Large fragments were not chunked (max 256 KiB per chunk)

Changes:
- Fix HDS dataSend.data message structure to use proper packets array with
  nested data/metadata (dataType, dataSequenceNumber, dataChunkSequenceNumber,
  isLastDataChunk, dataTotalSize)
- Add 256 KiB chunking for large media fragments
- Buffer moof+mdat pairs in hksvConsumer and flush on keyframe boundaries
  (GOP-based fragmentation)
- Pre-start consumer at pair-verify for instant init segment delivery
- Add write-response support to HAP PUT handler for ch131 DataStream setup
- Fix HAP service linking to match HAP-NodeJS reference
- Add default SelectedCameraRecordingConfiguration (ch209) value
- Start continuous motion generator at pair-verify with dedup protection
2026-03-05 06:26:06 +03:00
Sergey Krashevich ab27a042c1 feat(homekit): add HKSV support with motion detection and doorbell functionality
- Introduced HKSV configuration options in homekit.go, allowing for motion detection and doorbell features.
- Implemented API endpoints for triggering motion detection and doorbell events.
- Enhanced server.go to handle HKSV sessions and manage motion detection states.
- Created new accessory types for HKSV and doorbell in accessory.go.
- Added support for audio recording configurations in ch207.go.
- Defined new services for motion detection and doorbell in services_hksv.go.
- Implemented opack encoding/decoding for HDS protocol in opack.go and protocol.go.
- Updated OpenAPI documentation to reflect new endpoints and features.
- Extended schema.json to include HKSV configuration options.
2026-03-04 13:53:17 +03:00
Alex X 01c7451556 Restore fix audio sample rate for some xiaomi cameras #2006 2026-02-13 10:59:38 +03:00
Sergey Krashevich 6304987a26 Review uncommitted changes 2026-02-08 08:50:18 +03:00
Alex X 44f6f111c4 Move kasa source to separate module 2026-02-08 07:01:14 +03:00
Alex X 7083afe9b2 Merge pull request #2044 from skrashevich/documentation-site
(website): new documentation site
2026-02-06 21:49:35 +03:00
Alex X d01b99d105 BIG docs refactoring 2026-02-06 21:45:55 +03:00
Alex X d1d7846aed Merge pull request #2064 from jmelancondev/webrtc/ice-server-urls-list
webrtc: Fix ice_servers parsing for a list of URLs
2026-02-03 13:42:13 +03:00
Sergey Krashevich f1d61bf15a fix: handle errors in stream creation and patching in tests 2026-02-01 04:18:04 +03:00
José Mélançon d2c4e44844 webrtc: Fix ice_servers parsing for a list of URLs 2026-01-31 14:25:13 -05:00
Sergey Krashevich 5970dd2fe4 📝 docs(README): update documentation for clarity and accuracy 2026-01-26 00:40:48 +03:00
Alex X 6374366da5 Add support xiaomi isa.camera.df3 on old firmwares 2026-01-21 22:26:16 +03:00
Alex X de157eb144 Strip Userinfo from log entries and errors #2051 2026-01-21 17:15:36 +03:00
Alex X 8f68f80bff Add support xiaomi chuangmi.camera.ipc019e 2026-01-20 20:51:40 +03:00
Alex X 2f9d138692 Fix zero channel for xiaomi source #2047 2026-01-20 17:05:14 +03:00
Alex X 366cbd200d Fix unknown msg 0xF0 for cs2 proto 2026-01-20 14:24:27 +03:00
Alex X 75bd1f1b2b Improve packet loss on old TUTK proto 2026-01-20 14:19:18 +03:00
Alex X 7793a55853 Add support xiaomi lumi.camera.gwagl01 2026-01-20 14:18:03 +03:00
Alex X 06cbbe5543 Add support xiaomi isa.camera.isc5c1 2026-01-19 21:55:07 +03:00
Alex X a37fdf38d8 Add support xiaomi chuangmi.camera.v2 on old firmwares 2026-01-19 18:17:38 +03:00
Alex X fc22b20896 Fix ONVIF server support for Unifi Protect #1994 2026-01-18 22:47:04 +03:00
Alex X af819952e8 Improve ONVIF server support #1299 2026-01-18 21:51:05 +03:00
Alex X 8c457710bd Merge pull request #2011 from seydx/wyze
Native Wyze camera support
2026-01-18 08:39:37 +03:00
Alex X 514188201a Move tutk dtls to separate package #2011 2026-01-18 08:38:38 +03:00
Alex X b65ee278cd Merge pull request #1991 from FIGIO55/onvif_info
Adding onvif name and hardware in info field of onvif discovery
2026-01-18 07:55:20 +03:00
Alex X 66225973ae Code refactoring for onvif device discovery #1991 2026-01-18 07:54:48 +03:00
seydx d40f6064d9 refactor dtls 2026-01-17 23:28:03 +01:00
seydx 9365fef7b3 move HL extraction to wyze client 2026-01-17 22:44:09 +01:00
seydx b220959e41 cleanup 2026-01-17 22:12:36 +01:00
seydx c493087876 fix intercom 2026-01-17 20:50:57 +01:00
seydx 679454aedb Merge branch 'master' into wyze 2026-01-17 20:31:05 +01:00
seydx 160695857e refactor 2026-01-17 20:22:08 +01:00
forrestsocool 572f07fcce Add two-way talk support for tp-link ipc camera (#1995)
* add tplink multitrans support

* 已经能成功播放音频了

* 初步能通讯了

* finish

* add tplink multitrans support

* 已经能成功播放音频了

* 初步能通讯了

* cleanup

* clean up

* Code refactoring for #1995

---------

Co-authored-by: Your Name <you@example.com>
Co-authored-by: Alex X <alexey.khit@gmail.com>
2026-01-17 21:39:49 +03:00
Alex X f85cfdc214 Merge pull request #2019 from binary-person/patch-1
fix typo for inability to set channels for backchannel
2026-01-17 19:06:00 +03:00
seydx c03cd9f156 minor improvements 2026-01-17 12:09:38 +01:00
seydx 8e6b8b32d6 Merge branch 'AlexxIT:master' into wyze 2026-01-17 09:40:49 +01:00
Alex X 425fcffbe1 Code refactoring for xiaomi source 2026-01-17 10:06:13 +03:00
Alex X 4ffdeb06d0 Merge branch 'xiaomi'
# Conflicts:
#	pkg/xiaomi/miss/client.go
#	pkg/xiaomi/miss/cs2/conn.go
#	pkg/xiaomi/producer.go
2026-01-17 09:23:23 +03:00
Alex X 6b4eb8ffb6 Big rewrite tutk proto support 2026-01-17 09:05:54 +03:00
seydx 7498d0fba5 copy audio payload before processing in handleAudio function 2026-01-15 22:51:58 +01:00
seydx 50d9aab0d7 change pcm to pcml 2026-01-15 22:50:46 +01:00
seydx 4dbf53122e enable video and audio in buildK10002 again 2026-01-15 12:12:08 +01:00
seydx f96a074957 refactor timestamp handling 2026-01-15 01:25:35 +01:00
seydx dbd04cb972 refactor frame handling 2026-01-15 01:11:16 +01:00