Net::RTP::Packet - RTP Packet object (RFC3550)
use Net::RTP::Packet; my $packet = new Net::RTP::Packet(); $packet->payload_type( 10 ); $packet->seq_num( 6789 ); $packet->timestamp( 76303 ); $packet->payload( $audio ); $binary = $packet->encode();
Net::RTP::Packet implements RTP packet header encoding and decoding.
The new() method is the constructor for the
Net::RTP::Packet class. The RTP version number is initialized to 2. The sequence number, timestamp and SSRC are all randomized.
$binary parameter is optional, and is passed to
decode() if present.
Get or set the version number of the RTP packet. Only version 2 is currently supported.
Get or set the number of bytes of padding at the end of the RTP packet.
Returns true if there was an RTP header extension present in the packet. It isn't currently possible to get the data of that extension.
Get or set the value of the marker flag in the header. If true, it usually means that this RTP packet is the start of a frame boundary.
Get or set the payload type of the packet. See
http://www.iana.org/assignments/rtp-parameters for the Payload Type values.
Get or set the sequence number of the packet. The sequence number increments by one for each RTP data packet sent, and may be used by the receiver to detect packet loss and to restore packet sequence.
Increment the packet's sequence number by
$amount. If no amount is specified, then the sequence number is incremented by 1. Returns the packet's new sequence number if successful.
Get or set the timestamp of the packet. The timestamp reflects the sampling instant of the first octet in the RTP data packet.
Increment the packet's timestamp by
$amount. If no amount is specified, then the timestamp is incremented by 1. Returns the packet's new timestamp if successful.
Get or set the 32-bit source identifier of the packet.
Get or set an ARRAYREF of contributing source identifiers for the packet.
Get or set the payload data for the packet.
Return the length (in bytes) of the packet's payload.
Return the source IP address of the packet (as an ASCII string). If the source IP is not known, the value is undefined.
Return the source port of the packet (as an ASCII string). If the source port is not known, the value is undefined.
Return the length (in bytes) of the binary RTP packet.
Note: The size of the packet is only calculated during encode() and decode().
Decodes binary RTP packet header into the packet object.
Encode a packet object into a binary RTP packet.
Please report any bugs or feature requests to
email@example.com, or through the web interface at http://rt.cpan.org. I will be notified, and then you will automatically be notified of progress on your bug as I make changes.
Nicholas J Humfrey, firstname.lastname@example.org
Copyright (C) 2006 University of Southampton
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.005 or, at your option, any later version of Perl 5 you may have available.