camera新增param类型为dict
This commit is contained in:
@@ -32,6 +32,7 @@ class CameraConfig:
|
|||||||
name: str
|
name: str
|
||||||
index: str
|
index: str
|
||||||
rtsp_url: str
|
rtsp_url: str
|
||||||
|
params: dict = None # 额外参数字典,可选
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -184,7 +185,7 @@ class RTSPService:
|
|||||||
def __init__(self, config_path: str = "config.yaml"):
|
def __init__(self, config_path: str = "config.yaml"):
|
||||||
with open(config_path, "r", encoding="utf-8") as f:
|
with open(config_path, "r", encoding="utf-8") as f:
|
||||||
cfg = yaml.safe_load(f)
|
cfg = yaml.safe_load(f)
|
||||||
self.cameras = [CameraConfig(id=c["id"], name=c.get("name", f"cam_{c['id']}"), index = c["index"], rtsp_url=c["rtsp_url"])
|
self.cameras = [CameraConfig(id=c["id"], name=c.get("name", f"cam_{c['id']}"), index = c["index"], rtsp_url=c["rtsp_url"], params=c.get("params"))
|
||||||
for c in cfg.get("cameras", [])]
|
for c in cfg.get("cameras", [])]
|
||||||
|
|
||||||
self.stop_event = threading.Event()
|
self.stop_event = threading.Event()
|
||||||
|
|||||||
Reference in New Issue
Block a user