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
impl RtmpContext
Sourcepub fn make_weak_mut<'a>(self: &'a Arc<Self>) -> &'a mut Self
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.
Sourcepub fn set_signed(&mut self, signed: bool)
pub fn set_signed(&mut self, signed: bool)
Stores a flag to mean this handshake is signed.
Sourcepub fn set_receiving_chunk_size(&mut self, chunk_size: ChunkSize)
pub fn set_receiving_chunk_size(&mut self, chunk_size: ChunkSize)
Sets a chunking size which reads from streams.
Sourcepub fn get_receiving_chunk_size(&mut self) -> ChunkSize
pub fn get_receiving_chunk_size(&mut self) -> ChunkSize
Gets a chunking size which reads from streams.
Sourcepub fn set_sending_chunk_size(&mut self, chunk_size: ChunkSize)
pub fn set_sending_chunk_size(&mut self, chunk_size: ChunkSize)
Sets a chunking size which writes into streams.
Sourcepub fn get_sending_chunk_size(&mut self) -> ChunkSize
pub fn get_sending_chunk_size(&mut self) -> ChunkSize
Gets a chunkign size which writes into stream.
Sourcepub fn set_window_acknowledgement_size(
&mut self,
window_acknowledgement_size: WindowAcknowledgementSize,
)
pub fn set_window_acknowledgement_size( &mut self, window_acknowledgement_size: WindowAcknowledgementSize, )
Sets the window acknowledgement size.
Sourcepub fn get_window_acknowledgement_size(&mut self) -> WindowAcknowledgementSize
pub fn get_window_acknowledgement_size(&mut self) -> WindowAcknowledgementSize
Gets the window acknowledgement size.
Sourcepub fn set_peer_bandwidth(&mut self, peer_bandwidth: PeerBandwidth)
pub fn set_peer_bandwidth(&mut self, peer_bandwidth: PeerBandwidth)
Sets the peer bandwidth.
Sourcepub fn get_peer_bandwidth(&mut self) -> PeerBandwidth
pub fn get_peer_bandwidth(&mut self) -> PeerBandwidth
Gets the peer bandwidth.
Sourcepub fn set_transaction_id(&mut self, transaction_id: Number)
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.
Sourcepub fn get_transaction_id(&mut self) -> Number
pub fn get_transaction_id(&mut self) -> Number
Gets a transaction ID sent.
Sourcepub fn increase_transaction_id(&mut self)
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.
Sourcepub fn set_app(&mut self, app: AmfString)
pub fn set_app(&mut self, app: AmfString)
Sets the app
name.
This can be contained in a request URI of RTMP.
Sourcepub fn get_app(&mut self) -> Option<&AmfString>
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())
Sourcepub fn set_tc_url(&mut self, tc_url: AmfString)
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).
Sourcepub fn get_tc_url(&mut self) -> Option<&AmfString>
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())
Sourcepub fn set_publisher_status(&mut self, status: PublisherStatus)
pub fn set_publisher_status(&mut self, status: PublisherStatus)
Sets one of status to mean which a publication client is in.
Sourcepub fn get_publisher_status(&mut self) -> Option<PublisherStatus>
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());
Sourcepub fn set_encryption_algorithm(
&mut self,
encryption_algorithm: EncryptionAlgorithm,
)
pub fn set_encryption_algorithm( &mut self, encryption_algorithm: EncryptionAlgorithm, )
Stores the algorithm to encrypt this handshake.
Sourcepub fn get_encryption_algorithm(&mut self) -> Option<EncryptionAlgorithm>
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())
Sourcepub fn set_client_handshake(&mut self, handshake: Handshake)
pub fn set_client_handshake(&mut self, handshake: Handshake)
Stores a cleint-side handshake bytes.
Sourcepub fn get_client_handshake(&mut self) -> Option<&Handshake>
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())
Sourcepub fn get_client_handshake_mut(&mut self) -> Option<&mut Handshake>
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())
Sourcepub fn set_server_handshake(&mut self, handshake: Handshake)
pub fn set_server_handshake(&mut self, handshake: Handshake)
Stores a server-side handshake bytes.
Sourcepub fn get_server_handshake(&mut self) -> Option<&Handshake>
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())
Sourcepub fn set_command_object(&mut self, command_object: Object)
pub fn set_command_object(&mut self, command_object: Object)
Sets a command object sent from a client.
Sourcepub fn get_command_object(&mut self) -> Option<&Object>
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())
Sourcepub fn set_properties(&mut self, properties: Object)
pub fn set_properties(&mut self, properties: Object)
Sets a properties object of a server.
Sourcepub fn get_properties(&mut self) -> Option<&Object>
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())
Sourcepub fn set_information(&mut self, information: Object)
pub fn set_information(&mut self, information: Object)
Sets a information object of a server.
Sourcepub fn get_information(&mut self) -> Option<&Object>
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())
Sourcepub fn set_playpath(&mut self, playpath: AmfString)
pub fn set_playpath(&mut self, playpath: AmfString)
Sets a playpath
(e.g. filename) sent from a client.
Sourcepub fn reset_playpath(&mut self)
pub fn reset_playpath(&mut self)
Resets a playpath
from this context.
This is prepared for deleting the playpath
when receives the FCUnpublish
command.
Sourcepub fn get_playpath(&mut self) -> Option<&AmfString>
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())
Sourcepub fn set_message_id(&mut self, message_id: u32)
pub fn set_message_id(&mut self, message_id: u32)
Sets a message ID of this stream.
Sourcepub fn reset_message_id(&mut self)
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.
Sourcepub fn get_message_id(&mut self) -> Option<u32>
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());
Sourcepub fn set_publishing_name(&mut self, publishing_name: AmfString)
pub fn set_publishing_name(&mut self, publishing_name: AmfString)
Sets a publishing name of this stream.
Sourcepub fn get_publishing_name(&mut self) -> Option<&AmfString>
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())
Sourcepub fn set_publishing_type(&mut self, publishing_type: AmfString)
pub fn set_publishing_type(&mut self, publishing_type: AmfString)
Sets a publishing type of this stream.
Sourcepub fn get_publishing_type(&mut self) -> Option<&AmfString>
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())
Sourcepub fn set_await_duration(&mut self, await_duration: Duration)
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.
Sourcepub fn get_await_duration(&mut self) -> Option<Duration>
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.
Sourcepub fn get_input(&mut self) -> Option<&Flv>
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())
Sourcepub fn get_input_mut(&mut self) -> Option<&mut Flv>
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())
Sourcepub fn insert_received_chunk(&mut self, chunk_id: u16, last_chunk: LastChunk)
pub fn insert_received_chunk(&mut self, chunk_id: u16, last_chunk: LastChunk)
Stores a last received chunk.
Sourcepub fn get_last_received_chunk(&mut self, chunk_id: &u16) -> Option<&LastChunk>
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())
Sourcepub fn get_last_received_chunk_mut(
&mut self,
chunk_id: &u16,
) -> Option<&mut LastChunk>
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())
Sourcepub fn insert_sent_chunk(&mut self, chunk_id: u16, last_chunk: LastChunk)
pub fn insert_sent_chunk(&mut self, chunk_id: u16, last_chunk: LastChunk)
Stores a last sent chunk.
Sourcepub fn get_last_sent_chunk(&mut self, chunk_id: &u16) -> Option<&LastChunk>
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())
Sourcepub fn get_last_sent_chunk_mut(
&mut self,
chunk_id: &u16,
) -> Option<&mut LastChunk>
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())