libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
SdpSession Class Reference

SDP session description (RFC 4566). More...

#include <sdpsession.h>

Public Types

using Ptr = SharedPtr< SdpSession >
 Shared pointer type.
 
using List = promeki::List< SdpSession >
 List of SdpSession values.
 
using PtrList = promeki::List< SdpSession::Ptr >
 List of shared SdpSession pointers.
 

Public Member Functions

 SdpSession ()=default
 Default constructor.
 
const StringsessionName () const
 Returns the session name (s= line).
 
void setSessionName (const String &name)
 Sets the session name.
 
const StringoriginUsername () const
 Returns the originator username.
 
uint64_t sessionId () const
 Returns the session ID.
 
uint64_t sessionVersion () const
 Returns the session version.
 
void setOrigin (const String &username, uint64_t sessionId, uint64_t sessionVersion, const String &netType="IN", const String &addrType="IP4", const String &address="0.0.0.0")
 Sets the origin (o= line) fields.
 
const StringoriginNetType () const
 Returns the origin network type (e.g. "IN").
 
const StringoriginAddrType () const
 Returns the origin address type (e.g. "IP4").
 
const StringoriginAddress () const
 Returns the origin address.
 
const StringconnectionAddress () const
 Returns the session-level connection address (c= line).
 
void setConnectionAddress (const String &address)
 Sets the session-level connection address.
 
const promeki::List< SdpMediaDescription > & mediaDescriptions () const
 Returns the list of media descriptions.
 
void addMediaDescription (const SdpMediaDescription &md)
 Adds a media description.
 
String toString () const
 Generates the SDP text representation.
 

Static Public Member Functions

static Result< SdpSessionfromString (const String &sdp)
 Parses an SDP text string into an SdpSession.
 

Detailed Description

SDP session description (RFC 4566).

SdpSession represents a complete SDP document. It can parse SDP text into structured data and generate SDP text from structured data. Used by ST 2110 and AES67 for stream advertisement.

Example
sdp.setSessionName("vidgen test stream");
sdp.setConnectionAddress("239.0.0.1");
video.setPort(5004);
video.setProtocol("RTP/AVP");
video.addPayloadType(96);
video.setAttribute("rtpmap", "96 raw/90000");
sdp.addMediaDescription(video);
String sdpText = sdp.toString();
SDP media description (m= section).
Definition sdpsession.h:38
void setMediaType(const String &type)
Sets the media type.
Definition sdpsession.h:47
SDP session description (RFC 4566).
Definition sdpsession.h:127
void setSessionName(const String &name)
Sets the session name.
Definition sdpsession.h:154
promeki::List< SdpSession > List
List of SdpSession values.
Definition sdpsession.h:134
Encoding-aware string class with copy-on-write semantics.
Definition string.h:35

Member Function Documentation

◆ fromString()

static Result< SdpSession > SdpSession::fromString ( const String sdp)
static

Parses an SDP text string into an SdpSession.

Parameters
sdpThe SDP text to parse.
Returns
A Result containing the parsed session and Error::Ok, or Error::Invalid on parse failure.

◆ setOrigin()

void SdpSession::setOrigin ( const String username,
uint64_t  sessionId,
uint64_t  sessionVersion,
const String netType = "IN",
const String addrType = "IP4",
const String address = "0.0.0.0" 
)

Sets the origin (o= line) fields.

Parameters
usernameThe originator username.
sessionIdThe session ID.
sessionVersionThe session version.
netTypeNetwork type (default "IN").
addrTypeAddress type (default "IP4").
addressThe originator's address.

◆ toString()

String SdpSession::toString ( ) const

Generates the SDP text representation.

Returns
The complete SDP document as a string.

The documentation for this class was generated from the following file: