68 path,
sizeof(path), uri);
73 ff_url_join(buf,
sizeof(buf),
"udp",
NULL, hostname, port + 1,
"%s", path);
94 vsnprintf(buf1,
sizeof(buf1), fmt, ap);
100 const char *hostname,
int port,
101 int local_port,
int ttl,
102 int max_packet_size,
int connect)
106 url_add_option(buf, buf_size,
"localport=%d", local_port);
108 url_add_option(buf, buf_size,
"ttl=%d", ttl);
109 if (max_packet_size >=0)
110 url_add_option(buf, buf_size,
"pkt_size=%d", max_packet_size);
112 url_add_option(buf, buf_size,
"connect=1");
135 int rtp_port, rtcp_port,
137 local_rtp_port, local_rtcp_port, max_packet_size;
144 path,
sizeof(path), uri);
147 rtcp_port = rtp_port+1;
149 local_rtcp_port = -1;
150 max_packet_size = -1;
153 p = strchr(uri,
'?');
156 ttl = strtol(buf,
NULL, 10);
159 rtcp_port = strtol(buf,
NULL, 10);
162 local_rtp_port = strtol(buf,
NULL, 10);
165 local_rtp_port = strtol(buf,
NULL, 10);
168 local_rtcp_port = strtol(buf,
NULL, 10);
171 max_packet_size = strtol(buf,
NULL, 10);
174 connect = strtol(buf,
NULL, 10);
179 hostname, rtp_port, local_rtp_port, ttl, max_packet_size,
183 if (local_rtp_port>=0 && local_rtcp_port<0)
187 hostname, rtcp_port, local_rtcp_port, ttl, max_packet_size,
215 struct pollfd p[2] = {{s->
rtp_fd, POLLIN, 0}, {s->
rtcp_fd, POLLIN, 0}};
224 if (p[1].revents & POLLIN) {
225 from_len =
sizeof(from);
226 len = recvfrom (s->
rtcp_fd, buf, size, 0,
227 (
struct sockaddr *)&from, &from_len);
237 if (p[0].revents & POLLIN) {
238 from_len =
sizeof(from);
239 len = recvfrom (s->
rtp_fd, buf, size, 0,
240 (
struct sockaddr *)&from, &from_len);
319 int *hs = *handles =
av_malloc(
sizeof(**handles) * 2);
void av_url_split(char *proto, int proto_size, char *authorization, int authorization_size, char *hostname, int hostname_size, int *port_ptr, char *path, int path_size, const char *url)
Split a URL string into components.
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int ff_rtp_get_local_rtp_port(URLContext *h)
Return the local rtp port used by the RTP connection.
#define URL_PROTOCOL_FLAG_NETWORK
int ffurl_write(URLContext *h, const unsigned char *buf, int size)
Write size bytes from buf to the resource accessed by h.
int is_streamed
true if streamed (no seek possible), default = false
AVIOInterruptCB interrupt_callback
static void build_udp_url(char *buf, int buf_size, const char *hostname, int port, int local_port, int ttl, int max_packet_size, int connect)
static int rtp_write(URLContext *h, const uint8_t *buf, int size)
static int rtp_close(URLContext *h)
miscellaneous OS support macros and functions.
int ff_udp_get_local_port(URLContext *h)
Return the local port used by the UDP connection.
int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
Attempt to find a specific tag in a URL.
int ff_udp_set_remote_url(URLContext *h, const char *uri)
If no filename is given to av_open_input_file because you want to get the local port first...
static int rtp_read(URLContext *h, uint8_t *buf, int size)
static int rtp_open(URLContext *h, const char *uri, int flags)
url syntax: rtp://host:port[?option=val...] option: 'ttl=n' : set the ttl value (for multicast only) ...
static int rtp_get_multi_file_handle(URLContext *h, int **handles, int *numhandles)
int ffurl_get_file_handle(URLContext *h)
Return the file descriptor associated with this URL.
int ff_check_interrupt(AVIOInterruptCB *cb)
Check if the user has requested to interrup a blocking function associated with cb.
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
static av_printf_format(3, 4)
add option to url of the form: "http://host:port/path?option1=val1&option2=val2...
size_t av_strlcat(char *dst, const char *src, size_t size)
Append the string src to the string dst, but to a total length of no more than size - 1 bytes...
#define RTP_PT_IS_RTCP(x)
int ffurl_close(URLContext *h)
Close the resource accessed by the URLContext h, and free the memory used by it.
static int rtp_get_file_handle(URLContext *h)
int ffurl_open(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create an URLContext for accessing to the resource indicated by url, and open it. ...
int ff_rtp_get_local_rtcp_port(URLContext *h)
Return the local rtcp port used by the RTP connection.
URLProtocol ff_rtp_protocol
int max_packet_size
if non zero, the stream is packetized with this max packet size
unbuffered private I/O API
int ff_rtp_set_remote_url(URLContext *h, const char *uri)
If no filename is given to av_open_input_file because you want to get the local port first...
struct RTPContext RTPContext