sheave_core::handlers

Struct RtmpContext

Source
pub struct RtmpContext { /* private fields */ }
Expand description

RTMP’s common contexts.

Many fields are optional by default. Because these data need for both of client and server but are sent/received later. Therefore the default constructor has been prepared instead of such as new.

§Examples

use sheave_core::handlers::RtmpContext;

// When you create this struct.
RtmpContext::default();

Implementations§

Source§

impl RtmpContext

Source

pub fn make_weak_mut<'a>(self: &'a Arc<Self>) -> &'a mut Self

Gets a mutable reference via this wrapped by Arc. Sheave uses this after wrapping into Arc. Because of making this shareable between every handling steps.

Source

pub fn set_signed(&mut self, signed: bool)

Stores a flag to mean this handshake is signed.

Source

pub fn is_signed(&mut self) -> bool

Indicates whether the handshake is signed.

Source

pub fn set_receiving_chunk_size(&mut self, chunk_size: ChunkSize)

Sets a chunking size which reads from streams.

Source

pub fn get_receiving_chunk_size(&mut self) -> ChunkSize

Gets a chunking size which reads from streams.

Source

pub fn set_sending_chunk_size(&mut self, chunk_size: ChunkSize)

Sets a chunking size which writes into streams.

Source

pub fn get_sending_chunk_size(&mut self) -> ChunkSize

Gets a chunkign size which writes into stream.

Source

pub fn set_window_acknowledgement_size( &mut self, window_acknowledgement_size: WindowAcknowledgementSize, )

Sets the window acknowledgement size.

Source

pub fn get_window_acknowledgement_size(&mut self) -> WindowAcknowledgementSize

Gets the window acknowledgement size.

Source

pub fn set_peer_bandwidth(&mut self, peer_bandwidth: PeerBandwidth)

Sets the peer bandwidth.

Source

pub fn get_peer_bandwidth(&mut self) -> PeerBandwidth

Gets the peer bandwidth.

Source

pub fn set_transaction_id(&mut self, transaction_id: Number)

Sets a transaction ID. Mainly, this is used by server side contexts. Because of servers should echo same transaction ID in its response.

Source

pub fn get_transaction_id(&mut self) -> Number

Gets a transaction ID sent.

Source

pub fn increase_transaction_id(&mut self)

Increases current transaction ID. Mainly, this is used by client side contexts. Because of clients should count which transaction is it now on.

Source

pub fn set_app(&mut self, app: AmfString)

Sets the app name. This can be contained in a request URI of RTMP.

Source

pub fn get_app(&mut self) -> Option<&AmfString>

Gets the app name. Note this can return None. e.g. When this field is default as it is.

§Examples
use sheave_core::handlers::RtmpContext;

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_app().is_none())
Source

pub fn set_tc_url(&mut self, tc_url: AmfString)

Sets the tcUrl. This is a full URL in the RTMP request like following form.

rtmp://hostname/[app]/[playpath]

Where app and playpath can be unspecified. Clients specify above URL at the start of RTMP requests. Then the server checks app and playpath in client-side Connect commands (if they are specified).

Source

pub fn get_tc_url(&mut self) -> Option<&AmfString>

Gets the tcUrl. Note this can return None. e.g. this field is default as it is.

§Examples
use sheave_core::handlers::RtmpContext;

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_tc_url().is_none())
Source

pub fn set_publisher_status(&mut self, status: PublisherStatus)

Sets one of status to mean which a publication client is in.

Source

pub fn get_publisher_status(&mut self) -> Option<PublisherStatus>

Gets one of status to mean which a publication client is in. Note this can return None. e.g. When this field is default as it is.

§Examples
use sheave_core::handlers::RtmpContext;

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_publisher_status().is_none());
Source

pub fn set_encryption_algorithm( &mut self, encryption_algorithm: EncryptionAlgorithm, )

Stores the algorithm to encrypt this handshake.

Source

pub fn get_encryption_algorithm(&mut self) -> Option<EncryptionAlgorithm>

Gets specieifed algorithm to encrypt this handshake. Note this can return None. e.g. When is as the default is.

§Examples
use sheave_core::handlers::RtmpContext;

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_encryption_algorithm().is_none())
Source

pub fn set_client_handshake(&mut self, handshake: Handshake)

Stores a cleint-side handshake bytes.

Source

pub fn get_client_handshake(&mut self) -> Option<&Handshake>

Gets a client-side handshake bytes. Note this can return None. e.g. When is as the default is.

§Examples
use sheave_core::handlers::RtmpContext;

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_client_handshake().is_none())
Source

pub fn get_client_handshake_mut(&mut self) -> Option<&mut Handshake>

Gets a client-side handshake bytes as mutable. Note:

  • This is currently used for only testing (also intagration tests contained).
  • This can return None. e.g. When is as the default is.
§Examples
use sheave_core::handlers::RtmpContext;

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_client_handshake_mut().is_none())
Source

pub fn set_server_handshake(&mut self, handshake: Handshake)

Stores a server-side handshake bytes.

Source

pub fn get_server_handshake(&mut self) -> Option<&Handshake>

Gets a server-side handshake bytes. Note this can return None. e.g. When it is the default as is.

§Examples
use sheave_core::handlers::RtmpContext;

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_server_handshake().is_none())
Source

pub fn set_command_object(&mut self, command_object: Object)

Sets a command object sent from a client.

Source

pub fn get_command_object(&mut self) -> Option<&Object>

Gets a command object sent from a client. Note this can return None. e.g. When it is default as is.

§Examples
use sheave_core::handlers::RtmpContext;

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_command_object().is_none())
Source

pub fn set_properties(&mut self, properties: Object)

Sets a properties object of a server.

Source

pub fn get_properties(&mut self) -> Option<&Object>

Gets a properties object of a server. Note this can return None. e.g. When it is the dafault as is.

§Examples
use sheave_core::handlers::RtmpContext;

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_properties().is_none())
Source

pub fn set_information(&mut self, information: Object)

Sets a information object of a server.

Source

pub fn get_information(&mut self) -> Option<&Object>

Gets a information object of a server. Note this can return None. e.g. When it is the default as is.

§Examples
use sheave_core::handlers::RtmpContext;

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_information().is_none())
Source

pub fn set_playpath(&mut self, playpath: AmfString)

Sets a playpath (e.g. filename) sent from a client.

Source

pub fn reset_playpath(&mut self)

Resets a playpath from this context. This is prepared for deleting the playpath when receives the FCUnpublish command.

Source

pub fn get_playpath(&mut self) -> Option<&AmfString>

Gets a playpath (e.g. filename) sent from a client. Note this can return None. e.g. When it is the default as is.

§Examples
use sheave_core::handlers::RtmpContext;

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_playpath().is_none())
Source

pub fn set_message_id(&mut self, message_id: u32)

Sets a message ID of this stream.

Source

pub fn reset_message_id(&mut self)

Resets a message ID from this context. This is prepared for deleting tne message_id when receives the deleteStream command.

Source

pub fn get_message_id(&mut self) -> Option<u32>

Gets a message ID of this stream. Note this can return None. e.g. When it is the default as is.

§Examples
use sheave_core::handlers::RtmpContext;

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_message_id().is_none());
Source

pub fn set_publishing_name(&mut self, publishing_name: AmfString)

Sets a publishing name of this stream.

Source

pub fn get_publishing_name(&mut self) -> Option<&AmfString>

Gets a publishing name of this stream. Note this can return None. e.g. When it is the default as is.

§Examples
use sheave_core::handlers::RtmpContext;

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_publishing_name().is_none())
Source

pub fn set_publishing_type(&mut self, publishing_type: AmfString)

Sets a publishing type of this stream.

Source

pub fn get_publishing_type(&mut self) -> Option<&AmfString>

Gets a publishing type of this stream. Note this can return None. e.g. When it is the default as is.

§Examples
use sheave_core::handlers::RtmpContext;

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_publishing_type().is_none())
Source

pub fn set_await_duration(&mut self, await_duration: Duration)

Sets a duration for awaiting of receiving some message.

Currently, this is used only clients during publishing audio/video data.

Source

pub fn get_await_duration(&mut self) -> Option<Duration>

Gets a duration for awaiting of receiving some message.

Currently, this is used only clients during publishing audio/video data.

Source

pub fn set_input(&mut self, input: Flv)

Sets input file/device.

Source

pub fn get_input(&mut self) -> Option<&Flv>

Gets input file/device. Note this can return None. e.g. When it is the default as is.

§Examples
use sheave_core::handlers::RtmpContext;

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_input().is_none())
Source

pub fn get_input_mut(&mut self) -> Option<&mut Flv>

Gets input file/device as mutable. Note this can return None. e.g. When it is the default as is.

§Examples
use sheave_core::handlers::RtmpContext;

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_input_mut().is_none())
Source

pub fn insert_received_chunk(&mut self, chunk_id: u16, last_chunk: LastChunk)

Stores a last received chunk.

Source

pub fn get_last_received_chunk(&mut self, chunk_id: &u16) -> Option<&LastChunk>

Loads a last received chunk. If no last chunk is stored associated with specified ID, this returns None.

§Examples
use sheave_core::{
    handlers::RtmpContext,
    messages::Channel
};

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_last_received_chunk(&Channel::System.into()).is_none())
Source

pub fn get_last_received_chunk_mut( &mut self, chunk_id: &u16, ) -> Option<&mut LastChunk>

Loads a last received chunk as mutable. If no last chunk is stored associated with specified ID, this returns None.

§Examples
use sheave_core::{
    handlers::RtmpContext,
    messages::Channel
};

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_last_received_chunk_mut(&Channel::System.into()).is_none())
Source

pub fn insert_sent_chunk(&mut self, chunk_id: u16, last_chunk: LastChunk)

Stores a last sent chunk.

Source

pub fn get_last_sent_chunk(&mut self, chunk_id: &u16) -> Option<&LastChunk>

Loads a last sent chunk. If no last chunk is stored associated with specified ID, this returns None.

§Examples
use sheave_core::{
    handlers::RtmpContext,
    messages::Channel
};

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_last_sent_chunk(&Channel::System.into()).is_none())
Source

pub fn get_last_sent_chunk_mut( &mut self, chunk_id: &u16, ) -> Option<&mut LastChunk>

Loads a last sent chunk as mutable. If no last chunk is stored associated with specified ID, this returns None.

§Examples
use sheave_core::{
    handlers::RtmpContext,
    messages::Channel
};

let mut rtmp_context = RtmpContext::default();
assert!(rtmp_context.get_last_sent_chunk_mut(&Channel::System.into()).is_none())

Trait Implementations§

Source§

impl Debug for RtmpContext

Source§

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

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

impl Default for RtmpContext

Source§

fn default() -> Self

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

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V