72 char host[1024], path[1024], url[1024], announce_addr[50] =
"";
74 int port = 9875, base_port = 5004, i, pos = 0, same_port = 0, ttl = 255;
78 socklen_t addrlen =
sizeof(localaddr);
92 option_list = strrchr(path,
'?');
96 port = strtol(buf,
NULL, 10);
99 same_port = strtol(buf,
NULL, 10);
102 ttl = strtol(buf,
NULL, 10);
105 av_strlcpy(announce_addr, buf,
sizeof(announce_addr));
109 if (!announce_addr[0]) {
117 if (ai->ai_family == AF_INET) {
119 av_strlcpy(announce_addr,
"224.2.127.254",
sizeof(announce_addr));
120 #if HAVE_STRUCT_SOCKADDR_IN6
121 }
else if (ai->ai_family == AF_INET6) {
125 av_strlcpy(announce_addr,
"ff0e::2:7ffe",
sizeof(announce_addr));
130 "address family\n", host);
162 av_strlcpy(contexts[i]->filename, url,
sizeof(contexts[i]->filename));
169 "?ttl=%d&connect=1", ttl);
178 if (getsockname(udp_fd, (
struct sockaddr*) &localaddr, &addrlen)) {
183 #
if HAVE_STRUCT_SOCKADDR_IN6
197 sap->
ann[pos] = (1 << 5);
198 #if HAVE_STRUCT_SOCKADDR_IN6
200 sap->
ann[pos] |= 0x10;
207 memcpy(&sap->
ann[pos], &((
struct sockaddr_in*)&localaddr)->sin_addr,
208 sizeof(
struct in_addr));
209 pos +=
sizeof(
struct in_addr);
210 #if HAVE_STRUCT_SOCKADDR_IN6
212 memcpy(&sap->
ann[pos], &((
struct sockaddr_in6*)&localaddr)->sin6_addr,
213 sizeof(
struct in6_addr));
214 pos +=
sizeof(
struct in6_addr);
219 pos += strlen(&sap->
ann[pos]) + 1;
228 pos += strlen(&sap->
ann[pos]);
254 if (ret < 0 && ret !=
AVERROR(ECONNREFUSED))
265 .priv_data_size =
sizeof(
struct SAPState),