- session_descriptor_t *p_session;
- announce_method_t *p_method = sout_SAPMethod ();
- vlc_url_t url;
- 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)))
+ /* Create the SDP */
+ static const struct addrinfo hints = {
+ .ai_family = AF_UNSPEC,
+ .ai_socktype = SOCK_DGRAM,
+ .ai_protocol = 0,
+ .ai_flags = AI_NUMERICHOST | AI_NUMERICSERV
+ };
+ char *shost = var_GetNonEmptyString (p_access, "src-addr");
+ char *dhost = var_GetNonEmptyString (p_access, "dst-addr");
+ int sport = var_GetInteger (p_access, "src-port");
+ int dport = var_GetInteger (p_access, "dst-port");
+ char port[6];
+ struct sockaddr_storage src, dst;
+ socklen_t srclen = 0, dstlen = 0;
+ struct addrinfo *res;
+
+ snprintf (port, sizeof (port), "%d", dport);
+ if (getaddrinfo (dhost, port, &hints, &res) == 0)