Skip to main content

rtsp/
lib.rs

1//! # rtsp — RTSP server library for live media streaming
2//!
3//! A Rust library for publishing live media streams (H.264, with H.265 and
4//! MJPEG planned) over the Real-Time Streaming Protocol (RTSP).
5//!
6//! ## Protocol references
7//!
8//! | RFC | Topic | How this crate uses it |
9//! |-----|-------|----------------------|
10//! | [RFC 2326](https://tools.ietf.org/html/rfc2326) | RTSP 1.0 | Request/response parsing, session lifecycle, transport negotiation |
11//! | [RFC 3550](https://tools.ietf.org/html/rfc3550) | RTP | Packet header format, SSRC generation, sequence/timestamp semantics |
12//! | [RFC 4566](https://tools.ietf.org/html/rfc4566) | SDP | Session description generation for DESCRIBE responses |
13//! | [RFC 6184](https://tools.ietf.org/html/rfc6184) | H.264 RTP payload | NAL unit packetization, FU-A fragmentation, SDP fmtp attributes |
14//!
15//! ## Architecture
16//!
17//! ```text
18//! ┌──────────────────────────────────────────┐
19//! │  Adapters (Python / GStreamer / CLI)      │
20//! ├──────────────────────────────────────────┤
21//! │  Server        — public API, orchestrator│
22//! │  MountRegistry — named stream endpoints  │
23//! ├──────────────────────────────────────────┤
24//! │  Protocol      — RTSP parsing, SDP, etc. │
25//! │  Session       — state machine, transport│
26//! ├──────────────────────────────────────────┤
27//! │  Transport     — TCP signaling, UDP data │
28//! │  Media         — RTP header, packetizers │
29//! └──────────────────────────────────────────┘
30//! ```
31//!
32//! ## Quick start
33//!
34//! ```no_run
35//! use rtsp::Server;
36//!
37//! let mut server = Server::new("0.0.0.0:8554");
38//! server.start().unwrap();
39//!
40//! // Push H.264 Annex B frames — the server packetizes and delivers via RTP.
41//! // server.send_frame(&h264_data, 3000).unwrap();
42//! ```
43//!
44//! ## Crate layout
45//!
46//! - [`server`] — High-level [`Server`] orchestrator and [`ServerConfig`].
47//! - [`mount`] — [`Mount`] (stream endpoint) and [`MountRegistry`].
48//! - [`protocol`] — RTSP request/response parsing, method handling, SDP generation.
49//! - [`session`] — RTSP session state machine and transport negotiation.
50//! - [`transport`] — TCP listener for RTSP signaling, UDP sender for RTP delivery.
51//! - [`media`] — [`Packetizer`] trait, RTP header builder, codec implementations.
52//! - [`error`] — [`RtspError`] enum and [`Result`] alias.
53
54pub mod error;
55pub mod media;
56pub mod mount;
57pub mod protocol;
58pub mod server;
59pub mod session;
60pub mod transport;
61
62pub use error::{Result, RtspError};
63pub use media::Packetizer;
64pub use mount::{DEFAULT_MOUNT_PATH, Mount, MountRegistry};
65pub use server::{Server, ServerConfig, Viewer};