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.
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