Skip to main content

ConnectCapabilities

Struct ConnectCapabilities 

Source
pub struct ConnectCapabilities {
    pub fourcc_list: Vec<String>,
    pub video_fourcc_info_map: FourCcInfoMap,
    pub audio_fourcc_info_map: FourCcInfoMap,
    pub caps_ex: u32,
    pub object_encoding: Option<u8>,
}
Expand description

Capability block exchanged in the NetConnection connect command.

Owns all four spec entries (fourCcList, videoFourCcInfoMap, audioFourCcInfoMap, capsEx) plus the long-standing objectEncoding byte. Encoded into the existing Command Object by Self::encode_into without touching the surrounding key order, and parsed back with Self::from_amf0 from either the client’s Command Object or the server’s _result properties object.

A default-constructed instance is empty — is_empty() is true and encode_into writes nothing, so a caller composing a legacy AVC / AAC-only connect command keeps the pre-2023 byte layout exactly.

Fields§

§fourcc_list: Vec<String>

fourCcList — Enhanced RTMP v1 strict-array of supported FourCC strings (e.g. "av01", "hvc1"). The v2 spec deprecates this on the client side in favour of audio/videoFourCcInfoMap, but servers are encouraged to keep supporting both for older clients.

§video_fourcc_info_map: FourCcInfoMap

videoFourCcInfoMap — v2 per-codec capability bits for video codecs.

§audio_fourcc_info_map: FourCcInfoMap

audioFourCcInfoMap — v2 per-codec capability bits for audio codecs.

§caps_ex: u32

capsEx — v2 bag of extended capability bits.

§object_encoding: Option<u8>

objectEncoding — 0 for AMF0-only, 3 for AMF0+AMF3.

Implementations§

Source§

impl ConnectCapabilities

Source

pub fn new() -> Self

Empty capability block — encodes to nothing.

Source

pub fn is_empty(&self) -> bool

True when every field is empty / default.

Source

pub fn supports_caps_ex(&self, mask: u32) -> bool

Test for a specific CapsExMask flag.

Source

pub fn has_fourcc(&self, key: &str) -> bool

True when fourcc_list includes either the wildcard "*" or the literal FourCC key.

Source

pub fn encode_into(&self, pairs: &mut Vec<(String, Amf0Value)>)

Append our capability properties to a command-object pair list.

Each property is only appended when the corresponding field is non-default, so encoding an empty block adds zero bytes. Caller keeps any other Command Object properties they want around the call site — pairs is mutated in place.

Source

pub fn from_amf0(v: &Amf0Value) -> Self

Parse any subset of capability properties out of an Object / ECMA-array. Missing properties stay at their default; malformed values are silently ignored (the spec’s “fail gracefully” rule — a forged capsEx = "abc" from a stale peer must not abort the connect handshake).

Trait Implementations§

Source§

impl Clone for ConnectCapabilities

Source§

fn clone(&self) -> ConnectCapabilities

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConnectCapabilities

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ConnectCapabilities

Source§

fn default() -> ConnectCapabilities

Returns the “default value” for a type. Read more
Source§

impl Eq for ConnectCapabilities

Source§

impl PartialEq for ConnectCapabilities

Source§

fn eq(&self, other: &ConnectCapabilities) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ConnectCapabilities

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.