Programming Interfaces Guide

Adding a Media Field to the SDP Session Structure

int sdp_add_media(sdp_session_t *session, const char *name, uint_t port, int portcount, const char *protocol, const char *format, sdp_media_t **media);

The sdp_add_media() function adds the MEDIA (m=) SDP field to the session structure that is specified by the value of the session parameter (sdp_session_t) using the values of the name, port, portcount, protocol, and format parameters. The format parameter is a string that holds one or more values, such as the string 0 32 97.

This function creates a new media structure and returns a pointer to that structure in the media parameter. Functions that add SDP fields to the media structure use this pointer.

Return Values: The sdp_add_media() function returns 0 when the function completes successfully. When mandatory parameters are not present, the function returns EINVAL. When memory allocation fails, the function returns ENOMEM. The value of errno does not change in the event of an error.