Add initialization and cleanup functions for Winsock

Originally committed as revision 10040 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Ramiro Polla
2007-08-09 23:39:05 +00:00
parent 7c04134fa1
commit 1642cb6b2e
3 changed files with 25 additions and 0 deletions

View File

@@ -321,6 +321,9 @@ static int udp_open(URLContext *h, const char *uri, int flags)
udp_set_remote_url(h, uri);
}
if(!ff_network_init())
return AVERROR(EIO);
#ifndef CONFIG_IPV6
udp_fd = socket(AF_INET, SOCK_DGRAM, 0);
if (udp_fd < 0)
@@ -472,6 +475,7 @@ static int udp_close(URLContext *h)
udp_ipv6_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);
#endif
closesocket(s->udp_fd);
ff_network_close();
av_free(s);
return 0;
}