- session_descriptor_t *p_session;
- announce_method_t *p_method = sout_SAPMethod ();
- const int payload_type = 33;
-
- static const struct { const char *access; const char *fmt; } fmts[] =
- {
- /* TLS/DTLS variants (none implemented): */
- { "dtlslite", "UDPLite/TLS/RTP/AVP %d" },
- { "dtls", "UDP/TLS/RTP/AVP %d" },
- { "dccps", "DCCP/TLS/RTP/AVP %d" },
- { "tls", "TCP/TLS/RTP/AVP %d" },
- /* Plain text: */
- { "udplite", "UDPLite/RTP/AVP %d" },
- { "udp", "udp mpeg" },
- { "rtp", "RTP/AVP %d" },
- /* Currently unsupported access outputs: */
- { "dccp", "DCCP/RTP/AVP %d" },
- { "tcp", "TCP/RTP/AVP %d" },
- /* SRTP (none 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 (strncasecmp (fmts[i].access, psz_access, strlen (fmts[i].access)) == 0)
- {
- psz_sdp_fmt = fmts[i].fmt;
- break;
- }
+ /* 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)
+ {
+ memcpy (&dst, res->ai_addr, dstlen = res->ai_addrlen);
+ freeaddrinfo (res);
+ }