feat(v1): configurable low-latency capture options
Config gains source.transport (tcp/udp), timeout_seconds and low_latency; build_ffmpeg_options assembles OPENCV_FFMPEG_CAPTURE_OPTIONS and app.py sets it into the environment before opening the stream, so tuning lives in config/settings instead of a launch script. Settings tab exposes a dropdown/number/checkbox rather than the raw option string. 64 tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -314,11 +314,25 @@ class SettingsTab(QtWidgets.QWidget):
|
||||
self.user_edit = QtWidgets.QLineEdit(str(camera.get("username", "")))
|
||||
self.password_edit = QtWidgets.QLineEdit(str(camera.get("password", "")))
|
||||
self.password_edit.setEchoMode(QtWidgets.QLineEdit.Password)
|
||||
self.transport_combo = QtWidgets.QComboBox()
|
||||
self.transport_combo.addItem("TCP", "tcp")
|
||||
self.transport_combo.addItem("UDP", "udp")
|
||||
self.transport_combo.setCurrentIndex(1 if str(camera.get("transport", "tcp")) == "udp" else 0)
|
||||
self.timeout_spin = QtWidgets.QDoubleSpinBox()
|
||||
self.timeout_spin.setRange(0.0, 60.0)
|
||||
self.timeout_spin.setSingleStep(1.0)
|
||||
self.timeout_spin.setDecimals(1)
|
||||
self.timeout_spin.setValue(float(camera.get("timeout_seconds", 5.0)))
|
||||
self.low_latency_check = QtWidgets.QCheckBox("低延迟(丢弃缓冲)")
|
||||
self.low_latency_check.setChecked(bool(camera.get("low_latency", True)))
|
||||
form.addRow("IP / 主机", self.host_edit)
|
||||
form.addRow("端口", self.port_spin)
|
||||
form.addRow("通道", self.channel_combo)
|
||||
form.addRow("账号", self.user_edit)
|
||||
form.addRow("密码", self.password_edit)
|
||||
form.addRow("传输协议", self.transport_combo)
|
||||
form.addRow("连接超时(秒)", self.timeout_spin)
|
||||
form.addRow("", self.low_latency_check)
|
||||
|
||||
self.test_button = QtWidgets.QPushButton("测试连接")
|
||||
self.save_camera_button = QtWidgets.QPushButton("保存连接到本地配置")
|
||||
@@ -386,6 +400,9 @@ class SettingsTab(QtWidgets.QWidget):
|
||||
channel=self.channel_combo.currentData(),
|
||||
username=self.user_edit.text().strip(),
|
||||
password=self.password_edit.text(),
|
||||
transport=self.transport_combo.currentData(),
|
||||
timeout_seconds=self.timeout_spin.value(),
|
||||
low_latency=self.low_latency_check.isChecked(),
|
||||
)
|
||||
except Exception as exc: # noqa: BLE001 - surface any write error to the UI
|
||||
self.camera_status.setText("保存失败:{0}".format(exc))
|
||||
|
||||
Reference in New Issue
Block a user