Camera¶
Camera entities and runtime device API: CameraDevice (the per-camera handle your plugin receives in ConfigureCameras), camera sources, snapshots, streaming URL helpers, video frame data, detection events, and the property-change observables.
Note
The reference below is auto-generated from Go doc comments via gomarkdoc. Re-run scripts/gen-api-docs.sh to refresh it.
func BuildSnapshotUrl¶
func BuildSnapshotUrl(cameraName, sourceName, snapshotUrl string, opts *SnapshotUrlOptions) (string, error)
BuildSnapshotUrl constructs a go2rtc-compatible snapshot URL for the given camera/source pair. Optional dimensions, rotation, cache and hardware transcode flags are appended as query parameters.
Example:
url, err := sdk.BuildSnapshotUrl("Front Door", "main", base, &sdk.SnapshotUrlOptions{Width: 640})
func BuildTargetUrl¶
func BuildTargetUrl(rtspUrl string, opts *RTSPUrlOptions) (string, error)
BuildTargetUrl constructs a go2rtc-compatible RTSP target URL from a base RTSP URL and a set of stream selection options (video/audio tracks, GOP, timeout). Timeout is clamped to 5..30 seconds.
Example:
url, err := sdk.BuildTargetUrl(base, &sdk.RTSPUrlOptions{Video: true, GOP: true, Timeout: 15})
type AlertZone¶
AlertZone is a polygon zone that never filters detections: a label selected here only sends push notifications while an object of that label is inside the zone.
type AlertZone struct {
// Name is the zone display name.
Name string `msgpack:"name" json:"name"`
// Points are the polygon points (0-100 percentage coordinates).
Points []Point `msgpack:"points" json:"points"`
// Labels are the labels that alert from inside this zone (empty = every label alerts here).
Labels []DetectionLabel `msgpack:"labels" json:"labels"`
// Faces are the faces that may push from inside this zone. Nil leaves faces out
// of the decision, an empty list lets every recognized face push, otherwise only
// the listed identities do. "unknown" covers everyone the recognition could not
// name, including people whose face was never captured.
Faces *[]string `msgpack:"faces,omitempty" json:"faces,omitempty"`
// Plates are the plates that may push from inside this zone, same rules as Faces.
// Plates are OCR text, so the list is free-form rather than picked from a roster.
Plates *[]string `msgpack:"plates,omitempty" json:"plates,omitempty"`
// Match decides when an object counts as inside. Default: contain.
Match AlertZoneMatch `msgpack:"match" json:"match"`
// Color is the zone display color (hex).
Color string `msgpack:"color" json:"color"`
}
type AlertZoneMatch¶
AlertZoneMatch decides when an object counts as inside an alert zone.
type AlertZoneMatch = string
Supported alert zone match modes.
const (
AlertZoneMatchAnchor AlertZoneMatch = "anchor" // where the object stands (bottom center of its box)
AlertZoneMatchIntersect AlertZoneMatch = "intersect" // its box touches the zone
AlertZoneMatchContain AlertZoneMatch = "contain" // its box lies fully inside the zone
)
type AudioCodec¶
AudioCodec is a supported audio codec (RTP/SDP format name).
type AudioCodec string
const (
AudioCodecPCMU AudioCodec = "PCMU"
AudioCodecPCMA AudioCodec = "PCMA"
AudioCodecMPEG4Generic AudioCodec = "MPEG4-GENERIC"
AudioCodecOpus AudioCodec = "opus"
AudioCodecG722 AudioCodec = "G722"
AudioCodecG726 AudioCodec = "G726"
AudioCodecMPA AudioCodec = "MPA"
AudioCodecPCM AudioCodec = "PCM"
AudioCodecFLAC AudioCodec = "FLAC"
AudioCodecELD AudioCodec = "ELD"
AudioCodecPCML AudioCodec = "PCML"
AudioCodecL16 AudioCodec = "L16"
)
type AudioCodecProperties¶
AudioCodecProperties holds audio codec properties from a stream probe.
type AudioCodecProperties struct {
// SampleRate is the audio sample rate in Hz.
SampleRate int `msgpack:"sampleRate" json:"sampleRate"`
// Channels is the number of audio channels.
Channels int `msgpack:"channels" json:"channels"`
// PayloadType is the RTP payload type number.
PayloadType int `msgpack:"payloadType" json:"payloadType"`
// FmtpInfo holds optional format parameters.
FmtpInfo *FMTPInfo `msgpack:"fmtpInfo,omitempty" json:"fmtpInfo,omitempty"`
}
type AudioFFmpegCodec¶
AudioFFmpegCodec is an FFmpeg audio codec name used for transcoding.
type AudioFFmpegCodec string
const (
AudioFFmpegCodecPCMMulaw AudioFFmpegCodec = "pcm_mulaw"
AudioFFmpegCodecPCMAlaw AudioFFmpegCodec = "pcm_alaw"
AudioFFmpegCodecAAC AudioFFmpegCodec = "aac"
AudioFFmpegCodecLibopus AudioFFmpegCodec = "libopus"
AudioFFmpegCodecG722 AudioFFmpegCodec = "g722"
AudioFFmpegCodecG726 AudioFFmpegCodec = "g726"
AudioFFmpegCodecMP3 AudioFFmpegCodec = "mp3"
AudioFFmpegCodecPCMS16BE AudioFFmpegCodec = "pcm_s16be"
AudioFFmpegCodecPCMS16LE AudioFFmpegCodec = "pcm_s16le"
AudioFFmpegCodecFLAC AudioFFmpegCodec = "flac"
)
type AudioStreamInfo¶
AudioStreamInfo is audio stream information from a probe.
type AudioStreamInfo struct {
// Codec is the audio codec.
Codec AudioCodec `msgpack:"codec" json:"codec"`
// FFmpegCodec is the FFmpeg codec name.
FFmpegCodec AudioFFmpegCodec `msgpack:"ffmpegCodec" json:"ffmpegCodec"`
// Properties are the codec properties.
Properties AudioCodecProperties `msgpack:"properties" json:"properties"`
// Direction is the stream direction.
Direction StreamDirection `msgpack:"direction" json:"direction"`
}
type BaseCamera¶
BaseCamera is the stored camera data structure (database row) without resolved video sources. See Camera for the resolved form.
type BaseCamera struct {
// ID is the unique camera ID.
ID string `msgpack:"_id" json:"_id"`
// Name is the camera display name.
Name string `msgpack:"name" json:"name"`
// Room is the room this camera belongs to.
Room string `msgpack:"room" json:"room"`
// NativeID is the native device ID from the source plugin.
NativeID string `msgpack:"nativeId,omitempty" json:"nativeId,omitempty"`
// PluginInfo identifies the source plugin.
PluginInfo *CameraPluginInfo `msgpack:"pluginInfo,omitempty" json:"pluginInfo,omitempty"`
// Type is the camera type (camera/doorbell).
Type CameraType `msgpack:"type,omitempty" json:"type,omitempty"`
// Disabled indicates whether the camera is disabled.
Disabled bool `msgpack:"disabled,omitempty" json:"disabled,omitempty"`
// Privacy is the privacy mode of the camera.
Privacy CameraPrivacy `msgpack:"privacy,omitempty" json:"privacy"`
// IsCloud indicates whether the camera streams from cloud.
IsCloud bool `msgpack:"isCloud,omitempty" json:"isCloud,omitempty"`
// Info is the camera hardware information.
Info CameraInformation `msgpack:"info,omitempty" json:"info"`
// Assignments are sensor-to-plugin assignments.
Assignments PluginAssignments `msgpack:"assignments,omitempty" json:"assignments"`
// SnapshotSettings are the snapshot settings.
SnapshotSettings SnapshotSettings `msgpack:"snapshotSettings,omitempty" json:"snapshotSettings"`
// Zones are the zone configurations, one list per purpose.
Zones CameraZones `msgpack:"zones,omitempty" json:"zones"`
// DetectionSettings are the detection settings.
DetectionSettings CameraDetectionSettings `msgpack:"detectionSettings,omitempty" json:"detectionSettings"`
// PtzAutotrack is the PTZ autotracking configuration.
PtzAutotrack PtzAutotrackSettings `msgpack:"ptzAutotrack,omitempty" json:"ptzAutotrack"`
// RecordingSettings is the recording configuration.
RecordingSettings CameraRecordingSettings `msgpack:"recordingSettings,omitempty" json:"recordingSettings"`
// NotificationSettings is the push notification configuration.
NotificationSettings CameraNotificationSettings `msgpack:"notificationSettings,omitempty" json:"notificationSettings"`
// ExportSettings decide how other apps reach the camera.
ExportSettings CameraExportSettings `msgpack:"exportSettings,omitempty" json:"exportSettings"`
// FrameWorkerSettings is the frame worker configuration.
FrameWorkerSettings CameraFrameWorkerSettings `msgpack:"frameWorkerSettings,omitempty" json:"frameWorkerSettings"`
// InterfaceSettings is the UI display settings.
InterfaceSettings CameraUiSettings `msgpack:"interfaceSettings,omitempty" json:"interfaceSettings"`
// Plugins are the installed plugins for this camera.
Plugins []AssignedPlugin `msgpack:"plugins,omitempty" json:"plugins,omitempty"`
}
type BaseCameraConfig¶
BaseCameraConfig holds the camera configuration fields shared between creation and update operations.
type BaseCameraConfig struct {
// Name is the camera display name.
Name string `msgpack:"name" json:"name"`
// NativeID is the native device ID from the source plugin.
NativeID string `msgpack:"nativeId,omitempty" json:"nativeId,omitempty"`
// IsCloud indicates whether the camera streams from cloud.
IsCloud bool `msgpack:"isCloud,omitempty" json:"isCloud,omitempty"`
// Disabled disables this camera.
Disabled bool `msgpack:"disabled,omitempty" json:"disabled,omitempty"`
// Info is the camera hardware information.
Info *CameraInformation `msgpack:"info,omitempty" json:"info,omitempty"`
// Type is the device type, CameraTypeDoorbell for doorbell cameras.
Type CameraType `msgpack:"type,omitempty" json:"type,omitempty"`
}
type Camera¶
Camera is BaseCamera with its video sources resolved into streaming URLs.
type Camera struct {
BaseCamera
// Sources are the video input sources.
Sources []CameraInput `msgpack:"sources,omitempty" json:"sources,omitempty"`
}
type CameraActivityMode¶
CameraActivityMode is when the live stream runs: continuously, only during activity, or on demand.
type CameraActivityMode string
const (
CameraActivityModeAlwaysOn CameraActivityMode = "always-on"
CameraActivityModeActivity CameraActivityMode = "activity"
CameraActivityModeStandby CameraActivityMode = "standby"
)
type CameraAspectRatio¶
CameraAspectRatio is the camera aspect ratio for UI display. The constants are the built-in presets; any custom "width:height" ratio is also valid.
type CameraAspectRatio string
const (
CameraAspectRatio16x9 CameraAspectRatio = "16:9"
CameraAspectRatio9x16 CameraAspectRatio = "9:16"
CameraAspectRatio8x3 CameraAspectRatio = "8:3"
CameraAspectRatio4x3 CameraAspectRatio = "4:3"
CameraAspectRatio1x1 CameraAspectRatio = "1:1"
)
type CameraConfig¶
CameraConfig is the full camera configuration with sources, supplied when creating or adopting a camera.
type CameraConfig struct {
BaseCameraConfig
// Sources are the video input sources.
Sources []CameraConfigInputSettings `msgpack:"sources" json:"sources"`
}
type CameraConfigInputSettings¶
CameraConfigInputSettings is a camera input/source definition supplied when creating or adopting a camera (e.g. from DiscoveryProvider.OnAdoptCamera). Unlike CameraInput, the URLs are raw source URLs the host resolves into streaming URLs.
type CameraConfigInputSettings struct {
// Name is the source display name.
Name string `msgpack:"name" json:"name"`
// Role is the resolution role of this source.
Role CameraRole `msgpack:"role" json:"role"`
// UseForSnapshot indicates whether this source is used for snapshots.
UseForSnapshot bool `msgpack:"useForSnapshot" json:"useForSnapshot"`
// HotMode keeps the connection always active.
HotMode bool `msgpack:"hotMode" json:"hotMode"`
// Preload keeps a keyframe cache for this source so the view opens faster.
// Use HotMode to keep the stream connected.
Preload bool `msgpack:"preload" json:"preload"`
// Muted strips the audio track from this source.
Muted bool `msgpack:"muted,omitempty" json:"muted,omitempty"`
// BackchannelDisabled drops the talk channel of this source, so clients get no microphone.
BackchannelDisabled bool `msgpack:"backchannelDisabled,omitempty" json:"backchannelDisabled,omitempty"`
// Timeout is the seconds without media before the stream reconnects. Zero
// means the host default: 5 for cameras, 60 for plugin-served sources.
Timeout int `msgpack:"timeout,omitempty" json:"timeout,omitempty"`
// HandshakeTimeout is the seconds allowed per RTSP request while
// connecting. Raise it for cameras that wake slowly. Zero means 5.
HandshakeTimeout int `msgpack:"handshakeTimeout,omitempty" json:"handshakeTimeout,omitempty"`
// ChildSourceId is the child source ID (for snapshot fallback).
ChildSourceId string `msgpack:"childSourceId,omitempty" json:"childSourceId,omitempty"`
// ChildCameraId is the camera whose stream shows in the picture-in-picture
// overlay, instead of a source of this camera.
ChildCameraId string `msgpack:"childCameraId,omitempty" json:"childCameraId,omitempty"`
// ChildCameraRole is the role of the ChildCameraId stream shown in the overlay.
ChildCameraRole StreamingRole `msgpack:"childCameraRole,omitempty" json:"childCameraRole,omitempty"`
// Urls are the raw source URLs (resolved into streaming URLs by the host).
Urls []string `msgpack:"urls,omitempty" json:"urls,omitempty"`
}
type CameraDetectionSettings¶
CameraDetectionSettings is the combined detection settings for a camera.
type CameraDetectionSettings struct {
// Motion is the motion detection settings.
Motion MotionDetectionSettings `msgpack:"motion" json:"motion"`
// Object is the object detection settings.
Object ObjectDetectionSettings `msgpack:"object" json:"object"`
// Audio is the audio detection settings.
Audio AudioDetectionSettings `msgpack:"audio" json:"audio"`
// Face is the face detection settings.
Face *FaceDetectionSettings `msgpack:"face,omitempty" json:"face,omitempty"`
// LicensePlate is the license plate detection settings.
LicensePlate *LicensePlateDetectionSettings `msgpack:"licensePlate,omitempty" json:"licensePlate,omitempty"`
// Sensor is the sensor trigger settings.
Sensor SensorTriggerSettings `msgpack:"sensor" json:"sensor"`
// CascadeDetection enables the detection cascade.
CascadeDetection *bool `msgpack:"cascadeDetection,omitempty" json:"cascadeDetection,omitempty"`
// CascadeTimeout is the cascade hold-open window in seconds.
CascadeTimeout *int `msgpack:"cascadeTimeout,omitempty" json:"cascadeTimeout,omitempty"`
// Snooze indicates whether detections are snoozed (paused).
Snooze bool `msgpack:"snooze,omitempty" json:"snooze,omitempty"`
// SnoozeSince is when the snooze began (Unix ms), set by the server.
SnoozeSince int64 `msgpack:"snoozeSince,omitempty" json:"snoozeSince,omitempty"`
// SnoozeUntil is when the snooze ends by itself (Unix ms), zero while it has no end.
SnoozeUntil int64 `msgpack:"snoozeUntil,omitempty" json:"snoozeUntil,omitempty"`
}
type CameraDevice¶
CameraDevice represents a camera assigned to this plugin. Plugins receive CameraDevice instances in ConfigureCameras and OnCameraAdded.
type CameraDevice struct {
// contains filtered or unexported fields
}
func (*CameraDevice) AddSensor¶
func (d *CameraDevice) AddSensor(s Sensor) error
AddSensor registers a sensor that belongs to this camera's hardware (spotlight, siren, PTZ, battery, ...). The host assigns it to this camera and reconciles it across restarts like a standalone sensor.
Registering here declares "this sensor belongs to this camera and no other": the assignment is locked, users cannot re-assign it. Sensors the user should assign freely come in through SensorDiscoveryProvider instead.
func (*CameraDevice) Assignments¶
func (d *CameraDevice) Assignments() PluginAssignments
Assignments returns which plugin provides each sensor type of the camera.
func (*CameraDevice) Connect¶
func (d *CameraDevice) Connect() error
Connect tells the server this camera is online. Only the plugin that owns this camera (via pluginInfo) may connect it.
func (*CameraDevice) Connected¶
func (d *CameraDevice) Connected() bool
Connected returns whether the camera is currently connected.
func (*CameraDevice) DetectionSettings¶
func (d *CameraDevice) DetectionSettings() CameraDetectionSettings
DetectionSettings returns the detection settings.
func (*CameraDevice) Disabled¶
func (d *CameraDevice) Disabled() bool
Disabled returns whether the camera is disabled.
func (*CameraDevice) Disconnect¶
func (d *CameraDevice) Disconnect() error
Disconnect tells the server this camera is offline. Only the plugin that owns this camera (via pluginInfo) may disconnect it.
func (*CameraDevice) ExportSettings¶
func (d *CameraDevice) ExportSettings() CameraExportSettings
ExportSettings returns the settings that decide how other apps reach the camera.
func (*CameraDevice) FrameWorkerConnected¶
func (d *CameraDevice) FrameWorkerConnected() bool
FrameWorkerConnected returns whether the frame worker is currently connected.
func (*CameraDevice) FrameWorkerSettings¶
func (d *CameraDevice) FrameWorkerSettings() CameraFrameWorkerSettings
FrameWorkerSettings returns the frame worker settings.
func (*CameraDevice) GetSnapshot¶
func (d *CameraDevice) GetSnapshot(forceNew bool) ([]byte, error)
GetSnapshot returns a JPEG snapshot from SnapshotSource, or nil when the camera has no source. If forceNew is true, the snapshot cache is bypassed.
Example:
jpeg, err := camera.GetSnapshot(false)
func (*CameraDevice) GetSourceByID¶
func (d *CameraDevice) GetSourceByID(id string) *CameraDeviceSource
GetSourceByID returns a source by its ID.
func (*CameraDevice) HighResolutionSource¶
func (d *CameraDevice) HighResolutionSource() *CameraDeviceSource
HighResolutionSource returns the high-resolution source.
func (*CameraDevice) ID¶
func (d *CameraDevice) ID() string
ID returns the camera ID.
func (*CameraDevice) Implement¶
func (d *CameraDevice) Implement(impl any) error
Implement registers a camera implementation for streaming and/or snapshot. The impl value should implement StreamingInterface, SnapshotInterface, or both.
func (*CameraDevice) Info¶
func (d *CameraDevice) Info() CameraInformation
Info returns the camera hardware information.
func (*CameraDevice) InterfaceSettings¶
func (d *CameraDevice) InterfaceSettings() CameraUiSettings
InterfaceSettings returns the UI display settings.
func (*CameraDevice) IsCloud¶
func (d *CameraDevice) IsCloud() bool
IsCloud returns whether the camera streams from cloud.
func (*CameraDevice) Logger¶
func (d *CameraDevice) Logger() *Logger
Logger returns the camera's logger.
func (*CameraDevice) LowResolutionSource¶
func (d *CameraDevice) LowResolutionSource() *CameraDeviceSource
LowResolutionSource returns the low-resolution source.
func (*CameraDevice) MidResolutionSource¶
func (d *CameraDevice) MidResolutionSource() *CameraDeviceSource
MidResolutionSource returns the mid-resolution source.
func (*CameraDevice) Name¶
func (d *CameraDevice) Name() string
Name returns the camera name.
func (*CameraDevice) NativeID¶
func (d *CameraDevice) NativeID() string
NativeID returns the native device ID from the plugin, or empty string if not set.
func (*CameraDevice) NotificationSettings¶
func (d *CameraDevice) NotificationSettings() CameraNotificationSettings
NotificationSettings returns the push notification settings.
func (*CameraDevice) OnConnected¶
func (d *CameraDevice) OnConnected() *Observable[bool]
OnConnected returns an Observable that emits distinct connection state changes.
func (*CameraDevice) OnDetectionEvent¶
func (d *CameraDevice) OnDetectionEvent(callback func(eventType DetectionEventType, event DetectionEvent)) *Disposable
OnDetectionEvent registers a callback for detection events (start/update/end and segment-start/segment-update/segment-end). Segments ride on the segment-* events only, thumbnails on segment-start and segment-end. Returns a Disposable to unsubscribe.
func (*CameraDevice) OnFrameWorkerConnected¶
func (d *CameraDevice) OnFrameWorkerConnected() *Observable[bool]
OnFrameWorkerConnected returns an Observable that emits distinct frame worker state changes.
func (*CameraDevice) OnPropertyChange¶
func (d *CameraDevice) OnPropertyChange(properties ...string) *Observable[PropertyChangeEvent]
OnPropertyChange returns an Observable that emits when any of the specified camera properties change.
func (*CameraDevice) PTZAutotrack¶
func (d *CameraDevice) PTZAutotrack() PtzAutotrackSettings
PTZAutotrack returns the PTZ autotracking settings.
func (*CameraDevice) PluginInfo¶
func (d *CameraDevice) PluginInfo() *CameraPluginInfo
PluginInfo returns the source plugin information, or nil if not set.
func (*CameraDevice) Privacy¶
func (d *CameraDevice) Privacy() CameraPrivacy
Privacy returns the privacy mode of the camera.
func (*CameraDevice) RecordingSettings¶
func (d *CameraDevice) RecordingSettings() CameraRecordingSettings
RecordingSettings returns the recording settings.
func (*CameraDevice) RemoveSensor¶
func (d *CameraDevice) RemoveSensor(sensorID string) error
RemoveSensor unregisters a sensor this plugin registered on this camera. The persisted entity stays (shows disconnected) unless the user deletes it.
func (*CameraDevice) Room¶
func (d *CameraDevice) Room() string
Room returns the room this camera belongs to.
func (*CameraDevice) SnapshotSettings¶
func (d *CameraDevice) SnapshotSettings() SnapshotSettings
SnapshotSettings returns the snapshot settings.
func (*CameraDevice) SnapshotSource¶
func (d *CameraDevice) SnapshotSource() *CameraDeviceSource
SnapshotSource returns the source GetSnapshot uses: the snapshot source or the one marked for snapshots, otherwise the low, mid or high resolution source. Nil when the camera has no source.
func (*CameraDevice) Snooze¶
func (d *CameraDevice) Snooze() bool
Snooze returns whether detections are snoozed (paused).
func (*CameraDevice) Sources¶
func (d *CameraDevice) Sources() []*CameraDeviceSource
Sources returns the camera's source list.
func (*CameraDevice) Storage¶
func (d *CameraDevice) Storage() *DeviceStorage
Storage returns the camera's device storage.
func (*CameraDevice) StreamSource¶
func (d *CameraDevice) StreamSource() *CameraDeviceSource
StreamSource returns the primary streaming source (first high-resolution, or first available).
func (*CameraDevice) Type¶
func (d *CameraDevice) Type() CameraType
Type returns the camera type (camera/doorbell).
func (*CameraDevice) Zones¶
func (d *CameraDevice) Zones() CameraZones
Zones returns the camera's zone configurations, one list per purpose.
type CameraDeviceSource¶
CameraDeviceSource is a camera source (one of the camera's video inputs) with snapshot, probe and URL-generation capabilities.
type CameraDeviceSource struct {
// contains filtered or unexported fields
}
func (*CameraDeviceSource) GenerateRTSPUrl¶
func (s *CameraDeviceSource) GenerateRTSPUrl(options *RTSPUrlOptions) (string, error)
GenerateRTSPUrl generates an RTSP URL for this source with the given options.
func (*CameraDeviceSource) GenerateSnapshotUrl¶
func (s *CameraDeviceSource) GenerateSnapshotUrl(options *SnapshotUrlOptions) (string, error)
GenerateSnapshotUrl generates a snapshot URL for this source with the given options.
func (*CameraDeviceSource) GetStreamStatus¶
func (s *CameraDeviceSource) GetStreamStatus() (string, error)
GetStreamStatus returns the current stream connection status (e.g. "connected", "connecting", "error", "idle").
func (*CameraDeviceSource) HotMode¶
func (s *CameraDeviceSource) HotMode() bool
HotMode returns whether hot mode (always-on connection) is enabled.
func (*CameraDeviceSource) ID¶
func (s *CameraDeviceSource) ID() string
ID returns the unique source ID.
func (*CameraDeviceSource) Name¶
func (s *CameraDeviceSource) Name() string
Name returns the source display name.
func (*CameraDeviceSource) Preload¶
func (s *CameraDeviceSource) Preload() bool
Preload returns whether the stream is preloaded on startup.
func (*CameraDeviceSource) ProbeStream¶
func (s *CameraDeviceSource) ProbeStream(config *ProbeConfig, refresh bool) (*ProbeStream, error)
ProbeStream probes this source for codec and track information.
config selects which tracks to inspect (nil probes the defaults). When refresh is true a fresh probe is performed, ignoring any cached result.
func (*CameraDeviceSource) Role¶
func (s *CameraDeviceSource) Role() CameraRole
Role returns the resolution role of this source.
func (*CameraDeviceSource) Snapshot¶
func (s *CameraDeviceSource) Snapshot(forceNew bool) ([]byte, error)
Snapshot returns a JPEG snapshot for this source. If forceNew is true, the snapshot cache is bypassed.
func (*CameraDeviceSource) SourceURL¶
func (s *CameraDeviceSource) SourceURL() string
SourceURL returns the default RTSP URL for this source.
func (*CameraDeviceSource) Urls¶
func (s *CameraDeviceSource) Urls() StreamUrls
Urls returns the generated stream URLs for this source.
func (*CameraDeviceSource) UseForSnapshot¶
func (s *CameraDeviceSource) UseForSnapshot() bool
UseForSnapshot returns whether this source is used for snapshots.
type CameraExportSettings¶
CameraExportSettings decide how other apps reach a camera.
type CameraExportSettings struct {
// Onvif gives the camera an ONVIF device of its own on OnvifPort.
Onvif bool `msgpack:"onvif" json:"onvif"`
// OnvifPort is the port of the camera's own ONVIF device, set while Onvif is on.
OnvifPort int `msgpack:"onvifPort,omitempty" json:"onvifPort,omitempty"`
// Rtmp offers the camera's streams on the RTMP server.
Rtmp bool `msgpack:"rtmp" json:"rtmp"`
}
type CameraFrameWorkerSettings¶
CameraFrameWorkerSettings is frame worker (decoder) settings.
type CameraFrameWorkerSettings struct {
// MainStreamAnalysis analyses the main stream while something is detected,
// instead of the detection stream.
MainStreamAnalysis bool `msgpack:"mainStreamAnalysis,omitempty" json:"mainStreamAnalysis,omitempty"`
// Decoder is the decoder hardware selection. Applies on the machine that
// decodes this camera (master or assigned worker); an unusable selection
// falls back to auto.
Decoder *FrameWorkerDecoderSettings `msgpack:"decoder,omitempty" json:"decoder,omitempty"`
// WorkerDecoder is the decoder hardware selection used instead of Decoder
// while this camera decodes on its assigned worker. Falls back to Decoder
// when nil.
WorkerDecoder *FrameWorkerDecoderSettings `msgpack:"workerDecoder,omitempty" json:"workerDecoder,omitempty"`
}
type CameraInformation¶
CameraInformation is camera hardware/firmware information.
type CameraInformation struct {
// Manufacturer is the manufacturer name.
Manufacturer string `msgpack:"manufacturer,omitempty" json:"manufacturer,omitempty"`
// Model is the camera model name.
Model string `msgpack:"model,omitempty" json:"model,omitempty"`
// Hardware is the hardware version/revision.
Hardware string `msgpack:"hardware,omitempty" json:"hardware,omitempty"`
// SerialNumber is the device serial number.
SerialNumber string `msgpack:"serialNumber,omitempty" json:"serialNumber,omitempty"`
// FirmwareVersion is the current firmware version.
FirmwareVersion string `msgpack:"firmwareVersion,omitempty" json:"firmwareVersion,omitempty"`
// SupportUrl is the manufacturer support URL.
SupportUrl string `msgpack:"supportUrl,omitempty" json:"supportUrl,omitempty"`
// Power is the power source. A battery camera is set up so it can sleep:
// no lasting connection, snapshots on request, live view on tap and event
// recording.
Power CameraPower `msgpack:"power,omitempty" json:"power,omitempty"`
}
type CameraInput¶
CameraInput is a camera video input/source with resolved URLs.
type CameraInput struct {
// ID is the unique source ID.
ID string `msgpack:"_id" json:"_id"`
// Name is the source display name.
Name string `msgpack:"name,omitempty" json:"name,omitempty"`
// Role is the resolution role of this source.
Role CameraRole `msgpack:"role,omitempty" json:"role,omitempty"`
// UseForSnapshot indicates whether this source is used for snapshots.
UseForSnapshot bool `msgpack:"useForSnapshot,omitempty" json:"useForSnapshot,omitempty"`
// HotMode keeps the connection always active.
HotMode bool `msgpack:"hotMode,omitempty" json:"hotMode,omitempty"`
// Preload keeps a keyframe cache for this source so the view opens faster.
// Use HotMode to keep the stream connected.
Preload bool `msgpack:"preload,omitempty" json:"preload,omitempty"`
// Muted strips the audio track from this source.
Muted bool `msgpack:"muted,omitempty" json:"muted,omitempty"`
// BackchannelDisabled drops the talk channel of this source, so clients get no microphone.
BackchannelDisabled bool `msgpack:"backchannelDisabled,omitempty" json:"backchannelDisabled,omitempty"`
// Timeout is the seconds without media before the stream reconnects. Zero
// means the host default: 5 for cameras, 60 for plugin-served sources.
Timeout int `msgpack:"timeout,omitempty" json:"timeout,omitempty"`
// HandshakeTimeout is the seconds allowed per RTSP request while
// connecting. Raise it for cameras that wake slowly. Zero means 5.
HandshakeTimeout int `msgpack:"handshakeTimeout,omitempty" json:"handshakeTimeout,omitempty"`
// Urls are the generated streaming URLs.
Urls StreamUrls `msgpack:"urls,omitempty" json:"urls"`
// VideoCodec is the probed video codec of this source. Filled by the
// server once the stream has been probed; empty until then.
VideoCodec VideoCodec `msgpack:"videoCodec,omitempty" json:"videoCodec,omitempty"`
// AudioCodecs are the probed audio codecs of this source (camera to
// client, deduplicated, in track order). Filled by the server once the
// stream has been probed; empty until then.
AudioCodecs []AudioCodec `msgpack:"audioCodecs,omitempty" json:"audioCodecs,omitempty"`
// HasAudio is true when the probed source sends audio, also in a codec that
// is not an AudioCodec. False until the stream has been probed, and for a
// source without audio.
HasAudio bool `msgpack:"hasAudio,omitempty" json:"hasAudio,omitempty"`
// BackchannelAudioCodec is the probed talkback audio codec (client to
// camera). Set only when the probed source has a backchannel.
BackchannelAudioCodec AudioCodec `msgpack:"backchannelAudioCodec,omitempty" json:"backchannelAudioCodec,omitempty"`
// ChildSourceId is the child source ID (for snapshot fallback).
ChildSourceId string `msgpack:"childSourceId,omitempty" json:"childSourceId,omitempty"`
// ChildCameraId is the camera whose stream shows in the picture-in-picture
// overlay, instead of a source of this camera.
ChildCameraId string `msgpack:"childCameraId,omitempty" json:"childCameraId,omitempty"`
// ChildCameraRole is the role of the ChildCameraId stream shown in the overlay.
ChildCameraRole StreamingRole `msgpack:"childCameraRole,omitempty" json:"childCameraRole,omitempty"`
}
type CameraNotificationSettings¶
CameraNotificationSettings is the push notification configuration of a camera.
type CameraNotificationSettings struct {
// Enabled reports whether detections on this camera send a push at all.
Enabled bool `msgpack:"enabled" json:"enabled"`
// Video attaches a short clip of the moment. Needs recording, uses the lowest recorded quality.
Video bool `msgpack:"video" json:"video"`
// Audio are the audio events that send a push. "other" covers custom audio labels.
Audio []string `msgpack:"audio,omitempty" json:"audio,omitempty"`
// Sensors are the sensor triggers that send a push, by sensor type.
Sensors []string `msgpack:"sensors,omitempty" json:"sensors,omitempty"`
// Cooldown is the minimum seconds between pushes. Critical alerts bypass it
// and do not count toward it.
Cooldown float64 `msgpack:"cooldown,omitempty" json:"cooldown"`
// Speed decides how long a push waits for a good picture.
Speed NotificationSpeed `msgpack:"speed,omitempty" json:"speed"`
}
type CameraPluginInfo¶
CameraPluginInfo identifies the plugin that provides a camera (id + display name).
type CameraPluginInfo struct {
// ID is the plugin ID.
ID string `msgpack:"id" json:"id"`
// Name is the plugin display name.
Name string `msgpack:"name" json:"name"`
}
type CameraPower¶
CameraPower is the camera power source.
- mains: Wired or PoE, may stay connected
-
battery: Battery powered, sleeps between events
type CameraPower string
const (
CameraPowerMains CameraPower = "mains"
CameraPowerBattery CameraPower = "battery"
)
type CameraPrivacy¶
CameraPrivacy is the privacy mode of a camera.
type CameraPrivacy struct {
// Enabled reports whether privacy mode is on. Nobody sees the camera live, its snapshots or its shares.
Enabled bool `msgpack:"enabled" json:"enabled"`
// PauseRecording reports whether recording and detection pause too while privacy mode is on.
PauseRecording bool `msgpack:"pauseRecording" json:"pauseRecording"`
// Since is when privacy mode began (Unix ms), set by the server.
Since int64 `msgpack:"since,omitempty" json:"since,omitempty"`
// Until is when privacy mode ends by itself (Unix ms), zero while it has no end.
Until int64 `msgpack:"until,omitempty" json:"until,omitempty"`
}
type CameraRecordingSettings¶
CameraRecordingSettings is the recording settings for a camera.
type CameraRecordingSettings struct {
// Enabled reports whether recording is enabled.
Enabled bool `msgpack:"enabled" json:"enabled"`
// Mode is the recording mode.
Mode RecordingMode `msgpack:"mode,omitempty" json:"mode"`
// PreBuffer is the seconds of video kept before an event (event mode, 0 - 60).
PreBuffer float64 `msgpack:"preBuffer,omitempty" json:"preBuffer"`
// Sources are the stream tiers to record.
Sources []RecordingSource `msgpack:"sources,omitempty" json:"sources,omitempty"`
// Paused reports whether recording is paused. A paused camera keeps its place among the recording cameras.
Paused bool `msgpack:"paused,omitempty" json:"paused,omitempty"`
// PausedSince is when the pause began (Unix ms), set by the server.
PausedSince int64 `msgpack:"pausedSince,omitempty" json:"pausedSince,omitempty"`
// PausedUntil is when the pause ends by itself (Unix ms), zero while it has no end.
PausedUntil int64 `msgpack:"pausedUntil,omitempty" json:"pausedUntil,omitempty"`
}
type CameraRole¶
CameraRole identifies the resolution tier of a camera source. Used to identify different quality streams from the same camera.
type CameraRole string
const (
CameraRoleHighRes CameraRole = "high-resolution"
CameraRoleMidRes CameraRole = "mid-resolution"
CameraRoleLowRes CameraRole = "low-resolution"
CameraRoleSnapshot CameraRole = "snapshot"
)
type CameraType¶
CameraType is the camera device type.
- camera: Standard surveillance camera
-
doorbell: Doorbell camera
type CameraType string
const (
CameraTypeCamera CameraType = "camera"
CameraTypeDoorbell CameraType = "doorbell"
)
type CameraUiSettings¶
CameraUiSettings is UI display settings for a camera.
type CameraUiSettings struct {
// StreamingMode is the preferred streaming method.
StreamingMode VideoStreamingMode `msgpack:"streamingMode" json:"streamingMode"`
// StreamingSource is the preferred stream quality.
StreamingSource StreamingRole `msgpack:"streamingSource" json:"streamingSource"`
// PlaybackSource is the recorded playback quality. Auto picks the best
// tier with footage and may switch at coverage edges.
PlaybackSource PlaybackSource `msgpack:"playbackSource" json:"playbackSource"`
// ActivityMode is when the live stream runs: continuously, only during
// activity, or on demand.
ActivityMode CameraActivityMode `msgpack:"activityMode" json:"activityMode"`
// AspectRatio is the display aspect ratio.
AspectRatio CameraAspectRatio `msgpack:"aspectRatio" json:"aspectRatio"`
}
type CameraZones¶
CameraZones holds everything the zone editor draws, one list per purpose.
type CameraZones struct {
// PrivacyFallback decides what happens to a picture the privacy zones could not be applied to.
PrivacyFallback PrivacyFallback `msgpack:"privacyFallback" json:"privacyFallback"`
// Motion holds the zones where frame motion counts.
Motion []MotionZone `msgpack:"motion" json:"motion"`
// Object holds the zones that set which object types count where.
Object []ObjectZone `msgpack:"object" json:"object"`
// Privacy holds the zones where nothing is looked at.
Privacy []PrivacyZone `msgpack:"privacy" json:"privacy"`
// Alert holds the zones that set which object types notify from where.
Alert []AlertZone `msgpack:"alert" json:"alert"`
// Lines holds the lines that report objects crossing them.
Lines []DetectionLine `msgpack:"lines" json:"lines"`
}
type DetectionEvent¶
DetectionEvent is an aggregated detection event with lifecycle (start -> update -> end). Groups individual sensor detections into structured events.
type DetectionEvent struct {
// ID is the unique event ID.
ID string `msgpack:"id" json:"id"`
// CameraID is the camera that produced this event.
CameraID string `msgpack:"cameraId" json:"cameraId"`
// State is the event lifecycle state.
State DetectionEventState `msgpack:"state" json:"state"`
// StartTime is the event start time (Unix ms).
StartTime int64 `msgpack:"startTime" json:"startTime"`
// EndTime is the event end time (Unix ms, only when ended).
EndTime int64 `msgpack:"endTime,omitempty" json:"endTime,omitempty"`
// LastUpdate is the last activity timestamp (Unix ms).
LastUpdate int64 `msgpack:"lastUpdate" json:"lastUpdate"`
// Types lists the detection types present in this event (for filtering).
Types []string `msgpack:"types" json:"types"`
// Triggers are the event triggers (motion/audio/sensor/line-crossing).
Triggers []EventTrigger `msgpack:"triggers" json:"triggers"`
// Segments are detection segments (object detection phases).
// For segment-* messages: contains only the current segment.
// For start/end messages: empty.
Segments []EventSegment `msgpack:"segments" json:"segments"`
// SegmentIndex is the index of the segment in segments[0] for segment-* messages.
SegmentIndex int `msgpack:"segmentIndex,omitempty" json:"segmentIndex,omitempty"`
// ExpectedEndTime is the expected event end time (Unix ms): the latest dwell expiry across all
// currently-active triggers. Monotonically non-decreasing during the event lifetime.
// Updated on each update / segment-* message.
ExpectedEndTime int64 `msgpack:"expectedEndTime,omitempty" json:"expectedEndTime,omitempty"`
}
type DetectionEventData¶
DetectionEventData wraps a detection event with its lifecycle type.
type DetectionEventData struct {
// Type is the lifecycle phase of the message.
Type DetectionEventType
// Event is the aggregated detection event.
Event DetectionEvent
}
type DetectionEventState¶
DetectionEventState is the lifecycle state of a detection event.
type DetectionEventState = string
const (
DetectionEventStateActive DetectionEventState = "active"
DetectionEventStateEnded DetectionEventState = "ended"
)
type DetectionEventType¶
DetectionEventType is the lifecycle phase of a detection event message.
type DetectionEventType = string
const (
DetectionEventStart DetectionEventType = "start"
DetectionEventEnd DetectionEventType = "end"
DetectionEventUpdate DetectionEventType = "update"
DetectionEventSegmentStart DetectionEventType = "segment-start"
DetectionEventSegmentUpdate DetectionEventType = "segment-update"
DetectionEventSegmentEnd DetectionEventType = "segment-end"
)
type DetectionLine¶
DetectionLine is a virtual tripwire for line crossing detection. The two points define grab-handle positions; the actual crossing line is perpendicular through their midpoint.
type DetectionLine struct {
// Name is the line display name.
Name string `msgpack:"name" json:"name"`
// Points are the grab-handle positions (0-100%). The crossing line is perpendicular through the midpoint.
Points [2]Point `msgpack:"points" json:"points"`
// Direction controls which crossing direction(s) trigger events.
Direction LineDirection `msgpack:"direction" json:"direction"`
// Labels are the labels to filter (empty = all labels).
Labels []DetectionLabel `msgpack:"labels" json:"labels"`
// Color is the line display color (hex).
Color string `msgpack:"color" json:"color"`
}
type DetectionPath¶
DetectionPath holds the normalized box centers (0-1) of a tracked object's first and last sighting in a segment.
type DetectionPath struct {
// EnterX is the horizontal box center at the first sighting.
EnterX float64 `msgpack:"enterX" json:"enterX"`
// EnterY is the vertical box center at the first sighting.
EnterY float64 `msgpack:"enterY" json:"enterY"`
// ExitX is the horizontal box center at the last sighting.
ExitX float64 `msgpack:"exitX" json:"exitX"`
// ExitY is the vertical box center at the last sighting.
ExitY float64 `msgpack:"exitY" json:"exitY"`
}
type FMTPInfo¶
FMTPInfo holds format parameters (fmtp) from SDP.
type FMTPInfo struct {
// Payload is the RTP payload type number.
Payload int `msgpack:"payload" json:"payload"`
// Config is the codec-specific configuration string.
Config string `msgpack:"config" json:"config"`
}
type FaceDetectionSettings¶
FaceDetectionSettings is the face detection settings.
type FaceDetectionSettings struct {
// Confidence is the minimum confidence threshold (0 - 1) for a face to count.
Confidence *float64 `msgpack:"confidence,omitempty" json:"confidence,omitempty"`
// MatchSensitivity is how readily a face is recognized as an enrolled
// person. Named rather than numeric because the similarity a model calls a
// match differs per model.
MatchSensitivity *FaceMatchSensitivity `msgpack:"matchSensitivity,omitempty" json:"matchSensitivity,omitempty"`
}
type FaceMatchSensitivity¶
FaceMatchSensitivity is how readily a face counts as a known person.
type FaceMatchSensitivity string
const (
FaceMatchStrict FaceMatchSensitivity = "strict"
FaceMatchBalanced FaceMatchSensitivity = "balanced"
FaceMatchRelaxed FaceMatchSensitivity = "relaxed"
)
type FrameFormat¶
FrameFormat identifies the pixel layout of a video frame.
type FrameFormat string
Supported video frame pixel formats.
const (
FrameFormatNV12 FrameFormat = "nv12" // YUV 4:2:0 semi-planar
FrameFormatRGB FrameFormat = "rgb" // 3 bytes/pixel interleaved
FrameFormatRGBA FrameFormat = "rgba" // 4 bytes/pixel interleaved
FrameFormatGray FrameFormat = "gray" // 1 byte/pixel grayscale
)
type FrameWorkerDecoderHardware¶
FrameWorkerDecoderHardware is the hardware backend for the detection decoder. "auto" probes the platform order, "cpu" forces software decoding.
type FrameWorkerDecoderHardware string
const (
FrameWorkerDecoderAuto FrameWorkerDecoderHardware = "auto"
FrameWorkerDecoderCPU FrameWorkerDecoderHardware = "cpu"
FrameWorkerDecoderCUDA FrameWorkerDecoderHardware = "cuda"
FrameWorkerDecoderVAAPI FrameWorkerDecoderHardware = "vaapi"
FrameWorkerDecoderQSV FrameWorkerDecoderHardware = "qsv"
FrameWorkerDecoderVideoToolbox FrameWorkerDecoderHardware = "videotoolbox"
FrameWorkerDecoderD3D11VA FrameWorkerDecoderHardware = "d3d11va"
FrameWorkerDecoderD3D12VA FrameWorkerDecoderHardware = "d3d12va"
FrameWorkerDecoderDXVA2 FrameWorkerDecoderHardware = "dxva2"
FrameWorkerDecoderVulkan FrameWorkerDecoderHardware = "vulkan"
FrameWorkerDecoderOpenCL FrameWorkerDecoderHardware = "opencl"
FrameWorkerDecoderDRM FrameWorkerDecoderHardware = "drm"
FrameWorkerDecoderRKMPP FrameWorkerDecoderHardware = "rkmpp"
)
type FrameWorkerDecoderSettings¶
FrameWorkerDecoderSettings is the decoder hardware selection for the frame worker.
type FrameWorkerDecoderSettings struct {
// Hardware is the backend to decode with.
Hardware FrameWorkerDecoderHardware `msgpack:"hardware" json:"hardware"`
// Device is what the backend opens (GPU index like "0", or a path like
// /dev/dri/renderD128). Backend default when empty.
Device string `msgpack:"device,omitempty" json:"device,omitempty"`
}
type Go2RtcRTSPSource¶
Go2RtcRTSPSource contains RTSP streaming URLs from go2rtc.
type Go2RtcRTSPSource struct {
// Base is the base RTSP URL.
Base string `msgpack:"base,omitempty" json:"base,omitempty"`
// Default is the default stream (video + audio).
Default string `msgpack:"default,omitempty" json:"default,omitempty"`
// Muted is the video-only stream.
Muted string `msgpack:"muted,omitempty" json:"muted,omitempty"`
// AudioOnly is the audio-only stream (no video).
AudioOnly string `msgpack:"audioOnly,omitempty" json:"audioOnly,omitempty"`
// AAC is the stream URL with AAC audio.
AAC string `msgpack:"aac,omitempty" json:"aac,omitempty"`
// Opus is the stream URL with Opus audio.
Opus string `msgpack:"opus,omitempty" json:"opus,omitempty"`
// PCMA is the stream URL with PCMA audio.
PCMA string `msgpack:"pcma,omitempty" json:"pcma,omitempty"`
// ONVIF is the ONVIF URL.
ONVIF string `msgpack:"onvif,omitempty" json:"onvif,omitempty"`
// NoGop is the stream URL with GOP cache disabled.
NoGop string `msgpack:"noGop,omitempty" json:"noGop,omitempty"`
}
type Go2RtcSnapshotSource¶
Go2RtcSnapshotSource contains snapshot/image URLs from go2rtc.
type Go2RtcSnapshotSource struct {
// MP4 is the MP4 single-frame video URL.
MP4 string `msgpack:"mp4,omitempty" json:"mp4,omitempty"`
// JPEG is the JPEG snapshot URL.
JPEG string `msgpack:"jpeg,omitempty" json:"jpeg,omitempty"`
// MJPEG is the MJPEG stream URL.
MJPEG string `msgpack:"mjpeg,omitempty" json:"mjpeg,omitempty"`
}
type Go2RtcWSSource¶
Go2RtcWSSource contains WebSocket streaming URLs from go2rtc.
type Go2RtcWSSource struct {
// WebRTC is the WebRTC signaling endpoint.
WebRTC string `msgpack:"webrtc,omitempty" json:"webrtc,omitempty"`
// MSE is the MSE streaming endpoint.
MSE string `msgpack:"mse,omitempty" json:"mse,omitempty"`
}
type LicensePlateDetectionSettings¶
LicensePlateDetectionSettings is the license plate detection settings.
type LicensePlateDetectionSettings struct {
// Confidence is the minimum confidence threshold (0 - 1) for a plate to be found in the picture.
Confidence *float64 `msgpack:"confidence,omitempty" json:"confidence,omitempty"`
// OcrConfidence is the minimum text recognition confidence (0 - 1) for a plate read to count.
OcrConfidence *float64 `msgpack:"ocrConfidence,omitempty" json:"ocrConfidence,omitempty"`
// MinLength is the minimum plate text length, shorter reads are dropped as fragments.
MinLength *int `msgpack:"minLength,omitempty" json:"minLength,omitempty"`
}
type LineDirection¶
LineDirection is the line crossing direction filter.
- both: Trigger on crossings in either direction
- a-to-b: Trigger only when crossing from A side to B side
-
b-to-a: Trigger only when crossing from B side to A side
type LineDirection = string
const (
LineDirectionBoth LineDirection = "both"
LineDirectionAToB LineDirection = "a-to-b"
LineDirectionBToA LineDirection = "b-to-a"
)
type MotionResolution¶
MotionResolution is the motion detection resolution setting. Higher resolution = more accurate but slower.
type MotionResolution string
const (
MotionResolutionLow MotionResolution = "low"
MotionResolutionMedium MotionResolution = "medium"
MotionResolutionHigh MotionResolution = "high"
)
type MotionZone¶
MotionZone is a polygon zone that says where frame motion counts. Motion carries no labels, so a motion zone has none. No motion zone at all means motion counts everywhere.
type MotionZone struct {
// Name is the zone display name.
Name string `msgpack:"name" json:"name"`
// Points are the polygon points (0-100 percentage coordinates).
Points []Point `msgpack:"points" json:"points"`
// Color is the zone display color (hex).
Color string `msgpack:"color" json:"color"`
}
type NotificationSpeed¶
NotificationSpeed decides how long a push waits for a good picture.
type NotificationSpeed = string
const (
NotificationSpeedImmediate NotificationSpeed = "immediate" // send right away, with a picture only if one is ready
NotificationSpeedBalanced NotificationSpeed = "balanced" // wait up to 2 seconds for the best picture
NotificationSpeedBest NotificationSpeed = "best" // wait up to 4 seconds for the best picture
)
type ObjectZone¶
ObjectZone is a polygon zone that says which object types count where. With at least one include object zone, an object counts only inside such a zone and only when its label is listed there.
type ObjectZone struct {
// Name is the zone display name.
Name string `msgpack:"name" json:"name"`
// Points are the polygon points (0-100 percentage coordinates).
Points []Point `msgpack:"points" json:"points"`
// Type is the intersection detection type.
Type ZoneType `msgpack:"type" json:"type"`
// Labels are the labels that count in this zone. Besides the detection labels,
// "face" and "license_plate" decide whether an object here is identified at
// all, so a zone can watch a street without recognizing anyone on it.
Labels []ZoneLabel `msgpack:"labels" json:"labels"`
// Color is the zone display color (hex).
Color string `msgpack:"color" json:"color"`
}
type PTZCapability¶
PTZCapability is an optional capability of a PTZ control.
type PTZCapability string
Optional capabilities of a PTZ control.
const (
PTZCapabilityPan PTZCapability = "pan" // Camera supports panning (horizontal movement)
PTZCapabilityTilt PTZCapability = "tilt" // Camera supports tilting (vertical movement)
PTZCapabilityZoom PTZCapability = "zoom" // Camera supports zoom
PTZCapabilityPresets PTZCapability = "presets" // Camera supports named position presets
PTZCapabilityHome PTZCapability = "home" // Camera supports a home position
PTZCapabilityRelativeMove PTZCapability = "relativeMove" // Camera executes relative displacement moves
PTZCapabilityAbsolutePosition PTZCapability = "absolutePosition" // Camera accepts absolute position writes via `setPosition()`
PTZCapabilityVelocityControl PTZCapability = "velocityControl" // Camera accepts continuous-move commands via `setVelocity()`
)
type PTZDirection¶
PTZDirection represents PTZ movement speed for continuous move commands.
Speeds are in normalized range [-1, 1] where -1 is maximum speed in the negative direction, 0 stops movement, and 1 is maximum speed in the positive direction. Plugins should clamp values to [-1, 1] and map them to hardware-specific speeds.
type PTZDirection struct {
// PanSpeed is the horizontal speed, positive moves right.
PanSpeed float64 `msgpack:"panSpeed" json:"panSpeed"`
// TiltSpeed is the vertical speed, positive moves up.
TiltSpeed float64 `msgpack:"tiltSpeed" json:"tiltSpeed"`
// ZoomSpeed is the zoom speed, positive zooms in.
ZoomSpeed float64 `msgpack:"zoomSpeed" json:"zoomSpeed"`
}
type PTZPosition¶
PTZPosition represents an absolute PTZ position.
type PTZPosition struct {
// Pan is the horizontal position.
Pan float64 `msgpack:"pan" json:"pan"`
// Tilt is the vertical position.
Tilt float64 `msgpack:"tilt" json:"tilt"`
// Zoom is the zoom level.
Zoom float64 `msgpack:"zoom" json:"zoom"`
}
type PTZRelativeMove¶
PTZRelativeMove represents a relative displacement for a single PTZ move.
Deltas are normalized to the camera's field of view: PanDelta 1 moves the view by one full frame width, TiltDelta 1 by one full frame height. Plugins map the deltas to hardware-specific translation spaces (e.g. ONVIF RelativeMove).
type PTZRelativeMove struct {
// PanDelta is the horizontal move, positive moves right.
PanDelta float64 `msgpack:"panDelta" json:"panDelta"`
// TiltDelta is the vertical move, positive moves up.
TiltDelta float64 `msgpack:"tiltDelta" json:"tiltDelta"`
// ZoomDelta is the zoom change, positive zooms in.
ZoomDelta float64 `msgpack:"zoomDelta" json:"zoomDelta"`
}
type PlaybackSource¶
PlaybackSource is the recorded playback quality selection: a fixed tier, or automatic tier choice from the recorded coverage.
type PlaybackSource string
const (
PlaybackSourceAuto PlaybackSource = "auto"
PlaybackSourceHigh PlaybackSource = "high"
PlaybackSourceMid PlaybackSource = "mid"
PlaybackSourceLow PlaybackSource = "low"
)
type Point¶
Point is a zone polygon coordinate as [x, y] (0-100 percentage).
type Point [2]float64
type PrivacyFallback¶
PrivacyFallback decides what happens to a picture whose privacy zones could not be applied, for example on a pixel format we cannot write.
type PrivacyFallback = string
const (
PrivacyFallbackSend PrivacyFallback = "send" // ship it unmasked, the user can delete it
PrivacyFallbackDrop PrivacyFallback = "drop" // no picture at all rather than an unmasked one
)
type PrivacyZone¶
PrivacyZone is a polygon zone camera.ui covers in live view, playback and its pictures. DropDetections decides whether detections inside are dropped too or whether the camera keeps watching an area it does not show.
type PrivacyZone struct {
// Name is the zone display name.
Name string `msgpack:"name" json:"name"`
// Points are the polygon points (0-100 percentage coordinates).
Points []Point `msgpack:"points" json:"points"`
// DropDetections drops detections inside the zone. Default: true.
DropDetections bool `msgpack:"dropDetections" json:"dropDetections"`
}
type ProbeAudioCodec¶
ProbeAudioCodec is an audio codec supported for stream probing.
type ProbeAudioCodec string
const (
ProbeAudioCodecAAC ProbeAudioCodec = "aac"
ProbeAudioCodecOpus ProbeAudioCodec = "opus"
ProbeAudioCodecPCMA ProbeAudioCodec = "pcma"
)
type ProbeConfig¶
ProbeConfig is the configuration for stream probing.
type ProbeConfig struct {
// Video includes video track info.
Video *bool `msgpack:"video,omitempty" json:"video,omitempty"`
// Audio includes audio track info: a bool, the string "all", or a
// []ProbeAudioCodec listing specific codecs.
Audio any `msgpack:"audio,omitempty" json:"audio,omitempty"`
// Microphone includes microphone/backchannel info.
Microphone *bool `msgpack:"microphone,omitempty" json:"microphone,omitempty"`
}
type ProbeStream¶
ProbeStream is the stream probe result containing SDP and track information.
type ProbeStream struct {
// SDP is the raw SDP string.
SDP string `msgpack:"sdp,omitempty" json:"sdp,omitempty"`
// Audio are the available audio tracks.
Audio []AudioStreamInfo `msgpack:"audio,omitempty" json:"audio,omitempty"`
// Video are the available video tracks.
Video []VideoStreamInfo `msgpack:"video,omitempty" json:"video,omitempty"`
}
type PropertyChangeEvent¶
PropertyChangeEvent is emitted when a camera property changes.
type PropertyChangeEvent struct {
// Property is the json name of the changed camera field.
Property string
// OldCamera is the camera state before the change.
OldCamera Camera
// NewCamera is the camera state after the change.
NewCamera Camera
}
type PtzAutotrackSettings¶
PtzAutotrackSettings is the PTZ autotracking settings: the camera follows detected objects automatically.
type PtzAutotrackSettings struct {
// Enabled toggles PTZ autotracking.
Enabled bool `msgpack:"enabled" json:"enabled"`
// TargetLabels are the object labels to track (e.g. "person", "vehicle").
TargetLabels []string `msgpack:"targetLabels" json:"targetLabels"`
// MinConfidence is the minimum detection confidence to track (0.3 - 1.0).
MinConfidence float64 `msgpack:"minConfidence" json:"minConfidence"`
// TriggerDeadZone is the dead zone around frame center (0 - 0.3).
// No motor command is issued while the target is inside this zone.
TriggerDeadZone float64 `msgpack:"triggerDeadZone" json:"triggerDeadZone"`
// TrackingSpeed is how aggressively the camera moves to re-center the target (1 - 5).
// Higher reaches full pan/tilt speed at a smaller off-center error.
TrackingSpeed float64 `msgpack:"trackingSpeed" json:"trackingSpeed"`
// LeadMs is the motion prediction (0 - 4000): aim this many milliseconds ahead
// along the target's measured velocity, covering the time the camera needs to
// move and settle. 0 disables prediction.
LeadMs float64 `msgpack:"leadMs" json:"leadMs"`
// PanRate is the camera pan-rate calibration (0.1 - 3): assumed pan travel at
// full motor speed in normalized frame-widths per second. Lower it if the
// camera stops short of the target, raise it if it overshoots.
PanRate float64 `msgpack:"panRate" json:"panRate"`
// ReturnToHome enables returning to the home position when no target is found for HomeWaitMs.
ReturnToHome bool `msgpack:"returnToHome" json:"returnToHome"`
// HomeWaitMs is how long to wait (ms) without a target before returning home.
HomeWaitMs int `msgpack:"homeWaitMs" json:"homeWaitMs"`
// MinTargetSize is the smallest target to start following, as a fraction of
// the frame height (0 - 0.5). 0 disables the limit.
MinTargetSize *float64 `msgpack:"minTargetSize,omitempty" json:"minTargetSize,omitempty"`
// MaxTargetSize is the largest target to keep following, as a fraction of the
// frame height (0 - 1). Above it the camera holds its position. 0 disables the limit.
MaxTargetSize *float64 `msgpack:"maxTargetSize,omitempty" json:"maxTargetSize,omitempty"`
// ActiveHours are the hours the camera is allowed to follow. Outside them
// autotracking rests.
ActiveHours *TimeWindow `msgpack:"activeHours,omitempty" json:"activeHours,omitempty"`
}
type RTSPAudioCodec¶
RTSPAudioCodec is an audio codec supported for RTSP streaming.
type RTSPAudioCodec string
const (
RTSPAudioCodecAAC RTSPAudioCodec = "aac"
RTSPAudioCodecOpus RTSPAudioCodec = "opus"
RTSPAudioCodecPCMA RTSPAudioCodec = "pcma"
)
type RTSPUrlOptions¶
RTSPUrlOptions is options for generating RTSP URLs.
type RTSPUrlOptions struct {
// Video toggles inclusion of the video track.
Video bool `msgpack:"video,omitempty" json:"video"`
// Audio is the list of audio codecs to include.
Audio []RTSPAudioCodec `msgpack:"audio,omitempty" json:"audio"`
// GOP requests a keyframe at start.
GOP bool `msgpack:"gop,omitempty" json:"gop"`
// AudioSingleTrack combines audio tracks into a single track.
AudioSingleTrack bool `msgpack:"audioSingleTrack,omitempty" json:"audioSingleTrack"`
// Backchannel enables backchannel (two-way audio).
Backchannel bool `msgpack:"backchannel,omitempty" json:"backchannel"`
// Timeout is the connection timeout in seconds.
Timeout int `msgpack:"timeout,omitempty" json:"timeout"`
}
type RecordingMode¶
RecordingMode selects how recordings are captured.
type RecordingMode string
const (
// RecordingModeContinuous records around the clock.
RecordingModeContinuous RecordingMode = "continuous"
// RecordingModeEvent records only around detections, padded by the pre-buffer.
RecordingModeEvent RecordingMode = "event"
// RecordingModeAdhoc connects and records only while a detection event runs.
RecordingModeAdhoc RecordingMode = "adhoc"
)
type RecordingSource¶
RecordingSource is a stream tier to record.
type RecordingSource string
const (
// RecordingSourceHigh is the high resolution stream.
RecordingSourceHigh RecordingSource = "high"
// RecordingSourceMid is the mid resolution stream.
RecordingSourceMid RecordingSource = "mid"
// RecordingSourceLow is the low resolution stream.
RecordingSourceLow RecordingSource = "low"
)
type SnapshotInterface¶
SnapshotInterface is optionally implemented to provide snapshots.
type SnapshotInterface interface {
// Snapshot returns a snapshot image from the camera. When forceNew is true, the cache is bypassed for a fresh snapshot.
Snapshot(sourceID string, forceNew bool) ([]byte, error)
}
type SnapshotRefreshMode¶
SnapshotRefreshMode is when a camera takes a new snapshot. "interval" runs a timer, "onView" fetches for a viewer once the stored picture is older than MaxAge, "onDemand" only on an explicit request (automations, the refresh button, the API).
type SnapshotRefreshMode string
const (
SnapshotRefreshInterval SnapshotRefreshMode = "interval"
SnapshotRefreshOnView SnapshotRefreshMode = "onView"
SnapshotRefreshOnDemand SnapshotRefreshMode = "onDemand"
)
type SnapshotSettings¶
SnapshotSettings is the snapshot settings for a camera.
type SnapshotSettings struct {
// Mode is when a new picture is taken.
Mode SnapshotRefreshMode `msgpack:"mode" json:"mode"`
// Interval is the timer interval in seconds for "interval" mode (10 to 3600).
Interval int `msgpack:"interval" json:"interval"`
// MaxAge is the age in seconds after which a viewer gets a new picture in
// "onView" mode (10 to 3600).
MaxAge int `msgpack:"maxAge" json:"maxAge"`
}
type SnapshotUrlOptions¶
SnapshotUrlOptions is options for generating snapshot URLs.
type SnapshotUrlOptions struct {
// Width is the output width in pixels.
Width int `msgpack:"width,omitempty" json:"width"`
// Height is the output height in pixels.
Height int `msgpack:"height,omitempty" json:"height"`
// Rotate is the rotation in degrees.
Rotate int `msgpack:"rotate,omitempty" json:"rotate"`
// Cache is the cache key/strategy.
Cache string `msgpack:"cache,omitempty" json:"cache"`
// HW is the hardware acceleration backend.
HW string `msgpack:"hw,omitempty" json:"hw"`
// GOP requests a keyframe at start.
GOP bool `msgpack:"gop,omitempty" json:"gop"`
}
type StreamDirection¶
StreamDirection is the direction of a media stream (from SDP).
type StreamDirection string
const (
StreamDirectionSendOnly StreamDirection = "sendonly"
StreamDirectionRecvOnly StreamDirection = "recvonly"
StreamDirectionSendRecv StreamDirection = "sendrecv"
StreamDirectionInactive StreamDirection = "inactive"
)
type StreamUrls¶
StreamUrls is the collection of all streaming URLs for a camera source.
type StreamUrls struct {
// WS are the WebSocket streaming URLs.
WS Go2RtcWSSource `msgpack:"ws,omitempty" json:"ws"`
// RTSP are the RTSP streaming URLs.
RTSP Go2RtcRTSPSource `msgpack:"rtsp,omitempty" json:"rtsp"`
// Snapshot are the snapshot/image URLs.
Snapshot Go2RtcSnapshotSource `msgpack:"snapshot,omitempty" json:"snapshot"`
}
type StreamingInterface¶
StreamingInterface is optionally implemented to provide stream URLs.
type StreamingInterface interface {
// StreamUrl returns the streaming URL for a source (e.g. rtsp://, rtmp://, or custom protocol).
StreamUrl(sourceID string) (string, error)
}
type StreamingRole¶
StreamingRole is the resolution role for live streaming (excludes snapshot).
type StreamingRole string
const (
StreamingRoleHighRes StreamingRole = "high-resolution"
StreamingRoleMidRes StreamingRole = "mid-resolution"
StreamingRoleLowRes StreamingRole = "low-resolution"
)
type TalkbackInterface¶
TalkbackInterface is optionally implemented to serve two-way audio apart from the video. A source that lists cui://talk next to cui:// in its Urls dials this endpoint only to talk, so the video can come straight from the camera.
type TalkbackInterface interface {
// TalkUrl returns the URL of an RTSP endpoint that offers only the talkback audio of a source.
TalkUrl(sourceID string) (string, error)
}
type TimeWindow¶
TimeWindow is a daily time window, given in the timezone it was configured in.
type TimeWindow struct {
// From is the start time as "HH:mm".
From string `msgpack:"from" json:"from"`
// To is the end time as "HH:mm". A time before From wraps around midnight.
To string `msgpack:"to" json:"to"`
// Timezone is the IANA timezone the times are read in, e.g. "Europe/Berlin".
Timezone string `msgpack:"timezone" json:"timezone"`
}
type VideoCodec¶
VideoCodec is a supported video codec (RTP/SDP format name).
type VideoCodec string
const (
VideoCodecH264 VideoCodec = "H264"
VideoCodecH265 VideoCodec = "H265"
VideoCodecVP8 VideoCodec = "VP8"
VideoCodecVP9 VideoCodec = "VP9"
VideoCodecAV1 VideoCodec = "AV1"
VideoCodecJPEG VideoCodec = "JPEG"
VideoCodecRAW VideoCodec = "RAW"
)
type VideoCodecProperties¶
VideoCodecProperties holds video codec properties from a stream probe.
type VideoCodecProperties struct {
// ClockRate is the video clock rate.
ClockRate int `msgpack:"clockRate" json:"clockRate"`
// PayloadType is the RTP payload type number.
PayloadType int `msgpack:"payloadType" json:"payloadType"`
// FmtpInfo holds optional format parameters.
FmtpInfo *FMTPInfo `msgpack:"fmtpInfo,omitempty" json:"fmtpInfo,omitempty"`
// Profile is the H.264 or H.265 profile, for example "High" or "Main 10".
Profile string `msgpack:"profile,omitempty" json:"profile,omitempty"`
// Level is the H.264 or H.265 level times ten, for example 51 for level 5.1.
Level int `msgpack:"level,omitempty" json:"level,omitempty"`
}
type VideoFFmpegCodec¶
VideoFFmpegCodec is an FFmpeg video codec name used for transcoding.
type VideoFFmpegCodec string
const (
VideoFFmpegCodecH264 VideoFFmpegCodec = "h264"
VideoFFmpegCodecHEVC VideoFFmpegCodec = "hevc"
VideoFFmpegCodecVP8 VideoFFmpegCodec = "vp8"
VideoFFmpegCodecVP9 VideoFFmpegCodec = "vp9"
VideoFFmpegCodecAV1 VideoFFmpegCodec = "av1"
VideoFFmpegCodecMJPEG VideoFFmpegCodec = "mjpeg"
VideoFFmpegCodecRawvideo VideoFFmpegCodec = "rawvideo"
)
type VideoFrameData¶
VideoFrameData is the video frame payload delivered to detector sensors by the backend pipeline. The backend handles capture, decoding and scaling. Detectors only process the pixel buffer.
type VideoFrameData struct {
ID string `msgpack:"id" json:"id"` // Unique frame or crop identifier used to map batch results back to inputs
CameraID string `msgpack:"cameraId" json:"cameraId"` // Camera the frame originated from
Data []byte `msgpack:"data" json:"data"` // Raw pixel buffer
Width int `msgpack:"width" json:"width"` // Frame width in pixels
Height int `msgpack:"height" json:"height"` // Frame height in pixels
Format FrameFormat `msgpack:"format" json:"format"` // Pixel format: rgb = 3 bytes/pixel interleaved, rgba = 4 bytes/pixel, gray = 1 byte/pixel, nv12 = YUV semi-planar
Timestamp int64 `msgpack:"timestamp" json:"timestamp"` // Capture timestamp in milliseconds since epoch
Label string `msgpack:"label,omitempty" json:"label,omitempty"` // Trigger label propagated by the coordinator for secondary detectors
}
type VideoStreamInfo¶
VideoStreamInfo is video stream information from a probe.
type VideoStreamInfo struct {
// Codec is the video codec.
Codec VideoCodec `msgpack:"codec" json:"codec"`
// FFmpegCodec is the FFmpeg codec name.
FFmpegCodec VideoFFmpegCodec `msgpack:"ffmpegCodec" json:"ffmpegCodec"`
// Properties are the codec properties.
Properties VideoCodecProperties `msgpack:"properties" json:"properties"`
// Direction is the stream direction.
Direction StreamDirection `msgpack:"direction" json:"direction"`
}
type VideoStreamingMode¶
VideoStreamingMode is the video streaming mode for UI playback.
- auto: Automatically select best method
- webrtc: WebRTC with UDP (lowest latency)
- webrtc/tcp: WebRTC with TCP fallback
-
mse: Media Source Extensions (browser native)
type VideoStreamingMode string
const (
VideoStreamingModeAuto VideoStreamingMode = "auto"
VideoStreamingModeWebRTC VideoStreamingMode = "webrtc"
VideoStreamingModeMSE VideoStreamingMode = "mse"
VideoStreamingModeWebRTCTCP VideoStreamingMode = "webrtc/tcp"
)
type ZoneLabel¶
ZoneLabel is what an object zone can list: a detection label, or an attribute that gates identification.
type ZoneLabel = string
type ZoneType¶
ZoneType is the detection zone intersection type.
- intersect: Trigger when object overlaps the zone at all
-
contain: Trigger only when object is fully inside the zone
type ZoneType string
const (
ZoneTypeIntersect ZoneType = "intersect"
ZoneTypeContain ZoneType = "contain"
)
Generated by gomarkdoc