FFmpeg
sdp.c
Go to the documentation of this file.
1 /*
2  * copyright (c) 2007 Luca Abeni
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "config_components.h"
22 
23 #include <string.h>
24 #include "libavutil/avstring.h"
25 #include "libavutil/base64.h"
26 #include "libavutil/dict.h"
27 #include "libavutil/mem.h"
28 #include "libavutil/parseutils.h"
29 #include "libavutil/opt.h"
30 #include "libavcodec/xiph.h"
31 #include "libavcodec/mpeg4audio.h"
32 #include "avformat.h"
33 #include "internal.h"
34 #include "avc.h"
35 #include "hevc.h"
36 #include "nal.h"
37 #include "rtp.h"
38 #include "version.h"
39 #if CONFIG_NETWORK
40 #include "network.h"
41 #endif
42 
43 #if CONFIG_RTP_MUXER
44 #define MAX_EXTRADATA_SIZE ((INT_MAX - 10) / 2)
45 
46 struct sdp_session_level {
47  int sdp_version; /**< protocol version (currently 0) */
48  int id; /**< session ID */
49  int version; /**< session version */
50  int start_time; /**< session start time (NTP time, in seconds),
51  or 0 in case of permanent session */
52  int end_time; /**< session end time (NTP time, in seconds),
53  or 0 if the session is not bounded */
54  int ttl; /**< TTL, in case of multicast stream */
55  const char *user; /**< username of the session's creator */
56  const char *src_addr; /**< IP address of the machine from which the session was created */
57  const char *src_type; /**< address type of src_addr */
58  const char *dst_addr; /**< destination IP address (can be multicast) */
59  const char *dst_type; /**< destination IP address type */
60  const char *name; /**< session name (can be an empty string) */
61 };
62 
63 static void sdp_write_address(char *buff, int size, const char *dest_addr,
64  const char *dest_type, int ttl)
65 {
66  if (dest_addr) {
67  if (!dest_type)
68  dest_type = "IP4";
69  if (ttl > 0 && !strcmp(dest_type, "IP4")) {
70  /* The TTL should only be specified for IPv4 multicast addresses,
71  * not for IPv6. */
72  av_strlcatf(buff, size, "c=IN %s %s/%d\r\n", dest_type, dest_addr, ttl);
73  } else {
74  av_strlcatf(buff, size, "c=IN %s %s\r\n", dest_type, dest_addr);
75  }
76  }
77 }
78 
79 static void sdp_write_header(char *buff, int size, struct sdp_session_level *s)
80 {
81  av_strlcatf(buff, size, "v=%d\r\n"
82  "o=- %d %d IN %s %s\r\n"
83  "s=%s\r\n",
84  s->sdp_version,
85  s->id, s->version, s->src_type, s->src_addr,
86  s->name);
87  sdp_write_address(buff, size, s->dst_addr, s->dst_type, s->ttl);
88  av_strlcatf(buff, size, "t=%d %d\r\n"
89  "a=tool:libavformat " AV_STRINGIFY(LIBAVFORMAT_VERSION) "\r\n",
90  s->start_time, s->end_time);
91 }
92 
93 #if CONFIG_NETWORK
94 static int resolve_destination(char *dest_addr, int size, char *type,
95  int type_size)
96 {
97  struct addrinfo hints = { 0 }, *ai;
98  int is_multicast;
99 
100  av_strlcpy(type, "IP4", type_size);
101  if (!dest_addr[0])
102  return 0;
103 
104  /* Resolve the destination, since it must be written
105  * as a numeric IP address in the SDP. */
106 
107  if (getaddrinfo(dest_addr, NULL, &hints, &ai))
108  return 0;
109  getnameinfo(ai->ai_addr, ai->ai_addrlen, dest_addr, size,
110  NULL, 0, NI_NUMERICHOST);
111 #ifdef AF_INET6
112  if (ai->ai_family == AF_INET6)
113  av_strlcpy(type, "IP6", type_size);
114 #endif
115  is_multicast = ff_is_multicast_address(ai->ai_addr);
116  freeaddrinfo(ai);
117  return is_multicast;
118 }
119 #else
120 static int resolve_destination(char *dest_addr, int size, char *type,
121  int type_size)
122 {
123  return 0;
124 }
125 #endif
126 
127 static int sdp_get_address(char *dest_addr, int size, int *ttl, const char *url)
128 {
129  int port;
130  const char *p;
131  char proto[32];
132 
133  av_url_split(proto, sizeof(proto), NULL, 0, dest_addr, size, &port, NULL, 0, url);
134 
135  *ttl = 0;
136 
137  if (strcmp(proto, "rtp") && strcmp(proto, "srtp")) {
138  /* The url isn't for the actual rtp sessions,
139  * don't parse out anything else than the destination.
140  */
141  return 0;
142  }
143 
144  p = strchr(url, '?');
145  if (p) {
146  char buff[64];
147 
148  if (av_find_info_tag(buff, sizeof(buff), "ttl", p)) {
149  *ttl = strtol(buff, NULL, 10);
150  } else {
151  *ttl = 5;
152  }
153  }
154 
155  return port;
156 }
157 
158 #define MAX_PSET_SIZE 1024
159 static int extradata2psets(AVFormatContext *s, const AVCodecParameters *par,
160  char **out)
161 {
162  char *psets, *p;
163  const uint8_t *r;
164  static const char pset_string[] = "; sprop-parameter-sets=";
165  static const char profile_string[] = "; profile-level-id=";
166  uint8_t *extradata = par->extradata;
167  int extradata_size = par->extradata_size;
168  uint8_t *tmpbuf = NULL;
169  const uint8_t *sps = NULL, *sps_end;
170 
171  *out = NULL;
172 
173  if (par->extradata_size > MAX_EXTRADATA_SIZE) {
174  av_log(s, AV_LOG_ERROR, "Too much extradata!\n");
175  return AVERROR_INVALIDDATA;
176  }
177  if (par->extradata[0] == 1) {
178  int ret = ff_avc_write_annexb_extradata(par->extradata, &extradata,
179  &extradata_size);
180  if (ret < 0)
181  return ret;
182 
183  tmpbuf = extradata;
184  }
185 
186  psets = av_mallocz(MAX_PSET_SIZE);
187  if (!psets) {
188  av_log(s, AV_LOG_ERROR, "Cannot allocate memory for the parameter sets.\n");
189  av_free(tmpbuf);
190  return AVERROR(ENOMEM);
191  }
192  memcpy(psets, pset_string, strlen(pset_string));
193  p = psets + strlen(pset_string);
194  r = ff_nal_find_startcode(extradata, extradata + extradata_size);
195  while (r < extradata + extradata_size) {
196  const uint8_t *r1;
197  uint8_t nal_type;
198 
199  while (!*(r++));
200  nal_type = *r & 0x1f;
201  r1 = ff_nal_find_startcode(r, extradata + extradata_size);
202  if (nal_type != 7 && nal_type != 8) { /* Only output SPS and PPS */
203  r = r1;
204  continue;
205  }
206  if (p != (psets + strlen(pset_string))) {
207  if (p - psets >= MAX_PSET_SIZE)
208  goto fail_in_loop;
209  *p = ',';
210  p++;
211  }
212  if (!sps) {
213  sps = r;
214  sps_end = r1;
215  }
216  if (!av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r)) {
217  av_log(s, AV_LOG_ERROR, "Cannot Base64-encode %"PTRDIFF_SPECIFIER" %"PTRDIFF_SPECIFIER"!\n",
218  MAX_PSET_SIZE - (p - psets), r1 - r);
219 fail_in_loop:
220  av_free(psets);
221  av_free(tmpbuf);
222 
223  return AVERROR_INVALIDDATA;
224  }
225  p += strlen(p);
226  r = r1;
227  }
228  if (sps && sps_end - sps >= 4 && p - psets <= MAX_PSET_SIZE - strlen(profile_string) - 7) {
229  memcpy(p, profile_string, strlen(profile_string));
230  p += strlen(p);
231  ff_data_to_hex(p, sps + 1, 3, 0);
232  }
233  av_free(tmpbuf);
234 
235  *out = psets;
236  return 0;
237 }
238 
239 static int extradata2psets_hevc(const AVCodecParameters *par, char **out)
240 {
241  char *psets;
242  uint8_t *extradata = par->extradata;
243  int extradata_size = par->extradata_size;
244  uint8_t *tmpbuf = NULL;
245  int ps_pos[3] = { 0 };
246  static const char * const ps_names[3] = { "vps", "sps", "pps" };
247  int num_arrays, num_nalus;
248  int pos, i, j, ret = 0;
249 
250  *out = NULL;
251 
252  // Convert to hvcc format. Since we need to group multiple NALUs of
253  // the same type, and we might need to convert from one format to the
254  // other anyway, we get away with a little less work by using the hvcc
255  // format.
256  if (par->extradata[0] != 1) {
257  AVIOContext *pb;
258 
259  ret = avio_open_dyn_buf(&pb);
260  if (ret < 0)
261  return ret;
262 
263  ret = ff_isom_write_hvcc(pb, par->extradata, par->extradata_size, 0);
264  if (ret < 0) {
265  avio_close_dyn_buf(pb, &tmpbuf);
266  goto err;
267  }
268  extradata_size = avio_close_dyn_buf(pb, &extradata);
269  tmpbuf = extradata;
270  }
271 
272  if (extradata_size < 23)
273  goto err;
274 
275  num_arrays = extradata[22];
276  pos = 23;
277  for (i = 0; i < num_arrays; i++) {
278  int num_nalus, nalu_type;
279  if (pos + 3 > extradata_size)
280  goto err;
281  nalu_type = extradata[pos] & 0x3f;
282  // Not including libavcodec/hevc.h to avoid confusion between
283  // NAL_* with the same name for both H.264 and HEVC.
284  if (nalu_type == 32) // VPS
285  ps_pos[0] = pos;
286  else if (nalu_type == 33) // SPS
287  ps_pos[1] = pos;
288  else if (nalu_type == 34) // PPS
289  ps_pos[2] = pos;
290  num_nalus = AV_RB16(&extradata[pos + 1]);
291  pos += 3;
292  for (j = 0; j < num_nalus; j++) {
293  int len;
294  if (pos + 2 > extradata_size)
295  goto err;
296  len = AV_RB16(&extradata[pos]);
297  pos += 2;
298  if (pos + len > extradata_size)
299  goto err;
300  pos += len;
301  }
302  }
303  if (!ps_pos[0] || !ps_pos[1] || !ps_pos[2])
304  goto err;
305 
306  psets = av_mallocz(MAX_PSET_SIZE);
307  if (!psets) {
308  ret = AVERROR(ENOMEM);
309  goto err;
310  }
311 
312  psets[0] = '\0';
313 
314  for (i = 0; i < 3; i++) {
315  pos = ps_pos[i];
316 
317  if (i > 0)
318  av_strlcat(psets, "; ", MAX_PSET_SIZE);
319  av_strlcatf(psets, MAX_PSET_SIZE, "sprop-%s=", ps_names[i]);
320 
321  // Skipping boundary checks in the input here; we've already traversed
322  // the whole hvcc structure above without issues
323  num_nalus = AV_RB16(&extradata[pos + 1]);
324  pos += 3;
325  for (j = 0; j < num_nalus; j++) {
326  int len = AV_RB16(&extradata[pos]);
327  int strpos;
328  pos += 2;
329  if (j > 0)
330  av_strlcat(psets, ",", MAX_PSET_SIZE);
331  strpos = strlen(psets);
332  if (!av_base64_encode(psets + strpos, MAX_PSET_SIZE - strpos,
333  &extradata[pos], len)) {
334  av_free(psets);
335  goto err;
336  }
337  pos += len;
338  }
339  }
340  av_free(tmpbuf);
341 
342  *out = psets;
343  return 0;
344 err:
345  if (ret >= 0)
347  av_free(tmpbuf);
348  return ret;
349 }
350 
351 static int extradata2config(AVFormatContext *s, const AVCodecParameters *par,
352  char **out)
353 {
354  char *config;
355 
356  *out = NULL;
357 
358  if (par->extradata_size > MAX_EXTRADATA_SIZE) {
359  av_log(s, AV_LOG_ERROR, "Too much extradata!\n");
360  return AVERROR_INVALIDDATA;
361  }
362  config = av_malloc(10 + par->extradata_size * 2);
363  if (!config) {
364  av_log(s, AV_LOG_ERROR, "Cannot allocate memory for the config info.\n");
365  return AVERROR(ENOMEM);
366  }
367  memcpy(config, "; config=", 9);
368  ff_data_to_hex(config + 9, par->extradata, par->extradata_size, 0);
369 
370  *out = config;
371  return 0;
372 }
373 
374 static int xiph_extradata2config(AVFormatContext *s, const AVCodecParameters *par,
375  char **out)
376 {
377  uint8_t *config;
378  char *encoded_config;
379  const uint8_t *header_start[3];
380  int headers_len, header_len[3], config_len;
381  int first_header_size, ret;
382 
383  *out = NULL;
384 
385  switch (par->codec_id) {
386  case AV_CODEC_ID_THEORA:
387  first_header_size = 42;
388  break;
389  case AV_CODEC_ID_VORBIS:
390  first_header_size = 30;
391  break;
392  default:
393  av_log(s, AV_LOG_ERROR, "Unsupported Xiph codec ID\n");
394  return AVERROR(ENOSYS);
395  }
396 
398  first_header_size, header_start,
399  header_len);
400  if (ret < 0) {
401  av_log(s, AV_LOG_ERROR, "Extradata corrupt.\n");
402  return ret;
403  }
404 
405  headers_len = header_len[0] + header_len[2];
406  config_len = 4 + // count
407  3 + // ident
408  2 + // packet size
409  1 + // header count
410  2 + // header size
411  headers_len; // and the rest
412 
413  config = av_malloc(config_len);
414  if (!config)
415  goto xiph_fail;
416 
417  encoded_config = av_malloc(AV_BASE64_SIZE(config_len));
418  if (!encoded_config) {
419  av_free(config);
420  goto xiph_fail;
421  }
422 
423  config[0] = config[1] = config[2] = 0;
424  config[3] = 1;
425  config[4] = (RTP_XIPH_IDENT >> 16) & 0xff;
426  config[5] = (RTP_XIPH_IDENT >> 8) & 0xff;
427  config[6] = (RTP_XIPH_IDENT ) & 0xff;
428  config[7] = (headers_len >> 8) & 0xff;
429  config[8] = headers_len & 0xff;
430  config[9] = 2;
431  config[10] = header_len[0];
432  config[11] = 0; // size of comment header; nonexistent
433  memcpy(config + 12, header_start[0], header_len[0]);
434  memcpy(config + 12 + header_len[0], header_start[2], header_len[2]);
435 
436  av_base64_encode(encoded_config, AV_BASE64_SIZE(config_len),
437  config, config_len);
438  av_free(config);
439 
440  *out = encoded_config;
441  return 0;
442 
443 xiph_fail:
445  "Not enough memory for configuration string\n");
446  return AVERROR(ENOMEM);
447 }
448 
449 static int latm_context2profilelevel(const AVCodecParameters *par)
450 {
451  /* MP4A-LATM
452  * The RTP payload format specification is described in RFC 3016
453  * The encoding specifications are provided in ISO/IEC 14496-3 */
454 
455  int profile_level = 0x2B;
456 
457  /* TODO: AAC Profile only supports AAC LC Object Type.
458  * Different Object Types should implement different Profile Levels */
459 
460  if (par->sample_rate <= 24000) {
461  if (par->ch_layout.nb_channels <= 2)
462  profile_level = 0x28; // AAC Profile, Level 1
463  } else if (par->sample_rate <= 48000) {
464  if (par->ch_layout.nb_channels <= 2) {
465  profile_level = 0x29; // AAC Profile, Level 2
466  } else if (par->ch_layout.nb_channels <= 5) {
467  profile_level = 0x2A; // AAC Profile, Level 4
468  }
469  } else if (par->sample_rate <= 96000) {
470  if (par->ch_layout.nb_channels <= 5) {
471  profile_level = 0x2B; // AAC Profile, Level 5
472  }
473  }
474 
475  return profile_level;
476 }
477 
478 static int latm_context2config(AVFormatContext *s, const AVCodecParameters *par,
479  char **out)
480 {
481  /* MP4A-LATM
482  * The RTP payload format specification is described in RFC 3016
483  * The encoding specifications are provided in ISO/IEC 14496-3 */
484 
485  uint8_t config_byte[6];
486  int rate_index;
487  char *config;
488 
489  *out = NULL;
490 
491  for (rate_index = 0; rate_index < 16; rate_index++)
492  if (ff_mpeg4audio_sample_rates[rate_index] == par->sample_rate)
493  break;
494  if (rate_index == 16) {
495  av_log(s, AV_LOG_ERROR, "Unsupported sample rate\n");
496  return AVERROR(ENOSYS);
497  }
498 
499  config_byte[0] = 0x40;
500  config_byte[1] = 0;
501  config_byte[2] = 0x20 | rate_index;
502  config_byte[3] = par->ch_layout.nb_channels << 4;
503  config_byte[4] = 0x3f;
504  config_byte[5] = 0xc0;
505 
506  config = av_malloc(6*2+1);
507  if (!config) {
508  av_log(s, AV_LOG_ERROR, "Cannot allocate memory for the config info.\n");
509  return AVERROR(ENOMEM);
510  }
511  ff_data_to_hex(config, config_byte, 6, 1);
512 
513  *out = config;
514  return 0;
515 }
516 
517 static int sdp_write_media_attributes(char *buff, int size, const AVStream *st,
518  int payload_type, AVFormatContext *fmt)
519 {
520  char *config = NULL;
521  const AVCodecParameters *p = st->codecpar;
522  int ret = 0;
523 
524  switch (p->codec_id) {
525  case AV_CODEC_ID_DIRAC:
526  av_strlcatf(buff, size, "a=rtpmap:%d VC2/90000\r\n", payload_type);
527  break;
528  case AV_CODEC_ID_H264: {
529  int mode = 1;
530  if (fmt && fmt->oformat && fmt->oformat->priv_class &&
531  av_opt_flag_is_set(fmt->priv_data, "rtpflags", "h264_mode0"))
532  mode = 0;
533  if (p->extradata_size) {
534  ret = extradata2psets(fmt, p, &config);
535  if (ret < 0)
536  return ret;
537  }
538  av_strlcatf(buff, size, "a=rtpmap:%d H264/90000\r\n"
539  "a=fmtp:%d packetization-mode=%d%s\r\n",
540  payload_type,
541  payload_type, mode, config ? config : "");
542  break;
543  }
544  case AV_CODEC_ID_H261:
545  {
546  const char *pic_fmt = NULL;
547  /* only QCIF and CIF are specified as supported in RFC 4587 */
548  if (p->width == 176 && p->height == 144)
549  pic_fmt = "QCIF=1";
550  else if (p->width == 352 && p->height == 288)
551  pic_fmt = "CIF=1";
552  if (payload_type >= RTP_PT_PRIVATE)
553  av_strlcatf(buff, size, "a=rtpmap:%d H261/90000\r\n", payload_type);
554  if (pic_fmt)
555  av_strlcatf(buff, size, "a=fmtp:%d %s\r\n", payload_type, pic_fmt);
556  break;
557  }
558  case AV_CODEC_ID_H263:
559  case AV_CODEC_ID_H263P:
560  /* a=framesize is required by 3GPP TS 26.234 (PSS). It
561  * actually specifies the maximum video size, but we only know
562  * the current size. This is required for playback on Android
563  * stagefright and on Samsung bada. */
564  if (!fmt || !fmt->oformat->priv_class ||
565  !av_opt_flag_is_set(fmt->priv_data, "rtpflags", "rfc2190") ||
567  av_strlcatf(buff, size, "a=rtpmap:%d H263-2000/90000\r\n"
568  "a=framesize:%d %d-%d\r\n",
569  payload_type,
570  payload_type, p->width, p->height);
571  break;
572  case AV_CODEC_ID_HEVC:
573  if (p->extradata_size) {
574  ret = extradata2psets_hevc(p, &config);
575  if (ret < 0)
576  return ret;
577  }
578  av_strlcatf(buff, size, "a=rtpmap:%d H265/90000\r\n", payload_type);
579  if (config)
580  av_strlcatf(buff, size, "a=fmtp:%d %s\r\n",
581  payload_type, config);
582  break;
583  case AV_CODEC_ID_MPEG4:
584  if (p->extradata_size) {
585  ret = extradata2config(fmt, p, &config);
586  if (ret < 0)
587  return ret;
588  }
589  av_strlcatf(buff, size, "a=rtpmap:%d MP4V-ES/90000\r\n"
590  "a=fmtp:%d profile-level-id=1%s\r\n",
591  payload_type,
592  payload_type, config ? config : "");
593  break;
594  case AV_CODEC_ID_AAC:
595  if (fmt && fmt->oformat && fmt->oformat->priv_class &&
596  av_opt_flag_is_set(fmt->priv_data, "rtpflags", "latm")) {
597  ret = latm_context2config(fmt, p, &config);
598  if (ret < 0)
599  return ret;
600  av_strlcatf(buff, size, "a=rtpmap:%d MP4A-LATM/%d/%d\r\n"
601  "a=fmtp:%d profile-level-id=%d;cpresent=0;config=%s\r\n",
602  payload_type, p->sample_rate, p->ch_layout.nb_channels,
603  payload_type, latm_context2profilelevel(p), config);
604  } else {
605  if (p->extradata_size) {
606  ret = extradata2config(fmt, p, &config);
607  if (ret < 0)
608  return ret;
609  } else {
610  /* FIXME: maybe we can forge config information based on the
611  * codec parameters...
612  */
613  av_log(fmt, AV_LOG_ERROR, "AAC with no global headers is currently not supported.\n");
614  return AVERROR(ENOSYS);
615  }
616  av_strlcatf(buff, size, "a=rtpmap:%d MPEG4-GENERIC/%d/%d\r\n"
617  "a=fmtp:%d profile-level-id=1;"
618  "mode=AAC-hbr;sizelength=13;indexlength=3;"
619  "indexdeltalength=3%s\r\n",
620  payload_type, p->sample_rate, p->ch_layout.nb_channels,
621  payload_type, config);
622  }
623  break;
625  if (payload_type >= RTP_PT_PRIVATE)
626  av_strlcatf(buff, size, "a=rtpmap:%d L16/%d/%d\r\n",
627  payload_type,
629  break;
631  if (payload_type >= RTP_PT_PRIVATE)
632  av_strlcatf(buff, size, "a=rtpmap:%d L24/%d/%d\r\n",
633  payload_type,
635  break;
637  if (payload_type >= RTP_PT_PRIVATE)
638  av_strlcatf(buff, size, "a=rtpmap:%d PCMU/%d/%d\r\n",
639  payload_type,
641  break;
643  if (payload_type >= RTP_PT_PRIVATE)
644  av_strlcatf(buff, size, "a=rtpmap:%d PCMA/%d/%d\r\n",
645  payload_type,
647  break;
648  case AV_CODEC_ID_AMR_NB:
649  av_strlcatf(buff, size, "a=rtpmap:%d AMR/%d/%d\r\n"
650  "a=fmtp:%d octet-align=1\r\n",
651  payload_type, p->sample_rate, p->ch_layout.nb_channels,
652  payload_type);
653  break;
654  case AV_CODEC_ID_AMR_WB:
655  av_strlcatf(buff, size, "a=rtpmap:%d AMR-WB/%d/%d\r\n"
656  "a=fmtp:%d octet-align=1\r\n",
657  payload_type, p->sample_rate, p->ch_layout.nb_channels,
658  payload_type);
659  break;
660  case AV_CODEC_ID_VORBIS:
661  if (p->extradata_size)
662  ret = xiph_extradata2config(fmt, p, &config);
663  else {
664  av_log(fmt, AV_LOG_ERROR, "Vorbis configuration info missing\n");
666  }
667  if (ret < 0)
668  return ret;
669 
670  av_strlcatf(buff, size, "a=rtpmap:%d vorbis/%d/%d\r\n"
671  "a=fmtp:%d configuration=%s\r\n",
672  payload_type, p->sample_rate, p->ch_layout.nb_channels,
673  payload_type, config);
674  break;
675  case AV_CODEC_ID_THEORA: {
676  const char *pix_fmt;
677  switch (p->format) {
678  case AV_PIX_FMT_YUV420P:
679  pix_fmt = "YCbCr-4:2:0";
680  break;
681  case AV_PIX_FMT_YUV422P:
682  pix_fmt = "YCbCr-4:2:2";
683  break;
684  case AV_PIX_FMT_YUV444P:
685  pix_fmt = "YCbCr-4:4:4";
686  break;
687  default:
688  av_log(fmt, AV_LOG_ERROR, "Unsupported pixel format.\n");
689  return AVERROR(ENOSYS);
690  }
691 
692  if (p->extradata_size)
693  ret = xiph_extradata2config(fmt, p, &config);
694  else {
695  av_log(fmt, AV_LOG_ERROR, "Theora configuration info missing\n");
697  }
698  if (ret < 0)
699  return ret;
700 
701  av_strlcatf(buff, size, "a=rtpmap:%d theora/90000\r\n"
702  "a=fmtp:%d delivery-method=inline; "
703  "width=%d; height=%d; sampling=%s; "
704  "configuration=%s\r\n",
705  payload_type, payload_type,
706  p->width, p->height, pix_fmt, config);
707  break;
708  }
710  case AV_CODEC_ID_RAWVIDEO: {
711  const char *pix_fmt;
712  int bit_depth = 8;
713 
714  switch (p->format) {
715  case AV_PIX_FMT_UYVY422:
716  pix_fmt = "YCbCr-4:2:2";
717  break;
719  pix_fmt = "YCbCr-4:2:2";
720  bit_depth = 10;
721  break;
722  case AV_PIX_FMT_YUV420P:
723  pix_fmt = "YCbCr-4:2:0";
724  break;
725  case AV_PIX_FMT_RGB24:
726  pix_fmt = "RGB";
727  break;
728  case AV_PIX_FMT_BGR24:
729  pix_fmt = "BGR";
730  break;
731  default:
732  av_log(fmt, AV_LOG_ERROR, "Unsupported pixel format.\n");
733  return AVERROR(ENOSYS);
734  }
735 
736  av_strlcatf(buff, size, "a=rtpmap:%d raw/90000\r\n"
737  "a=fmtp:%d sampling=%s; "
738  "width=%d; height=%d; "
739  "depth=%d",
740  payload_type, payload_type,
741  pix_fmt, p->width, p->height, bit_depth);
743  av_strlcatf(buff, size, "; interlace");
744  av_strlcatf(buff, size, "\r\n");
745  break;
746  }
747 
748  case AV_CODEC_ID_VP8:
749  av_strlcatf(buff, size, "a=rtpmap:%d VP8/90000\r\n",
750  payload_type);
751  break;
752  case AV_CODEC_ID_VP9:
753  av_strlcatf(buff, size, "a=rtpmap:%d VP9/90000\r\n",
754  payload_type);
755  break;
756  case AV_CODEC_ID_MJPEG:
757  if (payload_type >= RTP_PT_PRIVATE)
758  av_strlcatf(buff, size, "a=rtpmap:%d JPEG/90000\r\n",
759  payload_type);
760  break;
762  if (payload_type >= RTP_PT_PRIVATE)
763  av_strlcatf(buff, size, "a=rtpmap:%d G722/%d/%d\r\n",
764  payload_type,
765  8000, p->ch_layout.nb_channels);
766  break;
767  case AV_CODEC_ID_ADPCM_G726: {
768  if (payload_type >= RTP_PT_PRIVATE)
769  av_strlcatf(buff, size, "a=rtpmap:%d AAL2-G726-%d/%d\r\n",
770  payload_type,
772  p->sample_rate);
773  break;
774  }
776  if (payload_type >= RTP_PT_PRIVATE)
777  av_strlcatf(buff, size, "a=rtpmap:%d G726-%d/%d\r\n",
778  payload_type,
780  p->sample_rate);
781  break;
782  }
783  case AV_CODEC_ID_ILBC:
784  av_strlcatf(buff, size, "a=rtpmap:%d iLBC/%d\r\n"
785  "a=fmtp:%d mode=%d\r\n",
786  payload_type, p->sample_rate,
787  payload_type, p->block_align == 38 ? 20 : 30);
788  break;
789  case AV_CODEC_ID_SPEEX:
790  av_strlcatf(buff, size, "a=rtpmap:%d speex/%d\r\n",
791  payload_type, p->sample_rate);
792  break;
793  case AV_CODEC_ID_OPUS:
794  /* The opus RTP draft says that all opus streams MUST be declared
795  as stereo, to avoid negotiation failures. The actual number of
796  channels can change on a packet-by-packet basis. The number of
797  channels a receiver prefers to receive or a sender plans to send
798  can be declared via fmtp parameters (both default to mono), but
799  receivers MUST be able to receive and process stereo packets. */
800  av_strlcatf(buff, size, "a=rtpmap:%d opus/48000/2\r\n",
801  payload_type);
802  if (p->ch_layout.nb_channels == 2) {
803  av_strlcatf(buff, size, "a=fmtp:%d sprop-stereo=1\r\n",
804  payload_type);
805  }
806  break;
807  default:
808  /* Nothing special to do here... */
809  break;
810  }
811 
812  av_free(config);
813 
814  return 0;
815 }
816 
817 int ff_sdp_write_media(char *buff, int size, const AVStream *st, int idx,
818  const char *dest_addr, const char *dest_type,
819  int port, int ttl, AVFormatContext *fmt)
820 {
821  const AVCodecParameters *p = st->codecpar;
822  const char *type;
823  int payload_type;
824 
825  payload_type = ff_rtp_get_payload_type(fmt, st->codecpar, idx);
826 
827  switch (p->codec_type) {
828  case AVMEDIA_TYPE_VIDEO : type = "video" ; break;
829  case AVMEDIA_TYPE_AUDIO : type = "audio" ; break;
830  case AVMEDIA_TYPE_SUBTITLE: type = "text" ; break;
831  default : type = "application"; break;
832  }
833 
834  av_strlcatf(buff, size, "m=%s %d RTP/AVP %d\r\n", type, port, payload_type);
835  sdp_write_address(buff, size, dest_addr, dest_type, ttl);
836  if (p->bit_rate) {
837  av_strlcatf(buff, size, "b=AS:%"PRId64"\r\n", p->bit_rate / 1000);
838  }
839 
840  return sdp_write_media_attributes(buff, size, st, payload_type, fmt);
841 }
842 
843 int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
844 {
845  AVDictionaryEntry *title = av_dict_get(ac[0]->metadata, "title", NULL, 0);
846  struct sdp_session_level s = { 0 };
847  int i, j, port, ttl, is_multicast, index = 0;
848  char dst[32], dst_type[5];
849 
850  memset(buf, 0, size);
851  s.user = "-";
852  s.src_addr = "127.0.0.1"; /* FIXME: Properly set this */
853  s.src_type = "IP4";
854  s.name = title ? title->value : "No Name";
855 
856  port = 0;
857  ttl = 0;
858  if (n_files == 1) {
859  port = sdp_get_address(dst, sizeof(dst), &ttl, ac[0]->url ? ac[0]->url : "");
860  is_multicast = resolve_destination(dst, sizeof(dst), dst_type,
861  sizeof(dst_type));
862  if (!is_multicast)
863  ttl = 0;
864  if (dst[0]) {
865  s.dst_addr = dst;
866  s.dst_type = dst_type;
867  s.ttl = ttl;
868  if (!strcmp(dst_type, "IP6")) {
869  s.src_addr = "::1";
870  s.src_type = "IP6";
871  }
872  }
873  }
874  sdp_write_header(buf, size, &s);
875 
876  dst[0] = 0;
877  for (i = 0; i < n_files; i++) {
878  if (n_files != 1) {
879  port = sdp_get_address(dst, sizeof(dst), &ttl, ac[i]->url ? ac[i]->url : "");
880  is_multicast = resolve_destination(dst, sizeof(dst), dst_type,
881  sizeof(dst_type));
882  if (!is_multicast)
883  ttl = 0;
884  }
885  for (j = 0; j < ac[i]->nb_streams; j++) {
886  int ret = ff_sdp_write_media(buf, size, ac[i]->streams[j], index++,
887  dst[0] ? dst : NULL, dst_type,
888  (port > 0) ? port + j * 2 : 0,
889  ttl, ac[i]);
890  if (ret < 0)
891  return ret;
892 
893  if (port <= 0) {
894  av_strlcatf(buf, size,
895  "a=control:streamid=%d\r\n", i + j);
896  }
897  if (ac[i]->pb && ac[i]->pb->av_class) {
898  uint8_t *crypto_suite = NULL, *crypto_params = NULL;
899  av_opt_get(ac[i]->pb, "srtp_out_suite", AV_OPT_SEARCH_CHILDREN,
900  &crypto_suite);
901  av_opt_get(ac[i]->pb, "srtp_out_params", AV_OPT_SEARCH_CHILDREN,
902  &crypto_params);
903  if (crypto_suite && crypto_suite[0])
904  av_strlcatf(buf, size,
905  "a=crypto:1 %s inline:%s\r\n",
906  crypto_suite, crypto_params);
907  av_free(crypto_suite);
908  av_free(crypto_params);
909  }
910  }
911  }
912 
913  return 0;
914 }
915 #else
916 int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
917 {
918  return AVERROR(ENOSYS);
919 }
920 
921 int ff_sdp_write_media(char *buff, int size, const AVStream *st, int idx,
922  const char *dest_addr, const char *dest_type,
923  int port, int ttl, AVFormatContext *fmt)
924 {
925  return AVERROR(ENOSYS);
926 }
927 #endif
AV_OPT_SEARCH_CHILDREN
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
Definition: opt.h:533
AVMEDIA_TYPE_SUBTITLE
@ AVMEDIA_TYPE_SUBTITLE
Definition: avutil.h:204
AVCodecParameters::extradata
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition: codec_par.h:69
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
r
const char * r
Definition: vf_curves.c:127
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
av_find_info_tag
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:753
av_opt_flag_is_set
int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name)
Check whether a particular flag is set in a flags field.
Definition: opt.c:1354
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:51
hevc.h
out
FILE * out
Definition: movenc.c:55
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:47
AV_FIELD_PROGRESSIVE
@ AV_FIELD_PROGRESSIVE
Definition: defs.h:201
AV_CODEC_ID_DIRAC
@ AV_CODEC_ID_DIRAC
Definition: codec_id.h:168
AV_CODEC_ID_RAWVIDEO
@ AV_CODEC_ID_RAWVIDEO
Definition: codec_id.h:65
AV_CODEC_ID_MPEG4
@ AV_CODEC_ID_MPEG4
Definition: codec_id.h:64
AV_CODEC_ID_AMR_NB
@ AV_CODEC_ID_AMR_NB
Definition: codec_id.h:421
AV_CODEC_ID_ADPCM_G722
@ AV_CODEC_ID_ADPCM_G722
Definition: codec_id.h:395
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:76
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:321
bit_depth
static void bit_depth(AudioStatsContext *s, const uint64_t *const mask, uint8_t *depth)
Definition: af_astats.c:246
av_strlcatf
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
Definition: avstring.c:103
tf_sess_config.config
config
Definition: tf_sess_config.py:33
AV_CODEC_ID_AMR_WB
@ AV_CODEC_ID_AMR_WB
Definition: codec_id.h:422
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:30
AV_CODEC_ID_H261
@ AV_CODEC_ID_H261
Definition: codec_id.h:55
xiph.h
freeaddrinfo
#define freeaddrinfo
Definition: network.h:218
mpeg4audio.h
AV_CODEC_ID_SPEEX
@ AV_CODEC_ID_SPEEX
Definition: codec_id.h:475
AV_CODEC_ID_PCM_S16BE
@ AV_CODEC_ID_PCM_S16BE
Definition: codec_id.h:329
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
ff_data_to_hex
char * ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase)
Write hexadecimal string corresponding to given binary data.
Definition: utils.c:443
avio_close_dyn_buf
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
Definition: aviobuf.c:1407
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
av_dict_get
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
Definition: dict.c:62
avio_open_dyn_buf
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
Definition: aviobuf.c:1362
AV_CODEC_ID_ADPCM_G726
@ AV_CODEC_ID_ADPCM_G726
Definition: codec_id.h:378
s
#define s(width, name)
Definition: cbs_vp9.c:198
pix_fmt
static enum AVPixelFormat pix_fmt
Definition: demux_decode.c:41
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AV_CODEC_ID_VP9
@ AV_CODEC_ID_VP9
Definition: codec_id.h:220
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:134
AV_CODEC_ID_PCM_MULAW
@ AV_CODEC_ID_PCM_MULAW
Definition: codec_id.h:334
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
AVFormatContext
Format I/O context.
Definition: avformat.h:1255
AV_CODEC_ID_PCM_ALAW
@ AV_CODEC_ID_PCM_ALAW
Definition: codec_id.h:335
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:766
RTP_PT_PRIVATE
#define RTP_PT_PRIVATE
Definition: rtp.h:79
PTRDIFF_SPECIFIER
#define PTRDIFF_SPECIFIER
Definition: internal.h:128
NULL
#define NULL
Definition: coverity.c:32
avc.h
parseutils.h
ff_is_multicast_address
int ff_is_multicast_address(struct sockaddr *addr)
Definition: network.c:150
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:479
AVOutputFormat::priv_class
const AVClass * priv_class
AVClass for the private context.
Definition: avformat.h:538
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:180
base64.h
index
int index
Definition: gxfenc.c:90
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:184
AVCodecParameters::extradata_size
int extradata_size
Size of the extradata content in bytes.
Definition: codec_par.h:73
AVFormatContext::nb_streams
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:1311
AV_CODEC_ID_AAC
@ AV_CODEC_ID_AAC
Definition: codec_id.h:442
NI_NUMERICHOST
#define NI_NUMERICHOST
Definition: network.h:195
AVIOContext
Bytestream IO Context.
Definition: avio.h:160
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:75
RTP_XIPH_IDENT
#define RTP_XIPH_IDENT
Definition: rtp.h:91
start_time
static int64_t start_time
Definition: ffplay.c:326
AV_CODEC_ID_H263
@ AV_CODEC_ID_H263
Definition: codec_id.h:56
size
int size
Definition: twinvq_data.h:10344
AV_CODEC_ID_OPUS
@ AV_CODEC_ID_OPUS
Definition: codec_id.h:500
av_sdp_create
int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
Generate an SDP for an RTP session.
Definition: sdp.c:916
version
version
Definition: libkvazaar.c:321
AV_CODEC_ID_BITPACKED
@ AV_CODEC_ID_BITPACKED
Definition: codec_id.h:281
rtp.h
getaddrinfo
#define getaddrinfo
Definition: network.h:217
ff_isom_write_hvcc
int ff_isom_write_hvcc(AVIOContext *pb, const uint8_t *data, int size, int ps_array_completeness)
Writes HEVC extradata (parameter sets, declarative SEI NAL units) to the provided AVIOContext.
Definition: hevc.c:1044
AV_CODEC_ID_MJPEG
@ AV_CODEC_ID_MJPEG
Definition: codec_id.h:59
AV_BASE64_SIZE
#define AV_BASE64_SIZE(x)
Calculate the output size needed to base64-encode x bytes to a null-terminated string.
Definition: base64.h:66
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
AV_CODEC_ID_THEORA
@ AV_CODEC_ID_THEORA
Definition: codec_id.h:82
getnameinfo
#define getnameinfo
Definition: network.h:219
AVCodecParameters::height
int height
Definition: codec_par.h:135
AVCodecParameters::block_align
int block_align
Audio only.
Definition: codec_par.h:191
MAX_EXTRADATA_SIZE
#define MAX_EXTRADATA_SIZE
Definition: latmenc.c:35
AV_CODEC_ID_HEVC
@ AV_CODEC_ID_HEVC
Definition: codec_id.h:226
av_url_split
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:346
AV_STRINGIFY
#define AV_STRINGIFY(s)
Definition: macros.h:66
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:256
len
int len
Definition: vorbis_enc_data.h:426
nal.h
AVCodecParameters::field_order
enum AVFieldOrder field_order
Video only.
Definition: codec_par.h:161
version.h
LIBAVFORMAT_VERSION
#define LIBAVFORMAT_VERSION
Definition: version.h:40
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:743
AVFormatContext::oformat
const struct AVOutputFormat * oformat
The output container format.
Definition: avformat.h:1274
av_strlcat
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:95
sps
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
Definition: cbs_h264_syntax_template.c:260
pos
unsigned int pos
Definition: spdifenc.c:414
avformat.h
dict.h
network.h
id
enum AVCodecID id
Definition: dts2pts.c:365
AV_PIX_FMT_UYVY422
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:88
AV_CODEC_ID_H263P
@ AV_CODEC_ID_H263P
Definition: codec_id.h:71
AV_CODEC_ID_ADPCM_G726LE
@ AV_CODEC_ID_ADPCM_G726LE
Definition: codec_id.h:402
ff_avc_write_annexb_extradata
int ff_avc_write_annexb_extradata(const uint8_t *in, uint8_t **buf, int *size)
Definition: avc.c:144
ff_sdp_write_media
int ff_sdp_write_media(char *buff, int size, const AVStream *st, int idx, const char *dest_addr, const char *dest_type, int port, int ttl, AVFormatContext *fmt)
Append the media-specific SDP fragment for the media stream c to the buffer buff.
Definition: sdp.c:921
mode
mode
Definition: ebur128.h:83
av_base64_encode
char * av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size)
Encode data to base64 and null-terminate.
Definition: base64.c:147
avpriv_split_xiph_headers
int avpriv_split_xiph_headers(const uint8_t *extradata, int extradata_size, int first_header_size, const uint8_t *header_start[3], int header_len[3])
Split a single extradata buffer into the three headers that most Xiph codecs use.
Definition: xiph.c:26
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
ff_mpeg4audio_sample_rates
const int ff_mpeg4audio_sample_rates[16]
Definition: mpeg4audio_sample_rates.h:26
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AVCodecParameters::bits_per_coded_sample
int bits_per_coded_sample
The number of bits per sample in the codedwords.
Definition: codec_par.h:110
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
mem.h
AVCodecParameters::format
int format
Definition: codec_par.h:92
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
AVDictionaryEntry
Definition: dict.h:89
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:55
AV_CODEC_ID_ILBC
@ AV_CODEC_ID_ILBC
Definition: codec_id.h:499
AV_CODEC_ID_VP8
@ AV_CODEC_ID_VP8
Definition: codec_id.h:192
av_strlcpy
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:85
AVCodecParameters::bit_rate
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
Definition: codec_par.h:97
av_opt_get
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
Definition: opt.c:1159
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
AV_CODEC_ID_VORBIS
@ AV_CODEC_ID_VORBIS
Definition: codec_id.h:445
AVDictionaryEntry::value
char * value
Definition: dict.h:91
avstring.h
addrinfo
Definition: network.h:137
ff_nal_find_startcode
const uint8_t * ff_nal_find_startcode(const uint8_t *p, const uint8_t *end)
Definition: nal.c:68
AVFormatContext::priv_data
void * priv_data
Format private data.
Definition: avformat.h:1283
AV_CODEC_ID_PCM_S24BE
@ AV_CODEC_ID_PCM_S24BE
Definition: codec_id.h:341
ff_rtp_get_payload_type
int ff_rtp_get_payload_type(const AVFormatContext *fmt, const AVCodecParameters *par, int idx)
Return the payload type for a given stream used in the given format context.
Definition: rtp.c:93
AVIOContext::av_class
const AVClass * av_class
A class for private options.
Definition: avio.h:173
AV_RB16
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
Definition: bytestream.h:98