+ const int payload_type = 33;
+
+ static const struct { const char *access; const char *fmt; } fmts[] =
+ {
+ { "udp", "udp mpeg" },
+ { "rtp", "RTP/AVP %d" },
+ { "udplite", "UDPLite/RTP/AVP %d" },
+ /* Currently unsupported access outputs: */
+ { "dccp", "DCCP/RTP/AVP %d" },
+ { "tcp", "TCP/RTP/AVP %d" },
+ /* TLS/DTLS variants (none implemented). */
+ { "dtls", "UDP/TLS/RTP/AVP %d" },
+ { "dtlslite", "UDPLite/TLS/RTP/AVP %d" },
+ { "dccps", "DCCP/TLS/RTP/AVP %d" },
+ { "tls", "TCP/TLS/RTP/AVP %d" },
+ /* SRTP (not implemented) */
+ { "srtp", "RTP/SAVP %d" },
+ { "sudplite", "UDPLite/RTP/SAVP %d" },
+ { "sdccp", "DCCP/RTP/SAVP %d" },
+ { "stcp", "TCP/RTP/SAVP %d" },
+ { NULL, NULL }
+ };
+ const char *psz_sdp_fmt = NULL;
+ char *fmt, *src, *dst;
+ int sport, dport;
+
+ for (unsigned i = 0; fmts[i].access != NULL; i++)
+ if (strcasecmp (fmts[i].access, psz_access) == 0)
+ {
+ psz_sdp_fmt = fmts[i].fmt;
+ break;
+ }
+
+ src = var_GetNonEmptyString (p_access, "src-addr");
+ dst = var_GetNonEmptyString (p_access, "dst-addr");
+ sport = var_GetInteger (p_access, "src-port");
+ dport = var_GetInteger (p_access, "dst-port");
+ msg_Err (p_stream, "%p, %p, %d, %d", src, dst, sport, dport);
+
+ if ((psz_sdp_fmt == NULL)
+ || (asprintf (&fmt, psz_sdp_fmt, payload_type) == -1))
+ fmt = NULL;
+
+ msg_Dbg( p_stream, "SAP advertized format: %s", fmt);
+ if ((fmt == NULL) || ((src == NULL) && (dst == NULL)))
+ {
+ msg_Err (p_access, "SAP announces not supported for access %s",
+ psz_access);
+ free (fmt);
+ free (src);
+ free (dst);
+ goto nosap;
+ }
+
+ p_session = sout_AnnounceSessionCreate (VLC_OBJECT (p_stream),
+ SOUT_CFG_PREFIX);
+ sout_SessionSetMedia (VLC_OBJECT (p_stream), p_session, fmt,
+ src, sport, dst, dport);