Skip to main content

Crate oxideav_rtmp

Crate oxideav_rtmp 

Source
Expand description

Pure-Rust RTMP for oxideav — ingest + push.

This crate lets callers:

  • Accept an incoming publisher (RtmpServer). One TCP connection per publisher, blocking-thread-per-connection. Server drives the RTMP handshake + connect + createStream + publish handshake, then hands the consumer a PublishRequest carrying the app, stream_name, tc_url, and peer_addr so the consumer can verify the stream key / do whatever auth they want before accepting. Accepted publishers become an RtmpSession emitting audio / video / metadata packets.

  • Push an encoded stream out to a remote RTMP server (RtmpClient). Dial an rtmp://host[:port]/app/stream_name URL, run the client-side publish handshake, then call send_video / send_audio / send_metadata with H.264 / AAC payloads.

The protocol pieces are reusable on their own — amf, chunk, flv, message, handshake — for callers who need an RTMP primitive the high-level API doesn’t expose yet.

AMF support:

  • amf — AMF0 wire format (the default for RTMP command + metadata messages). Used by every commodity ingest endpoint.
  • amf3 — AMF3 wire format, the Flash Player 9+ binary serialization. RTMP can switch a channel to AMF3 via the AMF0 avmplus-object-marker (0x11) or by using message type IDs 15 (Data), 16 (Shared Object) and 17 (Command). The encoder + decoder handle all thirteen markers plus the three reference tables (strings / objects / traits).

Out of scope for this release:

  • RTMPS (TLS). Consumers who need it can wrap our Read + Write with rustls. We may add an rtmps feature later.
  • RTMP play (downstream subscriber / upstream pull). Only publish direction is implemented.
  • Shared objects, RTMFP, RTMP Encrypted, and the Adobe digest-verified handshake variant.

Re-exports§

pub use adapter::audio_codec_id;
pub use adapter::audio_codec_id_for_tag;
pub use adapter::audio_fourcc_codec_id;
pub use adapter::audio_to_packet;
pub use adapter::open_rtmp;
pub use adapter::register;
pub use adapter::video_codec_id;
pub use adapter::video_codec_id_for_tag;
pub use adapter::video_fourcc_codec_id;
pub use adapter::video_to_packet;
pub use adapter::RtmpPacketSource;
pub use adapter::AUDIO_STREAM_INDEX;
pub use adapter::RTMP_MS_TO_NS;
pub use adapter::RTMP_TIME_BASE;
pub use adapter::VIDEO_STREAM_INDEX;
pub use aggregate::build_aggregate;
pub use aggregate::parse_aggregate;
pub use amf::Amf0Value;
pub use amf3::Amf3Value;
pub use caps::ConnectCapabilities;
pub use caps::FourCcInfoMap;
pub use caps::CAPS_EX_MOD_EX;
pub use caps::CAPS_EX_MULTITRACK;
pub use caps::CAPS_EX_RECONNECT;
pub use caps::CAPS_EX_TIMESTAMP_NANO_OFFSET;
pub use caps::FOURCC_INFO_CAN_DECODE;
pub use caps::FOURCC_INFO_CAN_ENCODE;
pub use caps::FOURCC_INFO_CAN_FORWARD;
pub use caps::FOURCC_WILDCARD;
pub use caps::OBJECT_ENCODING_AMF0;
pub use caps::OBJECT_ENCODING_AMF3;
pub use chunk::Message;
pub use chunk::MessageStreamKind;
pub use client::resolve_tc_url;
pub use client::ClientEvent;
pub use client::RtmpClient;
pub use client::RtmpUrl;
pub use error::Error;
pub use error::Result;
pub use flv::AudioTag;
pub use flv::ColorConfig;
pub use flv::ColorInfo;
pub use flv::HdrCll;
pub use flv::HdrMdcv;
pub use flv::ModEx;
pub use flv::MultichannelConfig;
pub use flv::MultichannelConfigOrder;
pub use flv::Multitrack;
pub use flv::MultitrackTrack;
pub use flv::VideoTag;
pub use flv_file::FlvHeaderFlags;
pub use flv_file::FlvReader;
pub use flv_file::FlvTag;
pub use flv_file::FlvWriter;
pub use message::UserControlEvent;
pub use message::RECONNECT_REQUEST_CODE;
pub use server::PublishRequest;
pub use server::RtmpServer;
pub use server::RtmpSession;
pub use server::StreamPacket;

Modules§

adapter
PacketSource adapter wrapping an RtmpSession.
aggregate
RTMP Aggregate Message (type 22) parser + builder.
amf
AMF0 (Action Message Format 0) value encoder + decoder.
amf3
AMF3 (Action Message Format 3) value encoder + decoder.
caps
Enhanced RTMP NetConnection connect capability negotiation.
chunk
RTMP chunk stream reader + writer.
client
RTMP client: push a live stream to a remote RTMP server.
error
Single error enum covering every way RTMP goes wrong.
flv
FLV-tag payload shape for RTMP audio / video messages.
flv_file
FLV file / byte-stream writer + reader.
handshake
RTMP plain handshake (protocol version 3).
message
RTMP message-type constants + tiny builders for the protocol control and command messages we send during publish setup.
server
RTMP server: accepts an incoming publisher.