Mercurial > libavformat.hg
comparison tcp.c @ 2351:b9a881c0967e libavformat
Add initialization and cleanup functions for Winsock
author | ramiro |
---|---|
date | Thu, 09 Aug 2007 23:39:05 +0000 |
parents | 96bab3153939 |
children | 13b65f62e3a6 |
comparison
equal
deleted
inserted
replaced
2350:a0fb5ef1ec7c | 2351:b9a881c0967e |
---|---|
50 return AVERROR(ENOMEM); | 50 return AVERROR(ENOMEM); |
51 h->priv_data = s; | 51 h->priv_data = s; |
52 | 52 |
53 if (port <= 0 || port >= 65536) | 53 if (port <= 0 || port >= 65536) |
54 goto fail; | 54 goto fail; |
55 | |
56 if(!ff_network_init()) | |
57 return AVERROR(EIO); | |
55 | 58 |
56 dest_addr.sin_family = AF_INET; | 59 dest_addr.sin_family = AF_INET; |
57 dest_addr.sin_port = htons(port); | 60 dest_addr.sin_port = htons(port); |
58 if (resolve_host(&dest_addr.sin_addr, hostname) < 0) | 61 if (resolve_host(&dest_addr.sin_addr, hostname) < 0) |
59 goto fail; | 62 goto fail; |
172 | 175 |
173 static int tcp_close(URLContext *h) | 176 static int tcp_close(URLContext *h) |
174 { | 177 { |
175 TCPContext *s = h->priv_data; | 178 TCPContext *s = h->priv_data; |
176 closesocket(s->fd); | 179 closesocket(s->fd); |
180 ff_network_close(); | |
177 av_free(s); | 181 av_free(s); |
178 return 0; | 182 return 0; |
179 } | 183 } |
180 | 184 |
181 URLProtocol tcp_protocol = { | 185 URLProtocol tcp_protocol = { |