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 "hwconfig.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 
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  AVCodecInternal *avci;
572 
573  if (avcodec_is_open(avctx))
574  return 0;
575 
576  if (!codec && !avctx->codec) {
577  av_log(avctx, AV_LOG_ERROR, "No codec provided to avcodec_open2()\n");
578  return AVERROR(EINVAL);
579  }
580  if (codec && avctx->codec && codec != avctx->codec) {
581  av_log(avctx, AV_LOG_ERROR, "This AVCodecContext was allocated for %s, "
582  "but %s passed to avcodec_open2()\n", avctx->codec->name, codec->name);
583  return AVERROR(EINVAL);
584  }
585  if (!codec)
586  codec = avctx->codec;
587 
588  if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE)
589  return AVERROR(EINVAL);
590 
591  if (options)
592  av_dict_copy(&tmp, *options, 0);
593 
594  ff_lock_avcodec(avctx, codec);
595 
596  avci = av_mallocz(sizeof(*avci));
597  if (!avci) {
598  ret = AVERROR(ENOMEM);
599  goto end;
600  }
601  avctx->internal = avci;
602 
603  avci->to_free = av_frame_alloc();
605  avci->buffer_frame = av_frame_alloc();
606  avci->buffer_pkt = av_packet_alloc();
607  avci->ds.in_pkt = av_packet_alloc();
609  if (!avci->to_free || !avci->compat_decode_frame ||
610  !avci->buffer_frame || !avci->buffer_pkt ||
611  !avci->ds.in_pkt || !avci->last_pkt_props) {
612  ret = AVERROR(ENOMEM);
613  goto free_and_end;
614  }
615 
616  avci->skip_samples_multiplier = 1;
617 
618  if (codec->priv_data_size > 0) {
619  if (!avctx->priv_data) {
620  avctx->priv_data = av_mallocz(codec->priv_data_size);
621  if (!avctx->priv_data) {
622  ret = AVERROR(ENOMEM);
623  goto free_and_end;
624  }
625  if (codec->priv_class) {
626  *(const AVClass **)avctx->priv_data = codec->priv_class;
628  }
629  }
630  if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0)
631  goto free_and_end;
632  } else {
633  avctx->priv_data = NULL;
634  }
635  if ((ret = av_opt_set_dict(avctx, &tmp)) < 0)
636  goto free_and_end;
637 
638  if (avctx->codec_whitelist && av_match_list(codec->name, avctx->codec_whitelist, ',') <= 0) {
639  av_log(avctx, AV_LOG_ERROR, "Codec (%s) not on whitelist \'%s\'\n", codec->name, avctx->codec_whitelist);
640  ret = AVERROR(EINVAL);
641  goto free_and_end;
642  }
643 
644  // only call ff_set_dimensions() for non H.264/VP6F/DXV codecs so as not to overwrite previously setup dimensions
645  if (!(avctx->coded_width && avctx->coded_height && avctx->width && avctx->height &&
646  (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_VP6F || avctx->codec_id == AV_CODEC_ID_DXV))) {
647  if (avctx->coded_width && avctx->coded_height)
648  ret = ff_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
649  else if (avctx->width && avctx->height)
650  ret = ff_set_dimensions(avctx, avctx->width, avctx->height);
651  if (ret < 0)
652  goto free_and_end;
653  }
654 
655  if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height)
656  && ( av_image_check_size2(avctx->coded_width, avctx->coded_height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0
657  || av_image_check_size2(avctx->width, avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0)) {
658  av_log(avctx, AV_LOG_WARNING, "Ignoring invalid width/height values\n");
659  ff_set_dimensions(avctx, 0, 0);
660  }
661 
662  if (avctx->width > 0 && avctx->height > 0) {
663  if (av_image_check_sar(avctx->width, avctx->height,
664  avctx->sample_aspect_ratio) < 0) {
665  av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\n",
666  avctx->sample_aspect_ratio.num,
667  avctx->sample_aspect_ratio.den);
668  avctx->sample_aspect_ratio = (AVRational){ 0, 1 };
669  }
670  }
671 
672  /* if the decoder init function was already called previously,
673  * free the already allocated subtitle_header before overwriting it */
674  if (av_codec_is_decoder(codec))
675  av_freep(&avctx->subtitle_header);
676 
677  if (avctx->channels > FF_SANE_NB_CHANNELS || avctx->channels < 0) {
678  av_log(avctx, AV_LOG_ERROR, "Too many or invalid channels: %d\n", avctx->channels);
679  ret = AVERROR(EINVAL);
680  goto free_and_end;
681  }
682  if (avctx->sample_rate < 0) {
683  av_log(avctx, AV_LOG_ERROR, "Invalid sample rate: %d\n", avctx->sample_rate);
684  ret = AVERROR(EINVAL);
685  goto free_and_end;
686  }
687  if (avctx->block_align < 0) {
688  av_log(avctx, AV_LOG_ERROR, "Invalid block align: %d\n", avctx->block_align);
689  ret = AVERROR(EINVAL);
690  goto free_and_end;
691  }
692 
693  avctx->codec = codec;
694  if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) &&
695  avctx->codec_id == AV_CODEC_ID_NONE) {
696  avctx->codec_type = codec->type;
697  avctx->codec_id = codec->id;
698  }
699  if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type
700  && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) {
701  av_log(avctx, AV_LOG_ERROR, "Codec type or id mismatches\n");
702  ret = AVERROR(EINVAL);
703  goto free_and_end;
704  }
705  avctx->frame_number = 0;
707 
708  if ((avctx->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) &&
710  const char *codec_string = av_codec_is_encoder(codec) ? "encoder" : "decoder";
711  AVCodec *codec2;
712  av_log(avctx, AV_LOG_ERROR,
713  "The %s '%s' is experimental but experimental codecs are not enabled, "
714  "add '-strict %d' if you want to use it.\n",
716  codec2 = av_codec_is_encoder(codec) ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id);
717  if (!(codec2->capabilities & AV_CODEC_CAP_EXPERIMENTAL))
718  av_log(avctx, AV_LOG_ERROR, "Alternatively use the non experimental %s '%s'.\n",
719  codec_string, codec2->name);
721  goto free_and_end;
722  }
723 
724  if (avctx->codec_type == AVMEDIA_TYPE_AUDIO &&
725  (!avctx->time_base.num || !avctx->time_base.den)) {
726  avctx->time_base.num = 1;
727  avctx->time_base.den = avctx->sample_rate;
728  }
729 
730  if (!HAVE_THREADS)
731  av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread support, using thread emulation\n");
732 
733  if (CONFIG_FRAME_THREAD_ENCODER && av_codec_is_encoder(avctx->codec)) {
734  ff_unlock_avcodec(codec); //we will instantiate a few encoders thus kick the counter to prevent false detection of a problem
736  ff_lock_avcodec(avctx, codec);
737  if (ret < 0)
738  goto free_and_end;
739  }
740 
741  if (av_codec_is_decoder(avctx->codec)) {
742  ret = ff_decode_bsfs_init(avctx);
743  if (ret < 0)
744  goto free_and_end;
745  }
746 
747  if (HAVE_THREADS
748  && !(avci->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))) {
749  ret = ff_thread_init(avctx);
750  if (ret < 0) {
751  goto free_and_end;
752  }
753  }
754  if (!HAVE_THREADS && !(codec->capabilities & AV_CODEC_CAP_AUTO_THREADS))
755  avctx->thread_count = 1;
756 
757  if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) {
758  av_log(avctx, AV_LOG_WARNING, "The maximum value for lowres supported by the decoder is %d\n",
759  avctx->codec->max_lowres);
760  avctx->lowres = avctx->codec->max_lowres;
761  }
762 
763  if (av_codec_is_encoder(avctx->codec)) {
764  int i;
765 #if FF_API_CODED_FRAME
767  avctx->coded_frame = av_frame_alloc();
768  if (!avctx->coded_frame) {
769  ret = AVERROR(ENOMEM);
770  goto free_and_end;
771  }
773 #endif
774 
775  if (avctx->time_base.num <= 0 || avctx->time_base.den <= 0) {
776  av_log(avctx, AV_LOG_ERROR, "The encoder timebase is not set.\n");
777  ret = AVERROR(EINVAL);
778  goto free_and_end;
779  }
780 
781  if (avctx->codec->sample_fmts) {
782  for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {
783  if (avctx->sample_fmt == avctx->codec->sample_fmts[i])
784  break;
785  if (avctx->channels == 1 &&
788  avctx->sample_fmt = avctx->codec->sample_fmts[i];
789  break;
790  }
791  }
792  if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) {
793  char buf[128];
794  snprintf(buf, sizeof(buf), "%d", avctx->sample_fmt);
795  av_log(avctx, AV_LOG_ERROR, "Specified sample format %s is invalid or not supported\n",
796  (char *)av_x_if_null(av_get_sample_fmt_name(avctx->sample_fmt), buf));
797  ret = AVERROR(EINVAL);
798  goto free_and_end;
799  }
800  }
801  if (avctx->codec->pix_fmts) {
802  for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++)
803  if (avctx->pix_fmt == avctx->codec->pix_fmts[i])
804  break;
805  if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE
806  && !((avctx->codec_id == AV_CODEC_ID_MJPEG || avctx->codec_id == AV_CODEC_ID_LJPEG)
808  char buf[128];
809  snprintf(buf, sizeof(buf), "%d", avctx->pix_fmt);
810  av_log(avctx, AV_LOG_ERROR, "Specified pixel format %s is invalid or not supported\n",
811  (char *)av_x_if_null(av_get_pix_fmt_name(avctx->pix_fmt), buf));
812  ret = AVERROR(EINVAL);
813  goto free_and_end;
814  }
815  if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ420P ||
816  avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ411P ||
817  avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ422P ||
818  avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ440P ||
819  avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ444P)
820  avctx->color_range = AVCOL_RANGE_JPEG;
821  }
822  if (avctx->codec->supported_samplerates) {
823  for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++)
824  if (avctx->sample_rate == avctx->codec->supported_samplerates[i])
825  break;
826  if (avctx->codec->supported_samplerates[i] == 0) {
827  av_log(avctx, AV_LOG_ERROR, "Specified sample rate %d is not supported\n",
828  avctx->sample_rate);
829  ret = AVERROR(EINVAL);
830  goto free_and_end;
831  }
832  }
833  if (avctx->sample_rate < 0) {
834  av_log(avctx, AV_LOG_ERROR, "Specified sample rate %d is not supported\n",
835  avctx->sample_rate);
836  ret = AVERROR(EINVAL);
837  goto free_and_end;
838  }
839  if (avctx->codec->channel_layouts) {
840  if (!avctx->channel_layout) {
841  av_log(avctx, AV_LOG_WARNING, "Channel layout not specified\n");
842  } else {
843  for (i = 0; avctx->codec->channel_layouts[i] != 0; i++)
844  if (avctx->channel_layout == avctx->codec->channel_layouts[i])
845  break;
846  if (avctx->codec->channel_layouts[i] == 0) {
847  char buf[512];
848  av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);
849  av_log(avctx, AV_LOG_ERROR, "Specified channel layout '%s' is not supported\n", buf);
850  ret = AVERROR(EINVAL);
851  goto free_and_end;
852  }
853  }
854  }
855  if (avctx->channel_layout && avctx->channels) {
857  if (channels != avctx->channels) {
858  char buf[512];
859  av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);
860  av_log(avctx, AV_LOG_ERROR,
861  "Channel layout '%s' with %d channels does not match number of specified channels %d\n",
862  buf, channels, avctx->channels);
863  ret = AVERROR(EINVAL);
864  goto free_and_end;
865  }
866  } else if (avctx->channel_layout) {
868  }
869  if (avctx->channels < 0) {
870  av_log(avctx, AV_LOG_ERROR, "Specified number of channels %d is not supported\n",
871  avctx->channels);
872  ret = AVERROR(EINVAL);
873  goto free_and_end;
874  }
875  if(avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
876  pixdesc = av_pix_fmt_desc_get(avctx->pix_fmt);
877  if ( avctx->bits_per_raw_sample < 0
878  || (avctx->bits_per_raw_sample > 8 && pixdesc->comp[0].depth <= 8)) {
879  av_log(avctx, AV_LOG_WARNING, "Specified bit depth %d not possible with the specified pixel formats depth %d\n",
880  avctx->bits_per_raw_sample, pixdesc->comp[0].depth);
881  avctx->bits_per_raw_sample = pixdesc->comp[0].depth;
882  }
883  if (avctx->width <= 0 || avctx->height <= 0) {
884  av_log(avctx, AV_LOG_ERROR, "dimensions not set\n");
885  ret = AVERROR(EINVAL);
886  goto free_and_end;
887  }
888  }
889  if ( (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO)
890  && avctx->bit_rate>0 && avctx->bit_rate<1000) {
891  av_log(avctx, AV_LOG_WARNING, "Bitrate %"PRId64" is extremely low, maybe you mean %"PRId64"k\n", avctx->bit_rate, avctx->bit_rate);
892  }
893 
894  if (!avctx->rc_initial_buffer_occupancy)
895  avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3LL / 4;
896 
897  if (avctx->ticks_per_frame && avctx->time_base.num &&
898  avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
899  av_log(avctx, AV_LOG_ERROR,
900  "ticks_per_frame %d too large for the timebase %d/%d.",
901  avctx->ticks_per_frame,
902  avctx->time_base.num,
903  avctx->time_base.den);
904  goto free_and_end;
905  }
906 
907  if (avctx->hw_frames_ctx) {
908  AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
909  if (frames_ctx->format != avctx->pix_fmt) {
910  av_log(avctx, AV_LOG_ERROR,
911  "Mismatching AVCodecContext.pix_fmt and AVHWFramesContext.format\n");
912  ret = AVERROR(EINVAL);
913  goto free_and_end;
914  }
915  if (avctx->sw_pix_fmt != AV_PIX_FMT_NONE &&
916  avctx->sw_pix_fmt != frames_ctx->sw_format) {
917  av_log(avctx, AV_LOG_ERROR,
918  "Mismatching AVCodecContext.sw_pix_fmt (%s) "
919  "and AVHWFramesContext.sw_format (%s)\n",
921  av_get_pix_fmt_name(frames_ctx->sw_format));
922  ret = AVERROR(EINVAL);
923  goto free_and_end;
924  }
925  avctx->sw_pix_fmt = frames_ctx->sw_format;
926  }
927  }
928 
931  avctx->pts_correction_last_pts =
932  avctx->pts_correction_last_dts = INT64_MIN;
933 
934  if ( !CONFIG_GRAY && avctx->flags & AV_CODEC_FLAG_GRAY
936  av_log(avctx, AV_LOG_WARNING,
937  "gray decoding requested but not enabled at configuration time\n");
938  if (avctx->flags2 & AV_CODEC_FLAG2_EXPORT_MVS) {
940  }
941 
942  if ( avctx->codec->init && (!(avctx->active_thread_type&FF_THREAD_FRAME)
943  || avci->frame_thread_encoder)) {
944  ret = avctx->codec->init(avctx);
945  if (ret < 0) {
946  codec_init_ok = -1;
947  goto free_and_end;
948  }
949  codec_init_ok = 1;
950  }
951 
952  ret=0;
953 
954  if (av_codec_is_decoder(avctx->codec)) {
955  if (!avctx->bit_rate)
956  avctx->bit_rate = get_bit_rate(avctx);
957  /* validate channel layout from the decoder */
958  if (avctx->channel_layout) {
960  if (!avctx->channels)
961  avctx->channels = channels;
962  else if (channels != avctx->channels) {
963  char buf[512];
964  av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout);
965  av_log(avctx, AV_LOG_WARNING,
966  "Channel layout '%s' with %d channels does not match specified number of channels %d: "
967  "ignoring specified channel layout\n",
968  buf, channels, avctx->channels);
969  avctx->channel_layout = 0;
970  }
971  }
972  if (avctx->channels && avctx->channels < 0 ||
973  avctx->channels > FF_SANE_NB_CHANNELS) {
974  ret = AVERROR(EINVAL);
975  goto free_and_end;
976  }
977  if (avctx->bits_per_coded_sample < 0) {
978  ret = AVERROR(EINVAL);
979  goto free_and_end;
980  }
981  if (avctx->sub_charenc) {
982  if (avctx->codec_type != AVMEDIA_TYPE_SUBTITLE) {
983  av_log(avctx, AV_LOG_ERROR, "Character encoding is only "
984  "supported with subtitles codecs\n");
985  ret = AVERROR(EINVAL);
986  goto free_and_end;
987  } else if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) {
988  av_log(avctx, AV_LOG_WARNING, "Codec '%s' is bitmap-based, "
989  "subtitles character encoding will be ignored\n",
990  avctx->codec_descriptor->name);
992  } else {
993  /* input character encoding is set for a text based subtitle
994  * codec at this point */
997 
999 #if CONFIG_ICONV
1000  iconv_t cd = iconv_open("UTF-8", avctx->sub_charenc);
1001  if (cd == (iconv_t)-1) {
1002  ret = AVERROR(errno);
1003  av_log(avctx, AV_LOG_ERROR, "Unable to open iconv context "
1004  "with input character encoding \"%s\"\n", avctx->sub_charenc);
1005  goto free_and_end;
1006  }
1007  iconv_close(cd);
1008 #else
1009  av_log(avctx, AV_LOG_ERROR, "Character encoding subtitles "
1010  "conversion needs a libavcodec built with iconv support "
1011  "for this codec\n");
1012  ret = AVERROR(ENOSYS);
1013  goto free_and_end;
1014 #endif
1015  }
1016  }
1017  }
1018 
1019 #if FF_API_AVCTX_TIMEBASE
1020  if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
1021  avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));
1022 #endif
1023  }
1024  if (codec->priv_data_size > 0 && avctx->priv_data && codec->priv_class) {
1025  av_assert0(*(const AVClass **)avctx->priv_data == codec->priv_class);
1026  }
1027 
1028 end:
1029  ff_unlock_avcodec(codec);
1030  if (options) {
1032  *options = tmp;
1033  }
1034 
1035  return ret;
1036 free_and_end:
1037  if (avctx->codec && avctx->codec->close &&
1038  (codec_init_ok > 0 || (codec_init_ok < 0 &&
1040  avctx->codec->close(avctx);
1041 
1042  if (HAVE_THREADS && avci->thread_ctx)
1043  ff_thread_free(avctx);
1044 
1045  if (codec->priv_class && avctx->priv_data)
1046  av_opt_free(avctx->priv_data);
1047  av_opt_free(avctx);
1048 
1049  if (av_codec_is_encoder(avctx->codec)) {
1050 #if FF_API_CODED_FRAME
1052  av_frame_free(&avctx->coded_frame);
1054 #endif
1055  av_freep(&avctx->extradata);
1056  avctx->extradata_size = 0;
1057  }
1058 
1059  av_dict_free(&tmp);
1060  av_freep(&avctx->priv_data);
1061  av_freep(&avctx->subtitle_header);
1062  if (avci) {
1063  av_frame_free(&avci->to_free);
1065  av_frame_free(&avci->buffer_frame);
1066  av_packet_free(&avci->buffer_pkt);
1068 
1069  av_packet_free(&avci->ds.in_pkt);
1070  av_bsf_free(&avci->bsf);
1071 
1072  av_buffer_unref(&avci->pool);
1073  }
1074  av_freep(&avci);
1075  avctx->internal = NULL;
1076  avctx->codec = NULL;
1077  goto end;
1078 }
1079 
1081 {
1082  AVCodecInternal *avci = avctx->internal;
1083 
1084  if (av_codec_is_encoder(avctx->codec)) {
1085  int caps = avctx->codec->capabilities;
1086 
1087  if (!(caps & AV_CODEC_CAP_ENCODER_FLUSH)) {
1088  // Only encoders that explicitly declare support for it can be
1089  // flushed. Otherwise, this is a no-op.
1090  av_log(avctx, AV_LOG_WARNING, "Ignoring attempt to flush encoder "
1091  "that doesn't support it\n");
1092  return;
1093  }
1094 
1095  // We haven't implemented flushing for frame-threaded encoders.
1097  }
1098 
1099  avci->draining = 0;
1100  avci->draining_done = 0;
1101  avci->nb_draining_errors = 0;
1104  av_packet_unref(avci->buffer_pkt);
1105  avci->buffer_pkt_valid = 0;
1106 
1107  av_packet_unref(avci->ds.in_pkt);
1108 
1109  if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
1110  ff_thread_flush(avctx);
1111  else if (avctx->codec->flush)
1112  avctx->codec->flush(avctx);
1113 
1114  avctx->pts_correction_last_pts =
1115  avctx->pts_correction_last_dts = INT64_MIN;
1116 
1117  if (av_codec_is_decoder(avctx->codec))
1118  av_bsf_flush(avci->bsf);
1119 
1120  if (!avctx->refcounted_frames)
1121  av_frame_unref(avci->to_free);
1122 }
1123 
1125 {
1126  int i;
1127 
1128  for (i = 0; i < sub->num_rects; i++) {
1129  av_freep(&sub->rects[i]->data[0]);
1130  av_freep(&sub->rects[i]->data[1]);
1131  av_freep(&sub->rects[i]->data[2]);
1132  av_freep(&sub->rects[i]->data[3]);
1133  av_freep(&sub->rects[i]->text);
1134  av_freep(&sub->rects[i]->ass);
1135  av_freep(&sub->rects[i]);
1136  }
1137 
1138  av_freep(&sub->rects);
1139 
1140  memset(sub, 0, sizeof(*sub));
1141 }
1142 
1144 {
1145  int i;
1146 
1147  if (!avctx)
1148  return 0;
1149 
1150  if (avcodec_is_open(avctx)) {
1151  if (CONFIG_FRAME_THREAD_ENCODER &&
1152  avctx->internal->frame_thread_encoder && avctx->thread_count > 1) {
1154  }
1155  if (HAVE_THREADS && avctx->internal->thread_ctx)
1156  ff_thread_free(avctx);
1157  if (avctx->codec && avctx->codec->close)
1158  avctx->codec->close(avctx);
1159  avctx->internal->byte_buffer_size = 0;
1160  av_freep(&avctx->internal->byte_buffer);
1161  av_frame_free(&avctx->internal->to_free);
1166 
1167  av_packet_free(&avctx->internal->ds.in_pkt);
1168 
1169  av_buffer_unref(&avctx->internal->pool);
1170 
1171  if (avctx->hwaccel && avctx->hwaccel->uninit)
1172  avctx->hwaccel->uninit(avctx);
1174 
1175  av_bsf_free(&avctx->internal->bsf);
1176 
1177  av_freep(&avctx->internal);
1178  }
1179 
1180  for (i = 0; i < avctx->nb_coded_side_data; i++)
1181  av_freep(&avctx->coded_side_data[i].data);
1182  av_freep(&avctx->coded_side_data);
1183  avctx->nb_coded_side_data = 0;
1184 
1185  av_buffer_unref(&avctx->hw_frames_ctx);
1186  av_buffer_unref(&avctx->hw_device_ctx);
1187 
1188  if (avctx->priv_data && avctx->codec && avctx->codec->priv_class)
1189  av_opt_free(avctx->priv_data);
1190  av_opt_free(avctx);
1191  av_freep(&avctx->priv_data);
1192  if (av_codec_is_encoder(avctx->codec)) {
1193  av_freep(&avctx->extradata);
1194 #if FF_API_CODED_FRAME
1196  av_frame_free(&avctx->coded_frame);
1198 #endif
1199  }
1200  avctx->codec = NULL;
1201  avctx->active_thread_type = 0;
1202 
1203  return 0;
1204 }
1205 
1206 const char *avcodec_get_name(enum AVCodecID id)
1207 {
1208  const AVCodecDescriptor *cd;
1209  AVCodec *codec;
1210 
1211  if (id == AV_CODEC_ID_NONE)
1212  return "none";
1213  cd = avcodec_descriptor_get(id);
1214  if (cd)
1215  return cd->name;
1216  av_log(NULL, AV_LOG_WARNING, "Codec 0x%x is not in the full list.\n", id);
1217  codec = avcodec_find_decoder(id);
1218  if (codec)
1219  return codec->name;
1220  codec = avcodec_find_encoder(id);
1221  if (codec)
1222  return codec->name;
1223  return "unknown_codec";
1224 }
1225 
1226 size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag)
1227 {
1228  int i, len, ret = 0;
1229 
1230 #define TAG_PRINT(x) \
1231  (((x) >= '0' && (x) <= '9') || \
1232  ((x) >= 'a' && (x) <= 'z') || ((x) >= 'A' && (x) <= 'Z') || \
1233  ((x) == '.' || (x) == ' ' || (x) == '-' || (x) == '_'))
1234 
1235  for (i = 0; i < 4; i++) {
1236  len = snprintf(buf, buf_size,
1237  TAG_PRINT(codec_tag & 0xFF) ? "%c" : "[%d]", codec_tag & 0xFF);
1238  buf += len;
1239  buf_size = buf_size > len ? buf_size - len : 0;
1240  ret += len;
1241  codec_tag >>= 8;
1242  }
1243  return ret;
1244 }
1245 
1246 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
1247 {
1248  const char *codec_type;
1249  const char *codec_name;
1250  const char *profile = NULL;
1251  int64_t bitrate;
1252  int new_line = 0;
1253  AVRational display_aspect_ratio;
1254  const char *separator = enc->dump_separator ? (const char *)enc->dump_separator : ", ";
1255 
1256  if (!buf || buf_size <= 0)
1257  return;
1259  codec_name = avcodec_get_name(enc->codec_id);
1261 
1262  snprintf(buf, buf_size, "%s: %s", codec_type ? codec_type : "unknown",
1263  codec_name);
1264  buf[0] ^= 'a' ^ 'A'; /* first letter in uppercase */
1265 
1266  if (enc->codec && strcmp(enc->codec->name, codec_name))
1267  snprintf(buf + strlen(buf), buf_size - strlen(buf), " (%s)", enc->codec->name);
1268 
1269  if (profile)
1270  snprintf(buf + strlen(buf), buf_size - strlen(buf), " (%s)", profile);
1271  if ( enc->codec_type == AVMEDIA_TYPE_VIDEO
1273  && enc->refs)
1274  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1275  ", %d reference frame%s",
1276  enc->refs, enc->refs > 1 ? "s" : "");
1277 
1278  if (enc->codec_tag)
1279  snprintf(buf + strlen(buf), buf_size - strlen(buf), " (%s / 0x%04X)",
1280  av_fourcc2str(enc->codec_tag), enc->codec_tag);
1281 
1282  switch (enc->codec_type) {
1283  case AVMEDIA_TYPE_VIDEO:
1284  {
1285  char detail[256] = "(";
1286 
1287  av_strlcat(buf, separator, buf_size);
1288 
1289  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1290  "%s", enc->pix_fmt == AV_PIX_FMT_NONE ? "none" :
1292  if (enc->bits_per_raw_sample && enc->pix_fmt != AV_PIX_FMT_NONE &&
1294  av_strlcatf(detail, sizeof(detail), "%d bpc, ", enc->bits_per_raw_sample);
1296  av_strlcatf(detail, sizeof(detail), "%s, ",
1298 
1299  if (enc->colorspace != AVCOL_SPC_UNSPECIFIED ||
1301  enc->color_trc != AVCOL_TRC_UNSPECIFIED) {
1302  if (enc->colorspace != (int)enc->color_primaries ||
1303  enc->colorspace != (int)enc->color_trc) {
1304  new_line = 1;
1305  av_strlcatf(detail, sizeof(detail), "%s/%s/%s, ",
1309  } else
1310  av_strlcatf(detail, sizeof(detail), "%s, ",
1312  }
1313 
1314  if (enc->field_order != AV_FIELD_UNKNOWN) {
1315  const char *field_order = "progressive";
1316  if (enc->field_order == AV_FIELD_TT)
1317  field_order = "top first";
1318  else if (enc->field_order == AV_FIELD_BB)
1319  field_order = "bottom first";
1320  else if (enc->field_order == AV_FIELD_TB)
1321  field_order = "top coded first (swapped)";
1322  else if (enc->field_order == AV_FIELD_BT)
1323  field_order = "bottom coded first (swapped)";
1324 
1325  av_strlcatf(detail, sizeof(detail), "%s, ", field_order);
1326  }
1327 
1328  if (av_log_get_level() >= AV_LOG_VERBOSE &&
1330  av_strlcatf(detail, sizeof(detail), "%s, ",
1332 
1333  if (strlen(detail) > 1) {
1334  detail[strlen(detail) - 2] = 0;
1335  av_strlcatf(buf, buf_size, "%s)", detail);
1336  }
1337  }
1338 
1339  if (enc->width) {
1340  av_strlcat(buf, new_line ? separator : ", ", buf_size);
1341 
1342  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1343  "%dx%d",
1344  enc->width, enc->height);
1345 
1346  if (av_log_get_level() >= AV_LOG_VERBOSE &&
1347  (enc->width != enc->coded_width ||
1348  enc->height != enc->coded_height))
1349  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1350  " (%dx%d)", enc->coded_width, enc->coded_height);
1351 
1352  if (enc->sample_aspect_ratio.num) {
1353  av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
1354  enc->width * (int64_t)enc->sample_aspect_ratio.num,
1355  enc->height * (int64_t)enc->sample_aspect_ratio.den,
1356  1024 * 1024);
1357  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1358  " [SAR %d:%d DAR %d:%d]",
1360  display_aspect_ratio.num, display_aspect_ratio.den);
1361  }
1362  if (av_log_get_level() >= AV_LOG_DEBUG) {
1363  int g = av_gcd(enc->time_base.num, enc->time_base.den);
1364  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1365  ", %d/%d",
1366  enc->time_base.num / g, enc->time_base.den / g);
1367  }
1368  }
1369  if (encode) {
1370  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1371  ", q=%d-%d", enc->qmin, enc->qmax);
1372  } else {
1374  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1375  ", Closed Captions");
1377  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1378  ", lossless");
1379  }
1380  break;
1381  case AVMEDIA_TYPE_AUDIO:
1382  av_strlcat(buf, separator, buf_size);
1383 
1384  if (enc->sample_rate) {
1385  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1386  "%d Hz, ", enc->sample_rate);
1387  }
1388  av_get_channel_layout_string(buf + strlen(buf), buf_size - strlen(buf), enc->channels, enc->channel_layout);
1389  if (enc->sample_fmt != AV_SAMPLE_FMT_NONE) {
1390  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1391  ", %s", av_get_sample_fmt_name(enc->sample_fmt));
1392  }
1393  if ( enc->bits_per_raw_sample > 0
1395  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1396  " (%d bit)", enc->bits_per_raw_sample);
1397  if (av_log_get_level() >= AV_LOG_VERBOSE) {
1398  if (enc->initial_padding)
1399  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1400  ", delay %d", enc->initial_padding);
1401  if (enc->trailing_padding)
1402  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1403  ", padding %d", enc->trailing_padding);
1404  }
1405  break;
1406  case AVMEDIA_TYPE_DATA:
1407  if (av_log_get_level() >= AV_LOG_DEBUG) {
1408  int g = av_gcd(enc->time_base.num, enc->time_base.den);
1409  if (g)
1410  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1411  ", %d/%d",
1412  enc->time_base.num / g, enc->time_base.den / g);
1413  }
1414  break;
1415  case AVMEDIA_TYPE_SUBTITLE:
1416  if (enc->width)
1417  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1418  ", %dx%d", enc->width, enc->height);
1419  break;
1420  default:
1421  return;
1422  }
1423  if (encode) {
1424  if (enc->flags & AV_CODEC_FLAG_PASS1)
1425  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1426  ", pass 1");
1427  if (enc->flags & AV_CODEC_FLAG_PASS2)
1428  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1429  ", pass 2");
1430  }
1431  bitrate = get_bit_rate(enc);
1432  if (bitrate != 0) {
1433  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1434  ", %"PRId64" kb/s", bitrate / 1000);
1435  } else if (enc->rc_max_rate > 0) {
1436  snprintf(buf + strlen(buf), buf_size - strlen(buf),
1437  ", max. %"PRId64" kb/s", enc->rc_max_rate / 1000);
1438  }
1439 }
1440 
1441 const char *av_get_profile_name(const AVCodec *codec, int profile)
1442 {
1443  const AVProfile *p;
1444  if (profile == FF_PROFILE_UNKNOWN || !codec->profiles)
1445  return NULL;
1446 
1447  for (p = codec->profiles; p->profile != FF_PROFILE_UNKNOWN; p++)
1448  if (p->profile == profile)
1449  return p->name;
1450 
1451  return NULL;
1452 }
1453 
1455 {
1457  const AVProfile *p;
1458 
1459  if (profile == FF_PROFILE_UNKNOWN || !desc || !desc->profiles)
1460  return NULL;
1461 
1462  for (p = desc->profiles; p->profile != FF_PROFILE_UNKNOWN; p++)
1463  if (p->profile == profile)
1464  return p->name;
1465 
1466  return NULL;
1467 }
1468 
1469 unsigned avcodec_version(void)
1470 {
1473  av_assert0(AV_CODEC_ID_SRT==94216);
1475 
1476  return LIBAVCODEC_VERSION_INT;
1477 }
1478 
1479 const char *avcodec_configuration(void)
1480 {
1481  return FFMPEG_CONFIGURATION;
1482 }
1483 
1484 const char *avcodec_license(void)
1485 {
1486 #define LICENSE_PREFIX "libavcodec license: "
1487  return &LICENSE_PREFIX FFMPEG_LICENSE[sizeof(LICENSE_PREFIX) - 1];
1488 }
1489 
1491 {
1492  switch (codec_id) {
1493  case AV_CODEC_ID_8SVX_EXP:
1494  case AV_CODEC_ID_8SVX_FIB:
1495  case AV_CODEC_ID_ADPCM_CT:
1504  return 4;
1505  case AV_CODEC_ID_DSD_LSBF:
1506  case AV_CODEC_ID_DSD_MSBF:
1509  case AV_CODEC_ID_PCM_ALAW:
1510  case AV_CODEC_ID_PCM_MULAW:
1511  case AV_CODEC_ID_PCM_VIDC:
1512  case AV_CODEC_ID_PCM_S8:
1514  case AV_CODEC_ID_PCM_U8:
1515  case AV_CODEC_ID_SDX2_DPCM:
1516  case AV_CODEC_ID_DERF_DPCM:
1517  return 8;
1518  case AV_CODEC_ID_PCM_S16BE:
1520  case AV_CODEC_ID_PCM_S16LE:
1522  case AV_CODEC_ID_PCM_U16BE:
1523  case AV_CODEC_ID_PCM_U16LE:
1524  return 16;
1526  case AV_CODEC_ID_PCM_S24BE:
1527  case AV_CODEC_ID_PCM_S24LE:
1529  case AV_CODEC_ID_PCM_U24BE:
1530  case AV_CODEC_ID_PCM_U24LE:
1531  return 24;
1532  case AV_CODEC_ID_PCM_S32BE:
1533  case AV_CODEC_ID_PCM_S32LE:
1535  case AV_CODEC_ID_PCM_U32BE:
1536  case AV_CODEC_ID_PCM_U32LE:
1537  case AV_CODEC_ID_PCM_F32BE:
1538  case AV_CODEC_ID_PCM_F32LE:
1539  case AV_CODEC_ID_PCM_F24LE:
1540  case AV_CODEC_ID_PCM_F16LE:
1541  return 32;
1542  case AV_CODEC_ID_PCM_F64BE:
1543  case AV_CODEC_ID_PCM_F64LE:
1544  case AV_CODEC_ID_PCM_S64BE:
1545  case AV_CODEC_ID_PCM_S64LE:
1546  return 64;
1547  default:
1548  return 0;
1549  }
1550 }
1551 
1553 {
1554  static const enum AVCodecID map[][2] = {
1566  };
1567  if (fmt < 0 || fmt >= FF_ARRAY_ELEMS(map))
1568  return AV_CODEC_ID_NONE;
1569  if (be < 0 || be > 1)
1570  be = AV_NE(1, 0);
1571  return map[fmt][be];
1572 }
1573 
1575 {
1576  switch (codec_id) {
1578  return 2;
1580  return 3;
1584  case AV_CODEC_ID_ADPCM_SWF:
1585  case AV_CODEC_ID_ADPCM_MS:
1586  return 4;
1587  default:
1589  }
1590 }
1591 
1592 static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
1593  uint32_t tag, int bits_per_coded_sample, int64_t bitrate,
1594  uint8_t * extradata, int frame_size, int frame_bytes)
1595 {
1597  int framecount = (ba > 0 && frame_bytes / ba > 0) ? frame_bytes / ba : 1;
1598 
1599  /* codecs with an exact constant bits per sample */
1600  if (bps > 0 && ch > 0 && frame_bytes > 0 && ch < 32768 && bps < 32768)
1601  return (frame_bytes * 8LL) / (bps * ch);
1602  bps = bits_per_coded_sample;
1603 
1604  /* codecs with a fixed packet duration */
1605  switch (id) {
1606  case AV_CODEC_ID_ADPCM_ADX: return 32;
1607  case AV_CODEC_ID_ADPCM_IMA_QT: return 64;
1608  case AV_CODEC_ID_ADPCM_EA_XAS: return 128;
1609  case AV_CODEC_ID_AMR_NB:
1610  case AV_CODEC_ID_EVRC:
1611  case AV_CODEC_ID_GSM:
1612  case AV_CODEC_ID_QCELP:
1613  case AV_CODEC_ID_RA_288: return 160;
1614  case AV_CODEC_ID_AMR_WB:
1615  case AV_CODEC_ID_GSM_MS: return 320;
1616  case AV_CODEC_ID_MP1: return 384;
1617  case AV_CODEC_ID_ATRAC1: return 512;
1618  case AV_CODEC_ID_ATRAC9:
1619  case AV_CODEC_ID_ATRAC3:
1620  if (framecount > INT_MAX/1024)
1621  return 0;
1622  return 1024 * framecount;
1623  case AV_CODEC_ID_ATRAC3P: return 2048;
1624  case AV_CODEC_ID_MP2:
1625  case AV_CODEC_ID_MUSEPACK7: return 1152;
1626  case AV_CODEC_ID_AC3: return 1536;
1627  }
1628 
1629  if (sr > 0) {
1630  /* calc from sample rate */
1631  if (id == AV_CODEC_ID_TTA)
1632  return 256 * sr / 245;
1633  else if (id == AV_CODEC_ID_DST)
1634  return 588 * sr / 44100;
1635 
1636  if (ch > 0) {
1637  /* calc from sample rate and channels */
1638  if (id == AV_CODEC_ID_BINKAUDIO_DCT) {
1639  if (sr / 22050 > 22)
1640  return 0;
1641  return (480 << (sr / 22050)) / ch;
1642  }
1643  }
1644 
1645  if (id == AV_CODEC_ID_MP3)
1646  return sr <= 24000 ? 576 : 1152;
1647  }
1648 
1649  if (ba > 0) {
1650  /* calc from block_align */
1651  if (id == AV_CODEC_ID_SIPR) {
1652  switch (ba) {
1653  case 20: return 160;
1654  case 19: return 144;
1655  case 29: return 288;
1656  case 37: return 480;
1657  }
1658  } else if (id == AV_CODEC_ID_ILBC) {
1659  switch (ba) {
1660  case 38: return 160;
1661  case 50: return 240;
1662  }
1663  }
1664  }
1665 
1666  if (frame_bytes > 0) {
1667  /* calc from frame_bytes only */
1668  if (id == AV_CODEC_ID_TRUESPEECH)
1669  return 240 * (frame_bytes / 32);
1670  if (id == AV_CODEC_ID_NELLYMOSER)
1671  return 256 * (frame_bytes / 64);
1672  if (id == AV_CODEC_ID_RA_144)
1673  return 160 * (frame_bytes / 20);
1674 
1675  if (bps > 0) {
1676  /* calc from frame_bytes and bits_per_coded_sample */
1678  return frame_bytes * 8 / bps;
1679  }
1680 
1681  if (ch > 0 && ch < INT_MAX/16) {
1682  /* calc from frame_bytes and channels */
1683  switch (id) {
1684  case AV_CODEC_ID_ADPCM_AFC:
1685  return frame_bytes / (9 * ch) * 16;
1686  case AV_CODEC_ID_ADPCM_PSX:
1687  case AV_CODEC_ID_ADPCM_DTK:
1688  frame_bytes /= 16 * ch;
1689  if (frame_bytes > INT_MAX / 28)
1690  return 0;
1691  return frame_bytes * 28;
1692  case AV_CODEC_ID_ADPCM_4XM:
1695  return (frame_bytes - 4 * ch) * 2 / ch;
1697  return (frame_bytes - 4) * 2 / ch;
1699  return (frame_bytes - 8) * 2 / ch;
1700  case AV_CODEC_ID_ADPCM_THP:
1702  if (extradata)
1703  return frame_bytes * 14LL / (8 * ch);
1704  break;
1705  case AV_CODEC_ID_ADPCM_XA:
1706  return (frame_bytes / 128) * 224 / ch;
1708  return (frame_bytes - 6 - ch) / ch;
1709  case AV_CODEC_ID_ROQ_DPCM:
1710  return (frame_bytes - 8) / ch;
1711  case AV_CODEC_ID_XAN_DPCM:
1712  return (frame_bytes - 2 * ch) / ch;
1713  case AV_CODEC_ID_MACE3:
1714  return 3 * frame_bytes / ch;
1715  case AV_CODEC_ID_MACE6:
1716  return 6 * frame_bytes / ch;
1717  case AV_CODEC_ID_PCM_LXF:
1718  return 2 * (frame_bytes / (5 * ch));
1719  case AV_CODEC_ID_IAC:
1720  case AV_CODEC_ID_IMC:
1721  return 4 * frame_bytes / ch;
1722  }
1723 
1724  if (tag) {
1725  /* calc from frame_bytes, channels, and codec_tag */
1726  if (id == AV_CODEC_ID_SOL_DPCM) {
1727  if (tag == 3)
1728  return frame_bytes / ch;
1729  else
1730  return frame_bytes * 2 / ch;
1731  }
1732  }
1733 
1734  if (ba > 0) {
1735  /* calc from frame_bytes, channels, and block_align */
1736  int blocks = frame_bytes / ba;
1737  int64_t tmp = 0;
1738  switch (id) {
1740  if (bps < 2 || bps > 5)
1741  return 0;
1742  tmp = blocks * (1LL + (ba - 4 * ch) / (bps * ch) * 8);
1743  break;
1745  tmp = blocks * (((ba - 16LL) * 2 / 3 * 4) / ch);
1746  break;
1748  tmp = blocks * (1 + (ba - 4LL * ch) * 2 / ch);
1749  break;
1751  tmp = blocks * ((ba - 4LL * ch) * 2 / ch);
1752  break;
1753  case AV_CODEC_ID_ADPCM_MS:
1754  tmp = blocks * (2 + (ba - 7LL * ch) * 2LL / ch);
1755  break;
1757  tmp = blocks * (ba - 16LL) * 2 / ch;
1758  break;
1759  }
1760  if (tmp) {
1761  if (tmp != (int)tmp)
1762  return 0;
1763  return tmp;
1764  }
1765  }
1766 
1767  if (bps > 0) {
1768  /* calc from frame_bytes, channels, and bits_per_coded_sample */
1769  switch (id) {
1770  case AV_CODEC_ID_PCM_DVD:
1771  if(bps<4 || frame_bytes<3)
1772  return 0;
1773  return 2 * ((frame_bytes - 3) / ((bps * 2 / 8) * ch));
1775  if(bps<4 || frame_bytes<4)
1776  return 0;
1777  return (frame_bytes - 4) / ((FFALIGN(ch, 2) * bps) / 8);
1778  case AV_CODEC_ID_S302M:
1779  return 2 * (frame_bytes / ((bps + 4) / 4)) / ch;
1780  }
1781  }
1782  }
1783  }
1784 
1785  /* Fall back on using frame_size */
1786  if (frame_size > 1 && frame_bytes)
1787  return frame_size;
1788 
1789  //For WMA we currently have no other means to calculate duration thus we
1790  //do it here by assuming CBR, which is true for all known cases.
1791  if (bitrate > 0 && frame_bytes > 0 && sr > 0 && ba > 1) {
1792  if (id == AV_CODEC_ID_WMAV1 || id == AV_CODEC_ID_WMAV2)
1793  return (frame_bytes * 8LL * sr) / bitrate;
1794  }
1795 
1796  return 0;
1797 }
1798 
1799 int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
1800 {
1802  avctx->channels, avctx->block_align,
1803  avctx->codec_tag, avctx->bits_per_coded_sample,
1804  avctx->bit_rate, avctx->extradata, avctx->frame_size,
1805  frame_bytes);
1806  return FFMAX(0, duration);
1807 }
1808 
1810 {
1812  par->channels, par->block_align,
1813  par->codec_tag, par->bits_per_coded_sample,
1814  par->bit_rate, par->extradata, par->frame_size,
1815  frame_bytes);
1816  return FFMAX(0, duration);
1817 }
1818 
1819 #if !HAVE_THREADS
1821 {
1822  return -1;
1823 }
1824 
1825 #endif
1826 
1827 unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
1828 {
1829  unsigned int n = 0;
1830 
1831  while (v >= 0xff) {
1832  *s++ = 0xff;
1833  v -= 0xff;
1834  n++;
1835  }
1836  *s = v;
1837  n++;
1838  return n;
1839 }
1840 
1841 int ff_match_2uint16(const uint16_t(*tab)[2], int size, int a, int b)
1842 {
1843  int i;
1844  for (i = 0; i < size && !(tab[i][0] == a && tab[i][1] == b); i++) ;
1845  return i;
1846 }
1847 
1849 {
1850  int i;
1851  if (!codec->hw_configs || index < 0)
1852  return NULL;
1853  for (i = 0; i <= index; i++)
1854  if (!codec->hw_configs[i])
1855  return NULL;
1856  return &codec->hw_configs[index]->public;
1857 }
1858 
1859 #if FF_API_USER_VISIBLE_AVHWACCEL
1861 {
1862  return NULL;
1863 }
1864 
1866 {
1867 }
1868 #endif
1869 
1870 #if FF_API_LOCKMGR
1871 int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op))
1872 {
1873  return 0;
1874 }
1875 #endif
1876 
1877 unsigned int avpriv_toupper4(unsigned int x)
1878 {
1879  return av_toupper(x & 0xFF) +
1880  (av_toupper((x >> 8) & 0xFF) << 8) +
1881  (av_toupper((x >> 16) & 0xFF) << 16) +
1882 ((unsigned)av_toupper((x >> 24) & 0xFF) << 24);
1883 }
1884 
1886 {
1887  int ret;
1888 
1889  dst->owner[0] = src->owner[0];
1890  dst->owner[1] = src->owner[1];
1891 
1892  ret = av_frame_ref(dst->f, src->f);
1893  if (ret < 0)
1894  return ret;
1895 
1896  av_assert0(!dst->progress);
1897 
1898  if (src->progress &&
1899  !(dst->progress = av_buffer_ref(src->progress))) {
1900  ff_thread_release_buffer(dst->owner[0], dst);
1901  return AVERROR(ENOMEM);
1902  }
1903 
1904  return 0;
1905 }
1906 
1907 #if !HAVE_THREADS
1908 
1910 {
1911  return ff_get_format(avctx, fmt);
1912 }
1913 
1915 {
1916  f->owner[0] = f->owner[1] = avctx;
1917  return ff_get_buffer(avctx, f->f, flags);
1918 }
1919 
1921 {
1922  if (f->f)
1923  av_frame_unref(f->f);
1924 }
1925 
1927 {
1928 }
1929 
1931 {
1932 }
1933 
1934 void ff_thread_await_progress(ThreadFrame *f, int progress, int field)
1935 {
1936 }
1937 
1939 {
1940  return 1;
1941 }
1942 
1943 int ff_alloc_entries(AVCodecContext *avctx, int count)
1944 {
1945  return 0;
1946 }
1947 
1949 {
1950 }
1951 
1952 void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
1953 {
1954 }
1955 
1956 void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n)
1957 {
1958 }
1959 
1960 #endif
1961 
1963 {
1964  return !!s->internal;
1965 }
1966 
1967 int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf)
1968 {
1969  int ret;
1970  char *str;
1971 
1972  ret = av_bprint_finalize(buf, &str);
1973  if (ret < 0)
1974  return ret;
1975  if (!av_bprint_is_complete(buf)) {
1976  av_free(str);
1977  return AVERROR(ENOMEM);
1978  }
1979 
1980  avctx->extradata = str;
1981  /* Note: the string is NUL terminated (so extradata can be read as a
1982  * string), but the ending character is not accounted in the size (in
1983  * binary formats you are likely not supposed to mux that character). When
1984  * extradata is copied, it is also padded with AV_INPUT_BUFFER_PADDING_SIZE
1985  * zeros. */
1986  avctx->extradata_size = buf->len;
1987  return 0;
1988 }
1989 
1990 const uint8_t *avpriv_find_start_code(const uint8_t *av_restrict p,
1991  const uint8_t *end,
1992  uint32_t *av_restrict state)
1993 {
1994  int i;
1995 
1996  av_assert0(p <= end);
1997  if (p >= end)
1998  return end;
1999 
2000  for (i = 0; i < 3; i++) {
2001  uint32_t tmp = *state << 8;
2002  *state = tmp + *(p++);
2003  if (tmp == 0x100 || p == end)
2004  return p;
2005  }
2006 
2007  while (p < end) {
2008  if (p[-1] > 1 ) p += 3;
2009  else if (p[-2] ) p += 2;
2010  else if (p[-3]|(p[-1]-1)) p++;
2011  else {
2012  p++;
2013  break;
2014  }
2015  }
2016 
2017  p = FFMIN(p, end) - 4;
2018  *state = AV_RB32(p);
2019 
2020  return p + 4;
2021 }
2022 
2024 {
2025  AVCPBProperties *props = av_mallocz(sizeof(AVCPBProperties));
2026  if (!props)
2027  return NULL;
2028 
2029  if (size)
2030  *size = sizeof(*props);
2031 
2032  props->vbv_delay = UINT64_MAX;
2033 
2034  return props;
2035 }
2036 
2038 {
2040  AVCPBProperties *props;
2041  size_t size;
2042  int i;
2043 
2044  for (i = 0; i < avctx->nb_coded_side_data; i++)
2046  return (AVCPBProperties *)avctx->coded_side_data[i].data;
2047 
2048  props = av_cpb_properties_alloc(&size);
2049  if (!props)
2050  return NULL;
2051 
2052  tmp = av_realloc_array(avctx->coded_side_data, avctx->nb_coded_side_data + 1, sizeof(*tmp));
2053  if (!tmp) {
2054  av_freep(&props);
2055  return NULL;
2056  }
2057 
2058  avctx->coded_side_data = tmp;
2059  avctx->nb_coded_side_data++;
2060 
2062  avctx->coded_side_data[avctx->nb_coded_side_data - 1].data = (uint8_t*)props;
2063  avctx->coded_side_data[avctx->nb_coded_side_data - 1].size = size;
2064 
2065  return props;
2066 }
2067 
2069 {
2070  av_freep(&par->extradata);
2071 
2072  memset(par, 0, sizeof(*par));
2073 
2075  par->codec_id = AV_CODEC_ID_NONE;
2076  par->format = -1;
2083  par->sample_aspect_ratio = (AVRational){ 0, 1 };
2084  par->profile = FF_PROFILE_UNKNOWN;
2085  par->level = FF_LEVEL_UNKNOWN;
2086 }
2087 
2089 {
2090  AVCodecParameters *par = av_mallocz(sizeof(*par));
2091 
2092  if (!par)
2093  return NULL;
2095  return par;
2096 }
2097 
2099 {
2100  AVCodecParameters *par = *ppar;
2101 
2102  if (!par)
2103  return;
2105 
2106  av_freep(ppar);
2107 }
2108 
2110 {
2112  memcpy(dst, src, sizeof(*dst));
2113 
2114  dst->extradata = NULL;
2115  dst->extradata_size = 0;
2116  if (src->extradata) {
2117  dst->extradata = av_mallocz(src->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
2118  if (!dst->extradata)
2119  return AVERROR(ENOMEM);
2120  memcpy(dst->extradata, src->extradata, src->extradata_size);
2121  dst->extradata_size = src->extradata_size;
2122  }
2123 
2124  return 0;
2125 }
2126 
2128  const AVCodecContext *codec)
2129 {
2131 
2132  par->codec_type = codec->codec_type;
2133  par->codec_id = codec->codec_id;
2134  par->codec_tag = codec->codec_tag;
2135 
2136  par->bit_rate = codec->bit_rate;
2139  par->profile = codec->profile;
2140  par->level = codec->level;
2141 
2142  switch (par->codec_type) {
2143  case AVMEDIA_TYPE_VIDEO:
2144  par->format = codec->pix_fmt;
2145  par->width = codec->width;
2146  par->height = codec->height;
2147  par->field_order = codec->field_order;
2148  par->color_range = codec->color_range;
2149  par->color_primaries = codec->color_primaries;
2150  par->color_trc = codec->color_trc;
2151  par->color_space = codec->colorspace;
2154  par->video_delay = codec->has_b_frames;
2155  break;
2156  case AVMEDIA_TYPE_AUDIO:
2157  par->format = codec->sample_fmt;
2158  par->channel_layout = codec->channel_layout;
2159  par->channels = codec->channels;
2160  par->sample_rate = codec->sample_rate;
2161  par->block_align = codec->block_align;
2162  par->frame_size = codec->frame_size;
2163  par->initial_padding = codec->initial_padding;
2164  par->trailing_padding = codec->trailing_padding;
2165  par->seek_preroll = codec->seek_preroll;
2166  break;
2167  case AVMEDIA_TYPE_SUBTITLE:
2168  par->width = codec->width;
2169  par->height = codec->height;
2170  break;
2171  }
2172 
2173  if (codec->extradata) {
2175  if (!par->extradata)
2176  return AVERROR(ENOMEM);
2177  memcpy(par->extradata, codec->extradata, codec->extradata_size);
2178  par->extradata_size = codec->extradata_size;
2179  }
2180 
2181  return 0;
2182 }
2183 
2185  const AVCodecParameters *par)
2186 {
2187  codec->codec_type = par->codec_type;
2188  codec->codec_id = par->codec_id;
2189  codec->codec_tag = par->codec_tag;
2190 
2191  codec->bit_rate = par->bit_rate;
2194  codec->profile = par->profile;
2195  codec->level = par->level;
2196 
2197  switch (par->codec_type) {
2198  case AVMEDIA_TYPE_VIDEO:
2199  codec->pix_fmt = par->format;
2200  codec->width = par->width;
2201  codec->height = par->height;
2202  codec->field_order = par->field_order;
2203  codec->color_range = par->color_range;
2204  codec->color_primaries = par->color_primaries;
2205  codec->color_trc = par->color_trc;
2206  codec->colorspace = par->color_space;
2209  codec->has_b_frames = par->video_delay;
2210  break;
2211  case AVMEDIA_TYPE_AUDIO:
2212  codec->sample_fmt = par->format;
2213  codec->channel_layout = par->channel_layout;
2214  codec->channels = par->channels;
2215  codec->sample_rate = par->sample_rate;
2216  codec->block_align = par->block_align;
2217  codec->frame_size = par->frame_size;
2218  codec->delay =
2219  codec->initial_padding = par->initial_padding;
2220  codec->trailing_padding = par->trailing_padding;
2221  codec->seek_preroll = par->seek_preroll;
2222  break;
2223  case AVMEDIA_TYPE_SUBTITLE:
2224  codec->width = par->width;
2225  codec->height = par->height;
2226  break;
2227  }
2228 
2229  if (par->extradata) {
2230  av_freep(&codec->extradata);
2232  if (!codec->extradata)
2233  return AVERROR(ENOMEM);
2234  memcpy(codec->extradata, par->extradata, par->extradata_size);
2235  codec->extradata_size = par->extradata_size;
2236  }
2237 
2238  return 0;
2239 }
2240 
2241 int ff_alloc_a53_sei(const AVFrame *frame, size_t prefix_len,
2242  void **data, size_t *sei_size)
2243 {
2244  AVFrameSideData *side_data = NULL;
2245  uint8_t *sei_data;
2246 
2247  if (frame)
2249 
2250  if (!side_data) {
2251  *data = NULL;
2252  return 0;
2253  }
2254 
2255  *sei_size = side_data->size + 11;
2256  *data = av_mallocz(*sei_size + prefix_len);
2257  if (!*data)
2258  return AVERROR(ENOMEM);
2259  sei_data = (uint8_t*)*data + prefix_len;
2260 
2261  // country code
2262  sei_data[0] = 181;
2263  sei_data[1] = 0;
2264  sei_data[2] = 49;
2265 
2266  /**
2267  * 'GA94' is standard in North America for ATSC, but hard coding
2268  * this style may not be the right thing to do -- other formats
2269  * do exist. This information is not available in the side_data
2270  * so we are going with this right now.
2271  */
2272  AV_WL32(sei_data + 3, MKTAG('G', 'A', '9', '4'));
2273  sei_data[7] = 3;
2274  sei_data[8] = ((side_data->size/3) & 0x1f) | 0x40;
2275  sei_data[9] = 0;
2276 
2277  memcpy(sei_data + 10, side_data->data, side_data->size);
2278 
2279  sei_data[side_data->size+10] = 255;
2280 
2281  return 0;
2282 }
2283 
2285 {
2286  AVRational framerate = avctx->framerate;
2287  int bits_per_coded_sample = avctx->bits_per_coded_sample;
2288  int64_t bitrate;
2289 
2290  if (!(framerate.num && framerate.den))
2291  framerate = av_inv_q(avctx->time_base);
2292  if (!(framerate.num && framerate.den))
2293  return 0;
2294 
2295  if (!bits_per_coded_sample) {
2297  bits_per_coded_sample = av_get_bits_per_pixel(desc);
2298  }
2299  bitrate = (int64_t)bits_per_coded_sample * avctx->width * avctx->height *
2300  framerate.num / framerate.den;
2301 
2302  return bitrate;
2303 }
2304 
2305 int ff_int_from_list_or_default(void *ctx, const char * val_name, int val,
2306  const int * array_valid_values, int default_value)
2307 {
2308  int i = 0, ref_val;
2309 
2310  while (1) {
2311  ref_val = array_valid_values[i];
2312  if (ref_val == INT_MAX)
2313  break;
2314  if (val == ref_val)
2315  return val;
2316  i++;
2317  }
2318  /* val is not a valid value */
2320  "%s %d are not supported. Set to default value : %d\n", val_name, val, default_value);
2321  return default_value;
2322 }
AV_CODEC_ID_PCM_S16LE
@ AV_CODEC_ID_PCM_S16LE
Definition: codec_id.h:301
AVSubtitle
Definition: avcodec.h:2694
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:1143
func
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:67
hwconfig.h
AVCodecContext::frame_size
int frame_size
Number of samples per channel in an audio frame.
Definition: avcodec.h:1206
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: avpacket.c:605
AV_CODEC_ID_MACE6
@ AV_CODEC_ID_MACE6
Definition: codec_id.h:420
AVCodecContext::hwaccel
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
Definition: avcodec.h:1690
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: codec.h:190
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: codec_id.h:141
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: codec_id.h:321
AV_CODEC_ID_DSD_LSBF
@ AV_CODEC_ID_DSD_LSBF
Definition: codec_id.h:484
AVCodecParameters::extradata
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition: codec_par.h:74
AV_CODEC_ID_ADPCM_MS
@ AV_CODEC_ID_ADPCM_MS
Definition: codec_id.h:346
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
AV_CODEC_ID_ADPCM_IMA_QT
@ AV_CODEC_ID_ADPCM_IMA_QT
Definition: codec_id.h:340
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: codec_id.h:413
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:2699
opt.h
av_xiphlacing
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
Encode extradata length to a buffer.
Definition: utils.c:1827
AV_CODEC_ID_PCM_BLURAY
@ AV_CODEC_ID_PCM_BLURAY
Definition: codec_id.h:325
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:56
AV_WL32
#define AV_WL32(p, v)
Definition: intreadwrite.h:426
AVCodecContext::channel_layout
uint64_t channel_layout
Audio channel layout.
Definition: avcodec.h:1237
AVCodecContext::colorspace
enum AVColorSpace colorspace
YUV colorspace type.
Definition: avcodec.h:1154
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:1357
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:1279
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:1914
FF_COMPLIANCE_EXPERIMENTAL
#define FF_COMPLIANCE_EXPERIMENTAL
Allow nonstandardized experimental things.
Definition: avcodec.h:1594
AV_CODEC_ID_ADPCM_DTK
@ AV_CODEC_ID_ADPCM_DTK
Definition: codec_id.h:374
AVCodecContext::sample_rate
int sample_rate
samples per second
Definition: avcodec.h:1186
PixelFormatTag
Definition: raw.h:34
cb
static double cb(void *priv, double x, double y)
Definition: vf_geq.c:215
av_frame_get_side_data
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition: frame.c:739
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:52
AVCodec::priv_class
const AVClass * priv_class
AVClass for the private context.
Definition: codec.h:216
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:1956
AVCodecParameters::color_space
enum AVColorSpace color_space
Definition: codec_par.h:149
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:1967
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: codec.h:178
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:2549
AVBufferRef::data
uint8_t * data
The data buffer.
Definition: buffer.h:89
MKTAG
#define MKTAG(a, b, c, d)
Definition: common.h:406
ff_thread_flush
void ff_thread_flush(AVCodecContext *avctx)
Wait for decoding threads to finish and reset internal state.
Definition: pthread_frame.c:876
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: codec_id.h:464
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:2127
AVHWFramesContext::format
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
Definition: hwcontext.h:209
ff_thread_await_progress2
void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift)
Definition: utils.c:1952
avcodec_string
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
Definition: utils.c:1246
avpriv_toupper4
unsigned int avpriv_toupper4(unsigned int x)
Definition: utils.c:1877
ff_decode_bsfs_init
int ff_decode_bsfs_init(AVCodecContext *avctx)
Called during avcodec_open2() to initialize avctx->internal->bsf.
Definition: decode.c:204
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:727
AVCodecDescriptor::name
const char * name
Name of the codec described by this descriptor.
Definition: codec_desc.h:46
AVCodecContext::coded_side_data
AVPacketSideData * coded_side_data
Additional data associated with the entire coded stream.
Definition: avcodec.h:2201
ff_thread_can_start_frame
int ff_thread_can_start_frame(AVCodecContext *avctx)
Definition: utils.c:1938
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:2698
AVCodec::pix_fmts
enum AVPixelFormat * pix_fmts
array of supported pixel formats, or NULL if unknown, array is terminated by -1
Definition: codec.h:211
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:203
AV_CODEC_ID_PCM_S32LE_PLANAR
@ AV_CODEC_ID_PCM_S32LE_PLANAR
Definition: codec_id.h:330
profile
mfxU16 profile
Definition: qsvenc.c:45
end
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:92
AV_CODEC_ID_RA_144
@ AV_CODEC_ID_RA_144
Definition: codec_id.h:396
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:300
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:26
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:1147
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: packet.h:298
AVCodec::capabilities
int capabilities
Codec capabilities.
Definition: codec.h:209
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
the normal 2^n-1 "JPEG" YUV ranges
Definition: pixfmt.h:535
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: codec_id.h:331
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:1871
AV_CODEC_ID_VP6
@ AV_CODEC_ID_VP6
Definition: codec_id.h:140
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:1183
AVCodecParameters::seek_preroll
int seek_preroll
Audio only.
Definition: codec_par.h:200
AVCodecInternal::frame_thread_encoder
void * frame_thread_encoder
Definition: internal.h:152
TAG_PRINT
#define TAG_PRINT(x)
b
#define b
Definition: input.c:41
AVCOL_TRC_UNSPECIFIED
@ AVCOL_TRC_UNSPECIFIED
Definition: pixfmt.h:483
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: codec_id.h:315
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: codec_id.h:392
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:4084
AV_CODEC_ID_ADPCM_AICA
@ AV_CODEC_ID_ADPCM_AICA
Definition: codec_id.h:379
AV_CODEC_ID_ADPCM_IMA_OKI
@ AV_CODEC_ID_ADPCM_IMA_OKI
Definition: codec_id.h:373
AVCodec::decode
int(* decode)(struct AVCodecContext *, void *outdata, int *outdata_size, struct AVPacket *avpkt)
Definition: codec.h:282
AVCodecContext::subtitle_header
uint8_t * subtitle_header
Header containing style information for text subtitles.
Definition: avcodec.h:2014
version.h
AV_CODEC_ID_SOL_DPCM
@ AV_CODEC_ID_SOL_DPCM
Definition: codec_id.h:403
av_mallocz_array
void * av_mallocz_array(size_t nmemb, size_t size)
Definition: mem.c:190
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:192
float.h
AV_CODEC_ID_WMAV2
@ AV_CODEC_ID_WMAV2
Definition: codec_id.h:418
AV_CODEC_ID_ADPCM_G722
@ AV_CODEC_ID_ADPCM_G722
Definition: codec_id.h:368
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:1454
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:2501
ff_frame_thread_encoder_init
int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options)
Initialize frame thread encoder.
Definition: frame_thread_encoder.c:118
AVCodecParameters::codec_tag
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
Definition: codec_par.h:64
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:1983
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:2127
AVDictionary
Definition: dict.c:30
AV_CODEC_ID_IMC
@ AV_CODEC_ID_IMC
Definition: codec_id.h:437
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:1962
AVCodec::flush
void(* flush)(struct AVCodecContext *)
Flush buffers.
Definition: codec.h:305
AVCodecContext::qmax
int qmax
maximum quantizer
Definition: avcodec.h:1375
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:2126
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:682
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:64
ThreadFrame::f
AVFrame * f
Definition: thread.h:35
av_chroma_location_name
const char * av_chroma_location_name(enum AVChromaLocation location)
Definition: pixdesc.c:2966
FF_COMPLIANCE_UNOFFICIAL
#define FF_COMPLIANCE_UNOFFICIAL
Allow unofficial extensions.
Definition: avcodec.h:1593
AVCodecInternal::pool
AVBufferRef * pool
Definition: internal.h:133
AV_CODEC_ID_PCM_S16LE_PLANAR
@ AV_CODEC_ID_PCM_S16LE_PLANAR
Definition: codec_id.h:319
AV_CODEC_ID_ADPCM_THP_LE
@ AV_CODEC_ID_ADPCM_THP_LE
Definition: codec_id.h:377
AV_CODEC_ID_AMR_WB
@ AV_CODEC_ID_AMR_WB
Definition: codec_id.h:393
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: codec_id.h:516
AV_CODEC_ID_PCM_S64LE
@ AV_CODEC_ID_PCM_S64LE
Definition: codec_id.h:333
AVProfile
AVProfile.
Definition: codec.h:176
ff_mutex_unlock
static int ff_mutex_unlock(AVMutex *mutex)
Definition: thread.h:169
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: codec_id.h:487
AV_CODEC_ID_ADPCM_CT
@ AV_CODEC_ID_ADPCM_CT
Definition: codec_id.h:352
AVCodecParameters::color_primaries
enum AVColorPrimaries color_primaries
Definition: codec_par.h:147
AVCodecContext::framerate
AVRational framerate
Definition: avcodec.h:2069
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: codec.h:215
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
av_get_colorspace_name
const char * av_get_colorspace_name(enum AVColorSpace val)
Get the name of a colorspace.
Definition: frame.c:123
AVHWAccel
Definition: avcodec.h:2410
AVCodecParameters::channels
int channels
Audio only.
Definition: codec_par.h:166
ff_lock_avcodec
static void ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec)
Definition: utils.c:541
AV_FIELD_TT
@ AV_FIELD_TT
Definition: codec_par.h:39
av_color_space_name
const char * av_color_space_name(enum AVColorSpace space)
Definition: pixdesc.c:2942
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: codec_id.h:185
AVCodecContext::codec
const struct AVCodec * codec
Definition: avcodec.h:535
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: codec_id.h:302
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:108
AVCodecParameters::bits_per_raw_sample
int bits_per_raw_sample
This is the number of valid bits in each output sample.
Definition: codec_par.h:115
AVCodec::sample_fmts
enum AVSampleFormat * sample_fmts
array of supported sample formats, or NULL if unknown, array is terminated by -1
Definition: codec.h:213
AVCodecContext::thread_count
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
Definition: avcodec.h:1785
MAKE_ACCESSORS
#define MAKE_ACCESSORS(str, name, type, field)
Definition: internal.h:91
AV_CODEC_ID_XAN_DPCM
@ AV_CODEC_ID_XAN_DPCM
Definition: codec_id.h:402
AV_CODEC_ID_MSZH
@ AV_CODEC_ID_MSZH
Definition: codec_id.h:102
AVCodec::encode_sub
int(* encode_sub)(struct AVCodecContext *, uint8_t *buf, int buf_size, const struct AVSubtitle *sub)
Definition: codec.h:268
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:1990
AVCodecContext::initial_padding
int initial_padding
Audio only.
Definition: avcodec.h:2060
tab
static const struct twinvq_data tab
Definition: twinvq_data.h:11135
AVCodecContext::refs
int refs
number of reference frames
Definition: avcodec.h:1114
avcodec_find_encoder
AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
Definition: allcodecs.c:914
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:2125
AVCodecContext::flags
int flags
AV_CODEC_FLAG_*.
Definition: avcodec.h:606
val
static double val(void *priv, double ch)
Definition: aeval.c:76
AV_SAMPLE_FMT_S64P
@ AV_SAMPLE_FMT_S64P
signed 64 bits, planar
Definition: samplefmt.h:72
AVCodecContext::coded_height
int coded_height
Definition: avcodec.h:714
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:1909
AV_CODEC_CAP_ENCODER_FLUSH
#define AV_CODEC_CAP_ENCODER_FLUSH
This encoder can be flushed using avcodec_flush_buffers().
Definition: codec.h:171
AV_CODEC_ID_SMC
@ AV_CODEC_ID_SMC
Definition: codec_id.h:98
AV_CODEC_ID_MP3
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition: codec_id.h:411
AV_FIELD_TB
@ AV_FIELD_TB
Definition: codec_par.h:41
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: codec_id.h:465
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
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:2689
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: codec_id.h:441
avsubtitle_free
void avsubtitle_free(AVSubtitle *sub)
Free all allocated data in the given subtitle struct.
Definition: utils.c:1124
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:190
AVFormatContext::bit_rate
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
Definition: avformat.h:1457
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: codec_id.h:451
AVCodecParameters::color_trc
enum AVColorTransferCharacteristic color_trc
Definition: codec_par.h:148
AV_CODEC_ID_ADPCM_SBPRO_2
@ AV_CODEC_ID_ADPCM_SBPRO_2
Definition: codec_id.h:357
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: codec_id.h:417
AV_CODEC_ID_PCM_S8
@ AV_CODEC_ID_PCM_S8
Definition: codec_id.h:305
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:1140
AVCodec::supported_samplerates
const int * supported_samplerates
array of supported audio samplerates, or NULL if unknown, array is terminated by 0
Definition: codec.h:212
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: codec_id.h:419
AV_CODEC_ID_ATRAC3P
@ AV_CODEC_ID_ATRAC3P
Definition: codec_id.h:449
codec_mutex
static AVMutex codec_mutex
Definition: utils.c:68
frame_thread_encoder.h
AV_CODEC_CAP_EXPERIMENTAL
#define AV_CODEC_CAP_EXPERIMENTAL
Codec is experimental and is thus avoided in favor of non experimental encoders.
Definition: codec.h:98
av_cold
#define av_cold
Definition: attributes.h:90
AVCodecContext::pts_correction_num_faulty_pts
int64_t pts_correction_num_faulty_pts
Current statistics for PTS correction.
Definition: avcodec.h:2106
FF_CODEC_PROPERTY_LOSSLESS
#define FF_CODEC_PROPERTY_LOSSLESS
Definition: avcodec.h:2192
AV_CODEC_ID_TTA
@ AV_CODEC_ID_TTA
Definition: codec_id.h:432
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:1432
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: codec_par.h:181
AVMutex
#define AVMutex
Definition: thread.h:164
av_memcpy_backptr
void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
Overlapping memcpy() implementation.
Definition: mem.c:428
AV_CODEC_ID_S302M
@ AV_CODEC_ID_S302M
Definition: codec_id.h:327
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:1655
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:131
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:248
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:628
AVCodecContext::has_b_frames
int has_b_frames
Size of the frame reordering buffer in the decoder.
Definition: avcodec.h:816
AV_CODEC_ID_ADPCM_G726
@ AV_CODEC_ID_ADPCM_G726
Definition: codec_id.h:351
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: codec_desc.h:38
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: codec_id.h:326
AVCodecInternal::buffer_pkt
AVPacket * buffer_pkt
buffers for using new encode/decode API through legacy API
Definition: internal.h:172
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:183
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: codec_id.h:372
AVHWAccel::uninit
int(* uninit)(AVCodecContext *avctx)
Uninitialize the hwaccel private data.
Definition: avcodec.h:2548
AV_CODEC_ID_ADPCM_IMA_EA_SEAD
@ AV_CODEC_ID_ADPCM_IMA_EA_SEAD
Definition: codec_id.h:363
AVCodecParameters::sample_aspect_ratio
AVRational sample_aspect_ratio
Video only.
Definition: codec_par.h:136
g
const char * g
Definition: vf_curves.c:115
frame_size
int frame_size
Definition: mxfenc.c:2137
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:75
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:126
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:658
AV_CODEC_ID_MP2
@ AV_CODEC_ID_MP2
Definition: codec_id.h:410
AV_CODEC_ID_ADPCM_IMA_DK3
@ AV_CODEC_ID_ADPCM_IMA_DK3
Definition: codec_id.h:342
AV_PIX_FMT_GBRP12LE
@ AV_PIX_FMT_GBRP12LE
planar GBR 4:4:4 36bpp, little-endian
Definition: pixfmt.h:255
avcodec_parameters_copy
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
Definition: utils.c:2109
FF_PROFILE_UNKNOWN
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:1860
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: codec_id.h:369
AVCodecDescriptor::type
enum AVMediaType type
Definition: codec_desc.h:40
ff_thread_ref_frame
int ff_thread_ref_frame(ThreadFrame *dst, ThreadFrame *src)
Definition: utils.c:1885
AV_CODEC_ID_ATRAC9
@ AV_CODEC_ID_ATRAC9
Definition: codec_id.h:499
AV_FIELD_UNKNOWN
@ AV_FIELD_UNKNOWN
Definition: codec_par.h:37
AVCodecContext::bits_per_raw_sample
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition: avcodec.h:1757
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: packet.h:299
AV_CODEC_ID_ADPCM_IMA_ISS
@ AV_CODEC_ID_ADPCM_IMA_ISS
Definition: codec_id.h:367
AV_CODEC_ID_BINKAUDIO_DCT
@ AV_CODEC_ID_BINKAUDIO_DCT
Definition: codec_id.h:458
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:1943
AV_CODEC_ID_PCM_F24LE
@ AV_CODEC_ID_PCM_F24LE
Definition: codec_id.h:336
channels
channels
Definition: aptx.h:33
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_DERF_DPCM
@ AV_CODEC_ID_DERF_DPCM
Definition: codec_id.h:407
AV_CODEC_ID_PCM_MULAW
@ AV_CODEC_ID_PCM_MULAW
Definition: codec_id.h:307
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:2256
AV_CODEC_ID_PCM_U16BE
@ AV_CODEC_ID_PCM_U16BE
Definition: codec_id.h:304
AV_CODEC_ID_ADPCM_IMA_SMJPEG
@ AV_CODEC_ID_ADPCM_IMA_SMJPEG
Definition: codec_id.h:345
AV_PIX_FMT_GBRP10LE
@ AV_PIX_FMT_GBRP10LE
planar GBR 4:4:4 30bpp, little-endian
Definition: pixfmt.h:173
codec_id
enum AVCodecID codec_id
Definition: vaapi_decode.c:369
AV_CODEC_ID_PCM_DVD
@ AV_CODEC_ID_PCM_DVD
Definition: codec_id.h:320
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
AVCodecContext::rc_max_rate
int64_t rc_max_rate
maximum bitrate
Definition: avcodec.h:1404
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:137
AVCOL_PRI_UNSPECIFIED
@ AVCOL_PRI_UNSPECIFIED
Definition: pixfmt.h:458
AVSubtitleRect::text
char * text
0 terminated plain UTF-8 text
Definition: avcodec.h:2682
AVCPBProperties
This structure describes the bitrate properties of an encoded bitstream.
Definition: avcodec.h:448
AV_FIELD_BT
@ AV_FIELD_BT
Definition: codec_par.h:42
f
#define f(width, name)
Definition: cbs_vp9.c:255
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:76
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:1226
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:536
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: codec_desc.h:54
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:1389
AVCodecContext::sub_charenc
char * sub_charenc
DTS of the last frame.
Definition: avcodec.h:2116
av_color_range_name
const char * av_color_range_name(enum AVColorRange range)
Definition: pixdesc.c:2875
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_CODEC_CAP_FRAME_THREADS
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: codec.h:106
av_log_get_level
int av_log_get_level(void)
Get the current log level.
Definition: log.c:435
AV_CODEC_ID_PCM_ALAW
@ AV_CODEC_ID_PCM_ALAW
Definition: codec_id.h:308
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: codec_id.h:365
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:1841
AV_CODEC_ID_SP5X
@ AV_CODEC_ID_SP5X
Definition: codec_id.h:59
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:1920
AVHWFramesContext::sw_format
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
Definition: hwcontext.h:222
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:449
AV_CODEC_ID_DST
@ AV_CODEC_ID_DST
Definition: codec_id.h:492
AVCodecContext::color_range
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition: avcodec.h:1161
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: codec_id.h:88
AV_CODEC_ID_ADPCM_YAMAHA
@ AV_CODEC_ID_ADPCM_YAMAHA
Definition: codec_id.h:354
AV_CODEC_ID_ADPCM_IMA_WS
@ AV_CODEC_ID_ADPCM_IMA_WS
Definition: codec_id.h:344
AV_CODEC_ID_PCM_U24BE
@ AV_CODEC_ID_PCM_U24BE
Definition: codec_id.h:316
AVCodec::type
enum AVMediaType type
Definition: codec.h:203
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: codec_id.h:401
AV_CODEC_ID_PCM_U32BE
@ AV_CODEC_ID_PCM_U32BE
Definition: codec_id.h:312
AVCodecContext::nb_coded_side_data
int nb_coded_side_data
Definition: avcodec.h:2202
AVCodecContext::internal
struct AVCodecInternal * internal
Private context used for internal data.
Definition: avcodec.h:561
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: codec_id.h:343
AVCodecContext::bit_rate
int64_t bit_rate
the average bitrate
Definition: avcodec.h:576
AVPacketSideData::type
enum AVPacketSideDataType type
Definition: packet.h:301
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: codec_id.h:92
AVSubtitleRect::data
uint8_t * data[4]
data+linesize for the bitmap of this subtitle.
Definition: avcodec.h:2677
src
#define src
Definition: vp8dsp.c:254
AV_CODEC_ID_PCM_S64BE
@ AV_CODEC_ID_PCM_S64BE
Definition: codec_id.h:334
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: codec_desc.h:97
AV_CODEC_ID_ZLIB
@ AV_CODEC_ID_ZLIB
Definition: codec_id.h:103
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: codec.h:217
AVCodecContext::trailing_padding
int trailing_padding
Audio only.
Definition: avcodec.h:2248
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:2894
avcodec_license
const char * avcodec_license(void)
Return the libavcodec license.
Definition: utils.c:1484
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:2241
AV_CODEC_ID_ADPCM_IMA_AMV
@ AV_CODEC_ID_ADPCM_IMA_AMV
Definition: codec_id.h:359
av_opt_free
void av_opt_free(void *obj)
Free all allocated objects in obj.
Definition: opt.c:1610
lowres
static int lowres
Definition: ffplay.c:336
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:1469
AV_CODEC_ID_ROQ_DPCM
@ AV_CODEC_ID_ROQ_DPCM
Definition: codec_id.h:400
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: codec.h:177
AVCodecInternal::skip_samples_multiplier
int skip_samples_multiplier
Definition: internal.h:187
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
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
AVCodecInternal::draining_done
int draining_done
Definition: internal.h:175
AV_CODEC_ID_VP6A
@ AV_CODEC_ID_VP6A
Definition: codec_id.h:155
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:2023
AV_SAMPLE_FMT_U8
AV_SAMPLE_FMT_U8
Definition: audio_convert.c:194
AVCodecContext::level
int level
level
Definition: avcodec.h:1982
AVCodecInternal::bsf
AVBSFContext * bsf
Definition: internal.h:138
AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_UNSPECIFIED
Definition: pixfmt.h:533
AVCodecParameters::level
int level
Definition: codec_par.h:121
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: codec_par.h:170
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:144
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: codec_id.h:329
AV_CODEC_ID_ADPCM_XA
@ AV_CODEC_ID_ADPCM_XA
Definition: codec_id.h:348
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:2088
AV_CODEC_ID_GSM
@ AV_CODEC_ID_GSM
as in Berlin toast format
Definition: codec_id.h:428
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: codec_id.h:46
AV_CODEC_ID_PCM_VIDC
@ AV_CODEC_ID_PCM_VIDC
Definition: codec_id.h:337
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: codec_id.h:57
AVCodecParameters::extradata_size
int extradata_size
Size of the extradata content in bytes.
Definition: codec_par.h:78
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:649
av_codec_is_decoder
int av_codec_is_decoder(const AVCodec *codec)
Definition: utils.c:99
AVCodecContext::lowres
int lowres
low resolution decoding, 1-> 1/2 size, 2->1/4 size
Definition: avcodec.h:1765
AV_CODEC_ID_QCELP
@ AV_CODEC_ID_QCELP
Definition: codec_id.h:434
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:1574
AV_CODEC_CAP_AUTO_THREADS
#define AV_CODEC_CAP_AUTO_THREADS
Codec supports avctx->thread_count == 0 (auto).
Definition: codec.h:118
desc
const char * desc
Definition: nvenc.c:79
AV_CODEC_ID_PCM_S24LE
@ AV_CODEC_ID_PCM_S24LE
Definition: codec_id.h:313
AVCodecContext::flags2
int flags2
AV_CODEC_FLAG2_*.
Definition: avcodec.h:613
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1854
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_CODEC_ID_ADPCM_ADX
@ AV_CODEC_ID_ADPCM_ADX
Definition: codec_id.h:349
AV_CODEC_FLAG_GRAY
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
Definition: avcodec.h:308
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:444
AVCodec::send_frame
int(* send_frame)(struct AVCodecContext *avctx, const struct AVFrame *frame)
Encode API with decoupled packet/frame dataflow.
Definition: codec.h:292
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:162
AVCodec::close
int(* close)(struct AVCodecContext *)
Definition: codec.h:283
AV_CODEC_ID_ADPCM_IMA_RAD
@ AV_CODEC_ID_ADPCM_IMA_RAD
Definition: codec_id.h:375
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: codec_id.h:485
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:1441
FFMAX
#define FFMAX(a, b)
Definition: common.h:94
AV_CODEC_ID_DXV
@ AV_CODEC_ID_DXV
Definition: codec_id.h:240
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:1533
AVCodecContext::sample_fmt
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:1194
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:59
AV_MUTEX_INITIALIZER
#define AV_MUTEX_INITIALIZER
Definition: thread.h:165
AV_CODEC_ID_ADPCM_SWF
@ AV_CODEC_ID_ADPCM_SWF
Definition: codec_id.h:353
size
int size
Definition: twinvq_data.h:11134
AV_CODEC_ID_SMVJPEG
@ AV_CODEC_ID_SMVJPEG
Definition: codec_id.h:258
avpriv_codec_get_cap_skip_frame_fill_param
int avpriv_codec_get_cap_skip_frame_fill_param(const AVCodec *codec)
Definition: utils.c:506
AVCodec::encode2
int(* encode2)(struct AVCodecContext *avctx, struct AVPacket *avpkt, const struct AVFrame *frame, int *got_packet_ptr)
Encode data to an AVPacket.
Definition: codec.h:280
AV_NUM_DATA_POINTERS
#define AV_NUM_DATA_POINTERS
Definition: frame.h:301
state
static struct @314 state
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
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:2037
AVFrameSideData::data
uint8_t * data
Definition: frame.h:208
AVCodecInternal::byte_buffer
uint8_t * byte_buffer
temporary buffer used for encoders to store their bitstream
Definition: internal.h:149
AVCodecParameters::profile
int profile
Codec-specific bitstream restrictions that the stream conforms to.
Definition: codec_par.h:120
AVCHROMA_LOC_UNSPECIFIED
@ AVCHROMA_LOC_UNSPECIFIED
Definition: pixfmt.h:555
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
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
AV_CODEC_FLAG_PASS2
#define AV_CODEC_FLAG_PASS2
Use internal 2pass ratecontrol in second pass mode.
Definition: avcodec.h:300
encode
static void encode(AVCodecContext *ctx, AVFrame *frame, AVPacket *pkt, FILE *output)
Definition: encode_audio.c:95
AVCodec::receive_frame
int(* receive_frame)(struct AVCodecContext *avctx, struct AVFrame *frame)
Decode API with decoupled packet/frame dataflow.
Definition: codec.h:300
AVCodecContext::pts_correction_num_faulty_dts
int64_t pts_correction_num_faulty_dts
Number of incorrect PTS values so far.
Definition: avcodec.h:2107
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:2108
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: packet.h:300
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:168
av_packet_alloc
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
Definition: avpacket.c:53
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:1948
AVCodecInternal
Definition: internal.h:116
AVCodecInternal::byte_buffer_size
unsigned int byte_buffer_size
Definition: internal.h:150
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:2305
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:1860
AV_CODEC_ID_SVQ1
@ AV_CODEC_ID_SVQ1
Definition: codec_id.h:71
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:1934
FF_THREAD_FRAME
#define FF_THREAD_FRAME
Decode more than one frame at once.
Definition: avcodec.h:1796
AVCodecContext::channels
int channels
number of audio channels
Definition: avcodec.h:1187
AVChromaLocation
AVChromaLocation
Location of chroma samples.
Definition: pixfmt.h:554
AVCodec::id
enum AVCodecID id
Definition: codec.h:204
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_is_encoder
int av_codec_is_encoder(const AVCodec *codec)
Definition: utils.c:94
AV_CODEC_ID_VP5
@ AV_CODEC_ID_VP5
Definition: codec_id.h:139
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:490
avcodec_get_name
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
Definition: utils.c:1206
AV_FIELD_BB
@ AV_FIELD_BB
Definition: codec_par.h:40
AV_CODEC_ID_MJPEG
@ AV_CODEC_ID_MJPEG
Definition: codec_id.h:56
AVCodecContext::bits_per_coded_sample
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:1750
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: codec_id.h:456
AV_CODEC_ID_RA_288
@ AV_CODEC_ID_RA_288
Definition: codec_id.h:397
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:1926
AV_CODEC_ID_ADPCM_MTAF
@ AV_CODEC_ID_ADPCM_MTAF
Definition: codec_id.h:381
bprint.h
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:47
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
AVCodecContext::properties
unsigned properties
Properties of the stream that gets decoded.
Definition: avcodec.h:2191
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:627
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
internal.h
AV_CODEC_ID_EVRC
@ AV_CODEC_ID_EVRC
Definition: codec_id.h:482
AVCodecParameters::height
int height
Definition: codec_par.h:127
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:2184
AVCodecParameters::block_align
int block_align
Audio only.
Definition: codec_par.h:177
AV_CODEC_ID_DSD_LSBF_PLANAR
@ AV_CODEC_ID_DSD_LSBF_PLANAR
Definition: codec_id.h:486
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
AV_CODEC_ID_PCM_F64BE
@ AV_CODEC_ID_PCM_F64BE
Definition: codec_id.h:323
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:385
AVCodecContext::pts_correction_last_dts
int64_t pts_correction_last_dts
PTS of the last frame.
Definition: avcodec.h:2109
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:2176
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: codec_id.h:310
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:554
av_get_audio_frame_duration
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
Return audio frame duration.
Definition: utils.c:1799
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:237
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:197
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:2278
AV_PKT_DATA_CPB_PROPERTIES
@ AV_PKT_DATA_CPB_PROPERTIES
This side data corresponds to the AVCPBProperties struct.
Definition: packet.h:145
AVCodecContext::chroma_sample_location
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
Definition: avcodec.h:1168
AVCodecParameters::color_range
enum AVColorRange color_range
Video only.
Definition: codec_par.h:146
AV_CODEC_ID_PCM_F16LE
@ AV_CODEC_ID_PCM_F16LE
Definition: codec_id.h:335
AV_CODEC_ID_ADPCM_IMA_DAT4
@ AV_CODEC_ID_ADPCM_IMA_DAT4
Definition: codec_id.h:380
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:1865
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:512
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:699
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:736
AVCodecInternal::nb_draining_errors
int nb_draining_errors
Definition: internal.h:190
AVCodec::priv_data_size
int priv_data_size
Definition: codec.h:238
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:2284
AVCodecParameters::field_order
enum AVFieldOrder field_order
Video only.
Definition: codec_par.h:141
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:1490
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:2226
avcodec.h
AV_CODEC_ID_IAC
@ AV_CODEC_ID_IAC
Definition: codec_id.h:468
AVCodecContext::sub_charenc_mode
int sub_charenc_mode
Subtitles character encoding mode.
Definition: avcodec.h:2124
AVHWFramesContext
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:124
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: codec_id.h:440
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:1532
ret
ret
Definition: filter_design.txt:187
AVCodec::caps_internal
int caps_internal
Internal codec capabilities.
Definition: codec.h:310
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:1223
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:1592
avcodec_flush_buffers
void avcodec_flush_buffers(AVCodecContext *avctx)
Reset the internal codec state / flush internal buffers.
Definition: utils.c:1080
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: codec.h:325
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
avcodec_find_decoder
AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
Definition: allcodecs.c:919
AVCodecContext::strict_std_compliance
int strict_std_compliance
strictly follow the standard (MPEG-4, ...).
Definition: avcodec.h:1589
pos
unsigned int pos
Definition: spdifenc.c:412
dict.h
AV_CODEC_ID_JV
@ AV_CODEC_ID_JV
Definition: codec_id.h:198
codec_parameters_reset
static void codec_parameters_reset(AVCodecParameters *par)
Definition: utils.c:2068
AVCodecContext::refcounted_frames
attribute_deprecated int refcounted_frames
If non-zero, the decoded audio and video frames returned from avcodec_decode_video2() and avcodec_dec...
Definition: avcodec.h:1357
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: avcodec.h:215
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: codec_par.h:150
av_bsf_flush
void av_bsf_flush(AVBSFContext *ctx)
Reset the internal bitstream filter state / flush internal buffers.
Definition: bsf.c:185
AVCodecParameters::trailing_padding
int trailing_padding
Audio only.
Definition: codec_par.h:196
AV_CODEC_ID_AMV
@ AV_CODEC_ID_AMV
Definition: codec_id.h:156
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:1776
AVCodecContext
main external API structure.
Definition: avcodec.h:526
AVCodecContext::active_thread_type
int active_thread_type
Which multithreading methods are in use by the codec.
Definition: avcodec.h:1804
AVCodecContext::codec_descriptor
const AVCodecDescriptor * codec_descriptor
AVCodecDescriptor.
Definition: avcodec.h:2090
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: codec_id.h:376
channel_layout.h
AVCodecContext::qmin
int qmin
minimum quantizer
Definition: avcodec.h:1368
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:1552
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_CODEC_ID_JPEGLS
@ AV_CODEC_ID_JPEGLS
Definition: codec_id.h:60
AVCodecContext::profile
int profile
profile
Definition: avcodec.h:1859
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: codec_id.h:311
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
AVCodecContext::export_side_data
int export_side_data
Bit set of AV_CODEC_EXPORT_DATA_* flags, which affects the kind of metadata exported in frame,...
Definition: avcodec.h:2354
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:1809
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:2193
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:1848
AVCodecInternal::buffer_frame
AVFrame * buffer_frame
Definition: internal.h:174
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
AVCodecInternal::draining
int draining
checks API usage: after codec draining, flush is required to resume operation
Definition: internal.h:167
AV_CODEC_ID_TRUESPEECH
@ AV_CODEC_ID_TRUESPEECH
Definition: codec_id.h:431
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
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: codec_id.h:358
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:714
AVCodecContext::codec_type
enum AVMediaType codec_type
Definition: avcodec.h:534
AVCodecContext::seek_preroll
int seek_preroll
Number of samples to skip after a discontinuity.
Definition: avcodec.h:2149
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_CODEC_ID_PCM_S32LE
@ AV_CODEC_ID_PCM_S32LE
Definition: codec_id.h:309
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: codec_par.h:102
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
AV_CODEC_EXPORT_DATA_MVS
#define AV_CODEC_EXPORT_DATA_MVS
Export motion vectors through frame side data.
Definition: avcodec.h:403
AV_CODEC_ID_ADPCM_SBPRO_4
@ AV_CODEC_ID_ADPCM_SBPRO_4
Definition: codec_id.h:355
AV_CODEC_ID_PCM_U8
@ AV_CODEC_ID_PCM_U8
Definition: codec_id.h:306
AV_CODEC_ID_RPZA
@ AV_CODEC_ID_RPZA
Definition: codec_id.h:91
AV_CODEC_ID_SDX2_DPCM
@ AV_CODEC_ID_SDX2_DPCM
Definition: codec_id.h:405
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: codec_par.h:155
AVCodecInternal::buffer_pkt_valid
int buffer_pkt_valid
Definition: internal.h:173
AVCodecContext::frame_number
int frame_number
Frame counter, set by libavcodec.
Definition: avcodec.h:1217
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:206
AVCodecParameters::format
int format
Definition: codec_par.h:84
AV_CODEC_ID_PCM_S24DAUD
@ AV_CODEC_ID_PCM_S24DAUD
Definition: codec_id.h:317
AV_CODEC_ID_ADPCM_IMA_SSI
@ AV_CODEC_ID_ADPCM_IMA_SSI
Definition: codec_id.h:384
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: codec_id.h:324
AV_CODEC_FLAG2_EXPORT_MVS
#define AV_CODEC_FLAG2_EXPORT_MVS
Export motion vectors through frame side data.
Definition: avcodec.h:380
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:551
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:223
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:60
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:553
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:2098
AVFrameSideData::size
int size
Definition: frame.h:209
AV_CODEC_ID_ADPCM_IMA_WAV
@ AV_CODEC_ID_ADPCM_IMA_WAV
Definition: codec_id.h:341
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_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: codec_par.h:162
av_bsf_free
void av_bsf_free(AVBSFContext **pctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
Definition: bsf.c:40
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:1479
AVCodec::init
int(* init)(struct AVCodecContext *)
Definition: codec.h:267
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: codec_id.h:469
codec_string
Definition: dashenc.c:201
AV_PIX_FMT_GBRP14LE
@ AV_PIX_FMT_GBRP14LE
planar GBR 4:4:4 42bpp, little-endian
Definition: pixfmt.h:257
AVCodecInternal::thread_ctx
void * thread_ctx
Definition: internal.h:135
AV_CODEC_ID_PCM_S8_PLANAR
@ AV_CODEC_ID_PCM_S8_PLANAR
Definition: codec_id.h:328
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:699
bytestream.h
convert_header.str
string str
Definition: convert_header.py:20
AV_CODEC_ID_PCM_U16LE
@ AV_CODEC_ID_PCM_U16LE
Definition: codec_id.h:303
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:562
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: codec_id.h:322
AVCodecParameters::bit_rate
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
Definition: codec_par.h:89
DecodeSimpleContext::in_pkt
AVPacket * in_pkt
Definition: internal.h:112
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
AVCodecHWConfig
Definition: codec.h:425
AV_CODEC_ID_ADPCM_4XM
@ AV_CODEC_ID_ADPCM_4XM
Definition: codec_id.h:347
AV_SAMPLE_FMT_DBL
@ AV_SAMPLE_FMT_DBL
double
Definition: samplefmt.h:64
avcodec_descriptor_get
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
Definition: codec_desc.c:3394
AVCodecContext::sw_pix_fmt
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:2076
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: codec_id.h:438
AV_CODEC_ID_ADPCM_PSX
@ AV_CODEC_ID_ADPCM_PSX
Definition: codec_id.h:378
FF_SANE_NB_CHANNELS
#define FF_SANE_NB_CHANNELS
Definition: internal.h:97
AVCodecContext::codec_whitelist
char * codec_whitelist
',' separated list of allowed decoders.
Definition: avcodec.h:2184
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_S32, int32_t, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1<< 16)) 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/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0/(UINT64_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 *(UINT64_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 *(UINT64_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,(const uint8_t **) in->ch+ch, off *(out-> planar
Definition: audioconvert.c:56
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: hwconfig.h:34
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:1930
AV_SAMPLE_FMT_S32
@ AV_SAMPLE_FMT_S32
signed 32 bits
Definition: samplefmt.h:62
fourcc
uint32_t fourcc
Definition: vaapi_decode.c:239
AV_CODEC_ID_LJPEG
@ AV_CODEC_ID_LJPEG
Definition: codec_id.h:58
snprintf
#define snprintf
Definition: snprintf.h:34
AV_CODEC_ID_MP1
@ AV_CODEC_ID_MP1
Definition: codec_id.h:452
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: codec_par.h:189
AV_CODEC_ID_PCM_S24BE
@ AV_CODEC_ID_PCM_S24BE
Definition: codec_id.h:314
ff_thread_init
int ff_thread_init(AVCodecContext *s)
Definition: utils.c:1820
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:2918
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:905
AVCodec::channel_layouts
const uint64_t * channel_layouts
array of support channel layouts, or NULL if unknown. array is terminated by 0
Definition: codec.h:214
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
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: codec_id.h:443
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:2465
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:296
av_fourcc2str
#define av_fourcc2str(fourcc)
Definition: avutil.h:348
AV_CODEC_ID_ADPCM_SBPRO_3
@ AV_CODEC_ID_ADPCM_SBPRO_3
Definition: codec_id.h:356
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