avio: AVIO_ prefixes for URL_ open flags.

This commit is contained in:
Anton Khirnov
2011-04-04 20:11:19 +02:00
parent 3d42d4937b
commit f87b1b373a
26 changed files with 92 additions and 65 deletions

View File

@ -317,7 +317,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
h->is_streamed = 1;
h->max_packet_size = 1472;
is_output = (flags & URL_WRONLY);
is_output = (flags & AVIO_WRONLY);
s = av_mallocz(sizeof(UDPContext));
if (!s)
@ -360,14 +360,14 @@ static int udp_open(URLContext *h, const char *uri, int flags)
/* XXX: fix av_url_split */
if (hostname[0] == '\0' || hostname[0] == '?') {
/* only accepts null hostname if input */
if (flags & URL_WRONLY)
if (flags & AVIO_WRONLY)
goto fail;
} else {
if (ff_udp_set_remote_url(h, uri) < 0)
goto fail;
}
if (s->is_multicast && !(h->flags & URL_WRONLY))
if (s->is_multicast && !(h->flags & AVIO_WRONLY))
s->local_port = port;
udp_fd = udp_socket_create(s, &my_addr, &len);
if (udp_fd < 0)
@ -384,7 +384,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
/* the bind is needed to give a port to the socket now */
/* if multicast, try the multicast address bind first */
if (s->is_multicast && !(h->flags & URL_WRONLY)) {
if (s->is_multicast && !(h->flags & AVIO_WRONLY)) {
bind_ret = bind(udp_fd,(struct sockaddr *)&s->dest_addr, len);
}
/* bind to the local address if not multicast or if the multicast
@ -397,7 +397,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
s->local_port = udp_port(&my_addr, len);
if (s->is_multicast) {
if (h->flags & URL_WRONLY) {
if (h->flags & AVIO_WRONLY) {
/* output */
if (udp_set_multicast_ttl(udp_fd, s->ttl, (struct sockaddr *)&s->dest_addr) < 0)
goto fail;
@ -446,7 +446,7 @@ static int udp_read(URLContext *h, uint8_t *buf, int size)
UDPContext *s = h->priv_data;
int ret;
if (!(h->flags & URL_FLAG_NONBLOCK)) {
if (!(h->flags & AVIO_FLAG_NONBLOCK)) {
ret = ff_network_wait_fd(s->udp_fd, 0);
if (ret < 0)
return ret;
@ -460,7 +460,7 @@ static int udp_write(URLContext *h, const uint8_t *buf, int size)
UDPContext *s = h->priv_data;
int ret;
if (!(h->flags & URL_FLAG_NONBLOCK)) {
if (!(h->flags & AVIO_FLAG_NONBLOCK)) {
ret = ff_network_wait_fd(s->udp_fd, 1);
if (ret < 0)
return ret;
@ -480,7 +480,7 @@ static int udp_close(URLContext *h)
{
UDPContext *s = h->priv_data;
if (s->is_multicast && !(h->flags & URL_WRONLY))
if (s->is_multicast && !(h->flags & AVIO_WRONLY))
udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);
closesocket(s->udp_fd);
av_free(s);