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