mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-07-30 13:48:07 +02:00
Use first onvif profile with ptz config (#10012)
* Use zoom space id in Onvif RelativeMove setup (#9859) * use zoom space id in onvif relativemove setup * better handle cases when zooming is disabled * Fix birdseye camera comparison (#9887) * Format (#9889) * use first onvif profile with ptz config * Use zoom space id in Onvif RelativeMove setup (#9859) * use zoom space id in onvif relativemove setup * better handle cases when zooming is disabled * use first onvif profile with ptz config --------- Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
This commit is contained in:
parent
d73c8bb90c
commit
824e5ec3a3
@ -92,6 +92,9 @@ class OnvifController:
|
|||||||
if (
|
if (
|
||||||
onvif_profile.VideoEncoderConfiguration
|
onvif_profile.VideoEncoderConfiguration
|
||||||
and onvif_profile.VideoEncoderConfiguration.Encoding == "H264"
|
and onvif_profile.VideoEncoderConfiguration.Encoding == "H264"
|
||||||
|
and onvif_profile.PTZConfiguration
|
||||||
|
and onvif_profile.PTZConfiguration.DefaultContinuousPanTiltVelocitySpace
|
||||||
|
is not None
|
||||||
):
|
):
|
||||||
profile = onvif_profile
|
profile = onvif_profile
|
||||||
logger.debug(f"Selected Onvif profile for {camera_name}: {profile}")
|
logger.debug(f"Selected Onvif profile for {camera_name}: {profile}")
|
||||||
@ -151,7 +154,10 @@ class OnvifController:
|
|||||||
|
|
||||||
# autoracking relative panning/tilting needs a relative zoom value set to 0
|
# autoracking relative panning/tilting needs a relative zoom value set to 0
|
||||||
# if camera supports relative movement
|
# if camera supports relative movement
|
||||||
if self.config.cameras[camera_name].onvif.autotracking.zooming:
|
if (
|
||||||
|
self.config.cameras[camera_name].onvif.autotracking.zooming
|
||||||
|
!= ZoomingModeEnum.disabled
|
||||||
|
):
|
||||||
zoom_space_id = next(
|
zoom_space_id = next(
|
||||||
(
|
(
|
||||||
i
|
i
|
||||||
@ -182,17 +188,15 @@ class OnvifController:
|
|||||||
try:
|
try:
|
||||||
if (
|
if (
|
||||||
self.config.cameras[camera_name].onvif.autotracking.zooming
|
self.config.cameras[camera_name].onvif.autotracking.zooming
|
||||||
== ZoomingModeEnum.relative
|
!= ZoomingModeEnum.disabled
|
||||||
):
|
):
|
||||||
if zoom_space_id is not None:
|
if zoom_space_id is not None:
|
||||||
move_request.Translation.Zoom.space = ptz_config["Spaces"][
|
move_request.Translation.Zoom.space = ptz_config["Spaces"][
|
||||||
"RelativeZoomTranslationSpace"
|
"RelativeZoomTranslationSpace"
|
||||||
][0]["URI"]
|
][zoom_space_id]["URI"]
|
||||||
|
else:
|
||||||
|
move_request.Translation.Zoom = []
|
||||||
except Exception:
|
except Exception:
|
||||||
if (
|
|
||||||
self.config.cameras[camera_name].onvif.autotracking.zooming
|
|
||||||
== ZoomingModeEnum.relative
|
|
||||||
):
|
|
||||||
self.config.cameras[
|
self.config.cameras[
|
||||||
camera_name
|
camera_name
|
||||||
].onvif.autotracking.zooming = ZoomingModeEnum.disabled
|
].onvif.autotracking.zooming = ZoomingModeEnum.disabled
|
||||||
@ -387,7 +391,11 @@ class OnvifController:
|
|||||||
move_request.Translation.PanTilt.x = pan
|
move_request.Translation.PanTilt.x = pan
|
||||||
move_request.Translation.PanTilt.y = tilt
|
move_request.Translation.PanTilt.y = tilt
|
||||||
|
|
||||||
if "zoom-r" in self.cams[camera_name]["features"]:
|
if (
|
||||||
|
"zoom-r" in self.cams[camera_name]["features"]
|
||||||
|
and self.config.cameras[camera_name].onvif.autotracking.zooming
|
||||||
|
== ZoomingModeEnum.relative
|
||||||
|
):
|
||||||
move_request.Speed = {
|
move_request.Speed = {
|
||||||
"PanTilt": {
|
"PanTilt": {
|
||||||
"x": speed,
|
"x": speed,
|
||||||
@ -403,7 +411,11 @@ class OnvifController:
|
|||||||
move_request.Translation.PanTilt.x = 0
|
move_request.Translation.PanTilt.x = 0
|
||||||
move_request.Translation.PanTilt.y = 0
|
move_request.Translation.PanTilt.y = 0
|
||||||
|
|
||||||
if "zoom-r" in self.cams[camera_name]["features"]:
|
if (
|
||||||
|
"zoom-r" in self.cams[camera_name]["features"]
|
||||||
|
and self.config.cameras[camera_name].onvif.autotracking.zooming
|
||||||
|
== ZoomingModeEnum.relative
|
||||||
|
):
|
||||||
move_request.Translation.Zoom.x = 0
|
move_request.Translation.Zoom.x = 0
|
||||||
|
|
||||||
self.cams[camera_name]["active"] = False
|
self.cams[camera_name]["active"] = False
|
||||||
|
Loading…
Reference in New Issue
Block a user