"""Standard IP-camera / live-stream protocol catalog.
This is the single source of truth for which streaming standards Cetana
supports. Settings schema entries and Camera.protocol choices are derived
from this registry, so adding a new standard only requires one entry here.
"""
from __future__ import annotations
from typing import Any
# Each protocol describes how streams are addressed and whether a browser can
# play them natively (without a media gateway / WebRTC stack).
STREAM_PROTOCOLS: dict[str, dict[str, Any]] = {
"rtsp": {
"label": "RTSP (Real Time Streaming Protocol)",
"schemes": ("rtsp", "rtsps"),
"default_port": 554,
"default_path": "stream1",
"browser_native": False,
"mime_type": "",
"transports": ("tcp", "udp"),
"auth_methods": ("none", "basic", "digest"),
"url_template": "{scheme}://{host}:{port}/{path}",
"notes": "Most IP cameras. Needs a media gateway (e.g. MediaMTX) for browser playback.",
},
"rtmp": {
"label": "RTMP (Real-Time Messaging Protocol)",
"schemes": ("rtmp", "rtmps"),
"default_port": 1935,
"default_path": "live/stream",
"browser_native": False,
"mime_type": "",
"transports": (),
"auth_methods": ("none", "basic"),
"url_template": "{scheme}://{host}:{port}/{path}",
"notes": "Common for encoders/NVR publish. Needs HLS/WebRTC remux for browsers.",
},
"hls": {
"label": "HLS (HTTP Live Streaming)",
"schemes": ("https", "http"),
"default_port": 443,
"default_path": "live/index.m3u8",
"browser_native": True,
"mime_type": "application/vnd.apple.mpegurl",
"transports": (),
"auth_methods": ("none", "basic", "bearer", "query_token"),
"url_template": "{scheme}://{host}:{port}/{path}",
"notes": "Browser-friendly (.m3u8). Preferred default for web monitoring.",
},
"dash": {
"label": "MPEG-DASH",
"schemes": ("https", "http"),
"default_port": 443,
"default_path": "live/manifest.mpd",
"browser_native": True,
"mime_type": "application/dash+xml",
"transports": (),
"auth_methods": ("none", "basic", "bearer", "query_token"),
"url_template": "{scheme}://{host}:{port}/{path}",
"notes": "Adaptive HTTP streaming via MPD manifest.",
},
"webrtc": {
"label": "WebRTC",
"schemes": ("https", "http", "wss", "ws"),
"default_port": 443,
"default_path": "webrtc/offer",
"browser_native": True,
"mime_type": "",
"transports": ("udp", "tcp"),
"auth_methods": ("none", "bearer", "query_token"),
"url_template": "{scheme}://{host}:{port}/{path}",
"notes": "Low-latency browser playback via a signaling endpoint.",
},
"mjpeg": {
"label": "MJPEG over HTTP",
"schemes": ("https", "http"),
"default_port": 80,
"default_path": "video.mjpg",
"browser_native": True,
"mime_type": "multipart/x-mixed-replace",
"transports": (),
"auth_methods": ("none", "basic", "digest"),
"url_template": "{scheme}://{host}:{port}/{path}",
"notes": "Simple motion-JPEG snapshot stream; plays in
or