Home Units Hierarchy Routines All identifiers

Class unaRTPTransmitter

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type unaRTPTransmitter = class(unaObject)

Description

Basic RTP transmitter (UDP only)

Hierarchy

Overview

Methods

Public constructor create(const bind2addr: TSockAddrIn; payload: int; isRAW: bool = false; noRTCP: bool = false; ttl: int = -1; primaryDest: PSockAddrIn = nil);
Public function destAdd(dstatic: bool; addrRTP, addrRTCP: PSockAddrIn; doOpen: bool = false; fromHole: bool = false; recSSRC: uint32 = 0): int; overload;
Public function destAdd(dstatic: bool; const remoteHost, remotePortRTP, remotePortRTCP: string; doOpen: bool = false; ttl: int = -1; recSSRC: uint32 = 0; fromHole: bool = false): int; overload;
Public function destAdd(dstatic: bool; const uri: string; doOpen: bool = false; ttl: int = -1; recSSRC: uint32 = 0): int; overload;
Public function destAdd(dstatic: bool; const ipN: TIPv4N): int; overload;
Public function destGetAcq(index: int; ro: bool): unaRTPDestination; overload;
Public function destGetAcq(const addrRTP: sockaddr_in; ro: bool): unaRTPDestination; overload;
Public function destGetCount(): int;
Public function destHas(const addr: sockaddr_in): bool;
Public function open(waitForThreadsToStart: bool = true): bool;
Public function retransmit(data: pointer; len: uint; updateWeSent: bool = true; isRTCP: bool = false): int;
Public function sendTo(addr: PSockAddrIn; data: pointer; len: uint; isRTCP: bool; ownPacket: bool = true): int;
Public function transmit(samplesDelta: uint; data: pointer; len: uint; marker: bool = false; tpayload: int = -1; addr: PSockAddrIn = nil; prebufData: pointer = nil; prebufDataLen: uint = 0; updateWeSent: bool = true): int;
Protected function doOpen(waitForThreadsToStart: bool = true): bool; virtual;
Protected function okAddDest(destRTP, destRTCP: PSockAddrIn; fromHole: bool): bool; virtual;
Public procedure BeforeDestruction(); override;
Public procedure close(clearAllDest: bool = false);
Public procedure destEnable(index: int; doEnable: bool); overload;
Public procedure destEnable(const uri: string; doEnable: bool); overload;
Public procedure destRemove(const addrRTP: sockaddr_in); overload;
Public procedure destRemove(const uri: string); overload;
Public procedure destRemove(index: int); overload;
Public procedure destRemove(dest: unaRTPDestination); overload;
Public procedure setNewSSRC(newssrc: u_int32);
Protected procedure doClose(); virtual;
Protected procedure notifyBye(si: prtp_site_info; soft: bool); virtual;
Protected procedure onIdle(rtcpIdle: bool); virtual;
Protected procedure onPayload(addr: PSockAddrIn; hdr: prtp_hdr; data: pointer; len, packetSize: uint); virtual;
Protected procedure onRTCPPacket(ssrc: u_int32; addr: PSockAddrIn; hdr: prtcp_common_hdr; packetSize: uint); virtual;
Protected procedure onSsrcCNAME(ssrc: u_int32; cname: prtcp_sdes_item); virtual;
Protected procedure pushRTCPPacket(packet: pointer; len: uint); virtual;

Properties

Public property active: bool read getActive write setActive;
Public property bind2ip: string read f_bind2ip write f_bind2ip;
Public property bind2port: string read f_bind2port;
Public property dest[index:int]: unaRTPDestination read getDest;
Public property isRAW: bool read f_isRAW write f_isRAW;
Public property isTranslator: bool read f_isTranslator write f_isTranslator;
Public property onAddDest: unaRTPOnAddDestination read f_onAddDest write f_onAddDest;
Public property paused: bool read f_paused write f_paused;
Public property payload: int read f_payload write setPayload;
Public property receiver: unaRTPReceiver read f_receiver;
Public property rtcp: unaRTCPstack read getRTCP;
Public property RTPclockRate: unsigned read f_RTPclockRate write f_RTPclockRate;
Public property rtpPing: bool read f_rtpPing write f_rtpPing;
Public property samplingRate: unsigned read f_sr write f_sr;
Public property socketError: int read f_socketError;
Public property ttl: int read f_ttl write f_ttl;
Public property _SSRC: u_int32 read getSsrc;

Description

Methods

Public constructor create(const bind2addr: TSockAddrIn; payload: int; isRAW: bool = false; noRTCP: bool = false; ttl: int = -1; primaryDest: PSockAddrIn = nil);

Creates a new instance of IPTransmitter.

Parameters
payload
payload to assign by default on transmitted packets
isRAW
non-RTP sockets
noRTCP
disable/enable RTCP stack
bind2addr
bind socket to this local ip:port, if nil, will bind to 0.0.0.0:0
ttl
assign this TTL
primaryDest
primary destination. If nil, transmitter will add fixed destination. In case of multicast, push data to this remote address or join this multicast group
Public function destAdd(dstatic: bool; addrRTP, addrRTCP: PSockAddrIn; doOpen: bool = false; fromHole: bool = false; recSSRC: uint32 = 0): int; overload;

Adds new destination for transmission.

Returns

index of new dest

Public function destAdd(dstatic: bool; const remoteHost, remotePortRTP, remotePortRTCP: string; doOpen: bool = false; ttl: int = -1; recSSRC: uint32 = 0; fromHole: bool = false): int; overload;

Adds new destination for transmission.

Returns

index of just added destination.

Public function destAdd(dstatic: bool; const uri: string; doOpen: bool = false; ttl: int = -1; recSSRC: uint32 = 0): int; overload;

Adds new destination for transmission.

Returns

index of just added destination.

Public function destAdd(dstatic: bool; const ipN: TIPv4N): int; overload;

Adds new destination for transmission. It will use receiver's socket for communication. This method is mostly used for multicast sockets.

Returns

index of new dest

Public function destGetAcq(index: int; ro: bool): unaRTPDestination; overload;

Returns destination by index. Acquires it as well.

Public function destGetAcq(const addrRTP: sockaddr_in; ro: bool): unaRTPDestination; overload;

Returns destination by RTP address. Acquires it as well.

Public function destGetCount(): int;

Returns number of destinations.

Public function destHas(const addr: sockaddr_in): bool;

Checks if specified dest was already added.

Returns

True if dest already exsits

Public function open(waitForThreadsToStart: bool = true): bool;

Opens transmitter.

Public function retransmit(data: pointer; len: uint; updateWeSent: bool = true; isRTCP: bool = false): int;

Re-transmits data to all destinations. Assumes data is already points to RTP header, or is pure payload in RAW mode.

Public function sendTo(addr: PSockAddrIn; data: pointer; len: uint; isRTCP: bool; ownPacket: bool = true): int;

Sends data to specified destination. Returns 0 if all data was send successfully, or WinSock error otherwise.

Public function transmit(samplesDelta: uint; data: pointer; len: uint; marker: bool = false; tpayload: int = -1; addr: PSockAddrIn = nil; prebufData: pointer = nil; prebufDataLen: uint = 0; updateWeSent: bool = true): int;

Transmits data over RTP. Adds RTP header if required.

Parameters
samplesDelta
samples taken since last transfer
data
payload data
len
size of data buffer in bytes
marker
marker bit value. Default if 0
tpayload
override payload. Default is -1, means use payload property
addr
send to this address only. Default is nil, means send to all destinations
Returns

number of bytes actually sent to network

Protected function doOpen(waitForThreadsToStart: bool = true): bool; virtual;
 
Protected function okAddDest(destRTP, destRTCP: PSockAddrIn; fromHole: bool): bool; virtual;

Called just before adding a new destination. Fires onAddDest if assigned, otherwise always return True Override for different behaviour

Parameters
dest
Destination to be added
fromHole
destination was obtained from "hole" packet
Returns

True if it is OK to add this destination

Public procedure BeforeDestruction(); override;

Releases destinations and other resources.

Public procedure close(clearAllDest: bool = false);

Closes transmitter.

Public procedure destEnable(index: int; doEnable: bool); overload;

Temporarely enables/disables streaming to specified destination.

Public procedure destEnable(const uri: string; doEnable: bool); overload;

Temporarely enables/disables streaming to specified destination.

Public procedure destRemove(const addrRTP: sockaddr_in); overload;

Removes destination.

Public procedure destRemove(const uri: string); overload;

Removes destination.

Public procedure destRemove(index: int); overload;

Removes destination.

Public procedure destRemove(dest: unaRTPDestination); overload;

Removes destination.

Public procedure setNewSSRC(newssrc: u_int32);

Not everyday function.

Protected procedure doClose(); virtual;
 
Protected procedure notifyBye(si: prtp_site_info; soft: bool); virtual;

Called from context of receiver thread.

Protected procedure onIdle(rtcpIdle: bool); virtual;

Called from context of idle thread.

Protected procedure onPayload(addr: PSockAddrIn; hdr: prtp_hdr; data: pointer; len, packetSize: uint); virtual;
 
Protected procedure onRTCPPacket(ssrc: u_int32; addr: PSockAddrIn; hdr: prtcp_common_hdr; packetSize: uint); virtual;

New RTCP packed was received.

Parameters
ssrc
Generator of packet
addr
Remote address packet was received from.
hdr
RTCP packet header.
packetSize
Packet size including padding.
Protected procedure onSsrcCNAME(ssrc: u_int32; cname: prtcp_sdes_item); virtual;
 
Protected procedure pushRTCPPacket(packet: pointer; len: uint); virtual;

Transmitter could have own set of destinations, give it a chance to push RTCP data over

Properties

Public property active: bool read getActive write setActive;
 
Public property bind2ip: string read f_bind2ip write f_bind2ip;
 
Public property bind2port: string read f_bind2port;
 
Public property dest[index:int]: unaRTPDestination read getDest;

Destination

Public property isRAW: bool read f_isRAW write f_isRAW;

True if receiver is RAW (no RTP/RTCP will be used).

Public property isTranslator: bool read f_isTranslator write f_isTranslator;
 
Public property onAddDest: unaRTPOnAddDestination read f_onAddDest write f_onAddDest;

Fired when new destination is about to be added

Public property paused: bool read f_paused write f_paused;

When true, no packets are sent

Public property payload: int read f_payload write setPayload;

Payload for own transmits.

Public property receiver: unaRTPReceiver read f_receiver;
 
Public property rtcp: unaRTCPstack read getRTCP;
 
Public property RTPclockRate: unsigned read f_RTPclockRate write f_RTPclockRate;

Timestamp clock rate.

Public property rtpPing: bool read f_rtpPing write f_rtpPing;

Send CN packets over RTP when not streaming data. Default is true.

Public property samplingRate: unsigned read f_sr write f_sr;

Sampling rate of a stream.

Public property socketError: int read f_socketError;
 
Public property ttl: int read f_ttl write f_ttl;

TTL value

Public property _SSRC: u_int32 read getSsrc;

SSRC

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09