RAVENNAKIT
Loading...
Searching...
No Matches
Getting started

Integrating using CMake

The easiest and recommended way of integration RAVENNAKIT into your project is by using CMake. The following steps are required:

  1. Copy the RAVENNAKIT source code into the source tree of your project.
  2. Make the dependencies available through find_package() as RAVENNAKIT will try to link the dependencies using the CMake find_package() command. Recommended is to use vcpkg. See dependencies for more details.
  3. Call add_subdirectory() in your CMakeLists.txt file.:
add_subdirectory(path/to/ravennakit)

Then call target_link_libraries() to link your target against the RAVENNAKIT library:

target_link_libraries(your_target PRIVATE ravennakit)

Manually integrating RAVENNAKIT

It is possible to manually integrate RAVENNAKIT into your project. This requires some manual steps and is not as trivial as the CMake approach:

  1. Copy the RAVENNAKIT source code into the source tree of your project.
  2. Add the RAVENNAKIT source files to your project (path/to/ravennakit/include/** and path/to/ravennakit/src/**)
  3. Link the required dependencies to your project. Visit the dependencies documentation for more details.

Build configurations and options

To influence how RAVENNAKIT is built, several variables can be set. Head over to the options documentation for more details.

Setting up a RavennaNode

The easiest way to get started is to use the rav::RavennaNode class. This class offers the highest available abstraction of a RAVENNA node and provides a simple API to set up streams and to configure the node. It basically acts like a virtual RAVENNA node. Using this class also makes it easier to deal with cross thread boundaries.

The following code snippet shows how to set up a RAVENNA node:

namespace examples {
class RavennaNodeSubscriber: public rav::RavennaNode::Subscriber {
public:
RAV_LOG_INFO("Discovered node: {}", desc.to_string());
}
RAV_LOG_INFO("Removed node: {}", desc.to_string());
}
void ravenna_session_discovered(const rav::dnssd::ServiceDescription& desc) override {
RAV_LOG_INFO("Discovered session: {}", desc.to_string());
}
void ravenna_session_removed(const rav::dnssd::ServiceDescription& desc) override {
RAV_LOG_INFO("Removed session: {}", desc.to_string());
}
void ravenna_node_configuration_updated(const rav::RavennaNode::Configuration& configuration) override {
RAV_LOG_INFO("Node configuration updated: {}", rav::to_string(configuration));
}
void ravenna_receiver_added([[maybe_unused]] const rav::RavennaReceiver& receiver) override {
// Called when a receiver was added to the node.
}
void ravenna_receiver_removed([[maybe_unused]] const rav::Id receiver_id) override {
// Called when a receiver was removed from the node.
}
void ravenna_sender_added([[maybe_unused]] const rav::RavennaSender& sender) override {
// Called when a sender was added to the node.
}
void ravenna_sender_removed([[maybe_unused]] const rav::Id sender_id) override {
// Called when a sender was removed fom the node.
}
void nmos_node_config_updated([[maybe_unused]] const rav::nmos::Node::Configuration& config) override {
// Called when the NMOS node configuration was updated.
}
[[maybe_unused]] const rav::nmos::Node::Status status, [[maybe_unused]] const rav::nmos::Node::StatusInfo& registry_info
) override {
// Called when the NMOS status changed (connected to a registry for example).
}
void network_interface_config_updated([[maybe_unused]] const rav::NetworkInterfaceConfig& config) override {
// Called when the network interface config was updated.
}
};
} // namespace examples
int main([[maybe_unused]] int const argc, [[maybe_unused]] char* argv[]) {
node_config.enable_dnssd_node_discovery = true;
node_config.enable_dnssd_session_discovery = true;
node.set_configuration(node_config);
node.subscribe(&subscriber).wait();
fmt::println("Press return key to stop...");
std::string line;
std::getline(std::cin, line);
node.unsubscribe(&subscriber).wait();
return 0;
}
void ravenna_receiver_removed(const rav::Id receiver_id) override
Called when a receiver is removed from the node.
void network_interface_config_updated(const rav::NetworkInterfaceConfig &config) override
Called when the network interface configuration is updated.
void nmos_node_config_updated(const rav::nmos::Node::Configuration &config) override
Called when the NMOS configuration is updated.
void ravenna_sender_added(const rav::RavennaSender &sender) override
Called when a sender is added to the node, or when subscribing.
void ravenna_session_discovered(const rav::dnssd::ServiceDescription &desc) override
Called when a session is discovered.
void nmos_node_status_changed(const rav::nmos::Node::Status status, const rav::nmos::Node::StatusInfo &registry_info) override
Called when the NMOS node state changed.
void ravenna_node_discovered(const rav::dnssd::ServiceDescription &desc) override
Called when a node is discovered.
void ravenna_sender_removed(const rav::Id sender_id) override
Called when a sender is removed from the node.
void ravenna_session_removed(const rav::dnssd::ServiceDescription &desc) override
Called when a session is removed.
void ravenna_node_configuration_updated(const rav::RavennaNode::Configuration &configuration) override
Called when the configuration of the RavennaNode is updated.
void ravenna_receiver_added(const rav::RavennaReceiver &receiver) override
Called when a receiver is added to the node, or when subscribing.
void ravenna_node_removed(const rav::dnssd::ServiceDescription &desc) override
Called when a node is removed.
Base class for classes which want to receive updates from the ravenna node.
This class contains all the components to act like a RAVENNA node as specified in the RAVENNA protoco...
std::future< void > subscribe(Subscriber *subscriber)
Adds a subscriber to the node.
std::future< void > set_configuration(Configuration config)
Sets the configuration for this node, state will be updated accordingly.
std::future< void > unsubscribe(Subscriber *subscriber)
Removes a subscriber from the node.
int main()
#define RAV_LOG_INFO(...)
Definition log.hpp:120
void set_log_level_from_env(const char *env_var="RAV_LOG_LEVEL")
Tries to find given environment variable and set the log level accordingly.
Definition log.hpp:216
void do_system_checks()
Definition system.hpp:33
const char * to_string(const AudioEncoding encoding)
Holds the configuration of the node.
bool enable_dnssd_session_discovery
When true, the RAVENNA node will discover sessions (streams) using dns-sd.
bool enable_dnssd_node_discovery
When true, the RAVENNA node will discover other nodes using dns-sd.
bool enable_dnssd_session_advertisement
When true, the RAVENNA node will advertise senders using dns-sd.
A struct containing data which represents a service on the network.
std::string to_string() const noexcept
Returns a description of this struct, which might be handy for debugging or logging purposes.

There are examples which show how RAVENNAKIT can be used:
https://github.com/soundondigital/ravennakit/tree/main/examples