* option: 'multicast=1' : enable multicast
* 'ttl=n' : set the ttl value (for multicast only)
* 'localport=n' : set the local port
+ * 'pkt_size=n' : set max packet size
*
* @param s1 media file context
* @param uri of the remote server
char hostname[256];
int port;
- url_split(NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
+ url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
/* set the destination address */
if (resolve_host(&s->dest_addr.sin_addr, hostname) < 0)
- return -EIO;
+ return AVERROR_IO;
s->dest_addr.sin_family = AF_INET;
s->dest_addr.sin_port = htons(port);
return 0;
char buf[256];
h->is_streamed = 1;
+ h->max_packet_size = 1472;
is_output = (flags & URL_WRONLY);
h->priv_data = s;
s->ttl = 16;
s->is_multicast = 0;
+ s->local_port = 0;
p = strchr(uri, '?');
if (p) {
s->is_multicast = find_info_tag(buf, sizeof(buf), "multicast", p);
if (find_info_tag(buf, sizeof(buf), "localport", p)) {
s->local_port = strtol(buf, NULL, 10);
}
+ if (find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
+ h->max_packet_size = strtol(buf, NULL, 10);
+ }
}
/* fill the dest addr */
- url_split(NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
+ url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
/* XXX: fix url_split */
if (hostname[0] == '\0' || hostname[0] == '?') {
}
s->udp_fd = udp_fd;
- h->max_packet_size = 1472; /* XXX: probe it ? */
return 0;
fail:
if (udp_fd >= 0)
close(udp_fd);
#endif
av_free(s);
- return -EIO;
+ return AVERROR_IO;
}
-static int udp_read(URLContext *h, UINT8 *buf, int size)
+static int udp_read(URLContext *h, uint8_t *buf, int size)
{
UDPContext *s = h->priv_data;
struct sockaddr_in from;
(struct sockaddr *)&from, &from_len);
if (len < 0) {
if (errno != EAGAIN && errno != EINTR)
- return -EIO;
+ return AVERROR_IO;
} else {
break;
}
return len;
}
-static int udp_write(URLContext *h, UINT8 *buf, int size)
+static int udp_write(URLContext *h, uint8_t *buf, int size)
{
UDPContext *s = h->priv_data;
int ret;
sizeof (s->dest_addr));
if (ret < 0) {
if (errno != EINTR && errno != EAGAIN)
- return -EIO;
+ return AVERROR_IO;
} else {
break;
}