Libav
rtpproto.c
Go to the documentation of this file.
1 /*
2  * RTP network protocol
3  * Copyright (c) 2002 Fabrice Bellard
4  *
5  * This file is part of Libav.
6  *
7  * Libav is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * Libav is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
27 #include "libavutil/parseutils.h"
28 #include "libavutil/avstring.h"
29 #include "avformat.h"
30 #include "avio_internal.h"
31 #include "rtp.h"
32 #include "rtpproto.h"
33 #include "url.h"
34 
35 #include <stdarg.h>
36 #include "internal.h"
37 #include "network.h"
38 #include "os_support.h"
39 #include <fcntl.h>
40 #if HAVE_POLL_H
41 #include <sys/poll.h>
42 #endif
43 
44 typedef struct RTPContext {
49  struct sockaddr_storage last_rtp_source, last_rtcp_source;
51 } RTPContext;
52 
63 int ff_rtp_set_remote_url(URLContext *h, const char *uri)
64 {
65  RTPContext *s = h->priv_data;
66  char hostname[256];
67  int port, rtcp_port;
68  const char *p;
69 
70  char buf[1024];
71  char path[1024];
72 
73  av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port,
74  path, sizeof(path), uri);
75  rtcp_port = port + 1;
76 
77  p = strchr(uri, '?');
78  if (p) {
79  if (av_find_info_tag(buf, sizeof(buf), "rtcpport", p)) {
80  rtcp_port = strtol(buf, NULL, 10);
81  }
82  }
83 
84  ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, port, "%s", path);
86 
87  ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, rtcp_port, "%s", path);
89  return 0;
90 }
91 
92 static struct addrinfo* rtp_resolve_host(const char *hostname, int port,
93  int type, int family, int flags)
94 {
95  struct addrinfo hints = { 0 }, *res = 0;
96  int error;
97  char service[16];
98 
99  snprintf(service, sizeof(service), "%d", port);
100  hints.ai_socktype = type;
101  hints.ai_family = family;
102  hints.ai_flags = flags;
103  if ((error = getaddrinfo(hostname, service, &hints, &res))) {
104  res = NULL;
105  av_log(NULL, AV_LOG_ERROR, "rtp_resolve_host: %s\n", gai_strerror(error));
106  }
107 
108  return res;
109 }
110 
111 static int compare_addr(const struct sockaddr_storage *a,
112  const struct sockaddr_storage *b)
113 {
114  if (a->ss_family != b->ss_family)
115  return 1;
116  if (a->ss_family == AF_INET) {
117  return (((const struct sockaddr_in *)a)->sin_addr.s_addr !=
118  ((const struct sockaddr_in *)b)->sin_addr.s_addr);
119  }
120 
121 #if HAVE_STRUCT_SOCKADDR_IN6
122  if (a->ss_family == AF_INET6) {
123  const uint8_t *s6_addr_a = ((const struct sockaddr_in6 *)a)->sin6_addr.s6_addr;
124  const uint8_t *s6_addr_b = ((const struct sockaddr_in6 *)b)->sin6_addr.s6_addr;
125  return memcmp(s6_addr_a, s6_addr_b, 16);
126  }
127 #endif
128  return 1;
129 }
130 
131 static int get_port(const struct sockaddr_storage *ss)
132 {
133  if (ss->ss_family == AF_INET)
134  return ntohs(((const struct sockaddr_in *)ss)->sin_port);
135 #if HAVE_STRUCT_SOCKADDR_IN6
136  if (ss->ss_family == AF_INET6)
137  return ntohs(((const struct sockaddr_in6 *)ss)->sin6_port);
138 #endif
139  return 0;
140 }
141 
142 static void set_port(struct sockaddr_storage *ss, int port)
143 {
144  if (ss->ss_family == AF_INET)
145  ((struct sockaddr_in *)ss)->sin_port = htons(port);
146 #if HAVE_STRUCT_SOCKADDR_IN6
147  else if (ss->ss_family == AF_INET6)
148  ((struct sockaddr_in6 *)ss)->sin6_port = htons(port);
149 #endif
150 }
151 
152 static int rtp_check_source_lists(RTPContext *s, struct sockaddr_storage *source_addr_ptr)
153 {
154  int i;
155  if (s->nb_ssm_exclude_addrs) {
156  for (i = 0; i < s->nb_ssm_exclude_addrs; i++) {
157  if (!compare_addr(source_addr_ptr, s->ssm_exclude_addrs[i]))
158  return 1;
159  }
160  }
161  if (s->nb_ssm_include_addrs) {
162  for (i = 0; i < s->nb_ssm_include_addrs; i++) {
163  if (!compare_addr(source_addr_ptr, s->ssm_include_addrs[i]))
164  return 0;
165  }
166  return 1;
167  }
168  return 0;
169 }
170 
176 static av_printf_format(3, 4) void url_add_option(char *buf, int buf_size, const char *fmt, ...)
177 {
178  char buf1[1024];
179  va_list ap;
180 
181  va_start(ap, fmt);
182  if (strchr(buf, '?'))
183  av_strlcat(buf, "&", buf_size);
184  else
185  av_strlcat(buf, "?", buf_size);
186  vsnprintf(buf1, sizeof(buf1), fmt, ap);
187  av_strlcat(buf, buf1, buf_size);
188  va_end(ap);
189 }
190 
191 static void build_udp_url(char *buf, int buf_size,
192  const char *hostname, int port,
193  int local_port, int ttl,
194  int max_packet_size, int connect,
195  const char *include_sources,
196  const char *exclude_sources)
197 {
198  ff_url_join(buf, buf_size, "udp", NULL, hostname, port, NULL);
199  if (local_port >= 0)
200  url_add_option(buf, buf_size, "localport=%d", local_port);
201  if (ttl >= 0)
202  url_add_option(buf, buf_size, "ttl=%d", ttl);
203  if (max_packet_size >=0)
204  url_add_option(buf, buf_size, "pkt_size=%d", max_packet_size);
205  if (connect)
206  url_add_option(buf, buf_size, "connect=1");
207  if (include_sources && include_sources[0])
208  url_add_option(buf, buf_size, "sources=%s", include_sources);
209  if (exclude_sources && exclude_sources[0])
210  url_add_option(buf, buf_size, "block=%s", exclude_sources);
211 }
212 
213 static void rtp_parse_addr_list(URLContext *h, char *buf,
214  struct sockaddr_storage ***address_list_ptr,
215  int *address_list_size_ptr)
216 {
217  struct addrinfo *ai = NULL;
218  struct sockaddr_storage *source_addr;
219  char tmp = '\0', *p = buf, *next;
220 
221  /* Resolve all of the IPs */
222 
223  while (p && p[0]) {
224  next = strchr(p, ',');
225 
226  if (next) {
227  tmp = *next;
228  *next = '\0';
229  }
230 
231  ai = rtp_resolve_host(p, 0, SOCK_DGRAM, AF_UNSPEC, 0);
232  if (ai) {
233  source_addr = av_mallocz(sizeof(struct sockaddr_storage));
234  if (!source_addr)
235  break;
236 
237  memcpy(source_addr, ai->ai_addr, ai->ai_addrlen);
238  freeaddrinfo(ai);
239  dynarray_add(address_list_ptr, address_list_size_ptr, source_addr);
240  } else {
241  av_log(h, AV_LOG_WARNING, "Unable to resolve %s\n", p);
242  }
243 
244  if (next) {
245  *next = tmp;
246  p = next + 1;
247  } else {
248  p = NULL;
249  }
250  }
251 }
252 
273 static int rtp_open(URLContext *h, const char *uri, int flags)
274 {
275  RTPContext *s = h->priv_data;
276  int rtp_port, rtcp_port,
277  ttl, connect,
278  local_rtp_port, local_rtcp_port, max_packet_size;
279  char hostname[256], include_sources[1024] = "", exclude_sources[1024] = "";
280  char buf[1024];
281  char path[1024];
282  const char *p;
283 
284  av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &rtp_port,
285  path, sizeof(path), uri);
286  /* extract parameters */
287  ttl = -1;
288  rtcp_port = rtp_port+1;
289  local_rtp_port = -1;
290  local_rtcp_port = -1;
291  max_packet_size = -1;
292  connect = 0;
293 
294  p = strchr(uri, '?');
295  if (p) {
296  if (av_find_info_tag(buf, sizeof(buf), "ttl", p)) {
297  ttl = strtol(buf, NULL, 10);
298  }
299  if (av_find_info_tag(buf, sizeof(buf), "rtcpport", p)) {
300  rtcp_port = strtol(buf, NULL, 10);
301  }
302  if (av_find_info_tag(buf, sizeof(buf), "localport", p)) {
303  local_rtp_port = strtol(buf, NULL, 10);
304  }
305  if (av_find_info_tag(buf, sizeof(buf), "localrtpport", p)) {
306  local_rtp_port = strtol(buf, NULL, 10);
307  }
308  if (av_find_info_tag(buf, sizeof(buf), "localrtcpport", p)) {
309  local_rtcp_port = strtol(buf, NULL, 10);
310  }
311  if (av_find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
312  max_packet_size = strtol(buf, NULL, 10);
313  }
314  if (av_find_info_tag(buf, sizeof(buf), "connect", p)) {
315  connect = strtol(buf, NULL, 10);
316  }
317  if (av_find_info_tag(buf, sizeof(buf), "write_to_source", p)) {
318  s->write_to_source = strtol(buf, NULL, 10);
319  }
320  if (av_find_info_tag(buf, sizeof(buf), "sources", p)) {
321  av_strlcpy(include_sources, buf, sizeof(include_sources));
323  }
324  if (av_find_info_tag(buf, sizeof(buf), "block", p)) {
325  av_strlcpy(exclude_sources, buf, sizeof(exclude_sources));
327  }
328  }
329 
330  build_udp_url(buf, sizeof(buf),
331  hostname, rtp_port, local_rtp_port, ttl, max_packet_size,
332  connect, include_sources, exclude_sources);
333  if (ffurl_open(&s->rtp_hd, buf, flags, &h->interrupt_callback, NULL) < 0)
334  goto fail;
335  if (local_rtp_port>=0 && local_rtcp_port<0)
336  local_rtcp_port = ff_udp_get_local_port(s->rtp_hd) + 1;
337 
338  build_udp_url(buf, sizeof(buf),
339  hostname, rtcp_port, local_rtcp_port, ttl, max_packet_size,
340  connect, include_sources, exclude_sources);
341  if (ffurl_open(&s->rtcp_hd, buf, flags, &h->interrupt_callback, NULL) < 0)
342  goto fail;
343 
344  /* just to ease handle access. XXX: need to suppress direct handle
345  access */
348 
350  h->is_streamed = 1;
351  return 0;
352 
353  fail:
354  if (s->rtp_hd)
355  ffurl_close(s->rtp_hd);
356  if (s->rtcp_hd)
357  ffurl_close(s->rtcp_hd);
358  return AVERROR(EIO);
359 }
360 
361 static int rtp_read(URLContext *h, uint8_t *buf, int size)
362 {
363  RTPContext *s = h->priv_data;
364  int len, n, i;
365  struct pollfd p[2] = {{s->rtp_fd, POLLIN, 0}, {s->rtcp_fd, POLLIN, 0}};
366  int poll_delay = h->flags & AVIO_FLAG_NONBLOCK ? 0 : 100;
367  struct sockaddr_storage *addrs[2] = { &s->last_rtp_source, &s->last_rtcp_source };
368  socklen_t *addr_lens[2] = { &s->last_rtp_source_len, &s->last_rtcp_source_len };
369 
370  for(;;) {
372  return AVERROR_EXIT;
373  n = poll(p, 2, poll_delay);
374  if (n > 0) {
375  /* first try RTCP, then RTP */
376  for (i = 1; i >= 0; i--) {
377  if (!(p[i].revents & POLLIN))
378  continue;
379  *addr_lens[i] = sizeof(*addrs[i]);
380  len = recvfrom(p[i].fd, buf, size, 0,
381  (struct sockaddr *)addrs[i], addr_lens[i]);
382  if (len < 0) {
383  if (ff_neterrno() == AVERROR(EAGAIN) ||
384  ff_neterrno() == AVERROR(EINTR))
385  continue;
386  return AVERROR(EIO);
387  }
388  if (rtp_check_source_lists(s, addrs[i]))
389  continue;
390  return len;
391  }
392  } else if (n < 0) {
393  if (ff_neterrno() == AVERROR(EINTR))
394  continue;
395  return AVERROR(EIO);
396  }
397  if (h->flags & AVIO_FLAG_NONBLOCK)
398  return AVERROR(EAGAIN);
399  }
400  return len;
401 }
402 
403 static int rtp_write(URLContext *h, const uint8_t *buf, int size)
404 {
405  RTPContext *s = h->priv_data;
406  int ret;
407  URLContext *hd;
408 
409  if (size < 2)
410  return AVERROR(EINVAL);
411 
412  if (s->write_to_source) {
413  int fd;
414  struct sockaddr_storage *source, temp_source;
415  socklen_t *source_len, temp_len;
416  if (!s->last_rtp_source.ss_family && !s->last_rtcp_source.ss_family) {
417  av_log(h, AV_LOG_ERROR,
418  "Unable to send packet to source, no packets received yet\n");
419  // Intentionally not returning an error here
420  return size;
421  }
422 
423  if (RTP_PT_IS_RTCP(buf[1])) {
424  fd = s->rtcp_fd;
425  source = &s->last_rtcp_source;
426  source_len = &s->last_rtcp_source_len;
427  } else {
428  fd = s->rtp_fd;
429  source = &s->last_rtp_source;
430  source_len = &s->last_rtp_source_len;
431  }
432  if (!source->ss_family) {
433  source = &temp_source;
434  source_len = &temp_len;
435  if (RTP_PT_IS_RTCP(buf[1])) {
436  temp_source = s->last_rtp_source;
437  temp_len = s->last_rtp_source_len;
438  set_port(source, get_port(source) + 1);
439  av_log(h, AV_LOG_INFO,
440  "Not received any RTCP packets yet, inferring peer port "
441  "from the RTP port\n");
442  } else {
443  temp_source = s->last_rtcp_source;
444  temp_len = s->last_rtcp_source_len;
445  set_port(source, get_port(source) - 1);
446  av_log(h, AV_LOG_INFO,
447  "Not received any RTP packets yet, inferring peer port "
448  "from the RTCP port\n");
449  }
450  }
451 
452  if (!(h->flags & AVIO_FLAG_NONBLOCK)) {
453  ret = ff_network_wait_fd(fd, 1);
454  if (ret < 0)
455  return ret;
456  }
457  ret = sendto(fd, buf, size, 0, (struct sockaddr *) source,
458  *source_len);
459 
460  return ret < 0 ? ff_neterrno() : ret;
461  }
462 
463  if (RTP_PT_IS_RTCP(buf[1])) {
464  /* RTCP payload type */
465  hd = s->rtcp_hd;
466  } else {
467  /* RTP payload type */
468  hd = s->rtp_hd;
469  }
470 
471  ret = ffurl_write(hd, buf, size);
472  return ret;
473 }
474 
475 static int rtp_close(URLContext *h)
476 {
477  RTPContext *s = h->priv_data;
478  int i;
479 
480  for (i = 0; i < s->nb_ssm_include_addrs; i++)
481  av_free(s->ssm_include_addrs[i]);
483  for (i = 0; i < s->nb_ssm_exclude_addrs; i++)
484  av_free(s->ssm_exclude_addrs[i]);
486 
487  ffurl_close(s->rtp_hd);
488  ffurl_close(s->rtcp_hd);
489  return 0;
490 }
491 
499 {
500  RTPContext *s = h->priv_data;
501  return ff_udp_get_local_port(s->rtp_hd);
502 }
503 
511 {
512  RTPContext *s = h->priv_data;
513  return ff_udp_get_local_port(s->rtcp_hd);
514 }
515 
517 {
518  RTPContext *s = h->priv_data;
519  return s->rtp_fd;
520 }
521 
522 static int rtp_get_multi_file_handle(URLContext *h, int **handles,
523  int *numhandles)
524 {
525  RTPContext *s = h->priv_data;
526  int *hs = *handles = av_malloc(sizeof(**handles) * 2);
527  if (!hs)
528  return AVERROR(ENOMEM);
529  hs[0] = s->rtp_fd;
530  hs[1] = s->rtcp_fd;
531  *numhandles = 2;
532  return 0;
533 }
534 
536  .name = "rtp",
537  .url_open = rtp_open,
538  .url_read = rtp_read,
539  .url_write = rtp_write,
540  .url_close = rtp_close,
541  .url_get_file_handle = rtp_get_file_handle,
542  .url_get_multi_file_handle = rtp_get_multi_file_handle,
543  .priv_data_size = sizeof(RTPContext),
545 };
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.
Definition: utils.c:2713
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:62
int ff_rtp_get_local_rtp_port(URLContext *h)
Return the local rtp port used by the RTP connection.
Definition: rtpproto.c:498
int size
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:35
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:129
int ffurl_write(URLContext *h, const unsigned char *buf, int size)
Write size bytes from buf to the resource accessed by h.
Definition: avio.c:276
int is_streamed
true if streamed (no seek possible), default = false
Definition: url.h:48
AVIOInterruptCB interrupt_callback
Definition: url.h:50
static int rtp_check_source_lists(RTPContext *s, struct sockaddr_storage *source_addr_ptr)
Definition: rtpproto.c:152
static void rtp_parse_addr_list(URLContext *h, char *buf, struct sockaddr_storage ***address_list_ptr, int *address_list_size_ptr)
Definition: rtpproto.c:213
int flags
Definition: url.h:46
#define freeaddrinfo
Definition: network.h:183
URLContext * rtcp_hd
Definition: rtpproto.c:45
static int compare_addr(const struct sockaddr_storage *a, const struct sockaddr_storage *b)
Definition: rtpproto.c:111
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
Definition: mem.c:198
static int rtp_write(URLContext *h, const uint8_t *buf, int size)
Definition: rtpproto.c:403
static int rtp_close(URLContext *h)
Definition: rtpproto.c:475
uint8_t
miscellaneous OS support macros and functions.
socklen_t last_rtp_source_len
Definition: rtpproto.c:50
static int get_port(const struct sockaddr_storage *ss)
Definition: rtpproto.c:131
int ff_udp_get_local_port(URLContext *h)
Return the local port used by the UDP connection.
Definition: udp.c:364
uint16_t ss_family
Definition: network.h:93
#define b
Definition: input.c:52
static int flags
Definition: log.c:44
struct sockaddr_storage ** ssm_include_addrs
Definition: rtpproto.c:47
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.
Definition: parseutils.c:606
URLContext * rtp_hd
Definition: rtpproto.c:45
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:123
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
Definition: mem.c:186
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...
Definition: udp.c:325
#define AVERROR(e)
Definition: error.h:43
static int rtp_read(URLContext *h, uint8_t *buf, int size)
Definition: rtpproto.c:361
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:169
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
Definition: avstring.c:81
int ai_addrlen
Definition: network.h:107
#define dynarray_add(tab, nb_ptr, elem)
Definition: internal.h:64
struct sockaddr_storage last_rtp_source last_rtcp_source
Definition: rtpproto.c:49
#define ff_neterrno()
Definition: network.h:63
static int rtp_open(URLContext *h, const char *uri, int flags)
url syntax: rtp://host:port[?option=val...] option: &#39;ttl=n&#39; : set the ttl value (for multicast only) ...
Definition: rtpproto.c:273
int rtcp_fd
Definition: rtpproto.c:46
static int rtp_get_multi_file_handle(URLContext *h, int **handles, int *numhandles)
Definition: rtpproto.c:522
int rtp_fd
Definition: rtpproto.c:46
int ffurl_get_file_handle(URLContext *h)
Return the file descriptor associated with this URL.
Definition: avio.c:352
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
Definition: error.h:52
int ff_url_join(char *str, int size, const char *proto, const char *authorization, const char *hostname, int port, const char *fmt,...)
Definition: url.c:36
NULL
Definition: eval.c:55
#define AV_LOG_INFO
Standard information.
Definition: log.h:134
int ff_check_interrupt(AVIOInterruptCB *cb)
Check if the user has requested to interrup a blocking function associated with cb.
Definition: avio.c:381
#define AVIO_FLAG_NONBLOCK
Use non-blocking mode.
Definition: avio.h:311
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
socklen_t last_rtcp_source_len
Definition: rtpproto.c:50
Definition: url.h:41
static av_printf_format(3, 4)
add option to url of the form: "http://host:port/path?option1=val1&option2=val2...
Definition: rtpproto.c:176
void * priv_data
Definition: url.h:44
#define gai_strerror
Definition: network.h:190
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, const char *include_sources, const char *exclude_sources)
Definition: rtpproto.c:191
misc parsing utilities
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...
Definition: avstring.c:91
const char * name
Definition: url.h:54
int ai_socktype
Definition: network.h:105
#define RTP_PT_IS_RTCP(x)
Definition: rtp.h:110
static void set_port(struct sockaddr_storage *ss, int port)
Definition: rtpproto.c:142
int ffurl_close(URLContext *h)
Close the resource accessed by the URLContext h, and free the memory used by it.
Definition: avio.c:297
static struct addrinfo * rtp_resolve_host(const char *hostname, int port, int type, int family, int flags)
Definition: rtpproto.c:92
int nb_ssm_include_addrs
Definition: rtpproto.c:46
#define getaddrinfo
Definition: network.h:182
Main libavformat public API header.
struct sockaddr_storage ** ssm_exclude_addrs
Definition: rtpproto.c:47
static int rtp_get_file_handle(URLContext *h)
Definition: rtpproto.c:516
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. ...
Definition: avio.c:211
int ff_rtp_get_local_rtcp_port(URLContext *h)
Return the local rtcp port used by the RTP connection.
Definition: rtpproto.c:510
int write_to_source
Definition: rtpproto.c:48
int len
URLProtocol ff_rtp_protocol
Definition: rtpproto.c:535
int nb_ssm_exclude_addrs
Definition: rtpproto.c:46
int ai_flags
Definition: network.h:103
int max_packet_size
if non zero, the stream is packetized with this max packet size
Definition: url.h:47
int ff_network_wait_fd(int fd, int write)
Definition: network.c:141
unbuffered private I/O API
struct sockaddr * ai_addr
Definition: network.h:108
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...
Definition: rtpproto.c:63
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:205
int ai_family
Definition: network.h:104