RTP (Real-Time Transfer Protocol)
The RTP library provides functions for creating and manipulation RTP packets.
Functionality
- Create RTP packets of any length
- Create and extract RTP headers
More details in nw_rtp_pkg
Example use
Include the libraries:
library nw_util;
context nw_util.nw_util_context;
library nw_rtp;
Assume the variable v_payload contains the RTP payload. The variables are defined:
variable v_header : t_rtp_header; -- RTP header record
variable v_rtp_pkt : t_slv_arr(0 to 1500)(7 downto 0); -- byte array
variable v_len : natural;
First setup the header, then calculate the total RTP packet length before creating the packet.
v_header := C_DEFAULT_RTP_HEADER; -- copy default header
v_header.cc := x"0010"; -- two CSRC identifiers
v_header.csrc(0) := x"10005678"; -- CSRC #1
v_header.csrc(1) := x"1000abcd"; -- CSRC #2
v_header.payload_type := "0100011"; -- payload type
v_len := f_rtp_create_pkt_len(v_header, v_payload); -- calculate total packet length
v_rtp_pkt(0 to v_len - 1) := f_rtp_create_pkt(v_header, v_payload); -- create the packet
The variable v_rtp_pkt is an 8-bit array. This can of course be rearranged to any word width with f_repack .
v_rtp_pkt_64 := f_repack(v_rtp_pkt, 64, C_MSB_FIRST); -- repack to 64bit words (padded with zeros if required)
See further examples in the test bench nw_rtp_tb.vhd.