45 #define RTP_TX_BUF_SIZE (64 * 1024)
46 #define RTP_RX_BUF_SIZE (128 * 1024)
73 path,
sizeof(path), uri);
78 ff_url_join(buf,
sizeof(buf),
"udp",
NULL, hostname, port + 1,
"%s", path);
99 vsnprintf(buf1,
sizeof(buf1), fmt, ap);
105 const char *hostname,
int port,
106 int local_port,
int ttl,
107 int max_packet_size,
int connect)
111 url_add_option(buf, buf_size,
"localport=%d", local_port);
113 url_add_option(buf, buf_size,
"ttl=%d", ttl);
114 if (max_packet_size >=0)
115 url_add_option(buf, buf_size,
"pkt_size=%d", max_packet_size);
117 url_add_option(buf, buf_size,
"connect=1");
140 int rtp_port, rtcp_port,
142 local_rtp_port, local_rtcp_port, max_packet_size;
149 path,
sizeof(path), uri);
152 rtcp_port = rtp_port+1;
154 local_rtcp_port = -1;
155 max_packet_size = -1;
158 p = strchr(uri,
'?');
161 ttl = strtol(buf,
NULL, 10);
164 rtcp_port = strtol(buf,
NULL, 10);
167 local_rtp_port = strtol(buf,
NULL, 10);
170 local_rtp_port = strtol(buf,
NULL, 10);
173 local_rtcp_port = strtol(buf,
NULL, 10);
176 max_packet_size = strtol(buf,
NULL, 10);
179 connect = strtol(buf,
NULL, 10);
184 hostname, rtp_port, local_rtp_port, ttl, max_packet_size,
188 if (local_rtp_port>=0 && local_rtcp_port<0)
192 hostname, rtcp_port, local_rtcp_port, ttl, max_packet_size,
220 struct pollfd p[2] = {{s->
rtp_fd, POLLIN, 0}, {s->
rtcp_fd, POLLIN, 0}};
229 if (p[1].revents & POLLIN) {
230 from_len =
sizeof(from);
231 len = recvfrom (s->
rtcp_fd, buf, size, 0,
232 (
struct sockaddr *)&from, &from_len);
242 if (p[0].revents & POLLIN) {
243 from_len =
sizeof(from);
244 len = recvfrom (s->
rtp_fd, buf, size, 0,
245 (
struct sockaddr *)&from, &from_len);
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.
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_rtp_get_rtcp_file_handle(URLContext *h)
Get the file handle for the RTCP socket.
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) ...
int ffurl_get_file_handle(URLContext *h)
Return the file descriptor associated with this URL.
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
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...
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