### Basic RTP Sender Example Source: https://github.com/ultravideo/uvgrtp/blob/master/examples/README.md Demonstrates how to create a simple RTP sender using the uvgRTP library. This example is intended to be paired with a receiver example. ```C++ // sending.cc // Example for creating a simple RTP sender. ``` -------------------------------- ### UVGRTP CPack Setup Source: https://github.com/ultravideo/uvgrtp/blob/master/packaging/CMakeLists.txt Configures CPack for the UVGRTP project, setting package details, selecting appropriate generators for different platforms (Windows, macOS, Linux), and defining installable components and types. ```cmake set(CPACK_COMPONENTS_ALL ${PROJECT_NAME}_Runtime ${PROJECT_NAME}_Develop) set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${uvgrtp_DESCR}) set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}) set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) set(CPACK_VERBATIM_VARIABLES YES) set(CPACK_PACKAGE_CONTACT https://github.com/jrsnen) set(CPACK_DEBIAN_PACKAGE_MAINTAINER jrsnen) set(CPACK_RPM_COMPONENT_INSTALL TRUE) set(CPACK_DEB_COMPONENT_INSTALL TRUE) set(CPACK_COMPONENTS_GROUPING ONE_PER_GROUP) set(CPACK_DEBIAN_UVGRTP_DEVELOP_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}-dev.deb") set(CPACK_DEBIAN_UVGRTP_RUNTIME_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}-${CMAKE_HOST_SYSTEM_PROCESSOR}.deb") set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_LIST_DIR}/Description.txt ) set(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_CURRENT_LIST_DIR}/Welcome.txt ) set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_LIST_DIR}/License.txt ) set(CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_LIST_DIR}/Readme.txt ) set(CPACK_SOURCE_IGNORE_FILES /\.git/ /\.circleci/ /\.idea/ \.swp \.orig /CMakeLists\.txt\.user /privateDir/ /cmake\-build.*/ ) include(CPack) if(WIN32) set(CPACK_GENERATOR ZIP WIX) elseif(APPLE) set(CPACK_GENERATOR TGZ productbuild) elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") set(CPACK_GENERATOR TGZ RPM) else() set(CPACK_GENERATOR TGZ) endif() cpack_add_component(${PROJECT_NAME}_Runtime DISPLAY_NAME Runtime Description "Shared libraries" REQUIRED INSTALL_TYPES Full Developer Minimal) cpack_add_component(${PROJECT_NAME}_Development DISPLAY_NAME "Developer pre-requisites" DESCRIPTION "Headers needed for development" DEPENDS ${PROJECT_NAME}_Runtime INSTALL_TYPES Full Developer) cpack_add_component(${PROJECT_NAME}_Samples DISPLAY_NAME "Code Samples" INSTALL_TYPES Full Developer DISABLED) cpack_add_install_type(Full) cpack_add_install_type(Minimal) cpack_add_install_type(Developer DISPLAY_NAME "SDK Development") ``` -------------------------------- ### RTCP Example (Hooking) Source: https://github.com/ultravideo/uvgrtp/blob/master/examples/README.md Provides an example of how to use the RTCP instance within uvgRTP, specifically demonstrating the hooking mechanism for RTCP packet handling. ```C++ // rtcp_hook.cc // Example for using RTCP instance with hooking. ``` -------------------------------- ### Install uvgRTP Source: https://github.com/ultravideo/uvgrtp/blob/master/BUILDING.md Installs the compiled uvgRTP library to the system. This command usually requires superuser privileges (e.g., 'sudo') to write to system directories. ```bash sudo make install ``` -------------------------------- ### uvgrtp Basic Sending Example Source: https://github.com/ultravideo/uvgrtp/blob/master/docs/html/INDEX.md A complete C++ example demonstrating the creation of a context, session, and media stream, followed by sending and receiving data in a loop. Includes necessary cleanup. ```cpp #include /* g++ main.cc -luvgrtp -lpthread && ./a.out */ int main(void) { uvgrtp::context ctx; uvgrtp::session *sess = ctx.create_session("127.0.0.1"); uvgrtp::media_stream *strm = sess->create_stream(8888, 8888, RTP_FORMAT_GENERIC, RCE_NO_FLAGS); strm->configure_ctx(RCC_MTU_SIZE, 2312); char *message = (char *)"Hello, world!"; size_t msg_len = strlen(message) + 1; for (;;) { strm->push_frame((uint8_t *)message, msg_len, RTP_NO_FLAGS); auto frame = strm->pull_frame(); fprintf(stderr, "Message: '%s'\n", frame->payload); uvgrtp::frame::dealloc_frame(frame); } sess->destroy_stream(strm); ctx.destroy_session(sess); } ``` -------------------------------- ### uvgRTP Simple Sending Example Source: https://github.com/ultravideo/uvgrtp/blob/master/USAGE.md A complete, albeit non-working, example demonstrating the basic flow of creating a context, session, stream, sending data, receiving it, and cleanup. Compilation requires linking with -luvgrtp and -lpthread. ```cpp #include /* g++ main.cc -luvgrtp -lpthread && ./a.out */ int main(void) { uvgrtp::context ctx; uvgrtp::session *sess = ctx.create_session("127.0.0.1"); uvgrtp::media_stream *strm = sess->create_stream(8888, 8888, RTP_FORMAT_GENERIC, RCE_NO_FLAGS); strm->configure_ctx(RCC_MTU_SIZE, 2312); char *message = (char *)"Hello, world!"; size_t msg_len = strlen(message) + 1; for (;;) { strm->push_frame((uint8_t *)message, msg_len, RTP_NO_FLAGS); auto frame = strm->pull_frame(); fprintf(stderr, "Message: '%s'\n", frame->payload); uvgrtp::frame::dealloc_frame(frame); } sess->destroy_stream(strm); ctx.destroy_session(sess); } ``` -------------------------------- ### Install uvgRTP Receive Hook Source: https://github.com/ultravideo/uvgrtp/blob/master/USAGE.md Installs a callback function to handle incoming data, which is recommended for minimizing latency. The user is responsible for deallocating the received frame. ```cpp strm->install_receive_hook(nullptr, rtp_receive_hook); ``` -------------------------------- ### uvgrtp Library and Package Installation Source: https://github.com/ultravideo/uvgrtp/blob/master/CMakeLists.txt Handles the installation of the uvgrtp library, its runtime components, development headers, and CMake configuration files. This ensures the library can be easily used by other projects after installation. ```cmake # Install # # Define install target, install libraries and archives (static libraries) to "/..." install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_version EXPORT ${PROJECT_NAME}Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${PROJECT_NAME}_Runtime ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${PROJECT_NAME}_Runtime RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${PROJECT_NAME}_Runtime) #Copy all header files to the /include/uvgrtp directory file(GLOB DEPLOY_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/include/uvgrtp/*") install(FILES ${DEPLOY_FILES_AND_DIRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/ COMPONENT ${PROJECT_NAME}_Develop) #Create a File representing the current library version include(CMakePackageConfigHelpers) write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake" COMPATIBILITY SameMajorVersion ) #Create a Targets file representing exported targets (for usage within the build tree) export(EXPORT ${PROJECT_NAME}Targets FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Targets.cmake" NAMESPACE ${PROJECT_NAME}:: ) #Copy "cmake/uvgrtpConfig.cmake" to "${CMAKE_CURRENT_BINARY_DIR}/uvgrtp/uvgrtpConfig.cmake" configure_file(cmake/${PROJECT_NAME}Config.cmake "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake" COPYONLY ) #Copy "cmake/uvgrtpMacros.cmake" to "${CMAKE_CURRENT_BINARY_DIR}/uvgrtp/uvgrtpMacros.cmake" configure_file(cmake/${PROJECT_NAME}Macros.cmake "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Macros.cmake" COPYONLY ) # # Adding target to installing cmake package # set(ConfigPackageLocation lib/cmake/${PROJECT_NAME}) install(EXPORT ${PROJECT_NAME}Targets FILE ${PROJECT_NAME}Targets.cmake NAMESPACE ${PROJECT_NAME}:: DESTINATION ${ConfigPackageLocation} ) install(FILES cmake/${PROJECT_NAME}Config.cmake cmake/${PROJECT_NAME}Macros.cmake "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake" DESTINATION ${ConfigPackageLocation} COMPONENT uvgRTPMain ) # Packaging # if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) add_subdirectory(packaging) endif() ``` -------------------------------- ### Full Sending and Receiving Example Source: https://github.com/ultravideo/uvgrtp/blob/master/docs/html/index.html A complete C++ example demonstrating the lifecycle of a uvgrtp media stream. It includes session creation, stream creation, MTU configuration, sending "Hello, world!", receiving the message, printing it, and finally cleaning up the stream and session. ```C++ #include #include #include /* Compile with: g++ main.cc -luvgrtp -lpthread && ./a.out */ int main(void) { uvgrtp::context ctx; uvgrtp::session *sess = ctx.create_session("127.0.0.1"); uvgrtp::media_stream *strm = sess->create_stream(8888, 8888, RTP_FORMAT_GENERIC, RCE_NO_FLAGS); strm->configure_ctx(RCC_MTU_SIZE, 2312); char *message = (char *)"Hello, world!"; size_t msg_len = strlen(message) + 1; for (;;) { strm->push_frame((uint8_t *)message, msg_len, RTP_NO_FLAGS); auto frame = strm->pull_frame(); fprintf(stderr, "Message: '%s'\n", frame->payload); uvgrtp::frame::dealloc_frame(frame); } sess->destroy_stream(strm); ctx.destroy_session(sess); return 0; } ``` -------------------------------- ### Install Receive Hook Source: https://github.com/ultravideo/uvgrtp/blob/master/docs/html/INDEX.md Installs a callback function to handle incoming frames, recommended for minimizing latency. The user is responsible for memory deallocation. ```cpp strm->install_receive_hook(nullptr, rtp_receive_hook); ``` -------------------------------- ### Include uvgRTP Library Source: https://github.com/ultravideo/uvgrtp/blob/master/USAGE.md Includes all necessary uvgRTP header files with a single line. This is the first step to start using the library. ```cpp #include ``` -------------------------------- ### Subdirectory Inclusion for Examples and Tests Source: https://github.com/ultravideo/uvgrtp/blob/master/CMakeLists.txt Conditionally includes the 'examples' and 'test' subdirectories based on build configuration flags. This allows users to disable the building of examples or tests if not needed. ```cmake if (NOT UVGRTP_DISABLE_EXAMPLES) add_subdirectory(examples EXCLUDE_FROM_ALL) endif() if (NOT UVGRTP_DISABLE_TESTS) add_subdirectory(test EXCLUDE_FROM_ALL) endif() ``` -------------------------------- ### SRTP with User-Managed Keys Example Source: https://github.com/ultravideo/uvgrtp/blob/master/examples/README.md Shows how to implement SRTP using user-managed encryption keys, providing flexibility in key management. Requires linking with Crypto++. ```C++ // srtp_user.cc // Example for SRTP with user-managed keys. ``` -------------------------------- ### Multi-stream SRTP with ZRTP Example Source: https://github.com/ultravideo/uvgrtp/blob/master/examples/README.md Illustrates the usage of multi-stream SRTP with the ZRTP protocol, enabling secure and simultaneous transmission of multiple media streams. Requires linking with Crypto++. ```C++ // zrtp_multistream.cc // Example for multi-stream SRTP with ZRTP. ``` -------------------------------- ### Custom Timestamps Example Source: https://github.com/ultravideo/uvgrtp/blob/master/examples/README.md Demonstrates the correct usage of custom timestamps within the uvgRTP library, allowing for precise timing control in media streams. ```C++ // custom_timestamps.cc // Example for using custom timestamps correctly. ``` -------------------------------- ### SRTP with ZRTP Encryption Example Source: https://github.com/ultravideo/uvgrtp/blob/master/examples/README.md Demonstrates how to use Secure Real-time Transport Protocol (SRTP) with the ZRTP key exchange protocol for encrypted communication. Requires linking with Crypto++. ```C++ // srtp_zrtp.cc // Example for SRTP with ZRTP. ``` -------------------------------- ### V3C Streaming Example Source: https://github.com/ultravideo/uvgrtp/blob/master/examples/README.md Demonstrates Visual Volumetric Video-based Coding (V3C) streaming using uvgRTP. It includes instructions for building and running V3C sender and receiver applications with a test sequence. ```C++ // v3c_sender.cc and v3c_receiver.cc // Examples for V3C streaming. ``` -------------------------------- ### uvgRTP Commit Message Format Example Source: https://github.com/ultravideo/uvgrtp/blob/master/CONTRIBUTING.md An example of the recommended commit message format for uvgRTP. It includes a subsystem prefix, a concise subject line, and a detailed body explaining the changes, purpose, and implementation choices. Adhering to this format improves readability and understanding of commits. ```Git subsystem: A concice description of commit This text describes what this commit does or fixes, how it works on a high level and possibly why this implementation was chosen over other possibilities. You may also add the Github issue number, but please make sure the commit message is understandable without reading the issue. ``` -------------------------------- ### Run CPack for Packaging Source: https://github.com/ultravideo/uvgrtp/blob/master/packaging/README.md Executes the cpack command to generate distributable packages for uvgRTP after building. This command is typically run from the build directory. On Windows, NSIS must be installed beforehand. ```shell cpack ``` -------------------------------- ### Configure uvgRTP Media Stream MTU Source: https://github.com/ultravideo/uvgrtp/blob/master/USAGE.md Configures specific parameters for a media stream after creation. This example sets the Maximum Transmission Unit (MTU) size. ```cpp strm->configure_ctx(RCC_MTU_SIZE, 2312); ``` -------------------------------- ### media_stream::get_ssrc: Get SSRC Identifier Source: https://github.com/ultravideo/uvgrtp/blob/master/docs/html/classuvgrtp_1_1media__stream.html Retrieves the SSRC (Synchronization Source) identifier for the media stream. This value can be used, for example, to locate the corresponding report block in RTCP sender/receiver reports. ```APIDOC uint32_t uvgrtp::media_stream::get_ssrc( ) const // Get SSRC identifier. You can use the SSRC value for example to find the report block belonging to this media_stream in RTCP sender/receiver report. // Returns: SSRC value ``` -------------------------------- ### uvgrtp::media_stream API Source: https://github.com/ultravideo/uvgrtp/blob/master/docs/html/classuvgrtp_1_1media__stream.html Provides methods for managing an RTP stream, including starting ZRTP negotiation, adding SRTP keys, sending frames with various timestamp options, pulling received frames, installing receive hooks, configuring stream context, and accessing RTCP information. ```APIDOC uvgrtp::media_stream Class Reference The media_stream is an entity which represents one RTP stream. `#include ` Public Member Functions: start_zrtp rtp_error_t start_zrtp () - Starts the ZRTP negotiation manually. add_srtp_ctx rtp_error_t add_srtp_ctx (uint8_t *key, uint8_t *salt) - Adds keying information for a user-managed SRTP session. - Parameters: - key: Pointer to the SRTP key. - salt: Pointer to the SRTP salt. - Returns: rtp_error_t indicating success or failure. push_frame (multiple overloads) rtp_error_t push_frame (uint8_t *data, size_t data_len, int rtp_flags) rtp_error_t push_frame (std::unique_ptr< uint8_t[]> data, size_t data_len, int rtp_flags) rtp_error_t push_frame (uint8_t *data, size_t data_len, uint32_t ts, int rtp_flags) rtp_error_t push_frame (std::unique_ptr< uint8_t[]> data, size_t data_len, uint32_t ts, int rtp_flags) rtp_error_t push_frame (uint8_t *data, size_t data_len, uint32_t ts, uint64_t ntp_ts, int rtp_flags) rtp_error_t push_frame (std::unique_ptr< uint8_t[]> data, size_t data_len, uint32_t ts, uint64_t ntp_ts, int rtp_flags) - Sends data to a remote participant. - Supports sending raw data or unique_ptr managed data. - Allows specifying custom RTP timestamp (ts) and NTP timestamp (ntp_ts). - rtp_flags can be used to control RTP packetization. - Returns: rtp_error_t indicating success or failure. pull_frame (multiple overloads) uvgrtp::frame::rtp_frame* pull_frame () uvgrtp::frame::rtp_frame* pull_frame (size_t timeout_ms) - Polls a frame from the media stream object. - The first overload polls indefinitely. - The second overload polls for a specified duration in milliseconds. - Returns: A pointer to an rtp_frame object or nullptr on timeout/error. install_receive_hook rtp_error_t install_receive_hook (void *arg, void(*hook)(void *, uvgrtp::frame::rtp_frame *)) - Installs a callback hook for receiving frames asynchronously. - Parameters: - arg: User-defined argument passed to the hook. - hook: Pointer to the callback function. - Returns: rtp_error_t indicating success or failure. configure_ctx rtp_error_t configure_ctx (int rcc_flag, ssize_t value) - Configures the media stream context with specified flags and values. - Refer to RTP_CTX_CONFIGURATION_FLAGS for available flags. - Parameters: - rcc_flag: The configuration flag to set. - value: The value for the configuration flag. - Returns: rtp_error_t indicating success or failure. get_configuration_value int get_configuration_value (int rcc_flag) - Retrieves the current value associated with a configuration flag. - Refer to RTP_CTX_CONFIGURATION_FLAGS for available flags. - Parameters: - rcc_flag: The configuration flag to query. - Returns: The integer value of the configuration flag. get_rtcp uvgrtp::rtcp* get_rtcp () - Returns a pointer to the RTCP object associated with this media stream. get_ssrc uint32_t get_ssrc () const - Retrieves the SSRC (Synchronization Source) identifier for this media stream. - The SSRC can be used to locate the corresponding report block in RTCP sender/receiver reports. ``` -------------------------------- ### Initialize Menu and Search Source: https://github.com/ultravideo/uvgrtp/blob/master/docs/html/files.html Sets up the main navigation menu and integrates the search functionality, providing essential UI elements for browsing the documentation. ```javascript $(function() { initMenu('',true,false,'search.php','Search',false); $(function() { init_search(); }); }); ``` -------------------------------- ### Create uvgRTP Context Source: https://github.com/ultravideo/uvgrtp/blob/master/USAGE.md Initializes the uvgRTP context object. This object is mandatory and must be created before any other uvgRTP operations. ```cpp uvgrtp::context ctx; ``` -------------------------------- ### Modify uvgRTP Behavior Example Source: https://github.com/ultravideo/uvgrtp/blob/master/examples/README.md Demonstrates how to modify the behavior of the uvgRTP library, likely through configuration options or callbacks, to customize its functionality. ```C++ // configuration.cc // Example for modifying uvgRTP behavior. ``` -------------------------------- ### UDP Hole Punching Example Source: https://github.com/ultravideo/uvgrtp/blob/master/examples/README.md Shows how to enable and utilize UDP hole punching with uvgRTP, facilitating peer-to-peer connections in NAT environments. ```C++ // binding.cc // Example for enabling UDP hole punching. ``` -------------------------------- ### Create uvgRTP Media Stream (Standard) Source: https://github.com/ultravideo/uvgrtp/blob/master/USAGE.md Creates a media stream object for sending/receiving media. Specifies local and remote ports, RTP payload format, and flags to control behavior. ```cpp uvgrtp::media_stream *strm = sess->create_stream(8888, 8888, RTP_FORMAT_GENERIC, RCE_NO_FLAGS); ``` -------------------------------- ### Build and Run uvgRTP Tests (MSVC) Source: https://github.com/ultravideo/uvgrtp/blob/master/test/README.md Instructions for building and running the uvgRTP automated tests on Windows using MSVC. This involves opening the generated solution, building the test executable, and running it. ```bash Open the generated solution in Visual Studio. Build the 'uvgrtp_test' project. Run the generated 'uvgrtp_test.exe' from the Debug/Release folder. ``` -------------------------------- ### Doxygen Menu and Search Initialization Source: https://github.com/ultravideo/uvgrtp/blob/master/docs/html/globals_enum.html Initializes the main menu and the search interface for the documentation site. ```JavaScript $(function() { initMenu('',true,false,'search.php','Search',false); $(function() { init_search(); }); }); ``` -------------------------------- ### Disable Building Examples and Tests Source: https://github.com/ultravideo/uvgrtp/blob/master/BUILDING.md CMake commands to prevent the building of uvgRTP examples and test targets. This can be used to create a leaner build focused solely on the library. -------------------------------- ### Initialize Resizable Layout Source: https://github.com/ultravideo/uvgrtp/blob/master/docs/html/files.html Configures the resizable layout for the documentation interface, allowing users to adjust panel sizes for a personalized viewing experience. ```javascript $(function(){ initResizable(false); }); ``` -------------------------------- ### pkg-config File Generation and Installation Source: https://github.com/ultravideo/uvgrtp/blob/master/CMakeLists.txt Configures and installs the pkg-config file (uvgrtp.pc) if pkg-config is found. This allows other projects to easily find and link against the uvgrtp library. ```cmake configure_file("cmake/uvgrtp.pc.in" "uvgrtp.pc" @ONLY) if (NOT UVGRTP_DISABLE_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/uvgrtp.pc DESTINATION ${PKG_CONFIG_PATH}/) endif() else() message("pkg-config not found. Not generating pc file") endif(PkgConfig_FOUND) ``` -------------------------------- ### Include uvgRTP Library Source: https://github.com/ultravideo/uvgrtp/blob/master/docs/html/INDEX.md Include the main uvgRTP header file to access all necessary functionalities. This is the first step to use the library. ```cpp #include ``` -------------------------------- ### Fragment Generic Media Types Example Source: https://github.com/ultravideo/uvgrtp/blob/master/examples/README.md Illustrates how to fragment generic media types for transmission using uvgRTP. This is useful for sending custom or non-standard media formats. ```C++ // sending_generic.cc // Example for fragmenting generic media types. ``` -------------------------------- ### Basic RTP Receiver (Hooking) Source: https://github.com/ultravideo/uvgrtp/blob/master/examples/README.md Illustrates how to create a simple RTP receiver by hooking into the uvgRTP library. The hook is suitable for interfacing with an application thread for frame handling, not extensive media processing. ```C++ // receiving_hook.cc // Example for creating a simple RTP receiver using hooking. ``` -------------------------------- ### Install RTCP SDES Packet Hook (uvgrtp::rtcp) Source: https://github.com/ultravideo/uvgrtp/blob/master/docs/html/classuvgrtp_1_1rtcp.html Installs a callback function that is invoked when an RTCP SDES packet is received. Supports both std::function and C-style function pointers. ```APIDOC uvgrtp::rtcp::install_sdes_hook // Overload 1: Using std::function rtp_error_t install_sdes_hook( std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_sdes_packet >)> _sdes_handler_ ) // Overload 2: Using C-style function pointer rtp_error_t install_sdes_hook( void(* _hook_)(uvgrtp::frame::rtcp_sdes_packet *) ) Description: Installs an RTCP SDES packet hook. This function is called when an RTCP SDES packet is received. Parameters: _sdes_handler_ (Overload 1): C++ function pointer to the hook, accepting a unique_ptr to rtcp_sdes_packet. _hook_ (Overload 2): Function pointer to the hook, accepting a raw pointer to rtcp_sdes_packet. Return values: RTP_OK: on success RTP_INVALID_VALUE: If hook is nullptr ``` -------------------------------- ### Install RTCP Receiver Report Hook (uvgrtp::rtcp) Source: https://github.com/ultravideo/uvgrtp/blob/master/docs/html/classuvgrtp_1_1rtcp.html Installs a callback function that is invoked when an RTCP Receiver Report is received. Supports both std::function and C-style function pointers. ```APIDOC uvgrtp::rtcp::install_receiver_hook // Overload 1: Using std::function rtp_error_t install_receiver_hook( std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_receiver_report >)> _rr_handler_ ) // Overload 2: Using C-style function pointer rtp_error_t install_receiver_hook( void(* _hook_)(uvgrtp::frame::rtcp_receiver_report *) ) Description: Installs an RTCP Receiver Report hook. This function is called when an RTCP Receiver Report is received. Parameters: _rr_handler_ (Overload 1): C++ function pointer to the hook, accepting a unique_ptr to rtcp_receiver_report. _hook_ (Overload 2): Function pointer to the hook, accepting a raw pointer to rtcp_receiver_report. Return values: RTP_OK: on success RTP_INVALID_VALUE: If hook is nullptr ``` -------------------------------- ### Create uvgRTP Session (Single Address) Source: https://github.com/ultravideo/uvgrtp/blob/master/USAGE.md Creates a uvgRTP session object associated with a single IP address. The role (sending/receiving) can be specified later using flags. ```cpp uvgrtp::session *sess = ctx.create_session("10.10.10.2"); ``` -------------------------------- ### Install RTCP APP Packet Hook (uvgrtp::rtcp) Source: https://github.com/ultravideo/uvgrtp/blob/master/docs/html/classuvgrtp_1_1rtcp.html Installs a callback function that is invoked when an RTCP APP packet is received. Supports both std::function and C-style function pointers. ```APIDOC uvgrtp::rtcp::install_app_hook // Overload 1: Using std::function rtp_error_t install_app_hook( std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_app_packet >)> _app_handler_ ) // Overload 2: Using C-style function pointer rtp_error_t install_app_hook( void(* _hook_)(uvgrtp::frame::rtcp_app_packet *) ) Description: Installs an RTCP APP packet hook. This function is called when an RTCP APP packet is received. Parameters: _app_handler_ (Overload 1): C++ function pointer to the hook, accepting a unique_ptr to rtcp_app_packet. _hook_ (Overload 2): Function pointer to the hook, accepting a raw pointer to rtcp_app_packet. Return values: RTP_OK: on success RTP_INVALID_VALUE: If hook is nullptr ``` -------------------------------- ### Configure uvgrtp Tests with CMake and GoogleTest Source: https://github.com/ultravideo/uvgrtp/blob/master/test/CMakeLists.txt This CMake script configures the build process for the uvgrtp project's tests. It finds Git, enables testing, adds sources, sets include directories, and links against necessary libraries including GTest, uvgrtp, and optionally cryptopp. ```CMake find_package(Git) if (Git_FOUND) project(uvgrtp_test) enable_testing() include(GoogleTest) add_executable(${PROJECT_NAME}) target_sources(${PROJECT_NAME} PRIVATE main.cpp test_1_version.cpp test_2_rtp.cpp test_3_rtcp.cpp test_4_formats.cpp test_5_srtp_zrtp.cpp test_6_scl_unit_test.cpp test_common.hh ) target_include_directories(${PROJECT_NAME} PRIVATE $) # set crypto++ to be linked in tests if available if (NOT UVGRTP_DISABLE_CRYPTO AND CRYPTOPP_FOUND) if(MSVC) set(CRYPTOPP_LIB_NAME "cryptlib") else() set(CRYPTOPP_LIB_NAME "cryptopp") endif() else() set(CRYPTOPP_LIB_NAME "") endif () target_link_libraries(${PROJECT_NAME} PRIVATE GTest::GTestMain uvgrtp ${CRYPTOPP_LIB_NAME}) gtest_add_tests(TARGET ${PROJECT_NAME}) else() message(WARNING "Git not found, not building tests") endif() ``` -------------------------------- ### RTCP Receiver Report Hook Installation Source: https://github.com/ultravideo/uvgrtp/blob/master/docs/html/rtcp_8hh_source.html API methods for installing hooks to handle incoming RTCP Receiver Reports. Supports both C-style function pointers and C++ std::function for flexible integration. ```APIDOC uvgrtp::rtcp::install_receiver_hook // C-style function pointer rtp_error_t install_receiver_hook(void(*hook)(uvgrtp::frame::rtcp_receiver_report *)) - Installs a callback function to process incoming RTCP Receiver Reports. - Parameters: - hook: A pointer to a function that accepts a uvgrtp::frame::rtcp_receiver_report pointer. - Returns: rtp_error_t indicating success or failure. // std::function rtp_error_t install_receiver_hook(std::function)> rr_handler) - Installs a std::function callback for processing RTCP Receiver Reports. - Parameters: - rr_handler: A std::function object that takes a unique_ptr to a uvgrtp::frame::rtcp_receiver_report. - Returns: rtp_error_t indicating success or failure. ``` -------------------------------- ### Create Media Stream Source: https://github.com/ultravideo/uvgrtp/blob/master/docs/html/index.html Demonstrates the creation of a uvgrtp::media_stream object. It shows the standard constructor with local and remote ports, RTP format, and flags, as well as a simplified version for send-only or receive-only modes. ```C++ uvgrtp::media_stream *strm = sess->create_stream(8888, 8888, RTP_FORMAT_GENERIC, RCE_NO_FLAGS); // One port version for send/receive only uvgrtp::media_stream *strm = sess->create_stream(8888, RTP_FORMAT_GENERIC, RCE_RECEIVE_ONLY); ```