|
RAVENNAKIT
|
This class contains all the components to act like a RAVENNA node as specified in the RAVENNA protocol. More...
#include <ravenna_node.hpp>
Classes | |
| struct | Configuration |
| Holds the configuration of the node. More... | |
| class | Subscriber |
| Base class for classes which want to receive updates from the ravenna node. More... | |
Public Member Functions | |
| RavennaNode () | |
| ~RavennaNode () | |
| std::future< tl::expected< Id, std::string > > | create_receiver (RavennaReceiver::Configuration initial_config) |
| Creates a new receiver for the given session. | |
| std::future< void > | remove_receiver (Id receiver_id) |
| Removes the receiver with the given id. | |
| std::future< tl::expected< void, std::string > > | update_receiver_configuration (Id receiver_id, RavennaReceiver::Configuration config) |
| Updates the configuration of the receiver with the given id. | |
| std::future< void > | subscribe_to_receiver (Id receiver_id, RavennaReceiver::Subscriber *subscriber) |
| Adds a subscriber to the receiver with the given id. | |
| std::future< void > | unsubscribe_from_receiver (Id receiver_id, RavennaReceiver::Subscriber *subscriber) |
| Removes a subscriber from the receiver with the given id. | |
| std::optional< uint32_t > | read_data_realtime (Id receiver_id, uint8_t *buffer, size_t buffer_size, std::optional< uint32_t > at_timestamp, std::optional< uint32_t > require_delay) |
| Reads data from the buffer at the given timestamp. | |
| std::optional< uint32_t > | read_audio_data_realtime (Id receiver_id, AudioBufferView< float > &output_buffer, std::optional< uint32_t > at_timestamp, std::optional< uint32_t > require_delay) |
| Reads the data from the receiver with the given id. | |
| std::future< tl::expected< sdp::SessionDescription, std::string > > | get_sdp_for_sender (Id sender_id) |
| Get the SDP for the sender with the given id. | |
| std::future< std::optional< sdp::SessionDescription > > | get_sdp_for_receiver (Id receiver_id) |
| Get the SDP for the receiver with the given id. | |
| std::future< std::optional< std::string > > | get_sdp_text_for_receiver (Id receiver_id) |
| Get the SDP text for the receiver with the given id. | |
| std::future< tl::expected< Id, std::string > > | create_sender (RavennaSender::Configuration initial_config) |
| Creates a sender for the given session. | |
| std::future< void > | remove_sender (Id sender_id) |
| Removes the sender with the given id. | |
| std::future< tl::expected< void, std::string > > | update_sender_configuration (Id sender_id, RavennaSender::Configuration config) |
| Updates the configuration of the sender with the given id. | |
| std::future< void > | subscribe_to_sender (Id sender_id, RavennaSender::Subscriber *subscriber) |
| Adds a subscriber to the sender with the given id. | |
| std::future< void > | unsubscribe_from_sender (Id sender_id, RavennaSender::Subscriber *subscriber) |
| Removes a subscriber from the sender with the given id. | |
| bool | send_data_realtime (Id sender_id, BufferView< const uint8_t > buffer, uint32_t timestamp) |
| Schedules data for sending. | |
| bool | send_audio_data_realtime (Id sender_id, const AudioBufferView< const float > &buffer, uint32_t timestamp) |
| Schedules audio data for sending. | |
| std::future< void > | subscribe_to_ptp_instance (ptp::Instance::Subscriber *subscriber) |
| Adds a subscriber to the PTP instance. | |
| std::future< void > | unsubscribe_from_ptp_instance (ptp::Instance::Subscriber *subscriber) |
| Removes a subscriber from the PTP instance. | |
| std::future< tl::expected< void, std::string > > | set_ptp_instance_configuration (ptp::Instance::Configuration update) |
| Sets the configuration of the PTP instance. | |
| std::future< tl::expected< void, std::string > > | set_nmos_configuration (nmos::Node::Configuration update) |
| Sets the configuration of the NMOS node. | |
| std::future< boost::uuids::uuid > | get_nmos_device_id () |
| std::future< void > | subscribe (Subscriber *subscriber) |
| Adds a subscriber to the node. | |
| std::future< void > | unsubscribe (Subscriber *subscriber) |
| Removes a subscriber from the node. | |
| std::future< void > | set_network_interface_config (NetworkInterfaceConfig interface_config) |
| Sets the network interfaces to use. | |
| std::future< void > | set_configuration (Configuration config) |
| Sets the configuration for this node, state will be updated accordingly. | |
| bool | is_maintenance_thread () const |
| std::future< boost::json::object > | to_boost_json () |
| std::future< tl::expected< void, std::string > > | restore_from_boost_json (const boost::json::value &json) |
| Restores the node from a JSON representation. | |
| template<typename CompletionToken> | |
| auto | dispatch (CompletionToken &&token) |
| Schedules some work on the maintenance thread using boost::asio::dispatch. | |
| template<typename CompletionToken> | |
| auto | post (CompletionToken &&token) |
| Schedules some work on the maintenance thread using asio::post. | |
This class contains all the components to act like a RAVENNA node as specified in the RAVENNA protocol.
Definition at line 48 of file ravenna_node.hpp.
|
explicit |
| rav::RavennaNode::~RavennaNode | ( | ) |
|
nodiscard |
Creates a new receiver for the given session.
| initial_config | The initial configuration for the receiver. Optional. |
|
nodiscard |
Creates a sender for the given session.
|
inlinenodiscard |
Schedules some work on the maintenance thread using boost::asio::dispatch.
This is useful for synchronizing with callbacks from the node and to offload work from the main (UI) thread. If passing using asio::use_future, the future will be set when the work is complete.
Example: node.dispatch(asio::use_future([] { return 1; })).get();
| CompletionToken | The type of the completion token. |
| token | The completion token. |
Definition at line 373 of file ravenna_node.hpp.
| std::future< boost::uuids::uuid > rav::RavennaNode::get_nmos_device_id | ( | ) |
|
nodiscard |
Get the SDP for the receiver with the given id.
TODO: Deprecate and signal sdp changes through RavennaReceiver::Subscriber
| receiver_id | The id of the receiver to get the SDP for. |
| std::future< tl::expected< sdp::SessionDescription, std::string > > rav::RavennaNode::get_sdp_for_sender | ( | Id | sender_id | ) |
Get the SDP for the sender with the given id.
This function will generate the SDP based on the current state of the receiver.
| sender_id | The id of the sender to get the SDP for. |
|
nodiscard |
Get the SDP text for the receiver with the given id.
This is the original SDP text as received from the server, and might contain things which haven't been parsed into the session_description. TODO: Deprecate and signal sdp changes through RavennaReceiver::Subscriber
| receiver_id | The id of the receiver to get the SDP text for. |
|
nodiscard |
|
inlinenodiscard |
Schedules some work on the maintenance thread using asio::post.
This is useful for synchronizing with callbacks from the node and to offload work from the main (UI) thread. If passing using asio::use_future, the future will be set when the work is complete.
Example: node.post(asio::use_future([] { return 1; })).get();
| CompletionToken | The type of the completion token. |
| token | The completion token. |
Definition at line 392 of file ravenna_node.hpp.
|
nodiscard |
Reads the data from the receiver with the given id.
Calling this function is realtime safe and thread safe when called from a single arbitrary thread.
| id | The id of the reader to get data from. |
| output_buffer | The buffer to read the data into. |
| at_timestamp | The optional timestamp to read at. If nullopt, the most recent timestamp minus the delay will be used for the first read and after that the timestamp will be incremented by the packet time. |
| require_delay | If set, the call to read_audio_data_realtime will only succeed if the requested timestamp is older than the most recent received timestamp - require_delay. This can be useful in a case where there is no PTP clock driving time, and instead, the time of the RTP stream has to be used. In normal PTP driven operation you would not set require_delay. |
|
nodiscard |
Reads data from the buffer at the given timestamp.
Calling this function is realtime safe and thread safe when called from a single arbitrary thread.
| id | The id of the reader to get data from. |
| buffer | The destination to write the data to. |
| buffer_size | The size of the buffer in bytes. |
| at_timestamp | The optional timestamp to read at. If nullopt, the most recent timestamp minus the delay will be used for the first read and after that the timestamp will be incremented by the packet time. |
| require_delay | If set, the call to read_data_realtime will only succeed if the requested timestamp is older than the most recent received timestamp - require_delay. This can be useful in a case where there is no PTP clock driving time, and instead, the time of the RTP stream has to be used. In normal PTP driven operation you would not set require_delay. |
|
nodiscard |
Removes the receiver with the given id.
| receiver_id | The id of the receiver to remove. |
|
nodiscard |
Removes the sender with the given id.
| sender_id | The id of the sender to remove. |
|
nodiscard |
Restores the node from a JSON representation.
| json | The JSON representation of the node. |
|
nodiscard |
Schedules audio data for sending.
A call to this function is realtime safe and thread safe as long as only one thread makes the call.
| id | The id of the writer. |
| input_buffer | The buffer to send. |
| timestamp | The timestamp of the buffer. |
|
nodiscard |
Schedules data for sending.
A call to this function is realtime safe and thread safe as long as only one thread makes the call.
| id | The id of the writer. |
| buffer | The buffer to send. |
| timestamp | The timestamp of the buffer. |
| std::future< void > rav::RavennaNode::set_configuration | ( | Configuration | config | ) |
Sets the configuration for this node, state will be updated accordingly.
| config | The new configuration. |
|
nodiscard |
Sets the network interfaces to use.
Can contain multiple interfaces for redundancy (not yet implemented).
| interface_config | The interfaces to use. If empty, operations will be stopped. |
|
nodiscard |
Sets the configuration of the NMOS node.
| update | The configuration to set. |
|
nodiscard |
Sets the configuration of the PTP instance.
| update | The configuration to set. |
|
nodiscard |
Adds a subscriber to the node.
This method can be called from any thread, and will wait until the operation is complete.
| subscriber | The subscriber to add. |
|
nodiscard |
Adds a subscriber to the PTP instance.
| subscriber | The subscriber to add. |
|
nodiscard |
Adds a subscriber to the receiver with the given id.
| receiver_id | The id of the stream to add the subscriber to. |
| subscriber | The subscriber to add. |
|
nodiscard |
Adds a subscriber to the sender with the given id.
| sender_id | The id of the stream to add the subscriber to. |
| subscriber | The subscriber to add. |
|
nodiscard |
|
nodiscard |
Removes a subscriber from the node.
This method can be called from any thread, and will wait until the operation is complete.
| subscriber | The subscriber to remove. |
|
nodiscard |
Removes a subscriber from the PTP instance.
| subscriber | The subscriber to remove. |
|
nodiscard |
Removes a subscriber from the receiver with the given id.
| receiver_id | The id of the stream to remove the subscriber from. |
| subscriber | The subscriber to remove. |
|
nodiscard |
Removes a subscriber from the sender with the given id.
| sender_id | The id of the stream to remove the subscriber from. |
| subscriber | The subscriber to remove. |
|
nodiscard |
Updates the configuration of the receiver with the given id.
| receiver_id | The id of the receiver to update. |
| config | The configuration changes to apply. |
|
nodiscard |
Updates the configuration of the sender with the given id.
| sender_id | The id of the sender to update. |
| config | The configuration changes to apply. |