*/
/**
- * @file libavformat/udp.c
+ * @file
* UDP protocol
*/
#define _BSD_SOURCE /* Needed for using struct ip_mreq with recent glibc */
#include "avformat.h"
#include <unistd.h>
+#include "internal.h"
#include "network.h"
#include "os_support.h"
#if HAVE_SYS_SELECT_H
* 'pkt_size=n' : set max packet size
* 'reuse=1' : enable reusing the socket
*
- * @param s1 media file context
+ * @param h media file context
* @param uri of the remote server
* @return zero if no error.
*/
char hostname[256];
int port;
- ff_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
+ av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
/* set the destination address */
s->dest_addr_len = udp_set_url(&s->dest_addr, hostname, port);
}
/**
- * Return the local port used by the UDP connexion
- * @param s1 media file context
+ * Return the local port used by the UDP connection
+ * @param h media file context
* @return the local port number
*/
int udp_get_local_port(URLContext *h)
}
/* fill the dest addr */
- ff_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
+ av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
- /* XXX: fix ff_url_split */
+ /* XXX: fix av_url_split */
if (hostname[0] == '\0' || hostname[0] == '?') {
/* only accepts null hostname if input */
if (flags & URL_WRONLY)
tv.tv_sec = 0;
tv.tv_usec = 100 * 1000;
ret = select(s->udp_fd + 1, &rfds, NULL, NULL, &tv);
- if (ret < 0)
+ if (ret < 0) {
+ if (ff_neterrno() == FF_NETERROR(EINTR))
+ continue;
return AVERROR(EIO);
+ }
if (!(ret > 0 && FD_ISSET(s->udp_fd, &rfds)))
continue;
len = recv(s->udp_fd, buf, size, 0);
return len;
}
-static int udp_write(URLContext *h, uint8_t *buf, int size)
+static int udp_write(URLContext *h, const uint8_t *buf, int size)
{
UDPContext *s = h->priv_data;
int ret;