42 #define OFFSET(x) offsetof(TCPContext, x)
43 #define D AV_OPT_FLAG_DECODING_PARAM
44 #define E AV_OPT_FLAG_ENCODING_PARAM
47 {
"timeout",
"set timeout of socket I/O operations",
OFFSET(rw_timeout),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
D|
E },
48 {
"listen_timeout",
"set connection awaiting timeout",
OFFSET(listen_timeout),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
D|
E },
62 struct addrinfo hints = { 0 }, *ai, *cur_ai;
68 char hostname[1024],proto[1024],path[1024];
72 av_url_split(proto,
sizeof(proto), NULL, 0, hostname,
sizeof(hostname),
73 &port, path,
sizeof(path), uri);
74 if (strcmp(proto,
"tcp"))
76 if (port <= 0 || port >= 65536) {
84 s->
listen = strtol(buf, &endptr, 10);
102 snprintf(portstr,
sizeof(portstr),
"%d", port);
111 "Failed to resolve hostname %s: %s\n",
121 cur_ai->ai_protocol);
150 if (cur_ai->ai_next) {
152 cur_ai = cur_ai->ai_next;
175 ret = recv(s->
fd, buf, size, 0);
206 return shutdown(s->
fd, how);
231 .priv_data_class = &tcp_context_class,