FFmpeg
utils.c
Go to the documentation of this file.
1 /*
2  * utils for libavcodec
3  * Copyright (c) 2001 Fabrice Bellard
4  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 /**
24  * @file
25  * utils.
26  */
27 
28 #include "config.h"
29 #include "libavutil/attributes.h"
30 #include "libavutil/avassert.h"
31 #include "libavutil/avstring.h"
32 #include "libavutil/bprint.h"
34 #include "libavutil/crc.h"
35 #include "libavutil/frame.h"
36 #include "libavutil/hwcontext.h"
37 #include "libavutil/internal.h"
38 #include "libavutil/mathematics.h"
39 #include "libavutil/mem_internal.h"
40 #include "libavutil/pixdesc.h"
41 #include "libavutil/imgutils.h"
42 #include "libavutil/samplefmt.h"
43 #include "libavutil/dict.h"
44 #include "libavutil/thread.h"
45 #include "avcodec.h"
46 #include "decode.h"
47 #include "hwaccel.h"
48 #include "libavutil/opt.h"
49 #include "mpegvideo.h"
50 #include "thread.h"
51 #include "frame_thread_encoder.h"
52 #include "internal.h"
53 #include "raw.h"
54 #include "bytestream.h"
55 #include "version.h"
56 #include <stdlib.h>
57 #include <stdarg.h>
58 #include <stdatomic.h>
59 #include <limits.h>
60 #include <float.h>
61 #if CONFIG_ICONV
62 # include <iconv.h>
63 #endif
64 
65 #include "libavutil/ffversion.h"
66 const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
67 
69 
70 void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
71 {
72  uint8_t **p = ptr;
73  if (min_size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
74  av_freep(p);
75  *size = 0;
76  return;
77  }
78  if (!ff_fast_malloc(p, size, min_size + AV_INPUT_BUFFER_PADDING_SIZE, 1))
79  memset(*p + min_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
80 }
81 
82 void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size)
83 {
84  uint8_t **p = ptr;
85  if (min_size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
86  av_freep(p);
87  *size = 0;
88  return;
89  }
90  if (!ff_fast_malloc(p, size, min_size + AV_INPUT_BUFFER_PADDING_SIZE, 1))
91  memset(*p, 0, min_size + AV_INPUT_BUFFER_PADDING_SIZE);
92 }
93 
94 int av_codec_is_encoder(const AVCodec *codec)
95 {
96  return codec && (codec->encode_sub || codec->encode2 ||codec->send_frame);
97 }
98 
99 int av_codec_is_decoder(const AVCodec *codec)
100 {
101  return codec && (codec->decode || codec->receive_frame);
102 }
103 
105 {
106  int ret = av_image_check_size2(width, height, s->max_pixels, AV_PIX_FMT_NONE, 0, s);
107 
108  if (ret < 0)
109  width = height = 0;
110 
111  s->coded_width = width;
112  s->coded_height = height;
113  s->width = AV_CEIL_RSHIFT(width, s->lowres);
114  s->height = AV_CEIL_RSHIFT(height, s->lowres);
115 
116  return ret;
117 }
118 
120 {
121  int ret = av_image_check_sar(avctx->width, avctx->height, sar);
122 
123  if (ret < 0) {
124  av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %d/%d\n",
125  sar.num, sar.den);
126  avctx->sample_aspect_ratio = (AVRational){ 0, 1 };
127  return ret;
128  } else {
129  avctx->sample_aspect_ratio = sar;
130  }
131  return 0;
132 }
133 
135  enum AVMatrixEncoding matrix_encoding)
136 {
137  AVFrameSideData *side_data;
138  enum AVMatrixEncoding *data;
139 
141  if (!side_data)
143  sizeof(enum AVMatrixEncoding));
144 
145  if (!side_data)
146  return AVERROR(ENOMEM);
147 
148  data = (enum AVMatrixEncoding*)side_data->data;
149  *data = matrix_encoding;
150 
151  return 0;
152 }
153 
155  int linesize_align[AV_NUM_DATA_POINTERS])
156 {
157  int i;
158  int w_align = 1;
159  int h_align = 1;
160  AVPixFmtDescriptor const *desc = av_pix_fmt_desc_get(s->pix_fmt);
161 
162  if (desc) {
163  w_align = 1 << desc->log2_chroma_w;
164  h_align = 1 << desc->log2_chroma_h;
165  }
166 
167  switch (s->pix_fmt) {
168  case AV_PIX_FMT_YUV420P:
169  case AV_PIX_FMT_YUYV422:
170  case AV_PIX_FMT_YVYU422:
171  case AV_PIX_FMT_UYVY422:
172  case AV_PIX_FMT_YUV422P:
173  case AV_PIX_FMT_YUV440P:
174  case AV_PIX_FMT_YUV444P:
175  case AV_PIX_FMT_GBRP:
176  case AV_PIX_FMT_GBRAP:
177  case AV_PIX_FMT_GRAY8:
178  case AV_PIX_FMT_GRAY16BE:
179  case AV_PIX_FMT_GRAY16LE:
180  case AV_PIX_FMT_YUVJ420P:
181  case AV_PIX_FMT_YUVJ422P:
182  case AV_PIX_FMT_YUVJ440P:
183  case AV_PIX_FMT_YUVJ444P:
184  case AV_PIX_FMT_YUVA420P:
185  case AV_PIX_FMT_YUVA422P:
186  case AV_PIX_FMT_YUVA444P:
243  case AV_PIX_FMT_GBRP9LE:
244  case AV_PIX_FMT_GBRP9BE:
245  case AV_PIX_FMT_GBRP10LE:
246  case AV_PIX_FMT_GBRP10BE:
247  case AV_PIX_FMT_GBRP12LE:
248  case AV_PIX_FMT_GBRP12BE:
249  case AV_PIX_FMT_GBRP14LE:
250  case AV_PIX_FMT_GBRP14BE:
251  case AV_PIX_FMT_GBRP16LE:
252  case AV_PIX_FMT_GBRP16BE:
257  w_align = 16; //FIXME assume 16 pixel per macroblock
258  h_align = 16 * 2; // interlaced needs 2 macroblocks height
259  break;
260  case AV_PIX_FMT_YUV411P:
261  case AV_PIX_FMT_YUVJ411P:
263  w_align = 32;
264  h_align = 16 * 2;
265  break;
266  case AV_PIX_FMT_YUV410P:
267  if (s->codec_id == AV_CODEC_ID_SVQ1) {
268  w_align = 64;
269  h_align = 64;
270  }
271  break;
272  case AV_PIX_FMT_RGB555:
273  if (s->codec_id == AV_CODEC_ID_RPZA) {
274  w_align = 4;
275  h_align = 4;
276  }
277  if (s->codec_id == AV_CODEC_ID_INTERPLAY_VIDEO) {
278  w_align = 8;
279  h_align = 8;
280  }
281  break;
282  case AV_PIX_FMT_PAL8:
283  case AV_PIX_FMT_BGR8:
284  case AV_PIX_FMT_RGB8:
285  if (s->codec_id == AV_CODEC_ID_SMC ||
286  s->codec_id == AV_CODEC_ID_CINEPAK) {
287  w_align = 4;
288  h_align = 4;
289  }
290  if (s->codec_id == AV_CODEC_ID_JV ||
291  s->codec_id == AV_CODEC_ID_INTERPLAY_VIDEO) {
292  w_align = 8;
293  h_align = 8;
294  }
295  if (s->codec_id == AV_CODEC_ID_MJPEG ||
296  s->codec_id == AV_CODEC_ID_MJPEGB ||
297  s->codec_id == AV_CODEC_ID_LJPEG ||
298  s->codec_id == AV_CODEC_ID_SMVJPEG ||
299  s->codec_id == AV_CODEC_ID_AMV ||
300  s->codec_id == AV_CODEC_ID_SP5X ||
301  s->codec_id == AV_CODEC_ID_JPEGLS) {
302  w_align = 8;
303  h_align = 2*8;
304  }
305  break;
306  case AV_PIX_FMT_BGR24:
307  if ((s->codec_id == AV_CODEC_ID_MSZH) ||
308  (s->codec_id == AV_CODEC_ID_ZLIB)) {
309  w_align = 4;
310  h_align = 4;
311  }
312  break;
313  case AV_PIX_FMT_RGB24:
314  if (s->codec_id == AV_CODEC_ID_CINEPAK) {
315  w_align = 4;
316  h_align = 4;
317  }
318  break;
319  default:
320  break;
321  }
322 
323  if (s->codec_id == AV_CODEC_ID_IFF_ILBM) {
324  w_align = FFMAX(w_align, 8);
325  }
326 
327  *width = FFALIGN(*width, w_align);
328  *height = FFALIGN(*height, h_align);
329  if (s->codec_id == AV_CODEC_ID_H264 || s->lowres ||
330  s->codec_id == AV_CODEC_ID_VP5 || s->codec_id == AV_CODEC_ID_VP6 ||
331  s->codec_id == AV_CODEC_ID_VP6F || s->codec_id == AV_CODEC_ID_VP6A
332  ) {
333  // some of the optimized chroma MC reads one line too much
334  // which is also done in mpeg decoders with lowres > 0
335  *height += 2;
336 
337  // H.264 uses edge emulation for out of frame motion vectors, for this
338  // it requires a temporary area large enough to hold a 21x21 block,
339  // increasing witdth ensure that the temporary area is large enough,
340  // the next rounded up width is 32
341  *width = FFMAX(*width, 32);
342  }
343 
344  for (i = 0; i < 4; i++)
345  linesize_align[i] = STRIDE_ALIGN;
346 }
347 
349 {
350  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt);
351  int chroma_shift = desc->log2_chroma_w;
352  int linesize_align[AV_NUM_DATA_POINTERS];
353  int align;
354 
355  avcodec_align_dimensions2(s, width, height, linesize_align);
356  align = FFMAX(linesize_align[0], linesize_align[3]);
357  linesize_align[1] <<= chroma_shift;
358  linesize_align[2] <<= chroma_shift;
359  align = FFMAX3(align, linesize_align[1], linesize_align[2]);
360  *width = FFALIGN(*width, align);
361 }
362 
363 int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos)
364 {
365  if (pos <= AVCHROMA_LOC_UNSPECIFIED || pos >= AVCHROMA_LOC_NB)
366  return AVERROR(EINVAL);
367  pos--;
368 
369  *xpos = (pos&1) * 128;
370  *ypos = ((pos>>1)^(pos<4)) * 128;
371 
372  return 0;
373 }
374 
376 {
377  int pos, xout, yout;
378 
379  for (pos = AVCHROMA_LOC_UNSPECIFIED + 1; pos < AVCHROMA_LOC_NB; pos++) {
380  if (avcodec_enum_to_chroma_pos(&xout, &yout, pos) == 0 && xout == xpos && yout == ypos)
381  return pos;
382  }
384 }
385 
387  enum AVSampleFormat sample_fmt, const uint8_t *buf,
388  int buf_size, int align)
389 {
390  int ch, planar, needed_size, ret = 0;
391 
393  frame->nb_samples, sample_fmt,
394  align);
395  if (buf_size < needed_size)
396  return AVERROR(EINVAL);
397 
398  planar = av_sample_fmt_is_planar(sample_fmt);
400  if (!(frame->extended_data = av_mallocz_array(nb_channels,
401  sizeof(*frame->extended_data))))
402  return AVERROR(ENOMEM);
403  } else {
404  frame->extended_data = frame->data;
405  }
406 
407  if ((ret = av_samples_fill_arrays(frame->extended_data, &frame->linesize[0],
408  (uint8_t *)(intptr_t)buf, nb_channels, frame->nb_samples,
409  sample_fmt, align)) < 0) {
410  if (frame->extended_data != frame->data)
411  av_freep(&frame->extended_data);
412  return ret;
413  }
414  if (frame->extended_data != frame->data) {
415  for (ch = 0; ch < AV_NUM_DATA_POINTERS; ch++)
416  frame->data[ch] = frame->extended_data[ch];
417  }
418 
419  return ret;
420 }
421 
422 void ff_color_frame(AVFrame *frame, const int c[4])
423 {
425  int p, y;
426 
428 
429  for (p = 0; p<desc->nb_components; p++) {
430  uint8_t *dst = frame->data[p];
431  int is_chroma = p == 1 || p == 2;
432  int bytes = is_chroma ? AV_CEIL_RSHIFT(frame->width, desc->log2_chroma_w) : frame->width;
433  int height = is_chroma ? AV_CEIL_RSHIFT(frame->height, desc->log2_chroma_h) : frame->height;
434  if (desc->comp[0].depth >= 9) {
435  ((uint16_t*)dst)[0] = c[p];
436  av_memcpy_backptr(dst + 2, 2, bytes - 2);
437  dst += frame->linesize[p];
438  for (y = 1; y < height; y++) {
439  memcpy(dst, frame->data[p], 2*bytes);
440  dst += frame->linesize[p];
441  }
442  } else {
443  for (y = 0; y < height; y++) {
444  memset(dst, c[p], bytes);
445  dst += frame->linesize[p];
446  }
447  }
448  }
449 }
450 
451 int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size)
452 {
453  int i;
454 
455  for (i = 0; i < count; i++) {
456  int r = func(c, (char *)arg + i * size);
457  if (ret)
458  ret[i] = r;
459  }
460  emms_c();
461  return 0;
462 }
463 
464 int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int jobnr, int threadnr), void *arg, int *ret, int count)
465 {
466  int i;
467 
468  for (i = 0; i < count; i++) {
469  int r = func(c, arg, i, 0);
470  if (ret)
471  ret[i] = r;
472  }
473  emms_c();
474  return 0;
475 }
476 
478  unsigned int fourcc)
479 {
480  while (tags->pix_fmt >= 0) {
481  if (tags->fourcc == fourcc)
482  return tags->pix_fmt;
483  tags++;
484  }
485  return AV_PIX_FMT_NONE;
486 }
487 
488 #if FF_API_CODEC_GET_SET
489 MAKE_ACCESSORS(AVCodecContext, codec, AVRational, pkt_timebase)
490 MAKE_ACCESSORS(AVCodecContext, codec, const AVCodecDescriptor *, codec_descriptor)
492 MAKE_ACCESSORS(AVCodecContext, codec, int, seek_preroll)
493 MAKE_ACCESSORS(AVCodecContext, codec, uint16_t*, chroma_intra_matrix)
494 
496 {
497  return codec->properties;
498 }
499 
501 {
502  return codec->max_lowres;
503 }
504 #endif
505 
508 }
509 
511 {
512  int64_t bit_rate;
513  int bits_per_sample;
514 
515  switch (ctx->codec_type) {
516  case AVMEDIA_TYPE_VIDEO:
517  case AVMEDIA_TYPE_DATA:
520  bit_rate = ctx->bit_rate;
521  break;
522  case AVMEDIA_TYPE_AUDIO:
523  bits_per_sample = av_get_bits_per_sample(ctx->codec_id);
524  if (bits_per_sample) {
525  bit_rate = ctx->sample_rate * (int64_t)ctx->channels;
526  if (bit_rate > INT64_MAX / bits_per_sample) {
527  bit_rate = 0;
528  } else
529  bit_rate *= bits_per_sample;
530  } else
531  bit_rate = ctx->bit_rate;
532  break;
533  default:
534  bit_rate = 0;
535  break;
536  }
537  return bit_rate;
538 }
539 
540 
541 static void ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec)
542 {
543  if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE) && codec->init)
545 }
546 
547 static void ff_unlock_avcodec(const AVCodec *codec)
548 {
549  if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE) && codec->init)
551 }
552 
553 int attribute_align_arg ff_codec_open2_recursive(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
554 {
555  int ret = 0;
556 
557  ff_unlock_avcodec(codec);
558 
559  ret = avcodec_open2(avctx, codec, options);
560 
561  ff_lock_avcodec(avctx, codec);
562  return ret;
563 }
564 
565 int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
566 {
567  int ret = 0;
568  int codec_init_ok = 0;
569  AVDictionary *tmp = NULL;
570  const AVPixFmtDescriptor *pixdesc;
571 
572  if (avcodec_is_open(avctx))
573  return 0;
574 
575  if ((!codec && !avctx->codec)) {
576  av_log(avctx, AV_LOG_ERROR, "No codec provided to avcodec_open2()\n");
577  return AVERROR(EINVAL);
578  }
579  if ((codec && avctx->codec && codec != avctx->codec)) {
580  av_log(avctx, AV_LOG_ERROR, "This AVCodecContext was allocated for %s, "
581  "but %s passed to avcodec_open2()\n", avctx->codec->name, codec->name);
582  return AVERROR(EINVAL);
583  }
584  if (!codec)
585  codec = avctx->codec;
586 
587  if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE)
588  return AVERROR(EINVAL);
589 
590  if (options)
591  av_dict_copy(&tmp, *options, 0);
592 
593  ff_lock_avcodec(avctx, codec);
594 
595  avctx->internal = av_mallocz(sizeof(*avctx->internal));
596  if (!avctx->internal) {
597  ret = AVERROR(ENOMEM);
598  goto end;
599  }
600 
601  avctx->internal->pool = av_mallocz(sizeof(*avctx->internal->pool));
602  if (!avctx->internal->pool) {
603  ret = AVERROR(ENOMEM);
604  goto free_and_end;
605  }
606 
607  avctx->internal->to_free = av_frame_alloc();
608  if (!avctx->internal->to_free) {
609  ret = AVERROR(ENOMEM);
610  goto free_and_end;
611  }
612 
614  if (!avctx->internal->compat_decode_frame) {
615  ret = AVERROR(ENOMEM);
616  goto free_and_end;
617  }
618 
620  if (!avctx->internal->buffer_frame) {
621  ret = AVERROR(ENOMEM);
622  goto free_and_end;
623  }
624 
625  avctx->internal->buffer_pkt = av_packet_alloc();
626  if (!avctx->internal->buffer_pkt) {
627  ret = AVERROR(ENOMEM);
628  goto free_and_end;
629  }
630 
631  avctx->internal->ds.in_pkt = av_packet_alloc();
632  if (!avctx->internal->ds.in_pkt) {
633  ret = AVERROR(ENOMEM);
634  goto free_and_end;
635  }
636 
638  if (!avctx->internal->last_pkt_props) {
639  ret = AVERROR(ENOMEM);
640  goto free_and_end;
641  }
642 
643  avctx->internal->skip_samples_multiplier = 1;
644 
645  if (codec->priv_data_size > 0) {
646  if (!avctx->priv_data) {
647  avctx->priv_data = av_mallocz(codec->priv_data_size);
648  if (!avctx->priv_data) {
649  ret = AVERROR(ENOMEM);
650  goto end;
651  }
652  if (codec->priv_class) {
653  *(const AVClass **)avctx->priv_data = codec->priv_class;
655  }
656  }
657  if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0)
658  goto free_and_end;
659  } else {
660  avctx->priv_data = NULL;
661  }
662  if ((ret = av_opt_set_dict(avctx, &tmp)) < 0)
663  goto free_and_end;
664 
665  if (avctx->codec_whitelist && av_match_list(codec->name, avctx->codec_whitelist, ',') <= 0) {
666  av_log(avctx, AV_LOG_ERROR, "Codec (%s) not on whitelist \'%s\'\n", codec->name, avctx->codec_whitelist);
667  ret = AVERROR(EINVAL);
668  goto free_and_end;
669  }
670 
671  // only call ff_set_dimensions() for non H.264/VP6F/DXV codecs so as not to overwrite previously setup dimensions
672  if (!(avctx->coded_width && avctx->coded_height && avctx->width && avctx->height &&
673  (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_VP6F || avctx->codec_id == AV_CODEC_ID_DXV))) {
674  if (avctx->coded_width && avctx->coded_height)
675  ret = ff_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
676  else if (avctx->width && avctx->height)
677  ret = ff_set_dimensions(avctx, avctx->width, avctx->height);
678  if (ret < 0)
679  goto free_and_end;
680  }
681 
682  if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height)
683  && ( av_image_check_size2(avctx->coded_width, avctx->coded_height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0
684  || av_image_check_size2(avctx->width, avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0)) {
685  av_log(avctx, AV_LOG_WARNING, "Ignoring invalid width/height values\n");
686  ff_set_dimensions(avctx, 0, 0);
687  }
688 
689  if (avctx->width > 0 && avctx->height > 0) {
690  if (av_image_check_sar(avctx->width, avctx->height,
691  avctx->sample_aspect_ratio) < 0) {
692  av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\n",
693  avctx->sample_aspect_ratio.num,
694  avctx->sample_aspect_ratio.den);
695  avctx->sample_aspect_ratio = (AVRational){ 0, 1 };
696  }
697  }
698 
699  /* if the decoder init function was already called previously,
700  * free the already allocated subtitle_header before overwriting it */
701  if (av_codec_is_decoder(codec))
702  av_freep(&avctx->subtitle_header);
703 
704  if (avctx->channels > FF_SANE_NB_CHANNELS || avctx->channels < 0) {
705  av_log(avctx, AV_LOG_ERROR, "Too many or invalid channels: %d\n", avctx->channels);
706  ret = AVERROR(EINVAL);
707  goto free_and_end;
708  }
709  if (avctx->sample_rate < 0) {
710  av_log(avctx, AV_LOG_ERROR, "Invalid sample rate: %d\n", avctx->sample_rate);
711  ret = AVERROR(EINVAL);
712  goto free_and_end;
713  }
714  if (avctx->block_align < 0) {
715  av_log(avctx, AV_LOG_ERROR, "Invalid block align: %d\n", avctx->block_align);
716  ret = AVERROR(EINVAL);
717  goto free_and_end;
718  }
719 
720  avctx->codec = codec;
721  if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) &&
722  avctx->codec_id == AV_CODEC_ID_NONE) {
723  avctx->codec_type = codec->type;
724  avctx->codec_id = codec->id;
725  }
726  if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type
727  && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) {
728  av_log(avctx, AV_LOG_ERROR, "Codec type or id mismatches\n");
729  ret = AVERROR(EINVAL);
730  goto free_and_end;
731  }
732  avctx->frame_number = 0;
734 
735  if ((avctx->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) &&
737  const char *codec_string = av_codec_is_encoder(codec) ? "encoder" : "decoder";
738  AVCodec *codec2;
739  av_log(avctx, AV_LOG_ERROR,
740  "The %s '%s' is experimental but experimental codecs are not enabled, "
741  "add '-strict %d' if you want to use it.\n",
743  codec2 = av_codec_is_encoder(codec) ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id);
744  if (!(codec2->capabilities & AV_CODEC_CAP_EXPERIMENTAL))
745  av_log(avctx, AV_LOG_ERROR, "Alternatively use the non experimental %s '%s'.\n",
746  codec_string, codec2->name);
748  goto free_and_end;
749  }
750 
751  if (avctx->codec_type == AVMEDIA_TYPE_AUDIO &&
752  (!avctx->time_base.num || !avctx->time_base.den)) {
753  avctx->time_base.num = 1;
754  avctx->time_base.den = avctx->sample_rate;
755  }
756 
757  if (!HAVE_THREADS)
758  av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread support, using thread emulation\n");
759 
760  if (CONFIG_FRAME_THREAD_ENCODER && av_codec_is_encoder(avctx->codec)) {
761  ff_unlock_avcodec(codec); //we will instantiate a few encoders thus kick the counter to prevent false detection of a problem
763  ff_lock_avcodec(avctx, codec);
764  if (ret < 0)
765  goto free_and_end;
766  }
767 
768  if (av_codec_is_decoder(avctx->codec)) {
769  ret = ff_decode_bsfs_init(avctx);
770  if (ret < 0)
771  goto free_and_end;
772  }
773 
774  if (HAVE_THREADS
776  ret = ff_thread_init(avctx);
777  if (ret < 0) {
778  goto free_and_end;
779  }
780  }
781  if (!HAVE_THREADS && !(codec->capabilities & AV_CODEC_CAP_AUTO_THREADS))
782  avctx->thread_count = 1;
783 
784  if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) {
785  av_log(avctx, AV_LOG_WARNING, "The maximum value for lowres supported by the decoder is %d\n",
786  avctx->codec->max_lowres);
787  avctx->lowres = avctx->codec->max_lowres;
788  }
789 
790  if (av_codec_is_encoder(avctx->codec)) {
791  int i;
792 #if FF_API_CODED_FRAME
794  avctx->coded_frame = av_frame_alloc();
795  if (!avctx->coded_frame) {
796  ret = AVERROR(ENOMEM);
797  goto free_and_end;
798  }
800 #endif
801 
802  if (avctx->time_base.num <= 0 || avctx->time_base.den <= 0) {
803  av_log(avctx, AV_LOG_ERROR, "The encoder timebase is not set.\n");
804  ret = AVERROR(EINVAL);
805  goto free_and_end;
806  }
807 
808  if (avctx->codec->sample_fmts) {
809  for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {
810  if (avctx->sample_fmt == avctx->codec->sample_fmts[i])
811  break;
812  if (avctx->channels == 1 &&
815  avctx->sample_fmt = avctx->codec->sample_fmts[i];
816  break;
817  }
818  }
819  if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) {
820  char buf[128];
821  snprintf(buf, sizeof(buf), "%d", avctx->sample_fmt);
822  av_log(avctx, AV_LOG_ERROR, "Specified sample format %s is invalid or not supported\n",
824  ret = AVERROR(EINVAL);
825  goto free_and_end;
826  }
827  }
828  if (avctx->codec->pix_fmts) {
829  for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++)
830  if (avctx->pix_fmt == avctx->codec->pix_fmts[i])
831  break;
832  if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE
833  && !((avctx->codec_id == AV_CODEC_ID_MJPEG || avctx->codec_id == AV_CODEC_ID_LJPEG)
835  char buf[128];
836  snprintf(buf, sizeof(buf), "%d", avctx->pix_fmt);
837  av_log(avctx, AV_LOG_ERROR, "Specified pixel format %s is invalid or not supported\n",
838  (char *)av_x_if_null(av_get_pix_fmt_name(avctx->pix_fmt), buf));
839  ret = AVERROR(EINVAL);
840  goto free_and_end;
841  }
842  if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ420P ||
843  avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ411P ||
844  avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ422P ||
845  avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ440P ||
846  avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ444P)
847  avctx->color_range = AVCOL_RANGE_JPEG;
848  }
849  if (avctx->codec->supported_samplerates) {
850  for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++)
851  if (avctx->sample_rate == avctx->codec->supported_samplerates[i])
852  break;
853  if (avctx->codec->supported_samplerates[i] == 0) {
854  av_log(avctx, AV_LOG_ERROR, "Specified sample rate %d is not supported\n",
855  avctx->sample_rate);
856  ret = AVERROR(EINVAL);
857  goto free_and_end;
858  }
859  }
860  if (avctx->sample_rate < 0) {
861  av_log(avctx, AV_LOG_ERROR, "Specified sample rate %d is not supported\n",
862  avctx->sample_rate);
863  ret = AVERROR(EINVAL);
864  goto free_and_end;
865  }
866  if (avctx->codec->channel_layouts) {
867  if (!avctx->channel_layout) {
868  av_log(avctx, AV_LOG_WARNING, "Channel layout not specified\n");
869  } else {
870  for (i = 0; avctx->codec->channel_layouts[i] != 0; i++)
871  if (avctx->channel_layout == avctx->codec->channel_layouts[i])
872  break;
873  if (avctx->codec->channel_layouts[i] == 0) {
874  char buf[512];
875  av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);
876  av_log(avctx, AV_LOG_ERROR, "Specified channel layout '%s' is not supported\n", buf);
877  ret = AVERROR(EINVAL);
878  goto free_and_end;
879  }
880  }
881  }
882  if (avctx->channel_layout && avctx->channels) {
884  if (channels != avctx->channels) {
885  char buf[512];
886  av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);
887  av_log(avctx, AV_LOG_ERROR,
888  "Channel layout '%s' with %d channels does not match number of specified channels %d\n",
889  buf, channels, avctx->channels);
890  ret = AVERROR(EINVAL);
891  goto free_and_end;
892  }
893  } else if (avctx->channel_layout) {
895  }
896  if (avctx->channels < 0) {
897  av_log(avctx, AV_LOG_ERROR, "Specified number of channels %d is not supported\n",
898  avctx->channels);
899  ret = AVERROR(EINVAL);
900  goto free_and_end;
901  }
902  if(avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
903  pixdesc = av_pix_fmt_desc_get(avctx->pix_fmt);
904  if ( avctx->bits_per_raw_sample < 0
905  || (avctx->bits_per_raw_sample > 8 && pixdesc->comp[0].depth <= 8)) {
906  av_log(avctx, AV_LOG_WARNING, "Specified bit depth %d not possible with the specified pixel formats depth %d\n",
907  avctx->bits_per_raw_sample, pixdesc->comp[0].depth);
908  avctx->bits_per_raw_sample = pixdesc->comp[0].depth;
909  }
910  if (avctx->width <= 0 || avctx->height <= 0) {
911  av_log(avctx, AV_LOG_ERROR, "dimensions not set\n");
912  ret = AVERROR(EINVAL);
913  goto free_and_end;
914  }
915  }
916  if ( (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO)
917  && avctx->bit_rate>0 && avctx->bit_rate<1000) {
918  av_log(avctx, AV_LOG_WARNING, "Bitrate %"PRId64" is extremely low, maybe you mean %"PRId64"k\n", avctx->bit_rate, avctx->bit_rate);
919  }
920 
921  if (!avctx->rc_initial_buffer_occupancy)
922  avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3LL / 4;
923 
924  if (avctx->ticks_per_frame && avctx->time_base.num &&
925  avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
926  av_log(avctx, AV_LOG_ERROR,
927  "ticks_per_frame %d too large for the timebase %d/%d.",
928  avctx->ticks_per_frame,
929  avctx->time_base.num,
930  avctx->time_base.den);
931  goto free_and_end;
932  }
933 
934  if (avctx->hw_frames_ctx) {
935  AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
936  if (frames_ctx->format != avctx->pix_fmt) {
937  av_log(avctx, AV_LOG_ERROR,
938  "Mismatching AVCodecContext.pix_fmt and AVHWFramesContext.format\n");
939  ret = AVERROR(EINVAL);
940  goto free_and_end;
941  }
942  if (avctx->sw_pix_fmt != AV_PIX_FMT_NONE &&
943  avctx->sw_pix_fmt != frames_ctx->sw_format) {
944  av_log(avctx, AV_LOG_ERROR,
945  "Mismatching AVCodecContext.sw_pix_fmt (%s) "
946  "and AVHWFramesContext.sw_format (%s)\n",
948  av_get_pix_fmt_name(frames_ctx->sw_format));
949  ret = AVERROR(EINVAL);
950  goto free_and_end;
951  }
952  avctx->sw_pix_fmt = frames_ctx->sw_format;
953  }
954  }
955 
958  avctx->pts_correction_last_pts =
959  avctx->pts_correction_last_dts = INT64_MIN;
960 
961  if ( !CONFIG_GRAY && avctx->flags & AV_CODEC_FLAG_GRAY
963  av_log(avctx, AV_LOG_WARNING,
964  "gray decoding requested but not enabled at configuration time\n");
965 
966  if ( avctx->codec->init && (!(avctx->active_thread_type&FF_THREAD_FRAME)
967  || avctx->internal->frame_thread_encoder)) {
968  ret = avctx->codec->init(avctx);
969  if (ret < 0) {
970  goto free_and_end;
971  }
972  codec_init_ok = 1;
973  }
974 
975  ret=0;
976 
977  if (av_codec_is_decoder(avctx->codec)) {
978  if (!avctx->bit_rate)
979  avctx->bit_rate = get_bit_rate(avctx);
980  /* validate channel layout from the decoder */
981  if (avctx->channel_layout) {
983  if (!avctx->channels)
984  avctx->channels = channels;
985  else if (channels != avctx->channels) {
986  char buf[512];
987  av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);
988  av_log(avctx, AV_LOG_WARNING,
989  "Channel layout '%s' with %d channels does not match specified number of channels %d: "
990  "ignoring specified channel layout\n",
991  buf, channels, avctx->channels);
992  avctx->channel_layout = 0;
993  }
994  }
995  if (avctx->channels && avctx->channels < 0 ||
996  avctx->channels > FF_SANE_NB_CHANNELS) {
997  ret = AVERROR(EINVAL);
998  goto free_and_end;
999  }
1000  if (avctx->bits_per_coded_sample < 0) {
1001  ret = AVERROR(EINVAL);
1002  goto free_and_end;
1003  }
1004  if (avctx->sub_charenc) {
1005  if (avctx->codec_type != AVMEDIA_TYPE_SUBTITLE) {
1006  av_log(avctx, AV_LOG_ERROR, "Character encoding is only "
1007  "supported with subtitles codecs\n");
1008  ret = AVERROR(EINVAL);
1009  goto free_and_end;
1010  } else if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) {
1011  av_log(avctx, AV_LOG_WARNING, "Codec '%s' is bitmap-based, "
1012  "subtitles character encoding will be ignored\n",
1013  avctx->codec_descriptor->name);
1015  } else {
1016  /* input character encoding is set for a text based subtitle
1017  * codec at this point */
1020 
1022 #if CONFIG_ICONV
1023  iconv_t cd = iconv_open("UTF-8", avctx->sub_charenc);
1024  if (cd == (iconv_t)-1) {
1025  ret = AVERROR(errno);
1026  av_log(avctx, AV_LOG_ERROR, "Unable to open iconv context "
1027  "with input character encoding \"%s\"\n", avctx->sub_charenc);
1028  goto free_and_end;
1029  }
1030  iconv_close(cd);
1031 #else
1032  av_log(avctx, AV_LOG_ERROR, "Character encoding subtitles "
1033  "conversion needs a libavcodec built with iconv support "
1034  "for this codec\n");
1035  ret = AVERROR(ENOSYS);
1036  goto free_and_end;
1037 #endif
1038  }
1039  }
1040  }
1041 
1042 #if FF_API_AVCTX_TIMEBASE
1043  if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
1044  avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));
1045 #endif
1046  }
1047  if (codec->priv_data_size > 0 && avctx->priv_data && codec->priv_class) {
1048  av_assert0(*(const AVClass **)avctx->priv_data == codec->priv_class);
1049  }
1050 
1051 end:
1052  ff_unlock_avcodec(codec);
1053  if (options) {
1055  *options = tmp;
1056  }
1057 
1058  return ret;
1059 free_and_end:
1060  if (avctx->codec && avctx->codec->close &&
1061  (codec_init_ok ||
1063  avctx->codec->close(avctx);
1064 
1065  if (HAVE_THREADS && avctx->internal->thread_ctx)
1066  ff_thread_free(avctx);
1067 
1068  if (codec->priv_class && codec->priv_data_size)
1069  av_opt_free(avctx->priv_data);
1070  av_opt_free(avctx);
1071 
1072 #if FF_API_CODED_FRAME
1074  av_frame_free(&avctx->coded_frame);
1076 #endif
1077 
1078  av_dict_free(&tmp);
1079  av_freep(&avctx->priv_data);
1080  av_freep(&avctx->subtitle_header);
1081  if (avctx->internal) {
1082  av_frame_free(&avctx->internal->to_free);
1087 
1088  av_packet_free(&avctx->internal->ds.in_pkt);
1089  ff_decode_bsfs_uninit(avctx);
1090 
1091  av_freep(&avctx->internal->pool);
1092  }
1093  av_freep(&avctx->internal);
1094  avctx->codec = NULL;
1095  goto end;
1096 }
1097 
1099 {
1100  int i;
1101 
1102  for (i = 0; i < sub->num_rects; i++) {
1103  av_freep(&sub->rects[i]->data[0]);
1104  av_freep(&sub->rects[i]->data[1]);
1105  av_freep(&sub->rects[i]->data[2]);
1106  av_freep(&sub->rects[i]->data[3]);
1107  av_freep(&sub->rects[i]->text);
1108  av_freep(&sub->rects[i]->ass);
1109  av_freep(&sub->rects[i]);
1110  }
1111 
1112  av_freep(&sub->rects);
1113 
1114  memset(sub, 0, sizeof(*sub));
1115 }
1116 
1118 {
1119  int i;
1120 
1121  if (!avctx)
1122  return 0;
1123 
1124  if (avcodec_is_open(avctx)) {
1125  FramePool *pool = avctx->internal->pool;
1126  if (CONFIG_FRAME_THREAD_ENCODER &&
1127  avctx->internal->frame_thread_encoder && avctx->thread_count > 1) {
1129  }
1130  if (HAVE_THREADS && avctx->internal->thread_ctx)
1131  ff_thread_free(avctx);
1132  if (avctx->codec && avctx->codec->close)
1133  avctx->codec->close(avctx);
1134  avctx->internal->byte_buffer_size = 0;
1135  av_freep(&avctx->internal->byte_buffer);
1136  av_frame_free(&avctx->internal->to_free);
1141 
1142  av_packet_free(&avctx->internal->ds.in_pkt);
1143 
1144  for (i = 0; i < FF_ARRAY_ELEMS(pool->pools); i++)
1145  av_buffer_pool_uninit(&pool->pools[i]);
1146  av_freep(&avctx->internal->pool);
1147 
1148  if (avctx->hwaccel && avctx->hwaccel->uninit)
1149  avctx->hwaccel->uninit(avctx);
1151 
1152  ff_decode_bsfs_uninit(avctx);
1153 
1154  av_freep(&avctx->internal);
1155  }
1156 
1157  for (i = 0; i < avctx->nb_coded_side_data; i++)
1158  av_freep(&avctx->coded_side_data[i].data);
1159  av_freep(&avctx->coded_side_data);
1160  avctx->nb_coded_side_data = 0;
1161 
1162  av_buffer_unref(&avctx->hw_frames_ctx);
1163  av_buffer_unref(&avctx->hw_device_ctx);
1164 
1165  if (avctx->priv_data && avctx->codec && avctx->codec->priv_class)
1166  av_opt_free(avctx->priv_data);
1167  av_opt_free(avctx);
1168  av_freep(&avctx->priv_data);
1169  if (av_codec_is_encoder(avctx->codec)) {
1170  av_freep(&avctx->extradata);
1171 #if FF_API_CODED_FRAME
1173  av_frame_free(&avctx->coded_frame);
1175 #endif
1176  }
1177  avctx->codec = NULL;
1178  avctx->active_thread_type = 0;
1179 
1180  return 0;
1181 }
1182 
1183 const char *avcodec_get_name(enum AVCodecID id)
1184 {
1185  const AVCodecDescriptor *cd;
1186  AVCodec *codec;
1187 
1188  if (id == AV_CODEC_ID_NONE)
1189  return "none";
1190  cd = avcodec_descriptor_get(id);
1191  if (cd)
1192  return cd->name;
1193  av_log(NULL, AV_LOG_WARNING, "Codec 0x%x is not in the full list.\n", id);
1194  codec = avcodec_find_decoder(id);
1195  if (codec)
1196  return codec->name;
1197  codec = avcodec_find_encoder(id);
1198  if (codec)
1199  return codec->name;
1200  return "unknown_codec";
1201 }
1202 
1203 size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
1204 {
1205  int i, len, ret = 0;
1206 
1207 #define TAG_PRINT(x) \
1208  (((x) >= '0' && (x) <= '9') || \
1209  ((x) >= 'a' && (x) <= 'z') || ((x) >= 'A' && (x) <= 'Z') || \
1210  ((x) == '.' || (x) == ' ' || (x) == '-' || (x) == '_'))
1211 
1212  for (i = 0; i < 4; i++) {
1213  len = snprintf(buf, buf_size,
1214  TAG_PRINT(codec_tag & 0xFF) ? "%c" : "[%d]", codec_tag & 0xFF);
1215  buf += len;
1216  buf_size = buf_size > len ? buf_size - len : 0;
1217  ret += len;
1218  codec_tag >>= 8;
1219  }
1220  return ret;
1221 }
1222 
1223 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
1224 {
1225  const char *codec_type;
1226  const char *codec_name;
1227  const char *profile = NULL;
1228  int64_t bitrate;
1229  int new_line = 0;
1230  AVRational display_aspect_ratio;
1231  const char *separator = enc->dump_separator ? (const char *)enc->dump_separator : ", ";
1232 
1233  if (!buf || buf_size <= 0)
1234  return;
1236  codec_name = avcodec_get_name(enc->codec_id);
1238 
1239  snprintf(buf, buf_size, "%s: %s", codec_type ? codec_type : "unknown",
1240  codec_name);
1241  buf[0] ^= 'a' ^ 'A'; /* first letter in uppercase */
1242 
1243  if (enc->codec && strcmp(enc->codec->name, codec_name))
1244  snprintf(buf + strlen(buf), buf_size - strlen(buf), " (%s)", enc->codec->name);
1245 
1246  if (profile)
1247  snprintf(buf + strlen(buf), buf_size - strlen(buf), " (%s)", profile);
1248  if ( enc->codec_type == AVMEDIA_TYPE_VIDEO
1250  && enc->refs)
1251  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1252  ", %d reference frame%s",
1253  enc->refs, enc->refs > 1 ? "s" : "");
1254 
1255  if (enc->codec_tag)
1256  snprintf(buf + strlen(buf), buf_size - strlen(buf), " (%s / 0x%04X)",
1257  av_fourcc2str(enc->codec_tag), enc->codec_tag);
1258 
1259  switch (enc->codec_type) {
1260  case AVMEDIA_TYPE_VIDEO:
1261  {
1262  char detail[256] = "(";
1263 
1264  av_strlcat(buf, separator, buf_size);
1265 
1266  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1267  "%s", enc->pix_fmt == AV_PIX_FMT_NONE ? "none" :
1269  if (enc->bits_per_raw_sample && enc->pix_fmt != AV_PIX_FMT_NONE &&
1271  av_strlcatf(detail, sizeof(detail), "%d bpc, ", enc->bits_per_raw_sample);
1273  av_strlcatf(detail, sizeof(detail), "%s, ",
1275 
1276  if (enc->colorspace != AVCOL_SPC_UNSPECIFIED ||
1278  enc->color_trc != AVCOL_TRC_UNSPECIFIED) {
1279  if (enc->colorspace != (int)enc->color_primaries ||
1280  enc->colorspace != (int)enc->color_trc) {
1281  new_line = 1;
1282  av_strlcatf(detail, sizeof(detail), "%s/%s/%s, ",
1286  } else
1287  av_strlcatf(detail, sizeof(detail), "%s, ",
1289  }
1290 
1291  if (enc->field_order != AV_FIELD_UNKNOWN) {
1292  const char *field_order = "progressive";
1293  if (enc->field_order == AV_FIELD_TT)
1294  field_order = "top first";
1295  else if (enc->field_order == AV_FIELD_BB)
1296  field_order = "bottom first";
1297  else if (enc->field_order == AV_FIELD_TB)
1298  field_order = "top coded first (swapped)";
1299  else if (enc->field_order == AV_FIELD_BT)
1300  field_order = "bottom coded first (swapped)";
1301 
1302  av_strlcatf(detail, sizeof(detail), "%s, ", field_order);
1303  }
1304 
1305  if (av_log_get_level() >= AV_LOG_VERBOSE &&
1307  av_strlcatf(detail, sizeof(detail), "%s, ",
1309 
1310  if (strlen(detail) > 1) {
1311  detail[strlen(detail) - 2] = 0;
1312  av_strlcatf(buf, buf_size, "%s)", detail);
1313  }
1314  }
1315 
1316  if (enc->width) {
1317  av_strlcat(buf, new_line ? separator : ", ", buf_size);
1318 
1319  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1320  "%dx%d",
1321  enc->width, enc->height);
1322 
1323  if (av_log_get_level() >= AV_LOG_VERBOSE &&
1324  (enc->width != enc->coded_width ||
1325  enc->height != enc->coded_height))
1326  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1327  " (%dx%d)", enc->coded_width, enc->coded_height);
1328 
1329  if (enc->sample_aspect_ratio.num) {
1330  av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
1331  enc->width * (int64_t)enc->sample_aspect_ratio.num,
1332  enc->height * (int64_t)enc->sample_aspect_ratio.den,
1333  1024 * 1024);
1334  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1335  " [SAR %d:%d DAR %d:%d]",
1337  display_aspect_ratio.num, display_aspect_ratio.den);
1338  }
1339  if (av_log_get_level() >= AV_LOG_DEBUG) {
1340  int g = av_gcd(enc->time_base.num, enc->time_base.den);
1341  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1342  ", %d/%d",
1343  enc->time_base.num / g, enc->time_base.den / g);
1344  }
1345  }
1346  if (encode) {
1347  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1348  ", q=%d-%d", enc->qmin, enc->qmax);
1349  } else {
1351  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1352  ", Closed Captions");
1354  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1355  ", lossless");
1356  }
1357  break;
1358  case AVMEDIA_TYPE_AUDIO:
1359  av_strlcat(buf, separator, buf_size);
1360 
1361  if (enc->sample_rate) {
1362  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1363  "%d Hz, ", enc->sample_rate);
1364  }
1365  av_get_channel_layout_string(buf + strlen(buf), buf_size - strlen(buf), enc->channels, enc->channel_layout);
1366  if (enc->sample_fmt != AV_SAMPLE_FMT_NONE) {
1367  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1368  ", %s", av_get_sample_fmt_name(enc->sample_fmt));
1369  }
1370  if ( enc->bits_per_raw_sample > 0
1372  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1373  " (%d bit)", enc->bits_per_raw_sample);
1374  if (av_log_get_level() >= AV_LOG_VERBOSE) {
1375  if (enc->initial_padding)
1376  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1377  ", delay %d", enc->initial_padding);
1378  if (enc->trailing_padding)
1379  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1380  ", padding %d", enc->trailing_padding);
1381  }
1382  break;
1383  case AVMEDIA_TYPE_DATA:
1384  if (av_log_get_level() >= AV_LOG_DEBUG) {
1385  int g = av_gcd(enc->time_base.num, enc->time_base.den);
1386  if (g)
1387  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1388  ", %d/%d",
1389  enc->time_base.num / g, enc->time_base.den / g);
1390  }
1391  break;
1392  case AVMEDIA_TYPE_SUBTITLE:
1393  if (enc->width)
1394  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1395  ", %dx%d", enc->width, enc->height);
1396  break;
1397  default:
1398  return;
1399  }
1400  if (encode) {
1401  if (enc->flags & AV_CODEC_FLAG_PASS1)
1402  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1403  ", pass 1");
1404  if (enc->flags & AV_CODEC_FLAG_PASS2)
1405  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1406  ", pass 2");
1407  }
1408  bitrate = get_bit_rate(enc);
1409  if (bitrate != 0) {
1410  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1411  ", %"PRId64" kb/s", bitrate / 1000);
1412  } else if (enc->rc_max_rate > 0) {
1413  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1414  ", max. %"PRId64" kb/s", enc->rc_max_rate / 1000);
1415  }
1416 }
1417 
1418 const char *av_get_profile_name(const AVCodec *codec, int profile)
1419 {
1420  const AVProfile *p;
1421  if (profile == FF_PROFILE_UNKNOWN || !codec->profiles)
1422  return NULL;
1423 
1424  for (p = codec->profiles; p->profile != FF_PROFILE_UNKNOWN; p++)
1425  if (p->profile == profile)
1426  return p->name;
1427 
1428  return NULL;
1429 }
1430 
1432 {
1434  const AVProfile *p;
1435 
1436  if (profile == FF_PROFILE_UNKNOWN || !desc || !desc->profiles)
1437  return NULL;
1438 
1439  for (p = desc->profiles; p->profile != FF_PROFILE_UNKNOWN; p++)
1440  if (p->profile == profile)
1441  return p->name;
1442 
1443  return NULL;
1444 }
1445 
1446 unsigned avcodec_version(void)
1447 {
1450  av_assert0(AV_CODEC_ID_SRT==94216);
1452 
1453  return LIBAVCODEC_VERSION_INT;
1454 }
1455 
1456 const char *avcodec_configuration(void)
1457 {
1458  return FFMPEG_CONFIGURATION;
1459 }
1460 
1461 const char *avcodec_license(void)
1462 {
1463 #define LICENSE_PREFIX "libavcodec license: "
1464  return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
1465 }
1466 
1468 {
1469  switch (codec_id) {
1470  case AV_CODEC_ID_8SVX_EXP:
1471  case AV_CODEC_ID_8SVX_FIB:
1472  case AV_CODEC_ID_ADPCM_CT:
1480  return 4;
1481  case AV_CODEC_ID_DSD_LSBF:
1482  case AV_CODEC_ID_DSD_MSBF:
1485  case AV_CODEC_ID_PCM_ALAW:
1486  case AV_CODEC_ID_PCM_MULAW:
1487  case AV_CODEC_ID_PCM_VIDC:
1488  case AV_CODEC_ID_PCM_S8:
1490  case AV_CODEC_ID_PCM_U8:
1491  case AV_CODEC_ID_PCM_ZORK:
1492  case AV_CODEC_ID_SDX2_DPCM:
1493  return 8;
1494  case AV_CODEC_ID_PCM_S16BE:
1496  case AV_CODEC_ID_PCM_S16LE:
1498  case AV_CODEC_ID_PCM_U16BE:
1499  case AV_CODEC_ID_PCM_U16LE:
1500  return 16;
1502  case AV_CODEC_ID_PCM_S24BE:
1503  case AV_CODEC_ID_PCM_S24LE:
1505  case AV_CODEC_ID_PCM_U24BE:
1506  case AV_CODEC_ID_PCM_U24LE:
1507  return 24;
1508  case AV_CODEC_ID_PCM_S32BE:
1509  case AV_CODEC_ID_PCM_S32LE:
1511  case AV_CODEC_ID_PCM_U32BE:
1512  case AV_CODEC_ID_PCM_U32LE:
1513  case AV_CODEC_ID_PCM_F32BE:
1514  case AV_CODEC_ID_PCM_F32LE:
1515  case AV_CODEC_ID_PCM_F24LE:
1516  case AV_CODEC_ID_PCM_F16LE:
1517  return 32;
1518  case AV_CODEC_ID_PCM_F64BE:
1519  case AV_CODEC_ID_PCM_F64LE:
1520  case AV_CODEC_ID_PCM_S64BE:
1521  case AV_CODEC_ID_PCM_S64LE:
1522  return 64;
1523  default:
1524  return 0;
1525  }
1526 }
1527 
1529 {
1530  static const enum AVCodecID map[AV_SAMPLE_FMT_NB][2] = {
1542  };
1543  if (fmt < 0 || fmt >= AV_SAMPLE_FMT_NB)
1544  return AV_CODEC_ID_NONE;
1545  if (be < 0 || be > 1)
1546  be = AV_NE(1, 0);
1547  return map[fmt][be];
1548 }
1549 
1551 {
1552  switch (codec_id) {
1554  return 2;
1556  return 3;
1560  case AV_CODEC_ID_ADPCM_SWF:
1561  case AV_CODEC_ID_ADPCM_MS:
1562  return 4;
1563  default:
1565  }
1566 }
1567 
1568 static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
1569  uint32_t tag, int bits_per_coded_sample, int64_t bitrate,
1570  uint8_t * extradata, int frame_size, int frame_bytes)
1571 {
1573  int framecount = (ba > 0 && frame_bytes / ba > 0) ? frame_bytes / ba : 1;
1574 
1575  /* codecs with an exact constant bits per sample */
1576  if (bps > 0 && ch > 0 && frame_bytes > 0 && ch < 32768 && bps < 32768)
1577  return (frame_bytes * 8LL) / (bps * ch);
1578  bps = bits_per_coded_sample;
1579 
1580  /* codecs with a fixed packet duration */
1581  switch (id) {
1582  case AV_CODEC_ID_ADPCM_ADX: return 32;
1583  case AV_CODEC_ID_ADPCM_IMA_QT: return 64;
1584  case AV_CODEC_ID_ADPCM_EA_XAS: return 128;
1585  case AV_CODEC_ID_AMR_NB:
1586  case AV_CODEC_ID_EVRC:
1587  case AV_CODEC_ID_GSM:
1588  case AV_CODEC_ID_QCELP:
1589  case AV_CODEC_ID_RA_288: return 160;
1590  case AV_CODEC_ID_AMR_WB:
1591  case AV_CODEC_ID_GSM_MS: return 320;
1592  case AV_CODEC_ID_MP1: return 384;
1593  case AV_CODEC_ID_ATRAC1: return 512;
1594  case AV_CODEC_ID_ATRAC9:
1595  case AV_CODEC_ID_ATRAC3:
1596  if (framecount > INT_MAX/1024)
1597  return 0;
1598  return 1024 * framecount;
1599  case AV_CODEC_ID_ATRAC3P: return 2048;
1600  case AV_CODEC_ID_MP2:
1601  case AV_CODEC_ID_MUSEPACK7: return 1152;
1602  case AV_CODEC_ID_AC3: return 1536;
1603  }
1604 
1605  if (sr > 0) {
1606  /* calc from sample rate */
1607  if (id == AV_CODEC_ID_TTA)
1608  return 256 * sr / 245;
1609  else if (id == AV_CODEC_ID_DST)
1610  return 588 * sr / 44100;
1611 
1612  if (ch > 0) {
1613  /* calc from sample rate and channels */
1614  if (id == AV_CODEC_ID_BINKAUDIO_DCT) {
1615  if (sr / 22050 > 22)
1616  return 0;
1617  return (480 << (sr / 22050)) / ch;
1618  }
1619  }
1620 
1621  if (id == AV_CODEC_ID_MP3)
1622  return sr <= 24000 ? 576 : 1152;
1623  }
1624 
1625  if (ba > 0) {
1626  /* calc from block_align */
1627  if (id == AV_CODEC_ID_SIPR) {
1628  switch (ba) {
1629  case 20: return 160;
1630  case 19: return 144;
1631  case 29: return 288;
1632  case 37: return 480;
1633  }
1634  } else if (id == AV_CODEC_ID_ILBC) {
1635  switch (ba) {
1636  case 38: return 160;
1637  case 50: return 240;
1638  }
1639  }
1640  }
1641 
1642  if (frame_bytes > 0) {
1643  /* calc from frame_bytes only */
1644  if (id == AV_CODEC_ID_TRUESPEECH)
1645  return 240 * (frame_bytes / 32);
1646  if (id == AV_CODEC_ID_NELLYMOSER)
1647  return 256 * (frame_bytes / 64);
1648  if (id == AV_CODEC_ID_RA_144)
1649  return 160 * (frame_bytes / 20);
1650 
1651  if (bps > 0) {
1652  /* calc from frame_bytes and bits_per_coded_sample */
1654  return frame_bytes * 8 / bps;
1655  }
1656 
1657  if (ch > 0 && ch < INT_MAX/16) {
1658  /* calc from frame_bytes and channels */
1659  switch (id) {
1660  case AV_CODEC_ID_ADPCM_AFC:
1661  return frame_bytes / (9 * ch) * 16;
1662  case AV_CODEC_ID_ADPCM_PSX:
1663  case AV_CODEC_ID_ADPCM_DTK:
1664  frame_bytes /= 16 * ch;
1665  if (frame_bytes > INT_MAX / 28)
1666  return 0;
1667  return frame_bytes * 28;
1668  case AV_CODEC_ID_ADPCM_4XM:
1671  return (frame_bytes - 4 * ch) * 2 / ch;
1673  return (frame_bytes - 4) * 2 / ch;
1675  return (frame_bytes - 8) * 2 / ch;
1676  case AV_CODEC_ID_ADPCM_THP:
1678  if (extradata)
1679  return frame_bytes * 14LL / (8 * ch);
1680  break;
1681  case AV_CODEC_ID_ADPCM_XA:
1682  return (frame_bytes / 128) * 224 / ch;
1684  return (frame_bytes - 6 - ch) / ch;
1685  case AV_CODEC_ID_ROQ_DPCM:
1686  return (frame_bytes - 8) / ch;
1687  case AV_CODEC_ID_XAN_DPCM:
1688  return (frame_bytes - 2 * ch) / ch;
1689  case AV_CODEC_ID_MACE3:
1690  return 3 * frame_bytes / ch;
1691  case AV_CODEC_ID_MACE6:
1692  return 6 * frame_bytes / ch;
1693  case AV_CODEC_ID_PCM_LXF:
1694  return 2 * (frame_bytes / (5 * ch));
1695  case AV_CODEC_ID_IAC:
1696  case AV_CODEC_ID_IMC:
1697  return 4 * frame_bytes / ch;
1698  }
1699 
1700  if (tag) {
1701  /* calc from frame_bytes, channels, and codec_tag */
1702  if (id == AV_CODEC_ID_SOL_DPCM) {
1703  if (tag == 3)
1704  return frame_bytes / ch;
1705  else
1706  return frame_bytes * 2 / ch;
1707  }
1708  }
1709 
1710  if (ba > 0) {
1711  /* calc from frame_bytes, channels, and block_align */
1712  int blocks = frame_bytes / ba;
1713  int64_t tmp = 0;
1714  switch (id) {
1716  if (bps < 2 || bps > 5)
1717  return 0;
1718  tmp = blocks * (1LL + (ba - 4 * ch) / (bps * ch) * 8);
1719  break;
1721  tmp = blocks * (((ba - 16LL) * 2 / 3 * 4) / ch);
1722  break;
1724  tmp = blocks * (1 + (ba - 4LL * ch) * 2 / ch);
1725  break;
1727  tmp = blocks * ((ba - 4LL * ch) * 2 / ch);
1728  break;
1729  case AV_CODEC_ID_ADPCM_MS:
1730  tmp = blocks * (2 + (ba - 7LL * ch) * 2LL / ch);
1731  break;
1733  tmp = blocks * (ba - 16LL) * 2 / ch;
1734  break;
1735  }
1736  if (tmp) {
1737  if (tmp != (int)tmp)
1738  return 0;
1739  return tmp;
1740  }
1741  }
1742 
1743  if (bps > 0) {
1744  /* calc from frame_bytes, channels, and bits_per_coded_sample */
1745  switch (id) {
1746  case AV_CODEC_ID_PCM_DVD:
1747  if(bps<4 || frame_bytes<3)
1748  return 0;
1749  return 2 * ((frame_bytes - 3) / ((bps * 2 / 8) * ch));
1751  if(bps<4 || frame_bytes<4)
1752  return 0;
1753  return (frame_bytes - 4) / ((FFALIGN(ch, 2) * bps) / 8);
1754  case AV_CODEC_ID_S302M:
1755  return 2 * (frame_bytes / ((bps + 4) / 4)) / ch;
1756  }
1757  }
1758  }
1759  }
1760 
1761  /* Fall back on using frame_size */
1762  if (frame_size > 1 && frame_bytes)
1763  return frame_size;
1764 
1765  //For WMA we currently have no other means to calculate duration thus we
1766  //do it here by assuming CBR, which is true for all known cases.
1767  if (bitrate > 0 && frame_bytes > 0 && sr > 0 && ba > 1) {
1768  if (id == AV_CODEC_ID_WMAV1 || id == AV_CODEC_ID_WMAV2)
1769  return (frame_bytes * 8LL * sr) / bitrate;
1770  }
1771 
1772  return 0;
1773 }
1774 
1775 int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
1776 {
1778  avctx->channels, avctx->block_align,
1779  avctx->codec_tag, avctx->bits_per_coded_sample,
1780  avctx->bit_rate, avctx->extradata, avctx->frame_size,
1781  frame_bytes);
1782  return FFMAX(0, duration);
1783 }
1784 
1786 {
1788  par->channels, par->block_align,
1789  par->codec_tag, par->bits_per_coded_sample,
1790  par->bit_rate, par->extradata, par->frame_size,
1791  frame_bytes);
1792  return FFMAX(0, duration);
1793 }
1794 
1795 #if !HAVE_THREADS
1797 {
1798  return -1;
1799 }
1800 
1801 #endif
1802 
1803 unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
1804 {
1805  unsigned int n = 0;
1806 
1807  while (v >= 0xff) {
1808  *s++ = 0xff;
1809  v -= 0xff;
1810  n++;
1811  }
1812  *s = v;
1813  n++;
1814  return n;
1815 }
1816 
1817 int ff_match_2uint16(const uint16_t(*tab)[2], int size, int a, int b)
1818 {
1819  int i;
1820  for (i = 0; i < size && !(tab[i][0] == a && tab[i][1] == b); i++) ;
1821  return i;
1822 }
1823 
1825 {
1826  int i;
1827  if (!codec->hw_configs || index < 0)
1828  return NULL;
1829  for (i = 0; i <= index; i++)
1830  if (!codec->hw_configs[i])
1831  return NULL;
1832  return &codec->hw_configs[index]->public;
1833 }
1834 
1835 #if FF_API_USER_VISIBLE_AVHWACCEL
1837 {
1838  return NULL;
1839 }
1840 
1842 {
1843 }
1844 #endif
1845 
1846 #if FF_API_LOCKMGR
1847 int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op))
1848 {
1849  return 0;
1850 }
1851 #endif
1852 
1853 unsigned int avpriv_toupper4(unsigned int x)
1854 {
1855  return av_toupper(x & 0xFF) +
1856  (av_toupper((x >> 8) & 0xFF) << 8) +
1857  (av_toupper((x >> 16) & 0xFF) << 16) +
1858 ((unsigned)av_toupper((x >> 24) & 0xFF) << 24);
1859 }
1860 
1862 {
1863  int ret;
1864 
1865  dst->owner[0] = src->owner[0];
1866  dst->owner[1] = src->owner[1];
1867 
1868  ret = av_frame_ref(dst->f, src->f);
1869  if (ret < 0)
1870  return ret;
1871 
1872  av_assert0(!dst->progress);
1873 
1874  if (src->progress &&
1875  !(dst->progress = av_buffer_ref(src->progress))) {
1876  ff_thread_release_buffer(dst->owner[0], dst);
1877  return AVERROR(ENOMEM);
1878  }
1879 
1880  return 0;
1881 }
1882 
1883 #if !HAVE_THREADS
1884 
1886 {
1887  return ff_get_format(avctx, fmt);
1888 }
1889 
1891 {
1892  f->owner[0] = f->owner[1] = avctx;
1893  return ff_get_buffer(avctx, f->f, flags);
1894 }
1895 
1897 {
1898  if (f->f)
1899  av_frame_unref(f->f);
1900 }
1901 
1903 {
1904 }
1905 
1907 {
1908 }
1909 
1910 void ff_thread_await_progress(ThreadFrame *f, int progress, int field)
1911 {
1912 }
1913 
1915 {
1916  return 1;
1917 }
1918 
1920 {
1921  return 0;
1922 }
1923 
1925 {
1926 }
1927 
1928 void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
1929 {
1930 }
1931 
1932 void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n)
1933 {
1934 }
1935 
1936 #endif
1937 
1939 {
1940  return !!s->internal;
1941 }
1942 
1943 int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf)
1944 {
1945  int ret;
1946  char *str;
1947 
1948  ret = av_bprint_finalize(buf, &str);
1949  if (ret < 0)
1950  return ret;
1951  if (!av_bprint_is_complete(buf)) {
1952  av_free(str);
1953  return AVERROR(ENOMEM);
1954  }
1955 
1956  avctx->extradata = str;
1957  /* Note: the string is NUL terminated (so extradata can be read as a
1958  * string), but the ending character is not accounted in the size (in
1959  * binary formats you are likely not supposed to mux that character). When
1960  * extradata is copied, it is also padded with AV_INPUT_BUFFER_PADDING_SIZE
1961  * zeros. */
1962  avctx->extradata_size = buf->len;
1963  return 0;
1964 }
1965 
1966 const uint8_t *avpriv_find_start_code(const uint8_t *av_restrict p,
1967  const uint8_t *end,
1968  uint32_t *av_restrict state)
1969 {
1970  int i;
1971 
1972  av_assert0(p <= end);
1973  if (p >= end)
1974  return end;
1975 
1976  for (i = 0; i < 3; i++) {
1977  uint32_t tmp = *state << 8;
1978  *state = tmp + *(p++);
1979  if (tmp == 0x100 || p == end)
1980  return p;
1981  }
1982 
1983  while (p < end) {
1984  if (p[-1] > 1 ) p += 3;
1985  else if (p[-2] ) p += 2;
1986  else if (p[-3]|(p[-1]-1)) p++;
1987  else {
1988  p++;
1989  break;
1990  }
1991  }
1992 
1993  p = FFMIN(p, end) - 4;
1994  *state = AV_RB32(p);
1995 
1996  return p + 4;
1997 }
1998 
2000 {
2001  AVCPBProperties *props = av_mallocz(sizeof(AVCPBProperties));
2002  if (!props)
2003  return NULL;
2004 
2005  if (size)
2006  *size = sizeof(*props);
2007 
2008  props->vbv_delay = UINT64_MAX;
2009 
2010  return props;
2011 }
2012 
2014 {
2016  AVCPBProperties *props;
2017  size_t size;
2018 
2019  props = av_cpb_properties_alloc(&size);
2020  if (!props)
2021  return NULL;
2022 
2023  tmp = av_realloc_array(avctx->coded_side_data, avctx->nb_coded_side_data + 1, sizeof(*tmp));
2024  if (!tmp) {
2025  av_freep(&props);
2026  return NULL;
2027  }
2028 
2029  avctx->coded_side_data = tmp;
2030  avctx->nb_coded_side_data++;
2031 
2033  avctx->coded_side_data[avctx->nb_coded_side_data - 1].data = (uint8_t*)props;
2034  avctx->coded_side_data[avctx->nb_coded_side_data - 1].size = size;
2035 
2036  return props;
2037 }
2038 
2040 {
2041  av_freep(&par->extradata);
2042 
2043  memset(par, 0, sizeof(*par));
2044 
2046  par->codec_id = AV_CODEC_ID_NONE;
2047  par->format = -1;
2054  par->sample_aspect_ratio = (AVRational){ 0, 1 };
2055  par->profile = FF_PROFILE_UNKNOWN;
2056  par->level = FF_LEVEL_UNKNOWN;
2057 }
2058 
2060 {
2061  AVCodecParameters *par = av_mallocz(sizeof(*par));
2062 
2063  if (!par)
2064  return NULL;
2066  return par;
2067 }
2068 
2070 {
2071  AVCodecParameters *par = *ppar;
2072 
2073  if (!par)
2074  return;
2076 
2077  av_freep(ppar);
2078 }
2079 
2081 {
2083  memcpy(dst, src, sizeof(*dst));
2084 
2085  dst->extradata = NULL;
2086  dst->extradata_size = 0;
2087  if (src->extradata) {
2088  dst->extradata = av_mallocz(src->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
2089  if (!dst->extradata)
2090  return AVERROR(ENOMEM);
2091  memcpy(dst->extradata, src->extradata, src->extradata_size);
2092  dst->extradata_size = src->extradata_size;
2093  }
2094 
2095  return 0;
2096 }
2097 
2099  const AVCodecContext *codec)
2100 {
2102 
2103  par->codec_type = codec->codec_type;
2104  par->codec_id = codec->codec_id;
2105  par->codec_tag = codec->codec_tag;
2106 
2107  par->bit_rate = codec->bit_rate;
2110  par->profile = codec->profile;
2111  par->level = codec->level;
2112 
2113  switch (par->codec_type) {
2114  case AVMEDIA_TYPE_VIDEO:
2115  par->format = codec->pix_fmt;
2116  par->width = codec->width;
2117  par->height = codec->height;
2118  par->field_order = codec->field_order;
2119  par->color_range = codec->color_range;
2120  par->color_primaries = codec->color_primaries;
2121  par->color_trc = codec->color_trc;
2122  par->color_space = codec->colorspace;
2125  par->video_delay = codec->has_b_frames;
2126  break;
2127  case AVMEDIA_TYPE_AUDIO:
2128  par->format = codec->sample_fmt;
2129  par->channel_layout = codec->channel_layout;
2130  par->channels = codec->channels;
2131  par->sample_rate = codec->sample_rate;
2132  par->block_align = codec->block_align;
2133  par->frame_size = codec->frame_size;
2134  par->initial_padding = codec->initial_padding;
2135  par->trailing_padding = codec->trailing_padding;
2136  par->seek_preroll = codec->seek_preroll;
2137  break;
2138  case AVMEDIA_TYPE_SUBTITLE:
2139  par->width = codec->width;
2140  par->height = codec->height;
2141  break;
2142  }
2143 
2144  if (codec->extradata) {
2146  if (!par->extradata)
2147  return AVERROR(ENOMEM);
2148  memcpy(par->extradata, codec->extradata, codec->extradata_size);
2149  par->extradata_size = codec->extradata_size;
2150  }
2151 
2152  return 0;
2153 }
2154 
2156  const AVCodecParameters *par)
2157 {
2158  codec->codec_type = par->codec_type;
2159  codec->codec_id = par->codec_id;
2160  codec->codec_tag = par->codec_tag;
2161 
2162  codec->bit_rate = par->bit_rate;
2165  codec->profile = par->profile;
2166  codec->level = par->level;
2167 
2168  switch (par->codec_type) {
2169  case AVMEDIA_TYPE_VIDEO:
2170  codec->pix_fmt = par->format;
2171  codec->width = par->width;
2172  codec->height = par->height;
2173  codec->field_order = par->field_order;
2174  codec->color_range = par->color_range;
2175  codec->color_primaries = par->color_primaries;
2176  codec->color_trc = par->color_trc;
2177  codec->colorspace = par->color_space;
2180  codec->has_b_frames = par->video_delay;
2181  break;
2182  case AVMEDIA_TYPE_AUDIO:
2183  codec->sample_fmt = par->format;
2184  codec->channel_layout = par->channel_layout;
2185  codec->channels = par->channels;
2186  codec->sample_rate = par->sample_rate;
2187  codec->block_align = par->block_align;
2188  codec->frame_size = par->frame_size;
2189  codec->delay =
2190  codec->initial_padding = par->initial_padding;
2191  codec->trailing_padding = par->trailing_padding;
2192  codec->seek_preroll = par->seek_preroll;
2193  break;
2194  case AVMEDIA_TYPE_SUBTITLE:
2195  codec->width = par->width;
2196  codec->height = par->height;
2197  break;
2198  }
2199 
2200  if (par->extradata) {
2201  av_freep(&codec->extradata);
2203  if (!codec->extradata)
2204  return AVERROR(ENOMEM);
2205  memcpy(codec->extradata, par->extradata, par->extradata_size);
2206  codec->extradata_size = par->extradata_size;
2207  }
2208 
2209  return 0;
2210 }
2211 
2212 int ff_alloc_a53_sei(const AVFrame *frame, size_t prefix_len,
2213  void **data, size_t *sei_size)
2214 {
2215  AVFrameSideData *side_data = NULL;
2216  uint8_t *sei_data;
2217 
2218  if (frame)
2220 
2221  if (!side_data) {
2222  *data = NULL;
2223  return 0;
2224  }
2225 
2226  *sei_size = side_data->size + 11;
2227  *data = av_mallocz(*sei_size + prefix_len);
2228  if (!*data)
2229  return AVERROR(ENOMEM);
2230  sei_data = (uint8_t*)*data + prefix_len;
2231 
2232  // country code
2233  sei_data[0] = 181;
2234  sei_data[1] = 0;
2235  sei_data[2] = 49;
2236 
2237  /**
2238  * 'GA94' is standard in North America for ATSC, but hard coding
2239  * this style may not be the right thing to do -- other formats
2240  * do exist. This information is not available in the side_data
2241  * so we are going with this right now.
2242  */
2243  AV_WL32(sei_data + 3, MKTAG('G', 'A', '9', '4'));
2244  sei_data[7] = 3;
2245  sei_data[8] = ((side_data->size/3) & 0x1f) | 0x40;
2246  sei_data[9] = 0;
2247 
2248  memcpy(sei_data + 10, side_data->data, side_data->size);
2249 
2250  sei_data[side_data->size+10] = 255;
2251 
2252  return 0;
2253 }
2254 
2256 {
2257  AVRational framerate = avctx->framerate;
2258  int bits_per_coded_sample = avctx->bits_per_coded_sample;
2259  int64_t bitrate;
2260 
2261  if (!(framerate.num && framerate.den))
2262  framerate = av_inv_q(avctx->time_base);
2263  if (!(framerate.num && framerate.den))
2264  return 0;
2265 
2266  if (!bits_per_coded_sample) {
2268  bits_per_coded_sample = av_get_bits_per_pixel(desc);
2269  }
2270  bitrate = (int64_t)bits_per_coded_sample * avctx->width * avctx->height *
2271  framerate.num / framerate.den;
2272 
2273  return bitrate;
2274 }
2275 
2276 int ff_int_from_list_or_default(void *ctx, const char * val_name, int val,
2277  const int * array_valid_values, int default_value)
2278 {
2279  int i = 0, ref_val;
2280 
2281  while (1) {
2282  ref_val = array_valid_values[i];
2283  if (ref_val == INT_MAX)
2284  break;
2285  if (val == ref_val)
2286  return val;
2287  i++;
2288  }
2289  /* val is not a valid value */
2291  "%s %d are not supported. Set to default value : %d\n", val_name, val, default_value);
2292  return default_value;
2293 }
AV_CODEC_ID_PCM_S16LE
@ AV_CODEC_ID_PCM_S16LE
Definition: avcodec.h:463
AVSubtitle
Definition: avcodec.h:3933
avcodec_close
av_cold int avcodec_close(AVCodecContext *avctx)
Close a given AVCodecContext and free all the data associated with it (but not the AVCodecContext its...
Definition: utils.c:1117
func
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:67
AVCodecContext::frame_size
int frame_size
Number of samples per channel in an audio frame.
Definition: avcodec.h:2245
AV_CODEC_ID_MACE6
@ AV_CODEC_ID_MACE6
Definition: avcodec.h:574
AVCodecContext::hwaccel
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
Definition: avcodec.h:2729
be
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 be(in the first position) for now. Options ------- Then comes the options array. This is what will define the user accessible options. For example
AVCodec
AVCodec.
Definition: avcodec.h:3481
FF_ENABLE_DEPRECATION_WARNINGS
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition: internal.h:85
AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:69
AV_PIX_FMT_YUV420P9LE
@ AV_PIX_FMT_YUV420P9LE
planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:157
av_codec_get_codec_properties
unsigned av_codec_get_codec_properties(const AVCodecContext *codec)
Definition: utils.c:495
AVMEDIA_TYPE_SUBTITLE
@ AVMEDIA_TYPE_SUBTITLE
Definition: avutil.h:204
AV_CODEC_ID_VP6F
@ AV_CODEC_ID_VP6F
Definition: avcodec.h:310
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
FF_CODEC_CAP_INIT_THREADSAFE
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:40
AV_CODEC_ID_PCM_F32BE
@ AV_CODEC_ID_PCM_F32BE
Definition: avcodec.h:483
AV_CODEC_ID_DSD_LSBF
@ AV_CODEC_ID_DSD_LSBF
Definition: avcodec.h:638
AVCodecParameters::extradata
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition: avcodec.h:3971
AV_CODEC_ID_ADPCM_MS
@ AV_CODEC_ID_ADPCM_MS
Definition: avcodec.h:508
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
AV_CODEC_ID_ADPCM_IMA_QT
@ AV_CODEC_ID_ADPCM_IMA_QT
Definition: avcodec.h:502
AVERROR_EXPERIMENTAL
#define AVERROR_EXPERIMENTAL
Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it.
Definition: error.h:72
AV_CODEC_ID_AC3
@ AV_CODEC_ID_AC3
Definition: avcodec.h:567
r
const char * r
Definition: vf_curves.c:114
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
AVSubtitle::rects
AVSubtitleRect ** rects
Definition: avcodec.h:3938
opt.h
av_xiphlacing
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
Encode extradata length to a buffer.
Definition: utils.c:1803
av_codec_is_decoder
int av_codec_is_decoder(const AVCodec *codec)
Definition: utils.c:99
AV_CODEC_ID_PCM_BLURAY
@ AV_CODEC_ID_PCM_BLURAY
Definition: avcodec.h:487
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: avcodec.h:3953
AV_WL32
#define AV_WL32(p, v)
Definition: intreadwrite.h:426
codec_id
enum AVCodecID codec_id
Definition: qsv.c:72
AVCodecContext::channel_layout
uint64_t channel_layout
Audio channel layout.
Definition: avcodec.h:2276
AVCodecContext::colorspace
enum AVColorSpace colorspace
YUV colorspace type.
Definition: avcodec.h:2193
av_opt_set_defaults
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
Definition: opt.c:1305
mem_internal.h
av_bprint_finalize
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition: bprint.c:235
ff_get_format
int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Select the (possibly hardware accelerated) pixel format.
Definition: decode.c:1371
ff_thread_get_buffer
int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
Wrapper around get_buffer() for frame-multithreaded codecs.
Definition: utils.c:1890
FF_COMPLIANCE_EXPERIMENTAL
#define FF_COMPLIANCE_EXPERIMENTAL
Allow nonstandardized experimental things.
Definition: avcodec.h:2633
AV_CODEC_ID_ADPCM_DTK
@ AV_CODEC_ID_ADPCM_DTK
Definition: avcodec.h:536
AVCodecContext::sample_rate
int sample_rate
samples per second
Definition: avcodec.h:2225
PixelFormatTag
Definition: raw.h:34
cb
static double cb(void *priv, double x, double y)
Definition: vf_geq.c:112
av_frame_get_side_data
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition: frame.c:734
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: avcodec.h:3949
n
int n
Definition: avisynth_c.h:760
AVCodec::priv_class
const AVClass * priv_class
AVClass for the private context.
Definition: avcodec.h:3507
AV_PIX_FMT_GBRP16BE
@ AV_PIX_FMT_GBRP16BE
planar GBR 4:4:4 48bpp, big-endian
Definition: pixfmt.h:174
ff_thread_report_progress2
void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n)
Definition: utils.c:1932
AVCodecParameters::color_space
enum AVColorSpace color_space
Definition: avcodec.h:4046
avpriv_bprint_to_extradata
int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf)
Finalize buf into extradata and set its size appropriately.
Definition: utils.c:1943
AV_PIX_FMT_GBRP10BE
@ AV_PIX_FMT_GBRP10BE
planar GBR 4:4:4 30bpp, big-endian
Definition: pixfmt.h:172
thread.h
AVProfile::name
const char * name
short name for the profile
Definition: avcodec.h:3416
ff_unlock_avcodec
static void ff_unlock_avcodec(const AVCodec *codec)
Definition: utils.c:547
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2522
AVBufferRef::data
uint8_t * data
The data buffer.
Definition: buffer.h:89
MKTAG
#define MKTAG(a, b, c, d)
Definition: common.h:366
AV_FRAME_DATA_A53_CC
@ AV_FRAME_DATA_A53_CC
ATSC A53 Part 4 Closed Captions.
Definition: frame.h:58
AV_CODEC_ID_8SVX_EXP
@ AV_CODEC_ID_8SVX_EXP
Definition: avcodec.h:618
AV_PIX_FMT_YUV422P14LE
@ AV_PIX_FMT_YUV422P14LE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:249
avcodec_parameters_from_context
int avcodec_parameters_from_context(AVCodecParameters *par, const AVCodecContext *codec)
Fill the parameters struct based on the values from the supplied codec context.
Definition: utils.c:2098
AVHWFramesContext::format
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
Definition: hwcontext.h:208
ff_thread_await_progress2
void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
Definition: utils.c:1928
avcodec_string
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
Definition: utils.c:1223
avpriv_toupper4
unsigned int avpriv_toupper4(unsigned int x)
Definition: utils.c:1853
ff_decode_bsfs_init
int ff_decode_bsfs_init(AVCodecContext *avctx)
Definition: decode.c:185
av_frame_new_side_data
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, int size)
Add a new side data to a frame.
Definition: frame.c:722
AVCodecDescriptor::name
const char * name
Name of the codec described by this descriptor.
Definition: avcodec.h:724
AVCodecContext::coded_side_data
AVPacketSideData * coded_side_data
Additional data associated with the entire coded stream.
Definition: avcodec.h:3237
ch
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi - 0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(INT64_C(1)<< 63))) #define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={ FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64), };static void cpy1(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, len);} static void cpy2(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 2 *len);} static void cpy4(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 4 *len);} static void cpy8(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 8 *len);} AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags) { AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;if(channels==1){ in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);} ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map) { switch(av_get_bytes_per_sample(in_fmt)){ case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;} } if(HAVE_X86ASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);return ctx;} void swri_audio_convert_free(AudioConvert **ctx) { av_freep(ctx);} int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len) { int ch;int off=0;const int os=(out->planar ? 1 :out->ch_count) *out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask) { int planes=in->planar ? in->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;} if(ctx->out_simd_align_mask) { int planes=out->planar ? out->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;} if(ctx->simd_f &&!ctx->ch_map &&!misaligned){ off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){ if(out->planar==in->planar){ int planes=out->planar ? out->ch_count :1;for(ch=0;ch< planes;ch++){ ctx->simd_f(out-> ch ch
Definition: audioconvert.c:56
ff_thread_can_start_frame
int ff_thread_can_start_frame(AVCodecContext *avctx)
Definition: utils.c:1914
av_samples_fill_arrays
int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, const uint8_t *buf, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Fill plane data pointers and linesize for samples with sample format sample_fmt.
Definition: samplefmt.c:151
AVSubtitle::num_rects
unsigned num_rects
Definition: avcodec.h:3937
count
void INT64 INT64 count
Definition: avisynth_c.h:767
AVCodec::pix_fmts
enum AVPixelFormat * pix_fmts
array of supported pixel formats, or NULL if unknown, array is terminated by -1
Definition: avcodec.h:3502
avcodec_find_encoder
AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
Definition: allcodecs.c:885
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:202
AV_CODEC_ID_PCM_S32LE_PLANAR
@ AV_CODEC_ID_PCM_S32LE_PLANAR
Definition: avcodec.h:492
profile
mfxU16 profile
Definition: qsvenc.c:44
end
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:90
AV_CODEC_ID_RA_144
@ AV_CODEC_ID_RA_144
Definition: avcodec.h:551
av_get_channel_layout_string
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout)
Return a description of a channel layout.
Definition: channel_layout.c:211
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:295
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:26
FramePool::pools
AVBufferPool * pools[4]
Pools for each data plane.
Definition: internal.h:105
AV_PIX_FMT_YUVA444P10BE
@ AV_PIX_FMT_YUVA444P10BE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:188
pixdesc.h
AVCodecContext::color_trc
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
Definition: avcodec.h:2186
AV_PIX_FMT_YUV440P12BE
@ AV_PIX_FMT_YUV440P12BE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:278
AVPacketSideData
Definition: avcodec.h:1420
AVCodec::capabilities
int capabilities
Codec capabilities.
Definition: avcodec.h:3500
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
the normal 2^n-1 "JPEG" YUV ranges
Definition: pixfmt.h:522
internal.h
ff_fast_malloc
static int ff_fast_malloc(void *ptr, unsigned int *size, size_t min_size, int zero_realloc)
Definition: mem_internal.h:27
AV_CODEC_ID_PCM_S16BE_PLANAR
@ AV_CODEC_ID_PCM_S16BE_PLANAR
Definition: avcodec.h:493
av_codec_get_max_lowres
int av_codec_get_max_lowres(const AVCodec *codec)
Definition: utils.c:500
av_lockmgr_register
int av_lockmgr_register(int(*cb)(void **mutex, enum AVLockOp op))
Register a user provided lock manager supporting the operations specified by AVLockOp.
Definition: utils.c:1847
AV_CODEC_ID_VP6
@ AV_CODEC_ID_VP6
Definition: avcodec.h:309
AVComponentDescriptor::depth
int depth
Number of bits in the component.
Definition: pixdesc.h:58
AVCodecContext::field_order
enum AVFieldOrder field_order
Field order.
Definition: avcodec.h:2222
AVCodecParameters::seek_preroll
int seek_preroll
Audio only.
Definition: avcodec.h:4097
AVCodecInternal::frame_thread_encoder
void * frame_thread_encoder
Definition: internal.h:180
TAG_PRINT
#define TAG_PRINT(x)
b
#define b
Definition: input.c:41
AVCOL_TRC_UNSPECIFIED
@ AVCOL_TRC_UNSPECIFIED
Definition: pixfmt.h:470
AV_SAMPLE_FMT_S32P
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition: samplefmt.h:68
data
const char data[16]
Definition: mxf.c:91
AV_CODEC_ID_PCM_U24LE
@ AV_CODEC_ID_PCM_U24LE
Definition: avcodec.h:477
AV_PIX_FMT_YUV420P14BE
@ AV_PIX_FMT_YUV420P14BE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:244
avcodec_align_dimensions
void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height)
Modify width and height values so that they will result in a memory buffer that is acceptable for the...
Definition: utils.c:348
AV_CODEC_ID_AMR_NB
@ AV_CODEC_ID_AMR_NB
Definition: avcodec.h:547
AV_PIX_FMT_YUV420P16LE
@ AV_PIX_FMT_YUV420P16LE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:131
AVLockOp
AVLockOp
Lock operation used by lockmgr.
Definition: avcodec.h:6129
AV_CODEC_ID_ADPCM_AICA
@ AV_CODEC_ID_ADPCM_AICA
Definition: avcodec.h:541
AV_CODEC_ID_ADPCM_IMA_OKI
@ AV_CODEC_ID_ADPCM_IMA_OKI
Definition: avcodec.h:535
AVCodecContext::subtitle_header
uint8_t * subtitle_header
Header containing style information for text subtitles.
Definition: avcodec.h:3050
version.h
AV_CODEC_ID_SOL_DPCM
@ AV_CODEC_ID_SOL_DPCM
Definition: avcodec.h:558
av_mallocz_array
void * av_mallocz_array(size_t nmemb, size_t size)
Definition: mem.c:191
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:192
AV_CODEC_ID_PCM_ZORK
@ AV_CODEC_ID_PCM_ZORK
Definition: avcodec.h:480
ff_decode_bsfs_uninit
void ff_decode_bsfs_uninit(AVCodecContext *avctx)
Definition: decode.c:2054
float.h
AV_CODEC_ID_WMAV2
@ AV_CODEC_ID_WMAV2
Definition: avcodec.h:572
AV_CODEC_ID_ADPCM_G722
@ AV_CODEC_ID_ADPCM_G722
Definition: avcodec.h:530
AV_PIX_FMT_GBRP14BE
@ AV_PIX_FMT_GBRP14BE
planar GBR 4:4:4 42bpp, big-endian
Definition: pixfmt.h:256
avcodec_profile_name
const char * avcodec_profile_name(enum AVCodecID codec_id, int profile)
Return a name for the specified profile, if available.
Definition: utils.c:1431
channels
channels
Definition: aptx.c:30
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:69
av_get_bits_per_pixel
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
Definition: pixdesc.c:2474
ff_frame_thread_encoder_init
int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options)
Initialize frame thread encoder.
Definition: frame_thread_encoder.c:117
AVCodecParameters::codec_tag
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
Definition: avcodec.h:3961
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
mpegvideo.h
FF_LEVEL_UNKNOWN
#define FF_LEVEL_UNKNOWN
Definition: avcodec.h:3019
mathematics.h
FF_SUB_CHARENC_MODE_PRE_DECODER
#define FF_SUB_CHARENC_MODE_PRE_DECODER
the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv
Definition: avcodec.h:3163
AVDictionary
Definition: dict.c:30
AV_CODEC_ID_IMC
@ AV_CODEC_ID_IMC
Definition: avcodec.h:591
AV_PIX_FMT_YUVA444P9BE
@ AV_PIX_FMT_YUVA444P9BE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
Definition: pixfmt.h:182
AV_PIX_FMT_YUV422P9BE
@ AV_PIX_FMT_YUV422P9BE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:166
avcodec_is_open
int avcodec_is_open(AVCodecContext *s)
Definition: utils.c:1938
AVCodecContext::qmax
int qmax
maximum quantizer
Definition: avcodec.h:2414
codec_type
enum AVMediaType codec_type
Definition: rtp.c:37
FF_SUB_CHARENC_MODE_AUTOMATIC
#define FF_SUB_CHARENC_MODE_AUTOMATIC
libavcodec will select the mode itself
Definition: avcodec.h:3162
av_strlcatf
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
Definition: avstring.c:101
AVCodecContext::delay
int delay
Codec delay.
Definition: avcodec.h:1721
thread.h
av_packet_free
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
Definition: avpacket.c:62
ThreadFrame::f
AVFrame * f
Definition: thread.h:35
av_chroma_location_name
const char * av_chroma_location_name(enum AVChromaLocation location)
Definition: pixdesc.c:2939
FF_COMPLIANCE_UNOFFICIAL
#define FF_COMPLIANCE_UNOFFICIAL
Allow unofficial extensions.
Definition: avcodec.h:2632
AV_CODEC_ID_PCM_S16LE_PLANAR
@ AV_CODEC_ID_PCM_S16LE_PLANAR
Definition: avcodec.h:481
AV_CODEC_ID_ADPCM_THP_LE
@ AV_CODEC_ID_ADPCM_THP_LE
Definition: avcodec.h:539
AV_CODEC_ID_AMR_WB
@ AV_CODEC_ID_AMR_WB
Definition: avcodec.h:548
AV_PIX_FMT_YUV444P16LE
@ AV_PIX_FMT_YUV444P16LE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:135
av_gcd
int64_t av_gcd(int64_t a, int64_t b)
Compute the greatest common divisor of two integer operands.
Definition: mathematics.c:37
AV_CODEC_ID_SRT
@ AV_CODEC_ID_SRT
Definition: avcodec.h:666
AV_CODEC_ID_PCM_S64LE
@ AV_CODEC_ID_PCM_S64LE
Definition: avcodec.h:495
AVProfile
AVProfile.
Definition: avcodec.h:3414
ff_mutex_unlock
static int ff_mutex_unlock(AVMutex *mutex)
Definition: thread.h:156
AV_PIX_FMT_GBRAP12LE
@ AV_PIX_FMT_GBRAP12LE
planar GBR 4:4:4:4 48bpp, little-endian
Definition: pixfmt.h:288
crc.h
AV_CODEC_ID_DSD_MSBF_PLANAR
@ AV_CODEC_ID_DSD_MSBF_PLANAR
Definition: avcodec.h:641
AV_CODEC_ID_ADPCM_CT
@ AV_CODEC_ID_ADPCM_CT
Definition: avcodec.h:514
AVCodecParameters::color_primaries
enum AVColorPrimaries color_primaries
Definition: avcodec.h:4044
AVCodecContext::framerate
AVRational framerate
Definition: avcodec.h:3105
AV_PIX_FMT_GRAY16BE
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
Definition: pixfmt.h:97
framerate
int framerate
Definition: h264_levels.c:65
AVCodec::max_lowres
uint8_t max_lowres
maximum value for lowres supported by the decoder
Definition: avcodec.h:3506
avcodec_enum_to_chroma_pos
int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos)
Converts AVChromaLocation to swscale x/y chroma position.
Definition: utils.c:363
AVCodec::encode_sub
int(* encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size, const struct AVSubtitle *sub)
Definition: avcodec.h:3565
av_get_colorspace_name
const char * av_get_colorspace_name(enum AVColorSpace val)
Get the name of a colorspace.
Definition: frame.c:122
fmt
const char * fmt
Definition: avisynth_c.h:861
AVHWAccel
Definition: avcodec.h:3649
AVCodecParameters::channels
int channels
Audio only.
Definition: avcodec.h:4063
ff_lock_avcodec
static void ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec)
Definition: utils.c:541
av_codec_is_encoder
int av_codec_is_encoder(const AVCodec *codec)
Definition: utils.c:94
av_color_space_name
const char * av_color_space_name(enum AVColorSpace space)
Definition: pixdesc.c:2915
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:215
AV_CODEC_ID_IFF_ILBM
@ AV_CODEC_ID_IFF_ILBM
Definition: avcodec.h:354
AVCodecContext::codec
const struct AVCodec * codec
Definition: avcodec.h:1574
AV_PIX_FMT_YUV420P12LE
@ AV_PIX_FMT_YUV420P12LE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:243
AV_CODEC_ID_PCM_S16BE
@ AV_CODEC_ID_PCM_S16BE
Definition: avcodec.h:464
AV_FRAME_DATA_MATRIXENCODING
@ AV_FRAME_DATA_MATRIXENCODING
The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
Definition: frame.h:67
STRIDE_ALIGN
#define STRIDE_ALIGN
Definition: internal.h:97
AVCodecParameters::bits_per_raw_sample
int bits_per_raw_sample
This is the number of valid bits in each output sample.
Definition: avcodec.h:4012
AVCodec::sample_fmts
enum AVSampleFormat * sample_fmts
array of supported sample formats, or NULL if unknown, array is terminated by -1
Definition: avcodec.h:3504
AVCodecContext::thread_count
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
Definition: avcodec.h:2824
MAKE_ACCESSORS
#define MAKE_ACCESSORS(str, name, type, field)
Definition: internal.h:91
AV_CODEC_ID_XAN_DPCM
@ AV_CODEC_ID_XAN_DPCM
Definition: avcodec.h:557
AV_CODEC_ID_MSZH
@ AV_CODEC_ID_MSZH
Definition: avcodec.h:271
samplefmt.h
avpriv_find_start_code
const uint8_t * avpriv_find_start_code(const uint8_t *av_restrict p, const uint8_t *end, uint32_t *av_restrict state)
Definition: utils.c:1966
AVCodecContext::initial_padding
int initial_padding
Audio only.
Definition: avcodec.h:3096
tab
static const struct twinvq_data tab
Definition: twinvq_data.h:11135
AVCodecContext::refs
int refs
number of reference frames
Definition: avcodec.h:2153
ThreadFrame::owner
AVCodecContext * owner[2]
Definition: thread.h:36
FF_SUB_CHARENC_MODE_DO_NOTHING
#define FF_SUB_CHARENC_MODE_DO_NOTHING
do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for inst...
Definition: avcodec.h:3161
AVCodecContext::flags
int flags
AV_CODEC_FLAG_*.
Definition: avcodec.h:1645
AV_SAMPLE_FMT_S64P
@ AV_SAMPLE_FMT_S64P
signed 64 bits, planar
Definition: samplefmt.h:72
AV_FIELD_UNKNOWN
@ AV_FIELD_UNKNOWN
Definition: avcodec.h:1544
AVCodecContext::coded_height
int coded_height
Definition: avcodec.h:1753
ff_thread_get_format
enum AVPixelFormat ff_thread_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Wrapper around get_format() for frame-multithreaded codecs.
Definition: utils.c:1885
AV_CODEC_ID_SMC
@ AV_CODEC_ID_SMC
Definition: avcodec.h:267
AV_CODEC_ID_MP3
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition: avcodec.h:565
AV_PIX_FMT_YUVA444P16BE
@ AV_PIX_FMT_YUVA444P16BE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:194
AV_CODEC_ID_8SVX_FIB
@ AV_CODEC_ID_8SVX_FIB
Definition: avcodec.h:619
av_reduce
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
Definition: rational.c:35
AVRational::num
int num
Numerator.
Definition: rational.h:59
src
#define src
Definition: vp8dsp.c:254
AV_PIX_FMT_YUV444P10BE
@ AV_PIX_FMT_YUV444P10BE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:164
AVSubtitleRect::ass
char * ass
0 terminated ASS/SSA compatible event line.
Definition: avcodec.h:3928
avcodec_default_execute2
int avcodec_default_execute2(AVCodecContext *c, int(*func)(AVCodecContext *c2, void *arg2, int jobnr, int threadnr), void *arg, int *ret, int count)
Definition: utils.c:464
av_image_check_size2
int av_image_check_size2(unsigned int w, unsigned int h, int64_t max_pixels, enum AVPixelFormat pix_fmt, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of a plane of an image with...
Definition: imgutils.c:253
AV_PIX_FMT_YUV420P10LE
@ AV_PIX_FMT_YUV420P10LE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:159
AV_CODEC_ID_ATRAC3
@ AV_CODEC_ID_ATRAC3
Definition: avcodec.h:595
avsubtitle_free
void avsubtitle_free(AVSubtitle *sub)
Free all allocated data in the given subtitle struct.
Definition: utils.c:1098
av_get_planar_sample_fmt
enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt)
Get the planar alternative form of the given sample format.
Definition: samplefmt.c:84
PixelFormatTag::pix_fmt
enum AVPixelFormat pix_fmt
Definition: raw.h:35
FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
The decoder extracts and fills its parameters even if the frame is skipped due to the skip_frame sett...
Definition: internal.h:60
raw.h
AV_PIX_FMT_YUV444P12LE
@ AV_PIX_FMT_YUV444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:251
av_frame_alloc
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:189
AVFormatContext::bit_rate
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
Definition: avformat.h:1464
AV_PIX_FMT_YUVJ411P
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:258
AV_CODEC_ID_SIPR
@ AV_CODEC_ID_SIPR
Definition: avcodec.h:605
AVCodecParameters::color_trc
enum AVColorTransferCharacteristic color_trc
Definition: avcodec.h:4045
AV_CODEC_ID_ADPCM_SBPRO_2
@ AV_CODEC_ID_ADPCM_SBPRO_2
Definition: avcodec.h:519
AV_PIX_FMT_YUV422P12BE
@ AV_PIX_FMT_YUV422P12BE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:246
AV_PIX_FMT_YUV444P14LE
@ AV_PIX_FMT_YUV444P14LE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:253
AV_CODEC_ID_WMAV1
@ AV_CODEC_ID_WMAV1
Definition: avcodec.h:571
AV_CODEC_ID_PCM_S8
@ AV_CODEC_ID_PCM_S8
Definition: avcodec.h:467
AV_PIX_FMT_BGR8
@ AV_PIX_FMT_BGR8
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
Definition: pixfmt.h:83
avassert.h
AVCodecContext::color_primaries
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
Definition: avcodec.h:2179
AVCodec::supported_samplerates
const int * supported_samplerates
array of supported audio samplerates, or NULL if unknown, array is terminated by 0
Definition: avcodec.h:3503
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
AV_CODEC_ID_MACE3
@ AV_CODEC_ID_MACE3
Definition: avcodec.h:573
AV_CODEC_ID_ATRAC3P
@ AV_CODEC_ID_ATRAC3P
Definition: avcodec.h:603
state
static struct @313 state
codec_mutex
static AVMutex codec_mutex
Definition: utils.c:68
frame_thread_encoder.h
buf
void * buf
Definition: avisynth_c.h:766
AV_CODEC_CAP_EXPERIMENTAL
#define AV_CODEC_CAP_EXPERIMENTAL
Codec is experimental and is thus avoided in favor of non experimental encoders.
Definition: avcodec.h:1029
av_cold
#define av_cold
Definition: attributes.h:84
AVCodecContext::pts_correction_num_faulty_pts
int64_t pts_correction_num_faulty_pts
Current statistics for PTS correction.
Definition: avcodec.h:3142
FF_CODEC_PROPERTY_LOSSLESS
#define FF_CODEC_PROPERTY_LOSSLESS
Definition: avcodec.h:3228
AV_CODEC_ID_TTA
@ AV_CODEC_ID_TTA
Definition: avcodec.h:586
AVCodecContext::rc_initial_buffer_occupancy
int rc_initial_buffer_occupancy
Number of bits which should be loaded into the rc buffer before decoding starts.
Definition: avcodec.h:2471
avpriv_find_pix_fmt
enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc)
Definition: utils.c:477
duration
int64_t duration
Definition: movenc.c:63
LIBAVCODEC_VERSION_MICRO
#define LIBAVCODEC_VERSION_MICRO
Definition: version.h:32
AVCodecParameters::frame_size
int frame_size
Audio only.
Definition: avcodec.h:4078
AVMutex
#define AVMutex
Definition: thread.h:151
av_memcpy_backptr
void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
Overlapping memcpy() implementation.
Definition: mem.c:426
AV_CODEC_ID_S302M
@ AV_CODEC_ID_S302M
Definition: avcodec.h:489
av_opt_set_dict
int av_opt_set_dict(void *obj, AVDictionary **options)
Set all the options from a given dictionary on an object.
Definition: opt.c:1603
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
AVCodecInternal::to_free
AVFrame * to_free
Definition: internal.h:159
AV_PIX_FMT_GBRAP16BE
@ AV_PIX_FMT_GBRAP16BE
planar GBRA 4:4:4:4 64bpp, big-endian
Definition: pixfmt.h:216
ff_frame_thread_encoder_free
void ff_frame_thread_encoder_free(AVCodecContext *avctx)
Definition: frame_thread_encoder.c:244
hwaccel.h
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:1667
AVCodecContext::has_b_frames
int has_b_frames
Size of the frame reordering buffer in the decoder.
Definition: avcodec.h:1855
AV_CODEC_ID_ADPCM_G726
@ AV_CODEC_ID_ADPCM_G726
Definition: avcodec.h:513
planar
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi - 0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(INT64_C(1)<< 63))) #define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={ FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64), };static void cpy1(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, len);} static void cpy2(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 2 *len);} static void cpy4(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 4 *len);} static void cpy8(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 8 *len);} AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags) { AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;if(channels==1){ in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);} ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map) { switch(av_get_bytes_per_sample(in_fmt)){ case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;} } if(HAVE_X86ASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);return ctx;} void swri_audio_convert_free(AudioConvert **ctx) { av_freep(ctx);} int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len) { int ch;int off=0;const int os=(out->planar ? 1 :out->ch_count) *out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask) { int planes=in->planar ? in->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;} if(ctx->out_simd_align_mask) { int planes=out->planar ? out->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;} if(ctx->simd_f &&!ctx->ch_map &&!misaligned){ off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){ if(out->planar==in->planar){ int planes=out->planar ? out->ch_count :1;for(ch=0;ch< planes;ch++){ ctx->simd_f(out-> ch const uint8_t **in ch off *out planar
Definition: audioconvert.c:226
FFMAX3
#define FFMAX3(a, b, c)
Definition: common.h:95
AVCodecDescriptor
This struct describes the properties of a single codec described by an AVCodecID.
Definition: avcodec.h:716
s
#define s(width, name)
Definition: cbs_vp9.c:257
AV_PIX_FMT_GBRP16LE
@ AV_PIX_FMT_GBRP16LE
planar GBR 4:4:4 48bpp, little-endian
Definition: pixfmt.h:175
AV_CODEC_ID_PCM_LXF
@ AV_CODEC_ID_PCM_LXF
Definition: avcodec.h:488
AVCodecInternal::buffer_pkt
AVPacket * buffer_pkt
buffers for using new encode/decode API through legacy API
Definition: internal.h:200
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
AVCodecInternal::compat_decode_frame
AVFrame * compat_decode_frame
Definition: internal.h:213
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58
height
static int height
Definition: utils.c:158
av_realloc_array
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Definition: mem.c:198
AV_CODEC_ID_ADPCM_AFC
@ AV_CODEC_ID_ADPCM_AFC
Definition: avcodec.h:534
AVHWAccel::uninit
int(* uninit)(AVCodecContext *avctx)
Uninitialize the hwaccel private data.
Definition: avcodec.h:3787
AV_CODEC_ID_ADPCM_IMA_EA_SEAD
@ AV_CODEC_ID_ADPCM_IMA_EA_SEAD
Definition: avcodec.h:525
AVCodecParameters::sample_aspect_ratio
AVRational sample_aspect_ratio
Video only.
Definition: avcodec.h:4033
g
const char * g
Definition: vf_curves.c:115
frame_size
int frame_size
Definition: mxfenc.c:2215
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
op
static int op(uint8_t **dst, const uint8_t *dst_end, GetByteContext *gb, int pixel, int count, int *x, int width, int linesize)
Perform decode operation.
Definition: anm.c:78
AVCodecParameters::width
int width
Video only.
Definition: avcodec.h:4023
AVCodecContext::ticks_per_frame
int ticks_per_frame
For some codecs, the time base is closer to the field rate than the frame rate.
Definition: avcodec.h:1697
AV_CODEC_ID_MP2
@ AV_CODEC_ID_MP2
Definition: avcodec.h:564
AV_CODEC_ID_ADPCM_IMA_DK3
@ AV_CODEC_ID_ADPCM_IMA_DK3
Definition: avcodec.h:504
AV_PIX_FMT_GBRP12LE
@ AV_PIX_FMT_GBRP12LE
planar GBR 4:4:4 36bpp, little-endian
Definition: pixfmt.h:255
FF_PROFILE_UNKNOWN
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:2899
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
av_sample_fmt_is_planar
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
Definition: samplefmt.c:112
AV_CODEC_ID_ADPCM_IMA_APC
@ AV_CODEC_ID_ADPCM_IMA_APC
Definition: avcodec.h:531
AVCodecDescriptor::type
enum AVMediaType type
Definition: avcodec.h:718
ff_thread_ref_frame
int ff_thread_ref_frame(ThreadFrame *dst, ThreadFrame *src)
Definition: utils.c:1861
AV_CODEC_ID_ATRAC9
@ AV_CODEC_ID_ATRAC9
Definition: avcodec.h:653
AVCodecContext::bits_per_raw_sample
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition: avcodec.h:2796
AV_PIX_FMT_YUVA420P16BE
@ AV_PIX_FMT_YUVA420P16BE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:190
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
ff_side_data_update_matrix_encoding
int ff_side_data_update_matrix_encoding(AVFrame *frame, enum AVMatrixEncoding matrix_encoding)
Add or update AV_FRAME_DATA_MATRIXENCODING side data.
Definition: utils.c:134
AVPacketSideData::data
uint8_t * data
Definition: avcodec.h:1421
AV_CODEC_ID_ADPCM_IMA_ISS
@ AV_CODEC_ID_ADPCM_IMA_ISS
Definition: avcodec.h:529
AV_CODEC_ID_BINKAUDIO_DCT
@ AV_CODEC_ID_BINKAUDIO_DCT
Definition: avcodec.h:612
ctx
AVFormatContext * ctx
Definition: movenc.c:48
avcodec_fill_audio_frame
int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, enum AVSampleFormat sample_fmt, const uint8_t *buf, int buf_size, int align)
Fill AVFrame audio data and linesize pointers.
Definition: utils.c:386
ff_alloc_entries
int ff_alloc_entries(AVCodecContext *avctx, int count)
Definition: utils.c:1919
AV_CODEC_ID_PCM_F24LE
@ AV_CODEC_ID_PCM_F24LE
Definition: avcodec.h:498
decode.h
limits.h
avcodec_align_dimensions2
void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int linesize_align[AV_NUM_DATA_POINTERS])
Modify width and height values so that they will result in a memory buffer that is acceptable for the...
Definition: utils.c:154
AV_CODEC_ID_PCM_MULAW
@ AV_CODEC_ID_PCM_MULAW
Definition: avcodec.h:469
field
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 field
Definition: writing_filters.txt:78
AVCodecContext::max_pixels
int64_t max_pixels
The number of pixels per image to maximally accept.
Definition: avcodec.h:3292
AV_CODEC_ID_PCM_U16BE
@ AV_CODEC_ID_PCM_U16BE
Definition: avcodec.h:466
avcodec_get_name
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
Definition: utils.c:1183
AV_CODEC_ID_ADPCM_IMA_SMJPEG
@ AV_CODEC_ID_ADPCM_IMA_SMJPEG
Definition: avcodec.h:507
AV_PIX_FMT_GBRP10LE
@ AV_PIX_FMT_GBRP10LE
planar GBR 4:4:4 30bpp, little-endian
Definition: pixfmt.h:173
AV_CODEC_ID_PCM_DVD
@ AV_CODEC_ID_PCM_DVD
Definition: avcodec.h:482
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
AVCodecContext::rc_max_rate
int64_t rc_max_rate
maximum bitrate
Definition: avcodec.h:2443
av_get_sample_fmt_name
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
Definition: samplefmt.c:49
AVMEDIA_TYPE_DATA
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
Definition: avutil.h:203
AVCodecInternal::ds
DecodeSimpleContext ds
Definition: internal.h:165
AVCOL_PRI_UNSPECIFIED
@ AVCOL_PRI_UNSPECIFIED
Definition: pixfmt.h:446
AVSubtitleRect::text
char * text
0 terminated plain UTF-8 text
Definition: avcodec.h:3921
AVCPBProperties
This structure describes the bitrate properties of an encoded bitstream.
Definition: avcodec.h:1128
f
#define f(width, name)
Definition: cbs_vp9.c:255
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: avcodec.h:245
av_get_codec_tag_string
size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
Put a string representing the codec tag codec_tag in buf.
Definition: utils.c:1203
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
ff_thread_free
void ff_thread_free(AVCodecContext *avctx)
Definition: pthread.c:82
AVCodecContext::codec_id
enum AVCodecID codec_id
Definition: avcodec.h:1575
AV_PIX_FMT_YUV444P10LE
@ AV_PIX_FMT_YUV444P10LE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:165
arg
const char * arg
Definition: jacosubdec.c:66
AVCodecDescriptor::props
int props
Codec properties, a combination of AV_CODEC_PROP_* flags.
Definition: avcodec.h:732
AV_PIX_FMT_YUVA422P10LE
@ AV_PIX_FMT_YUVA422P10LE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:187
ThreadFrame::progress
AVBufferRef * progress
Definition: thread.h:39
if
if(ret)
Definition: filter_design.txt:179
AVMatrixEncoding
AVMatrixEncoding
Definition: channel_layout.h:114
AVCodecContext::rc_buffer_size
int rc_buffer_size
decoder bitstream buffer size
Definition: avcodec.h:2428
AVCodecContext::sub_charenc
char * sub_charenc
DTS of the last frame.
Definition: avcodec.h:3152
av_color_range_name
const char * av_color_range_name(enum AVColorRange range)
Definition: pixdesc.c:2848
AV_PIX_FMT_YUV444P9BE
@ AV_PIX_FMT_YUV444P9BE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:162
av_log_get_level
int av_log_get_level(void)
Get the current log level.
Definition: log.c:380
AV_CODEC_ID_PCM_ALAW
@ AV_CODEC_ID_PCM_ALAW
Definition: avcodec.h:470
AV_PIX_FMT_YUV422P10BE
@ AV_PIX_FMT_YUV422P10BE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:160
LIBAVCODEC_VERSION_INT
#define LIBAVCODEC_VERSION_INT
Definition: version.h:34
AV_PIX_FMT_YUV422P16LE
@ AV_PIX_FMT_YUV422P16LE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:133
AV_CODEC_ID_ADPCM_EA_XAS
@ AV_CODEC_ID_ADPCM_EA_XAS
Definition: avcodec.h:527
ff_match_2uint16
int ff_match_2uint16(const uint16_t(*tab)[2], int size, int a, int b)
Return the index into tab at which {a,b} match elements {[0],[1]} of tab.
Definition: utils.c:1817
AV_CODEC_ID_SP5X
@ AV_CODEC_ID_SP5X
Definition: avcodec.h:228
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:67
AV_PIX_FMT_GBRAP12BE
@ AV_PIX_FMT_GBRAP12BE
planar GBR 4:4:4:4 48bpp, big-endian
Definition: pixfmt.h:287
NULL
#define NULL
Definition: coverity.c:32
ff_thread_release_buffer
void ff_thread_release_buffer(AVCodecContext *avctx, ThreadFrame *f)
Wrapper around release_buffer() frame-for multithreaded codecs.
Definition: utils.c:1896
AVHWFramesContext::sw_format
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
Definition: hwcontext.h:221
av_match_list
int av_match_list(const char *name, const char *list, char separator)
Check if a name is in a list.
Definition: avstring.c:443
AV_CODEC_ID_DST
@ AV_CODEC_ID_DST
Definition: avcodec.h:646
AVCodecContext::color_range
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition: avcodec.h:2200
av_buffer_unref
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
Definition: buffer.c:125
AV_CODEC_ID_INTERPLAY_VIDEO
@ AV_CODEC_ID_INTERPLAY_VIDEO
Definition: avcodec.h:257
avcodec_parameters_free
void avcodec_parameters_free(AVCodecParameters **ppar)
Free an AVCodecParameters instance and everything associated with it and write NULL to the supplied p...
Definition: utils.c:2069
AV_CODEC_ID_ADPCM_YAMAHA
@ AV_CODEC_ID_ADPCM_YAMAHA
Definition: avcodec.h:516
AV_CODEC_ID_ADPCM_IMA_WS
@ AV_CODEC_ID_ADPCM_IMA_WS
Definition: avcodec.h:506
AV_CODEC_ID_PCM_U24BE
@ AV_CODEC_ID_PCM_U24BE
Definition: avcodec.h:478
AVCodec::type
enum AVMediaType type
Definition: avcodec.h:3494
AV_PIX_FMT_YUYV422
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:67
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AV_CODEC_ID_INTERPLAY_DPCM
@ AV_CODEC_ID_INTERPLAY_DPCM
Definition: avcodec.h:556
AV_CODEC_ID_PCM_U32BE
@ AV_CODEC_ID_PCM_U32BE
Definition: avcodec.h:474
AVCodecContext::nb_coded_side_data
int nb_coded_side_data
Definition: avcodec.h:3238
AVCodecContext::internal
struct AVCodecInternal * internal
Private context used for internal data.
Definition: avcodec.h:1600
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
AV_CODEC_ID_ADPCM_IMA_DK4
@ AV_CODEC_ID_ADPCM_IMA_DK4
Definition: avcodec.h:505
AVCodecContext::bit_rate
int64_t bit_rate
the average bitrate
Definition: avcodec.h:1615
AVPacketSideData::type
enum AVPacketSideDataType type
Definition: avcodec.h:1423
AV_PIX_FMT_YUVA422P12LE
@ AV_PIX_FMT_YUVA422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, little-endian
Definition: pixfmt.h:344
AV_CODEC_ID_CINEPAK
@ AV_CODEC_ID_CINEPAK
Definition: avcodec.h:261
AVSubtitleRect::data
uint8_t * data[4]
data+linesize for the bitmap of this subtitle.
Definition: avcodec.h:3916
AV_CODEC_ID_PCM_S64BE
@ AV_CODEC_ID_PCM_S64BE
Definition: avcodec.h:496
AV_CODEC_PROP_BITMAP_SUB
#define AV_CODEC_PROP_BITMAP_SUB
Subtitle codec is bitmap based Decoded AVSubtitle data can be read from the AVSubtitleRect->pict fiel...
Definition: avcodec.h:775
AV_CODEC_ID_ZLIB
@ AV_CODEC_ID_ZLIB
Definition: avcodec.h:272
av_buffer_pool_uninit
void av_buffer_pool_uninit(AVBufferPool **ppool)
Mark the pool as being available for freeing.
Definition: buffer.c:275
AV_PIX_FMT_YUVA444P12BE
@ AV_PIX_FMT_YUVA444P12BE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, big-endian
Definition: pixfmt.h:345
AVCodec::profiles
const AVProfile * profiles
array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
Definition: avcodec.h:3508
AVCodecContext::trailing_padding
int trailing_padding
Audio only.
Definition: avcodec.h:3284
AV_PIX_FMT_YUVA444P9LE
@ AV_PIX_FMT_YUVA444P9LE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
Definition: pixfmt.h:183
av_color_primaries_name
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
Definition: pixdesc.c:2867
avcodec_license
const char * avcodec_license(void)
Return the libavcodec license.
Definition: utils.c:1461
ff_alloc_a53_sei
int ff_alloc_a53_sei(const AVFrame *frame, size_t prefix_len, void **data, size_t *sei_size)
Check AVFrame for A53 side data and allocate and fill SEI message with A53 info.
Definition: utils.c:2212
AV_CODEC_ID_ADPCM_IMA_AMV
@ AV_CODEC_ID_ADPCM_IMA_AMV
Definition: avcodec.h:521
av_opt_free
void av_opt_free(void *obj)
Free all allocated objects in obj.
Definition: opt.c:1558
lowres
static int lowres
Definition: ffplay.c:335
AV_PIX_FMT_YUVA420P16LE
@ AV_PIX_FMT_YUVA420P16LE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:191
AV_PIX_FMT_RGB8
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
Definition: pixfmt.h:86
avcodec_open2
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
Definition: utils.c:565
avcodec_version
unsigned avcodec_version(void)
Return the LIBAVCODEC_VERSION_INT constant.
Definition: utils.c:1446
AV_CODEC_ID_ROQ_DPCM
@ AV_CODEC_ID_ROQ_DPCM
Definition: avcodec.h:555
AV_PIX_FMT_YUV440P10LE
@ AV_PIX_FMT_YUV440P10LE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:275
AVProfile::profile
int profile
Definition: avcodec.h:3415
AVCodecInternal::skip_samples_multiplier
int skip_samples_multiplier
Definition: internal.h:217
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
AVCodec::init
int(* init)(AVCodecContext *)
Definition: avcodec.h:3564
AV_PIX_FMT_YUVA420P9LE
@ AV_PIX_FMT_YUVA420P9LE
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian
Definition: pixfmt.h:179
AV_CODEC_ID_VP6A
@ AV_CODEC_ID_VP6A
Definition: avcodec.h:324
av_cpb_properties_alloc
AVCPBProperties * av_cpb_properties_alloc(size_t *size)
Allocate a CPB properties structure and initialize its fields to default values.
Definition: utils.c:1999
AV_SAMPLE_FMT_U8
AV_SAMPLE_FMT_U8
Definition: audio_convert.c:194
AVCodecContext::level
int level
level
Definition: avcodec.h:3018
AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_UNSPECIFIED
Definition: pixfmt.h:520
AVCodecParameters::level
int level
Definition: avcodec.h:4018
ff_color_frame
void ff_color_frame(AVFrame *frame, const int c[4])
Definition: utils.c:422
index
int index
Definition: gxfenc.c:89
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: avcodec.h:4067
av_get_channel_layout_nb_channels
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
Definition: channel_layout.c:220
AVCodecInternal::last_pkt_props
AVPacket * last_pkt_props
Properties (timestamps+side data) extracted from the last packet passed for decoding.
Definition: internal.h:172
AV_PIX_FMT_YUV420P14LE
@ AV_PIX_FMT_YUV420P14LE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:245
AV_CODEC_ID_PCM_S24LE_PLANAR
@ AV_CODEC_ID_PCM_S24LE_PLANAR
Definition: avcodec.h:491
AV_CODEC_ID_ADPCM_XA
@ AV_CODEC_ID_ADPCM_XA
Definition: avcodec.h:510
AV_CODEC_ID_GSM
@ AV_CODEC_ID_GSM
as in Berlin toast format
Definition: avcodec.h:582
av_bprint_is_complete
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
Definition: bprint.h:185
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: avcodec.h:215
AV_CODEC_ID_PCM_VIDC
@ AV_CODEC_ID_PCM_VIDC
Definition: avcodec.h:499
AV_PIX_FMT_YUV444P14BE
@ AV_PIX_FMT_YUV444P14BE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:252
AV_CODEC_ID_MJPEGB
@ AV_CODEC_ID_MJPEGB
Definition: avcodec.h:226
AVCodecParameters::extradata_size
int extradata_size
Size of the extradata content in bytes.
Definition: avcodec.h:3975
AV_PIX_FMT_YUV420P9BE
@ AV_PIX_FMT_YUV420P9BE
The following 12 formats have the disadvantage of needing 1 format for each bit depth.
Definition: pixfmt.h:156
AVCodecContext::time_base
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition: avcodec.h:1688
AVCodecContext::lowres
int lowres
low resolution decoding, 1-> 1/2 size, 2->1/4 size
Definition: avcodec.h:2804
AV_CODEC_ID_QCELP
@ AV_CODEC_ID_QCELP
Definition: avcodec.h:588
options
const OptionDef options[]
av_get_bits_per_sample
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition: utils.c:1550
AV_CODEC_CAP_AUTO_THREADS
#define AV_CODEC_CAP_AUTO_THREADS
Codec supports avctx->thread_count == 0 (auto).
Definition: avcodec.h:1049
desc
const char * desc
Definition: nvenc.c:68
AV_CODEC_ID_PCM_S24LE
@ AV_CODEC_ID_PCM_S24LE
Definition: avcodec.h:475
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1965
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:68
AV_PIX_FMT_YUV440P12LE
@ AV_PIX_FMT_YUV440P12LE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:277
AV_SAMPLE_FMT_NB
@ AV_SAMPLE_FMT_NB
Number of sample formats. DO NOT USE if linking dynamically.
Definition: samplefmt.h:74
AV_CODEC_ID_ADPCM_ADX
@ AV_CODEC_ID_ADPCM_ADX
Definition: avcodec.h:511
AV_CODEC_FLAG_GRAY
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
Definition: avcodec.h:883
av_frame_ref
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
Definition: frame.c:443
AV_SAMPLE_FMT_U8P
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
Definition: samplefmt.h:66
AVCodecInternal::hwaccel_priv_data
void * hwaccel_priv_data
hwaccel-specific private data
Definition: internal.h:190
AV_CODEC_ID_ADPCM_IMA_RAD
@ AV_CODEC_ID_ADPCM_IMA_RAD
Definition: avcodec.h:537
AV_PIX_FMT_YUV420P12BE
@ AV_PIX_FMT_YUV420P12BE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:242
AV_PIX_FMT_YUV422P10LE
@ AV_PIX_FMT_YUV422P10LE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:161
AV_CODEC_ID_DSD_MSBF
@ AV_CODEC_ID_DSD_MSBF
Definition: avcodec.h:639
av_get_profile_name
const char * av_get_profile_name(const AVCodec *codec, int profile)
Return a name for the specified profile, if available.
Definition: utils.c:1418
FFMAX
#define FFMAX(a, b)
Definition: common.h:94
AV_CODEC_ID_DXV
@ AV_CODEC_ID_DXV
Definition: avcodec.h:409
AV_PIX_FMT_YUV422P14BE
@ AV_PIX_FMT_YUV422P14BE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:248
bps
unsigned bps
Definition: movenc.c:1497
AVCodecContext::sample_fmt
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:2233
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:59
AV_MUTEX_INITIALIZER
#define AV_MUTEX_INITIALIZER
Definition: thread.h:152
AV_CODEC_ID_ADPCM_SWF
@ AV_CODEC_ID_ADPCM_SWF
Definition: avcodec.h:515
size
int size
Definition: twinvq_data.h:11134
AV_CODEC_ID_SMVJPEG
@ AV_CODEC_ID_SMVJPEG
Definition: avcodec.h:427
avpriv_codec_get_cap_skip_frame_fill_param
int avpriv_codec_get_cap_skip_frame_fill_param(const AVCodec *codec)
Definition: utils.c:506
AV_NUM_DATA_POINTERS
#define AV_NUM_DATA_POINTERS
Definition: frame.h:296
AV_RB32
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_RB32
Definition: bytestream.h:92
AVCodecInternal::pool
FramePool * pool
Definition: internal.h:161
AV_PIX_FMT_GBRP9BE
@ AV_PIX_FMT_GBRP9BE
planar GBR 4:4:4 27bpp, big-endian
Definition: pixfmt.h:170
ff_add_cpb_side_data
AVCPBProperties * ff_add_cpb_side_data(AVCodecContext *avctx)
Add a CPB properties side data to an encoding context.
Definition: utils.c:2013
AVFrameSideData::data
uint8_t * data
Definition: frame.h:203
AVCodecInternal::byte_buffer
uint8_t * byte_buffer
temporary buffer used for encoders to store their bitstream
Definition: internal.h:177
AVCodecParameters::profile
int profile
Codec-specific bitstream restrictions that the stream conforms to.
Definition: avcodec.h:4017
AVCHROMA_LOC_UNSPECIFIED
@ AVCHROMA_LOC_UNSPECIFIED
Definition: pixfmt.h:542
AV_PIX_FMT_YUV420P10BE
@ AV_PIX_FMT_YUV420P10BE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:158
AVMEDIA_TYPE_UNKNOWN
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
Definition: avutil.h:200
frame.h
val
const char const char void * val
Definition: avisynth_c.h:863
AVCodec::send_frame
int(* send_frame)(AVCodecContext *avctx, const AVFrame *frame)
Encode API with decoupled packet/frame dataflow.
Definition: avcodec.h:3589
AV_PIX_FMT_GBRP9LE
@ AV_PIX_FMT_GBRP9LE
planar GBR 4:4:4 27bpp, little-endian
Definition: pixfmt.h:171
AV_NE
#define AV_NE(be, le)
Definition: common.h:50
avcodec_find_decoder
AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
Definition: allcodecs.c:890
AV_CODEC_FLAG_PASS2
#define AV_CODEC_FLAG_PASS2
Use internal 2pass ratecontrol in second pass mode.
Definition: avcodec.h:875
encode
static void encode(AVCodecContext *ctx, AVFrame *frame, AVPacket *pkt, FILE *output)
Definition: encode_audio.c:95
AVCodecContext::pts_correction_num_faulty_dts
int64_t pts_correction_num_faulty_dts
Number of incorrect PTS values so far.
Definition: avcodec.h:3143
FFMIN
#define FFMIN(a, b)
Definition: common.h:96
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
AVCodecContext::pts_correction_last_pts
int64_t pts_correction_last_pts
Number of incorrect DTS values so far.
Definition: avcodec.h:3144
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:177
AVPacketSideData::size
int size
Definition: avcodec.h:1422
AV_FIELD_TT
@ AV_FIELD_TT
Definition: avcodec.h:1546
avcodec_default_execute
int avcodec_default_execute(AVCodecContext *c, int(*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size)
Definition: utils.c:451
attributes.h
ff_mutex_lock
static int ff_mutex_lock(AVMutex *mutex)
Definition: thread.h:155
av_packet_alloc
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
Definition: avpacket.c:51
av_dict_free
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
Definition: dict.c:203
ff_reset_entries
void ff_reset_entries(AVCodecContext *avctx)
Definition: utils.c:1924
AVCodecInternal::byte_buffer_size
unsigned int byte_buffer_size
Definition: internal.h:178
bitrate
int64_t bitrate
Definition: h264_levels.c:131
ff_int_from_list_or_default
int ff_int_from_list_or_default(void *ctx, const char *val_name, int val, const int *array_valid_values, int default_value)
Check if a value is in the list.
Definition: utils.c:2276
AV_PIX_FMT_YUVA420P10LE
@ AV_PIX_FMT_YUVA420P10LE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:185
av_hwaccel_next
AVHWAccel * av_hwaccel_next(const AVHWAccel *hwaccel)
If hwaccel is NULL, returns the first registered hardware accelerator, if hwaccel is non-NULL,...
Definition: utils.c:1836
AV_CODEC_ID_SVQ1
@ AV_CODEC_ID_SVQ1
Definition: avcodec.h:240
AV_SAMPLE_FMT_S16P
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:67
ff_thread_await_progress
void ff_thread_await_progress(ThreadFrame *f, int progress, int field)
Wait for earlier decoding threads to finish reference pictures.
Definition: utils.c:1910
FF_THREAD_FRAME
#define FF_THREAD_FRAME
Decode more than one frame at once.
Definition: avcodec.h:2835
AVCodecContext::channels
int channels
number of audio channels
Definition: avcodec.h:2226
AVChromaLocation
AVChromaLocation
Location of chroma samples.
Definition: pixfmt.h:541
AVCodec::encode2
int(* encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Encode data to an AVPacket.
Definition: avcodec.h:3577
AVCodec::id
enum AVCodecID id
Definition: avcodec.h:3495
AV_PIX_FMT_YUVA422P10BE
@ AV_PIX_FMT_YUVA422P10BE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:186
AV_CODEC_ID_VP5
@ AV_CODEC_ID_VP5
Definition: avcodec.h:308
avcodec_parameters_alloc
AVCodecParameters * avcodec_parameters_alloc(void)
Allocate a new AVCodecParameters and set its fields to default values (unknown/invalid/0).
Definition: utils.c:2059
AVCPBProperties::vbv_delay
uint64_t vbv_delay
The delay between the time the packet this structure is associated with is received and the time when...
Definition: avcodec.h:1170
AV_CODEC_ID_MJPEG
@ AV_CODEC_ID_MJPEG
Definition: avcodec.h:225
AVCodecContext::bits_per_coded_sample
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:2789
AV_PIX_FMT_YUVA444P12LE
@ AV_PIX_FMT_YUVA444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, little-endian
Definition: pixfmt.h:346
AV_PIX_FMT_YUVA422P9BE
@ AV_PIX_FMT_YUVA422P9BE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
Definition: pixfmt.h:180
AV_CODEC_ID_ATRAC1
@ AV_CODEC_ID_ATRAC1
Definition: avcodec.h:610
AV_CODEC_ID_RA_288
@ AV_CODEC_ID_RA_288
Definition: avcodec.h:552
ff_thread_finish_setup
void ff_thread_finish_setup(AVCodecContext *avctx)
If the codec defines update_thread_context(), call this when they are ready for the next thread to st...
Definition: utils.c:1902
AV_CODEC_ID_ADPCM_MTAF
@ AV_CODEC_ID_ADPCM_MTAF
Definition: avcodec.h:543
bprint.h
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: avcodec.h:216
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
AVCodecContext::properties
unsigned properties
Properties of the stream that gets decoded.
Definition: avcodec.h:3227
width
static int width
Definition: utils.c:158
av_get_bytes_per_sample
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
Definition: samplefmt.c:106
AVCodecContext::extradata
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:1666
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: internal.h:48
avcodec_descriptor_get
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
Definition: codec_desc.c:3257
internal.h
AV_CODEC_ID_EVRC
@ AV_CODEC_ID_EVRC
Definition: avcodec.h:636
AVCodecParameters::height
int height
Definition: avcodec.h:4024
avcodec_parameters_to_context
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
Fill the codec context based on the values from the supplied codec parameters.
Definition: utils.c:2155
AVCodecParameters::block_align
int block_align
Audio only.
Definition: avcodec.h:4074
AV_CODEC_ID_DSD_LSBF_PLANAR
@ AV_CODEC_ID_DSD_LSBF_PLANAR
Definition: avcodec.h:640
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
AV_CODEC_ID_PCM_F64BE
@ AV_CODEC_ID_PCM_F64BE
Definition: avcodec.h:485
av_fast_padded_malloc
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
Definition: utils.c:70
AV_PIX_FMT_RGB555
#define AV_PIX_FMT_RGB555
Definition: pixfmt.h:375
AVCodecContext::pts_correction_last_dts
int64_t pts_correction_last_dts
PTS of the last frame.
Definition: avcodec.h:3145
av_toupper
static av_const int av_toupper(int c)
Locale-independent conversion of ASCII characters to uppercase.
Definition: avstring.h:231
AVMEDIA_TYPE_ATTACHMENT
@ AVMEDIA_TYPE_ATTACHMENT
Opaque data information usually sparse.
Definition: avutil.h:205
AVCodecContext::dump_separator
uint8_t * dump_separator
dump format separator.
Definition: avcodec.h:3212
AV_PIX_FMT_YUVJ440P
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition: pixfmt.h:100
AV_CODEC_ID_PCM_S32BE
@ AV_CODEC_ID_PCM_S32BE
Definition: avcodec.h:472
uint8_t
uint8_t
Definition: audio_convert.c:194
av_frame_unref
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition: frame.c:553
av_get_audio_frame_duration
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
Return audio frame duration.
Definition: utils.c:1775
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:61
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:236
AVCodec::name
const char * name
Name of the codec implementation.
Definition: avcodec.h:3488
av_inv_q
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:159
AVCodecContext::hw_device_ctx
AVBufferRef * hw_device_ctx
A reference to the AVHWDeviceContext describing the device which will be used by a hardware encoder/d...
Definition: avcodec.h:3314
AV_PKT_DATA_CPB_PROPERTIES
@ AV_PKT_DATA_CPB_PROPERTIES
This side data corresponds to the AVCPBProperties struct.
Definition: avcodec.h:1289
AVCodecContext::chroma_sample_location
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
Definition: avcodec.h:2207
AVCodecParameters::color_range
enum AVColorRange color_range
Video only.
Definition: avcodec.h:4043
AV_CODEC_ID_PCM_F16LE
@ AV_CODEC_ID_PCM_F16LE
Definition: avcodec.h:497
AVCodec::decode
int(* decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt)
Definition: avcodec.h:3579
AV_CODEC_ID_ADPCM_IMA_DAT4
@ AV_CODEC_ID_ADPCM_IMA_DAT4
Definition: avcodec.h:542
len
int len
Definition: vorbis_enc_data.h:452
av_register_hwaccel
void av_register_hwaccel(AVHWAccel *hwaccel)
Register the hardware accelerator hwaccel.
Definition: utils.c:1841
av_samples_get_buffer_size
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Get the required buffer size for the given audio parameters.
Definition: samplefmt.c:119
AVCOL_SPC_UNSPECIFIED
@ AVCOL_SPC_UNSPECIFIED
Definition: pixfmt.h:499
AV_PIX_FMT_YUV444P16BE
@ AV_PIX_FMT_YUV444P16BE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:136
AVCodecContext::height
int height
Definition: avcodec.h:1738
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1775
AVCodec::priv_data_size
int priv_data_size
Definition: avcodec.h:3529
ff_guess_coded_bitrate
int64_t ff_guess_coded_bitrate(AVCodecContext *avctx)
Get an estimated video bitrate based on frame size, frame rate and coded bits per pixel.
Definition: utils.c:2255
AVCodecParameters::field_order
enum AVFieldOrder field_order
Video only.
Definition: avcodec.h:4038
av_get_exact_bits_per_sample
int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition: utils.c:1467
AVCodecContext::hw_frames_ctx
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames.
Definition: avcodec.h:3262
avcodec.h
AV_CODEC_ID_IAC
@ AV_CODEC_ID_IAC
Definition: avcodec.h:622
AVCodecContext::sub_charenc_mode
int sub_charenc_mode
Subtitles character encoding mode.
Definition: avcodec.h:3160
AVHWFramesContext
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:123
AV_PIX_FMT_GBRAP16LE
@ AV_PIX_FMT_GBRAP16LE
planar GBRA 4:4:4:4 64bpp, little-endian
Definition: pixfmt.h:217
AV_PIX_FMT_PAL8
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:77
AV_CODEC_ID_GSM_MS
@ AV_CODEC_ID_GSM_MS
Definition: avcodec.h:594
AV_PIX_FMT_YVYU422
@ AV_PIX_FMT_YVYU422
packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
Definition: pixfmt.h:210
tag
uint32_t tag
Definition: movenc.c:1496
ret
ret
Definition: filter_design.txt:187
AVCodec::caps_internal
int caps_internal
Internal codec capabilities.
Definition: avcodec.h:3607
AVCodecContext::block_align
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs.
Definition: avcodec.h:2262
get_audio_frame_duration
static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba, uint32_t tag, int bits_per_coded_sample, int64_t bitrate, uint8_t *extradata, int frame_size, int frame_bytes)
Definition: utils.c:1568
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
AVCodec::hw_configs
const struct AVCodecHWConfigInternal ** hw_configs
Array of pointers to hardware configurations supported by the codec, or NULL if no hardware supported...
Definition: avcodec.h:3622
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
AVCodecContext::strict_std_compliance
int strict_std_compliance
strictly follow the standard (MPEG-4, ...).
Definition: avcodec.h:2628
align
const AVS_VideoInfo int align
Definition: avisynth_c.h:887
FramePool
Definition: internal.h:100
dict.h
AV_CODEC_ID_JV
@ AV_CODEC_ID_JV
Definition: avcodec.h:367
codec_parameters_reset
static void codec_parameters_reset(AVCodecParameters *par)
Definition: utils.c:2039
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: avcodec.h:790
AV_PIX_FMT_GBRP12BE
@ AV_PIX_FMT_GBRP12BE
planar GBR 4:4:4 36bpp, big-endian
Definition: pixfmt.h:254
AV_PIX_FMT_UYVY422
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:81
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen_template.c:38
AV_PIX_FMT_YUV444P12BE
@ AV_PIX_FMT_YUV444P12BE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:250
AVCodecParameters::chroma_location
enum AVChromaLocation chroma_location
Definition: avcodec.h:4047
AVCodecParameters::trailing_padding
int trailing_padding
Audio only.
Definition: avcodec.h:4093
AV_CODEC_ID_AMV
@ AV_CODEC_ID_AMV
Definition: avcodec.h:325
av_get_media_type_string
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
Definition: utils.c:76
AVCodecContext::coded_frame
attribute_deprecated AVFrame * coded_frame
the picture in the bitstream
Definition: avcodec.h:2815
AVCodecContext
main external API structure.
Definition: avcodec.h:1565
AVCodecContext::active_thread_type
int active_thread_type
Which multithreading methods are in use by the codec.
Definition: avcodec.h:2843
AVCodecContext::codec_descriptor
const AVCodecDescriptor * codec_descriptor
AVCodecDescriptor.
Definition: avcodec.h:3126
c2
static const uint64_t c2
Definition: murmur3.c:50
ThreadFrame
Definition: thread.h:34
AV_CODEC_ID_ADPCM_G726LE
@ AV_CODEC_ID_ADPCM_G726LE
Definition: avcodec.h:538
channel_layout.h
AVCodecContext::qmin
int qmin
minimum quantizer
Definition: avcodec.h:2407
av_get_pcm_codec
enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be)
Return the PCM codec associated with a sample format.
Definition: utils.c:1528
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
config.h
AV_CODEC_ID_JPEGLS
@ AV_CODEC_ID_JPEGLS
Definition: avcodec.h:229
AVCodecContext::profile
int profile
profile
Definition: avcodec.h:2898
AV_PIX_FMT_YUV444P9LE
@ AV_PIX_FMT_YUV444P9LE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:163
av_fast_padded_mallocz
void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_padded_malloc except that buffer will always be 0-initialized after call.
Definition: utils.c:82
LICENSE_PREFIX
#define LICENSE_PREFIX
AV_SAMPLE_FMT_DBLP
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition: samplefmt.h:70
AV_CODEC_ID_PCM_U32LE
@ AV_CODEC_ID_PCM_U32LE
Definition: avcodec.h:473
AVPixFmtDescriptor::comp
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:117
AV_PIX_FMT_FLAG_PLANAR
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
Definition: pixdesc.h:144
av_get_audio_frame_duration2
int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes)
This function is the same as av_get_audio_frame_duration(), except it works with AVCodecParameters in...
Definition: utils.c:1785
avcodec_chroma_pos_to_enum
enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos)
Converts swscale x/y chroma position to AVChromaLocation.
Definition: utils.c:375
FF_CODEC_PROPERTY_CLOSED_CAPTIONS
#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS
Definition: avcodec.h:3229
av_mul_q
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
Definition: rational.c:80
av_buffer_ref
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition: buffer.c:93
AV_PIX_FMT_YUVA420P10BE
@ AV_PIX_FMT_YUVA420P10BE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:184
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
avcodec_get_hw_config
const AVCodecHWConfig * avcodec_get_hw_config(const AVCodec *codec, int index)
Retrieve supported hardware configurations for a codec.
Definition: utils.c:1824
AVCodecInternal::buffer_frame
AVFrame * buffer_frame
Definition: internal.h:202
AV_PIX_FMT_YUV420P16BE
@ AV_PIX_FMT_YUV420P16BE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:132
AV_CODEC_ID_TRUESPEECH
@ AV_CODEC_ID_TRUESPEECH
Definition: avcodec.h:585
shift
static int shift(int a, int b)
Definition: sonic.c:82
FF_DISABLE_DEPRECATION_WARNINGS
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition: internal.h:84
AVCodec::close
int(* close)(AVCodecContext *)
Definition: avcodec.h:3580
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:168
AV_CODEC_ID_ADPCM_THP
@ AV_CODEC_ID_ADPCM_THP
Definition: avcodec.h:520
AV_PIX_FMT_YUV422P16BE
@ AV_PIX_FMT_YUV422P16BE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:134
AVCodecContext::coded_width
int coded_width
Bitstream width / height, may be different from width/height e.g.
Definition: avcodec.h:1753
AVCodecContext::codec_type
enum AVMediaType codec_type
Definition: avcodec.h:1573
AVCodecContext::seek_preroll
int seek_preroll
Number of samples to skip after a discontinuity.
Definition: avcodec.h:3185
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_CODEC_ID_PCM_S32LE
@ AV_CODEC_ID_PCM_S32LE
Definition: avcodec.h:471
AV_PIX_FMT_GRAY16LE
@ AV_PIX_FMT_GRAY16LE
Y , 16bpp, little-endian.
Definition: pixfmt.h:98
AVCodecParameters::bits_per_coded_sample
int bits_per_coded_sample
The number of bits per sample in the codedwords.
Definition: avcodec.h:3999
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
AV_CODEC_ID_ADPCM_SBPRO_4
@ AV_CODEC_ID_ADPCM_SBPRO_4
Definition: avcodec.h:517
AV_CODEC_ID_PCM_U8
@ AV_CODEC_ID_PCM_U8
Definition: avcodec.h:468
AV_CODEC_ID_RPZA
@ AV_CODEC_ID_RPZA
Definition: avcodec.h:260
AVCodec::receive_frame
int(* receive_frame)(AVCodecContext *avctx, AVFrame *frame)
Decode API with decoupled packet/frame dataflow.
Definition: avcodec.h:3597
AV_CODEC_ID_SDX2_DPCM
@ AV_CODEC_ID_SDX2_DPCM
Definition: avcodec.h:560
ff_set_dimensions
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
Definition: utils.c:104
ff_set_sar
int ff_set_sar(AVCodecContext *avctx, AVRational sar)
Check that the provided sample aspect ratio is valid and set it on the codec context.
Definition: utils.c:119
AVCodecParameters::video_delay
int video_delay
Video only.
Definition: avcodec.h:4052
AVCodecContext::frame_number
int frame_number
Frame counter, set by libavcodec.
Definition: avcodec.h:2256
AV_PIX_FMT_YUVA444P10LE
@ AV_PIX_FMT_YUVA444P10LE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:189
AVFrameSideData
Structure to hold side data for an AVFrame.
Definition: frame.h:201
AVCodecParameters::format
int format
Definition: avcodec.h:3981
AV_CODEC_ID_PCM_S24DAUD
@ AV_CODEC_ID_PCM_S24DAUD
Definition: avcodec.h:479
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
map
const VDPAUPixFmtMap * map
Definition: hwcontext_vdpau.c:85
AV_CODEC_ID_PCM_F64LE
@ AV_CODEC_ID_PCM_F64LE
Definition: avcodec.h:486
av_free
#define av_free(p)
Definition: tableprint_vlc.h:34
AVCodecContext::codec_tag
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Definition: avcodec.h:1590
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:48
FF_MAX_EXTRADATA_SIZE
#define FF_MAX_EXTRADATA_SIZE
Maximum size in bytes of extradata.
Definition: internal.h:253
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: avcodec.h:3957
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:1592
AVFrameSideData::size
int size
Definition: frame.h:204
AV_CODEC_ID_ADPCM_IMA_WAV
@ AV_CODEC_ID_ADPCM_IMA_WAV
Definition: avcodec.h:503
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
av_codec_ffversion
const char av_codec_ffversion[]
Definition: utils.c:66
get_bit_rate
static int64_t get_bit_rate(AVCodecContext *ctx)
Definition: utils.c:510
av_dict_copy
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
Definition: dict.c:217
AV_FIELD_TB
@ AV_FIELD_TB
Definition: avcodec.h:1548
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:73
AVCodecParameters::channel_layout
uint64_t channel_layout
Audio only.
Definition: avcodec.h:4059
AV_PIX_FMT_YUV440P10BE
@ AV_PIX_FMT_YUV440P10BE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:276
AV_PIX_FMT_YUVA422P16BE
@ AV_PIX_FMT_YUVA422P16BE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:192
avcodec_configuration
const char * avcodec_configuration(void)
Return the libavcodec build-time configuration.
Definition: utils.c:1456
AV_PIX_FMT_YUV422P9LE
@ AV_PIX_FMT_YUV422P9LE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:167
AV_PIX_FMT_YUVA422P16LE
@ AV_PIX_FMT_YUVA422P16LE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:193
PixelFormatTag::fourcc
unsigned int fourcc
Definition: raw.h:36
AV_CODEC_ID_ILBC
@ AV_CODEC_ID_ILBC
Definition: avcodec.h:623
codec_string
Definition: dashenc.c:154
AV_PIX_FMT_GBRP14LE
@ AV_PIX_FMT_GBRP14LE
planar GBR 4:4:4 42bpp, little-endian
Definition: pixfmt.h:257
AV_FIELD_BB
@ AV_FIELD_BB
Definition: avcodec.h:1547
AVCodecInternal::thread_ctx
void * thread_ctx
Definition: internal.h:163
AV_CODEC_ID_PCM_S8_PLANAR
@ AV_CODEC_ID_PCM_S8_PLANAR
Definition: avcodec.h:490
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:1738
bytestream.h
AV_CODEC_ID_PCM_U16LE
@ AV_CODEC_ID_PCM_U16LE
Definition: avcodec.h:465
imgutils.h
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565
hwcontext.h
AVCHROMA_LOC_NB
@ AVCHROMA_LOC_NB
Not part of ABI.
Definition: pixfmt.h:549
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:72
AV_CODEC_ID_PCM_F32LE
@ AV_CODEC_ID_PCM_F32LE
Definition: avcodec.h:484
AVCodecParameters::bit_rate
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
Definition: avcodec.h:3986
DecodeSimpleContext::in_pkt
AVPacket * in_pkt
Definition: internal.h:120
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
AVCodecHWConfig
Definition: avcodec.h:3455
AV_CODEC_ID_ADPCM_4XM
@ AV_CODEC_ID_ADPCM_4XM
Definition: avcodec.h:509
AV_SAMPLE_FMT_DBL
@ AV_SAMPLE_FMT_DBL
double
Definition: samplefmt.h:64
AVCodecContext::sw_pix_fmt
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:3112
av_image_check_sar
int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar)
Check if the given sample aspect ratio of an image is valid.
Definition: imgutils.c:287
avstring.h
AV_PIX_FMT_YUVA444P16LE
@ AV_PIX_FMT_YUVA444P16LE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:195
AV_CODEC_ID_MUSEPACK7
@ AV_CODEC_ID_MUSEPACK7
Definition: avcodec.h:592
AV_CODEC_ID_ADPCM_PSX
@ AV_CODEC_ID_ADPCM_PSX
Definition: avcodec.h:540
FF_SANE_NB_CHANNELS
#define FF_SANE_NB_CHANNELS
Definition: internal.h:86
AVCodecContext::codec_whitelist
char * codec_whitelist
',' separated list of allowed decoders.
Definition: avcodec.h:3220
AV_PIX_FMT_YUVA422P12BE
@ AV_PIX_FMT_YUVA422P12BE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, big-endian
Definition: pixfmt.h:343
AVCodecHWConfigInternal::public
AVCodecHWConfig public
This is the structure which will be returned to the user by avcodec_get_hw_config().
Definition: hwaccel.h:34
AV_FIELD_BT
@ AV_FIELD_BT
Definition: avcodec.h:1549
ff_thread_report_progress
void ff_thread_report_progress(ThreadFrame *f, int progress, int field)
Notify later decoding threads when part of their reference picture is ready.
Definition: utils.c:1906
AV_SAMPLE_FMT_S32
@ AV_SAMPLE_FMT_S32
signed 32 bits
Definition: samplefmt.h:62
fourcc
uint32_t fourcc
Definition: vaapi_decode.c:238
AV_CODEC_ID_LJPEG
@ AV_CODEC_ID_LJPEG
Definition: avcodec.h:227
snprintf
#define snprintf
Definition: snprintf.h:34
AV_CODEC_ID_MP1
@ AV_CODEC_ID_MP1
Definition: avcodec.h:606
AV_PIX_FMT_YUV422P12LE
@ AV_PIX_FMT_YUV422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:247
AVCodecParameters::initial_padding
int initial_padding
Audio only.
Definition: avcodec.h:4086
AV_CODEC_ID_PCM_S24BE
@ AV_CODEC_ID_PCM_S24BE
Definition: avcodec.h:476
ff_thread_init
int ff_thread_init(AVCodecContext *s)
Definition: utils.c:1796
AV_PIX_FMT_YUVA420P9BE
@ AV_PIX_FMT_YUVA420P9BE
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
Definition: pixfmt.h:178
AV_SAMPLE_FMT_FLT
@ AV_SAMPLE_FMT_FLT
float
Definition: samplefmt.h:63
av_color_transfer_name
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
Definition: pixdesc.c:2891
AVCodecContext::sample_aspect_ratio
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
Definition: avcodec.h:1944
AVCodec::channel_layouts
const uint64_t * channel_layouts
array of support channel layouts, or NULL if unknown. array is terminated by 0
Definition: avcodec.h:3505
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:176
mutex
static AVMutex mutex
Definition: log.c:44
avcodec_parameters_copy
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
Definition: utils.c:2080
av_x_if_null
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
Definition: avutil.h:308
AV_CODEC_ID_NELLYMOSER
@ AV_CODEC_ID_NELLYMOSER
Definition: avcodec.h:597
ff_codec_open2_recursive
int attribute_align_arg ff_codec_open2_recursive(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Call avcodec_open2 recursively by decrementing counter, unlocking mutex, calling the function and the...
Definition: utils.c:553
av_get_pix_fmt_name
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
Definition: pixdesc.c:2438
AV_PIX_FMT_UYYVYY411
@ AV_PIX_FMT_UYYVYY411
packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
Definition: pixfmt.h:82
AV_CODEC_FLAG_PASS1
#define AV_CODEC_FLAG_PASS1
Use internal 2pass ratecontrol in first pass mode.
Definition: avcodec.h:871
av_fourcc2str
#define av_fourcc2str(fourcc)
Definition: avutil.h:348
AV_CODEC_ID_ADPCM_SBPRO_3
@ AV_CODEC_ID_ADPCM_SBPRO_3
Definition: avcodec.h:518
nb_channels
int nb_channels
Definition: channel_layout.c:76
AV_PIX_FMT_YUVA422P9LE
@ AV_PIX_FMT_YUVA422P9LE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
Definition: pixfmt.h:181