Mercurial > libavformat.hg
comparison tcp.c @ 5757:b1a108ca71c5 libavformat
Don't explicitly initialize networking in the tcp and udp protocols
Networking is always initialized when opening protocols.
author | mstorsjo |
---|---|
date | Fri, 05 Mar 2010 22:38:48 +0000 |
parents | 0980c09b05c1 |
children | 7a123cc24a81 |
comparison
equal
deleted
inserted
replaced
5756:7c7fe75728dd | 5757:b1a108ca71c5 |
---|---|
41 int fd_max, ret; | 41 int fd_max, ret; |
42 struct timeval tv; | 42 struct timeval tv; |
43 socklen_t optlen; | 43 socklen_t optlen; |
44 char hostname[1024],proto[1024],path[1024]; | 44 char hostname[1024],proto[1024],path[1024]; |
45 char portstr[10]; | 45 char portstr[10]; |
46 | |
47 if(!ff_network_init()) | |
48 return AVERROR(EIO); | |
49 | 46 |
50 url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), | 47 url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), |
51 &port, path, sizeof(path), uri); | 48 &port, path, sizeof(path), uri); |
52 if (strcmp(proto,"tcp") || port <= 0 || port >= 65536) | 49 if (strcmp(proto,"tcp") || port <= 0 || port >= 65536) |
53 return AVERROR(EINVAL); | 50 return AVERROR(EINVAL); |
190 | 187 |
191 static int tcp_close(URLContext *h) | 188 static int tcp_close(URLContext *h) |
192 { | 189 { |
193 TCPContext *s = h->priv_data; | 190 TCPContext *s = h->priv_data; |
194 closesocket(s->fd); | 191 closesocket(s->fd); |
195 ff_network_close(); | |
196 av_free(s); | 192 av_free(s); |
197 return 0; | 193 return 0; |
198 } | 194 } |
199 | 195 |
200 static int tcp_get_file_handle(URLContext *h) | 196 static int tcp_get_file_handle(URLContext *h) |