RFC 4566-compliant SDP implementation.
More...
#include <smolrtsp/priv/compiler_attrs.h>
#include <smolrtsp/writer.h>
#include <slice99.h>
Go to the source code of this file.
|
| #define | SMOLRTSP_SDP_DESCRIBE(ret, w, ...) SMOLRTSP_PRIV_SDP_DESCRIBE(ret, w, __VA_ARGS__) |
| | Writes a sequence of SDP lines to w.
|
| |
|
#define | SMOLRTSP_SDP_VERSION 'v' |
| | Protocol Version (v=).
|
| |
|
#define | SMOLRTSP_SDP_ORIGIN 'o' |
| | Origin (o=).
|
| |
|
#define | SMOLRTSP_SDP_SESSION_NAME 's' |
| | Session Name (s=).
|
| |
|
#define | SMOLRTSP_SDP_INFO 'i' |
| | Session Information (i=).
|
| |
|
#define | SMOLRTSP_SDP_URI 'u' |
| | URI (u=).
|
| |
|
#define | SMOLRTSP_SDP_EMAIL 'e' |
| | Email Address (e=).
|
| |
|
#define | SMOLRTSP_SDP_PHONE 'p' |
| | Phone Number (p=).
|
| |
|
#define | SMOLRTSP_SDP_CONNECTION 'c' |
| | Connection Data (c=).
|
| |
|
#define | SMOLRTSP_SDP_BANDWIDTH 'b' |
| | Bandwidth (b=).
|
| |
|
#define | SMOLRTSP_SDP_TIME 't' |
| | Timing (t=).
|
| |
|
#define | SMOLRTSP_SDP_REPEAT 'r' |
| | Repeat Times (r=).
|
| |
|
#define | SMOLRTSP_SDP_TIME_ZONES 'z' |
| | Time Zones (z=).
|
| |
|
#define | SMOLRTSP_SDP_ENCRYPTION_KEYS 'k' |
| | Encryption Keys (k=).
|
| |
|
#define | SMOLRTSP_SDP_ATTR 'a' |
| | Attributes (a=).
|
| |
|
#define | SMOLRTSP_SDP_MEDIA 'm' |
| | Media Descriptions (m=).
|
| |
|
|
typedef char | SmolRTSP_SdpType |
| | An SDP type (one character).
|
| |
RFC 4566-compliant SDP implementation.
◆ SMOLRTSP_SDP_DESCRIBE
| #define SMOLRTSP_SDP_DESCRIBE |
( |
|
ret, |
|
|
|
w, |
|
|
|
... |
|
) |
| SMOLRTSP_PRIV_SDP_DESCRIBE(ret, w, __VA_ARGS__) |
Writes a sequence of SDP lines to w.
- Parameters
-
| [out] | ret | The variable name of type ssize_t that will be incremented with a number of bytes written to w. |
| [out] | w | The variable name of type SmolRTSP_Writer to be provided with SDP data. |
The rest of arguments represent a non-empty sequence of comma-separated tuples (ty, fmt, ...), where
ty is an SDP line type (such as SMOLRTSP_SDP_VERSION),
fmt is a printf-like format string,
- and
... are the fmt parameters (may be omitted).
Under the hood, SMOLRTSP_SDP_DESCRIBE just generates a smolrtsp_sdp_printf function invocation for each variadic argument.
Examples
char buffer[256] = {0};
ssize_t ret = 0;
ret, sdp,
AUDIO_RTP_PAYLOAD_TYPE),
const char *expected =
"v=0\r\n"
"o=SmolRTSP 3855320066 3855320129 IN IP4 0.0.0.0\r\n"
"s=SmolRTSP test\r\n"
"c=IN IP4 0.0.0.0\r\n"
"t=0 0\r\n"
"m=audio 123 RTP/AVP 456\r\n"
"a=control:audio\r\n";
assert((ssize_t)strlen(expected) == ret);
assert(strcmp(expected, buffer) == 0);
#define SMOLRTSP_SDP_TIME
Timing (t=).
Definition sdp.h:191
#define SMOLRTSP_SDP_SESSION_NAME
Session Name (s=).
Definition sdp.h:156
#define SMOLRTSP_SDP_ATTR
Attributes (a=).
Definition sdp.h:211
#define SMOLRTSP_SDP_CONNECTION
Connection Data (c=).
Definition sdp.h:181
#define SMOLRTSP_SDP_MEDIA
Media Descriptions (m=).
Definition sdp.h:216
#define SMOLRTSP_SDP_ORIGIN
Origin (o=).
Definition sdp.h:151
#define SMOLRTSP_SDP_VERSION
Protocol Version (v=).
Definition sdp.h:146
#define SMOLRTSP_SDP_DESCRIBE(ret, w,...)
Writes a sequence of SDP lines to w.
Definition sdp.h:113
SmolRTSP_Writer smolrtsp_string_writer(char *buffer) SMOLRTSP_PRIV_MUST_USE
A writer that invokes strncat on a provided buffer.
◆ smolrtsp_sdp_printf()
| ssize_t smolrtsp_sdp_printf |
( |
SmolRTSP_Writer |
w, |
|
|
SmolRTSP_SdpType |
ty, |
|
|
const char *restrict |
fmt, |
|
|
|
... |
|
) |
| |
Printfs a single SDP line to w.
- Parameters
-
| [out] | w | The writer to be provided with SDP data. |
| [in] | ty | The type of the SDP line. |
| [in] | fmt | The printf-like format string. |
- Returns
- The number of bytes written or a negative value on error.
- Precondition
w.self && w.vptr
-
fmt != NULL
◆ SmolRTSP_SdpLine_serialize()
| ssize_t SmolRTSP_SdpLine_serialize |
( |
const SmolRTSP_SdpLine *restrict |
self, |
|
|
SmolRTSP_Writer |
w |
|
) |
| |
Serialises self into w.
- Parameters
-
| [in] | self | The instance to be serialised. |
| [in] | w | The writer to be provided with serialised data. |
- Returns
- The number of bytes written or a negative value on error.
- Precondition
self != NULL
-
w.self && w.vptr