73 char host[1024], path[1024], url[1024], announce_addr[50] =
"";
75 int port = 9875, base_port = 5004, i, pos = 0, same_port = 0, ttl = 255;
79 socklen_t addrlen =
sizeof(localaddr);
93 option_list = strrchr(path,
'?');
97 port = strtol(buf,
NULL, 10);
100 same_port = strtol(buf,
NULL, 10);
103 ttl = strtol(buf,
NULL, 10);
106 av_strlcpy(announce_addr, buf,
sizeof(announce_addr));
110 if (!announce_addr[0]) {
118 if (ai->ai_family == AF_INET) {
120 av_strlcpy(announce_addr,
"224.2.127.254",
sizeof(announce_addr));
121 #if HAVE_STRUCT_SOCKADDR_IN6
122 }
else if (ai->ai_family == AF_INET6) {
126 av_strlcpy(announce_addr,
"ff0e::2:7ffe",
sizeof(announce_addr));
131 "address family\n", host);
161 av_strlcpy(contexts[i]->filename, url,
sizeof(contexts[i]->filename));
168 "?ttl=%d&connect=1", ttl);
177 if (getsockname(udp_fd, (
struct sockaddr*) &localaddr, &addrlen)) {
182 #
if HAVE_STRUCT_SOCKADDR_IN6
196 sap->
ann[pos] = (1 << 5);
197 #if HAVE_STRUCT_SOCKADDR_IN6
199 sap->
ann[pos] |= 0x10;
206 memcpy(&sap->
ann[pos], &((
struct sockaddr_in*)&localaddr)->sin_addr,
207 sizeof(
struct in_addr));
208 pos +=
sizeof(
struct in_addr);
209 #if HAVE_STRUCT_SOCKADDR_IN6
211 memcpy(&sap->
ann[pos], &((
struct sockaddr_in6*)&localaddr)->sin6_addr,
212 sizeof(
struct in6_addr));
213 pos +=
sizeof(
struct in6_addr);
218 pos += strlen(&sap->
ann[pos]) + 1;
227 pos += strlen(&sap->
ann[pos]);
253 if (ret < 0 && ret !=
AVERROR(ECONNREFUSED))
264 .priv_data_size =
sizeof(
struct SAPState),