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",
"timeout of socket i/o operations",
OFFSET(rw_timeout),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
D|
E },
48 {
"listen_timeout",
"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) {
97 snprintf(portstr,
sizeof(portstr),
"%d", port);
106 "Failed to resolve hostname %s: %s\n",
116 cur_ai->ai_protocol);
145 if (cur_ai->ai_next) {
147 cur_ai = cur_ai->ai_next;
170 ret = recv(s->
fd, buf, size, 0);
184 ret = send(s->
fd, buf, size, 0);
201 return shutdown(s->
fd, how);
226 .priv_data_class = &tcp_context_class,