oxideav_rtmp/lib.rs
1//! Pure-Rust RTMP for oxideav — ingest + push.
2//!
3//! This crate lets callers:
4//!
5//! * **Accept** an incoming publisher ([`RtmpServer`]). One TCP
6//! connection per publisher, blocking-thread-per-connection. Server
7//! drives the RTMP handshake + connect + createStream + publish
8//! handshake, then hands the consumer a [`PublishRequest`] carrying
9//! the `app`, `stream_name`, `tc_url`, and `peer_addr` so the
10//! consumer can verify the stream key / do whatever auth they want
11//! before accepting. Accepted publishers become an [`RtmpSession`]
12//! emitting audio / video / metadata packets.
13//!
14//! * **Push** an encoded stream out to a remote RTMP server
15//! ([`RtmpClient`]). Dial an `rtmp://host[:port]/app/stream_name`
16//! URL, run the client-side publish handshake, then call
17//! `send_video` / `send_audio` / `send_metadata` with H.264 /
18//! AAC payloads.
19//!
20//! The protocol pieces are reusable on their own —
21//! [`amf`], [`chunk`], [`flv`], [`message`], [`handshake`] — for
22//! callers who need an RTMP primitive the high-level API doesn't
23//! expose yet.
24//!
25//! AMF support:
26//!
27//! * [`amf`] — AMF0 wire format (the default for RTMP command +
28//! metadata messages). Used by every commodity ingest endpoint.
29//! * [`amf3`] — AMF3 wire format, the Flash Player 9+ binary
30//! serialization. RTMP can switch a channel to AMF3 via the AMF0
31//! `avmplus-object-marker` (0x11) or by using message type IDs 15
32//! (Data), 16 (Shared Object) and 17 (Command). The encoder + decoder
33//! handle all thirteen markers plus the three reference tables
34//! (strings / objects / traits).
35//!
36//! Out of scope for this release:
37//!
38//! * RTMPS (TLS). Consumers who need it can wrap our `Read + Write`
39//! with rustls. We may add an `rtmps` feature later.
40//! * RTMP play (downstream subscriber / upstream pull). Only publish
41//! direction is implemented.
42//! * Shared objects, RTMFP, RTMP Encrypted, and the Adobe
43//! digest-verified handshake variant.
44
45pub mod adapter;
46pub mod aggregate;
47pub mod amf;
48pub mod amf3;
49pub mod caps;
50pub mod chunk;
51pub mod client;
52pub mod error;
53pub mod flv;
54pub mod flv_file;
55pub mod handshake;
56pub mod message;
57pub mod server;
58
59pub use adapter::{
60 audio_codec_id, audio_codec_id_for_tag, audio_fourcc_codec_id, audio_to_packet, open_rtmp,
61 register, video_codec_id, video_codec_id_for_tag, video_fourcc_codec_id, video_to_packet,
62 RtmpPacketSource, AUDIO_STREAM_INDEX, RTMP_MS_TO_NS, RTMP_TIME_BASE, VIDEO_STREAM_INDEX,
63};
64pub use aggregate::{build_aggregate, parse_aggregate};
65pub use amf::Amf0Value;
66pub use amf3::Amf3Value;
67pub use caps::{
68 ConnectCapabilities, FourCcInfoMap, CAPS_EX_MOD_EX, CAPS_EX_MULTITRACK, CAPS_EX_RECONNECT,
69 CAPS_EX_TIMESTAMP_NANO_OFFSET, FOURCC_INFO_CAN_DECODE, FOURCC_INFO_CAN_ENCODE,
70 FOURCC_INFO_CAN_FORWARD, FOURCC_WILDCARD, OBJECT_ENCODING_AMF0, OBJECT_ENCODING_AMF3,
71};
72pub use chunk::{Message, MessageStreamKind};
73pub use client::{resolve_tc_url, ClientEvent, RtmpClient, RtmpUrl};
74pub use error::{Error, Result};
75pub use flv::{
76 AudioTag, ColorConfig, ColorInfo, HdrCll, HdrMdcv, ModEx, MultichannelConfig,
77 MultichannelConfigOrder, Multitrack, MultitrackTrack, VideoTag,
78};
79pub use flv_file::{FlvHeaderFlags, FlvReader, FlvTag, FlvWriter};
80pub use message::{UserControlEvent, RECONNECT_REQUEST_CODE};
81pub use server::{PublishRequest, RtmpServer, RtmpSession, StreamPacket};