Add PTZ passthrough and audio advertisement for virtual Onvif devices - #28
Open
coolham123 wants to merge 3 commits into
Open
Add PTZ passthrough and audio advertisement for virtual Onvif devices#28coolham123 wants to merge 3 commits into
coolham123 wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds two optional, config-gated features to the virtual Onvif devices. Both are off by default — configs without the new keys produce byte-identical profiles to current main.
1. PTZ passthrough (
ptz:config key)Upstream is Profile S only, so clients like Unifi Protect see a fixed camera even when the real camera supports PTZ. With a
ptz:block on a camera entry:GetCapabilitiesandGetServices, and embeds the camera's realPTZConfigurationinto the virtual profiles./onvif/ptz_serviceon the virtual device is a raw SOAP relay to the camera's real PTZ endpoint — not a SOAP server. Clients sign PTZ requests with WS-Security UsernameToken digests computed from the camera's own credentials, so the relayed envelope authenticates on the camera as-is. The relay stores no client credentials.main_stream/sub_stream) to the camera's real PTZ-capable profile token. All other tokens originate from relayed camera responses and pass through valid.startPtz()), using credentials from the config only for that discovery step. Failures are logged but don't kill the server.2. Audio advertisement (
audio:config key)Audio (e.g. AAC) already flows through the RTSP TCP proxy, but the virtual profiles contained no audio configurations, so clients assumed there is no microphone. With
audio: true(or an object overridingencoding/bitrate/samplerate, default AAC 64 kbps / 16 kHz):AudioSourceConfigurationandAudioEncoderConfigurationin schema-correct element order.GetAudioSources,GetAudioSourceConfigurations,GetAudioEncoderConfigurations,GetAudioEncoderConfiguration,GetAudioEncoderConfigurationOptions(empty results when audio is not configured).Testing
Deployed and verified against a dual-lens Reolink camera adopted as two virtual cameras in Unifi Protect: PTZ control works end-to-end through the relay, and audio is detected and recorded after adoption. Also regression-checked that entries without
ptz:/audio:produce profiles identical to upstream. One operational note for Protect users: it probes PTZ/audio capabilities only at adoption, so existing cameras must be re-adopted to pick up the new capabilities.README documentation for both keys is included.
🤖 Generated with Claude Code