prefer_rtsp treated an open CTRL port as a camera and handed Studio a
LAN URL with no RTSP hint, so BambuSource spoke MJPEG. A printer that
reports rtsp_url "disable" now falls through to TUTK instead.
Studio builds upload and part-skip tunnel URLs without device=, which
left LAN TLS verification without a serial and disabled the TUTK
fallback. Look the serial up in the local IP registry, then through a
new obn_get_lan_serial plugin export, and document the private exports.
Move the TUTK client to src/camera/tutk (IotcClient, IotcProtocol,
TutkSession) and the camera source to src/camera/TutkCameraSource,
all under obn::camera. Split the DTLS-PSK handshake into small
functions with RAII-owned OpenSSL objects, share the record
additional-data builder between EtM and AEAD, drop reverse-engineering
leftovers from comments, and trim log noise.
TutkCameraSource hands frames over through a condition variable
instead of sleep-polling. The DirectShow filter now picks the media
subtype from the codec of the actual TUTK stream.
get_camera_url returns the LAN URL right away when prefer_rtsp = 1 or
when TUTK is unreachable (block_cloud, no session, or no slicer key/cert:
/user/ttcode answers 403 unless both PoP headers are present).
BambuSource defers the TUTK connect until it knows whether the tunnel is
for video or for the file browser; CTRL switches to the printer's LAN
:6000 route via the new obn_get_lan_camera_url export.
Squash of PR #100 onto master after #97. Conflicts in agent.cpp,
abi_camera.cpp, signing.cpp and research/10.03 resolved in favour of the
get_camera_url).
Closes#100
* Implement deadline-aware SSL read functions for RTSP client
- Added `ssl_read_full_timeout` and `ssl_read_line_timeout` to handle timeouts during SSL reads, preventing indefinite blocking on read operations.
- Updated `read_response` in `rtsp_client.cpp` to utilize the new timeout functions, ensuring that responses are read within specified deadlines.
- Enhanced error handling for RTSP sessions to log errors when a stream dies mid-session.
- Introduced `SpsGeometry` struct and `parse_sps_geometry` function to decode display geometry from SPS NAL units, improving video stream handling.
- Updated `BambuSource` and `Passthrough` implementations to utilize the new geometry parsing for better video parameter management.
Signed-off-by: Alexey Cluster <cluster@cluster.wtf>
The LAN URL minted by get_camera_url serves three consumers with one
string: PrinterFileSystem (CTRL over :6000), the device image flow
(mem:/N) and gstbambusrc video. On X1/P1S/P2S-class printers LAN video
is RTSP(S) :322, not MJPEG :6000, so a plain local URL would break
liveview. Honour the lv=rtsps/rtsp query hint: when the VIDEO stream
starts (Bambu_StartStream, not the CTRL channel), drop the :6000 TLS
session and open the existing RTSP(S) passthrough instead. URLs minted
by Studio itself carry no hint and behave as before. Needs verification
on hardware.
Bambu firmware drops the FTPS control channel after ~5 min of idle
(observed: '221 Service closing' on PASV after ~6 min in the file
panel). The stale session caused LIST_INFO to surface as an empty
directory, SUB_FILE to fail thumbnail fetches, and FILE_DOWNLOAD /
FILE_DEL to report "file not exist" until the user reopened the
panel.
Adds a reconnect_ftp() helper (quit + reset + ensure_ftp) and wires
it into LIST_INFO, SUB_FILE (zip + thumbnails via download_blob),
FILE_DOWNLOAD (only while no chunk has been pushed yet), and
FILE_DEL on the first error. Retries once and falls through to the
old "empty / not-exist" reply if the second attempt also fails.
Made-with: Cursor