修改路径,从src放到根目录

This commit is contained in:
zqc
2026-01-08 10:32:36 +08:00
parent 96589ebdbd
commit f86effd63c
37 changed files with 51 additions and 410 deletions

55
rtsp/service.py Normal file
View File

@@ -0,0 +1,55 @@
"""
RTSP 服务模块 - 简洁版本,直接使用原始服务
"""
import threading
from rtsp_service_ws_1217 import RTSPService
class SimpleRTSPServer:
"""RTSP 服务管理器 - 简洁包装器"""
def __init__(self):
self.is_running = False
self.service = None
self.thread = None
def start(self):
"""启动 RTSP 服务"""
if self.is_running:
return
print("🚀 启动 RTSP 服务...")
# 创建原始服务实例
self.service = RTSPService(config_path="config.yaml")
# 在新线程中启动服务
self.thread = threading.Thread(
target=self.service.start,
daemon=True
)
self.thread.start()
self.is_running = True
print("✅ RTSP 服务启动完成")
def stop(self):
"""停止 RTSP 服务"""
if not self.is_running:
return
print("🛑 停止 RTSP 服务...")
if self.service:
self.service.stop()
if self.thread:
self.thread.join(timeout=5.0)
self.is_running = False
print("✅ RTSP 服务已停止")
# 创建全局实例
rtsp_server = SimpleRTSPServer()