FFmpeg
avcodec.c
Go to the documentation of this file.
1 /*
2  * AVCodecContext functions for libavcodec
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /**
22  * @file
23  * AVCodecContext functions for libavcodec
24  */
25 
26 #include <assert.h>
27 
28 #include "config.h"
29 #include "libavutil/avassert.h"
30 #include "libavutil/avstring.h"
31 #include "libavutil/bprint.h"
33 #include "libavutil/common.h"
34 #include "libavutil/emms.h"
35 #include "libavutil/imgutils.h"
36 #include "libavutil/mem.h"
37 #include "libavutil/opt.h"
38 #include "libavutil/thread.h"
39 #include "avcodec.h"
40 #include "avcodec_internal.h"
41 #include "bsf.h"
42 #include "codec_desc.h"
43 #include "codec_internal.h"
44 #include "decode.h"
45 #include "frame_thread_encoder.h"
46 #include "hwconfig.h"
47 #include "internal.h"
48 #include "libavutil/refstruct.h"
49 
50 /**
51  * Maximum size in bytes of extradata.
52  * This value was chosen such that every bit of the buffer is
53  * addressable by a 32-bit signed integer as used by get_bits.
54  */
55 #define FF_MAX_EXTRADATA_SIZE ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE)
56 
69  { AV_PKT_DATA_NB },
70 };
71 
72 
73 int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size)
74 {
75  size_t i;
76 
77  for (i = 0; i < count; i++) {
78  size_t offset = i * size;
79  int r = func(c, FF_PTR_ADD((char *)arg, offset));
80  if (ret)
81  ret[i] = r;
82  }
83  emms_c();
84  return 0;
85 }
86 
87 int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int jobnr, int threadnr), void *arg, int *ret, int count)
88 {
89  int i;
90 
91  for (i = 0; i < count; i++) {
92  int r = func(c, arg, i, 0);
93  if (ret)
94  ret[i] = r;
95  }
96  emms_c();
97  return 0;
98 }
99 
101 
102 static void lock_avcodec(const FFCodec *codec)
103 {
104  if (codec->caps_internal & FF_CODEC_CAP_NOT_INIT_THREADSAFE && codec->init)
106 }
107 
108 static void unlock_avcodec(const FFCodec *codec)
109 {
110  if (codec->caps_internal & FF_CODEC_CAP_NOT_INIT_THREADSAFE && codec->init)
112 }
113 
115 {
116  int64_t bit_rate;
117  int bits_per_sample;
118 
119  switch (ctx->codec_type) {
120  case AVMEDIA_TYPE_VIDEO:
121  case AVMEDIA_TYPE_DATA:
124  bit_rate = ctx->bit_rate;
125  break;
126  case AVMEDIA_TYPE_AUDIO:
127  bits_per_sample = av_get_bits_per_sample(ctx->codec_id);
128  if (bits_per_sample) {
129  bit_rate = ctx->sample_rate * (int64_t)ctx->ch_layout.nb_channels;
130  if (bit_rate > INT64_MAX / bits_per_sample) {
131  bit_rate = 0;
132  } else
133  bit_rate *= bits_per_sample;
134  } else
135  bit_rate = ctx->bit_rate;
136  break;
137  default:
138  bit_rate = 0;
139  break;
140  }
141  return bit_rate;
142 }
143 
145 {
146  int ret = 0;
147  AVCodecInternal *avci;
148  const FFCodec *codec2;
149  const AVDictionaryEntry *e;
150 
151  if (avcodec_is_open(avctx))
152  return 0;
153 
154  if (!codec && !avctx->codec) {
155  av_log(avctx, AV_LOG_ERROR, "No codec provided to avcodec_open2()\n");
156  return AVERROR(EINVAL);
157  }
158  if (codec && avctx->codec && codec != avctx->codec) {
159  av_log(avctx, AV_LOG_ERROR, "This AVCodecContext was allocated for %s, "
160  "but %s passed to avcodec_open2()\n", avctx->codec->name, codec->name);
161  return AVERROR(EINVAL);
162  }
163  if (!codec)
164  codec = avctx->codec;
165  codec2 = ffcodec(codec);
166 
167  if ((avctx->codec_type != AVMEDIA_TYPE_UNKNOWN && avctx->codec_type != codec->type) ||
168  (avctx->codec_id != AV_CODEC_ID_NONE && avctx->codec_id != codec->id)) {
169  av_log(avctx, AV_LOG_ERROR, "Codec type or id mismatches\n");
170  return AVERROR(EINVAL);
171  }
172 
173  avctx->codec_type = codec->type;
174  avctx->codec_id = codec->id;
175  avctx->codec = codec;
176 
177  if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE)
178  return AVERROR(EINVAL);
179 
180  // set the whitelist from provided options dict,
181  // so we can check it immediately
182  e = options ? av_dict_get(*options, "codec_whitelist", NULL, 0) : NULL;
183  if (e) {
184  ret = av_opt_set(avctx, e->key, e->value, 0);
185  if (ret < 0)
186  return ret;
187  }
188 
189  if (avctx->codec_whitelist && av_match_list(codec->name, avctx->codec_whitelist, ',') <= 0) {
190  av_log(avctx, AV_LOG_ERROR, "Codec (%s) not on whitelist \'%s\'\n", codec->name, avctx->codec_whitelist);
191  return AVERROR(EINVAL);
192  }
193 
194  avci = ff_codec_is_decoder(codec) ?
197  if (!avci) {
198  ret = AVERROR(ENOMEM);
199  goto end;
200  }
201  avctx->internal = avci;
202 
203  avci->buffer_frame = av_frame_alloc();
204  avci->buffer_pkt = av_packet_alloc();
205  if (!avci->buffer_frame || !avci->buffer_pkt) {
206  ret = AVERROR(ENOMEM);
207  goto free_and_end;
208  }
209 
210  if (codec2->priv_data_size > 0) {
211  if (!avctx->priv_data) {
212  avctx->priv_data = av_mallocz(codec2->priv_data_size);
213  if (!avctx->priv_data) {
214  ret = AVERROR(ENOMEM);
215  goto free_and_end;
216  }
217  if (codec->priv_class) {
218  *(const AVClass **)avctx->priv_data = codec->priv_class;
220  }
221  }
222  } else {
223  avctx->priv_data = NULL;
224  }
225 
227  if (ret < 0)
228  goto free_and_end;
229 
230  // only call ff_set_dimensions() for non H.264/VP6F/DXV codecs so as not to overwrite previously setup dimensions
231  if (!(avctx->coded_width && avctx->coded_height && avctx->width && avctx->height &&
232  (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_VP6F || avctx->codec_id == AV_CODEC_ID_DXV))) {
233  if (avctx->coded_width && avctx->coded_height)
234  ret = ff_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
235  else if (avctx->width && avctx->height)
236  ret = ff_set_dimensions(avctx, avctx->width, avctx->height);
237  if (ret < 0)
238  goto free_and_end;
239  }
240 
241  if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height)
242  && ( av_image_check_size2(avctx->coded_width, avctx->coded_height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0
243  || av_image_check_size2(avctx->width, avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0)) {
244  av_log(avctx, AV_LOG_WARNING, "Ignoring invalid width/height values\n");
245  ff_set_dimensions(avctx, 0, 0);
246  }
247 
248  if (avctx->width > 0 && avctx->height > 0) {
249  if (av_image_check_sar(avctx->width, avctx->height,
250  avctx->sample_aspect_ratio) < 0) {
251  av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\n",
252  avctx->sample_aspect_ratio.num,
253  avctx->sample_aspect_ratio.den);
254  avctx->sample_aspect_ratio = (AVRational){ 0, 1 };
255  }
256  }
257 
258  /* AV_CODEC_CAP_CHANNEL_CONF is a decoder-only flag; so the code below
259  * in particular checks that sample_rate is set for all audio encoders. */
260  if (avctx->sample_rate < 0 ||
261  avctx->sample_rate == 0 && avctx->codec_type == AVMEDIA_TYPE_AUDIO &&
263  av_log(avctx, AV_LOG_ERROR, "Invalid sample rate: %d\n", avctx->sample_rate);
264  ret = AVERROR(EINVAL);
265  goto free_and_end;
266  }
267  if (avctx->block_align < 0) {
268  av_log(avctx, AV_LOG_ERROR, "Invalid block align: %d\n", avctx->block_align);
269  ret = AVERROR(EINVAL);
270  goto free_and_end;
271  }
272 
273  /* AV_CODEC_CAP_CHANNEL_CONF is a decoder-only flag; so the code below
274  * in particular checks that nb_channels is set for all audio encoders. */
275  if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && !avctx->ch_layout.nb_channels
276  && !(codec->capabilities & AV_CODEC_CAP_CHANNEL_CONF)) {
277  av_log(avctx, AV_LOG_ERROR, "%s requires channel layout to be set\n",
278  ff_codec_is_decoder(codec) ? "Decoder" : "Encoder");
279  ret = AVERROR(EINVAL);
280  goto free_and_end;
281  }
282  if (avctx->ch_layout.nb_channels && !av_channel_layout_check(&avctx->ch_layout)) {
283  av_log(avctx, AV_LOG_ERROR, "Invalid channel layout\n");
284  ret = AVERROR(EINVAL);
285  goto free_and_end;
286  }
288  av_log(avctx, AV_LOG_ERROR, "Too many channels: %d\n", avctx->ch_layout.nb_channels);
289  ret = AVERROR(EINVAL);
290  goto free_and_end;
291  }
292 
293  avctx->frame_num = 0;
295 
296  if ((avctx->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) &&
298  const char *codec_string = ff_codec_is_encoder(codec) ? "encoder" : "decoder";
299  const AVCodec *codec2;
300  av_log(avctx, AV_LOG_ERROR,
301  "The %s '%s' is experimental but experimental codecs are not enabled, "
302  "add '-strict %d' if you want to use it.\n",
304  codec2 = ff_codec_is_encoder(codec) ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id);
305  if (!(codec2->capabilities & AV_CODEC_CAP_EXPERIMENTAL))
306  av_log(avctx, AV_LOG_ERROR, "Alternatively use the non experimental %s '%s'.\n",
307  codec_string, codec2->name);
309  goto free_and_end;
310  }
311 
312  if (avctx->codec_type == AVMEDIA_TYPE_AUDIO &&
313  (!avctx->time_base.num || !avctx->time_base.den)) {
314  avctx->time_base.num = 1;
315  avctx->time_base.den = avctx->sample_rate;
316  }
317 
318  if (ff_codec_is_encoder(avctx->codec))
319  ret = ff_encode_preinit(avctx);
320  else
321  ret = ff_decode_preinit(avctx);
322  if (ret < 0)
323  goto free_and_end;
324 
325  if (HAVE_THREADS && !avci->frame_thread_encoder) {
326  /* Frame-threaded decoders call FFCodec.init for their child contexts. */
327  lock_avcodec(codec2);
328  ret = ff_thread_init(avctx);
329  unlock_avcodec(codec2);
330  if (ret < 0) {
331  goto free_and_end;
332  }
333  }
334  if (!HAVE_THREADS && !(codec2->caps_internal & FF_CODEC_CAP_AUTO_THREADS))
335  avctx->thread_count = 1;
336 
337  if (!(avctx->active_thread_type & FF_THREAD_FRAME) ||
338  avci->frame_thread_encoder) {
339  if (codec2->init) {
340  lock_avcodec(codec2);
341  ret = codec2->init(avctx);
342  unlock_avcodec(codec2);
343  if (ret < 0) {
345  goto free_and_end;
346  }
347  }
348  avci->needs_close = 1;
349  }
350 
351  ret=0;
352 
353  if (ff_codec_is_decoder(avctx->codec)) {
354  if (!avctx->bit_rate)
355  avctx->bit_rate = get_bit_rate(avctx);
356 
357  /* validate channel layout from the decoder */
358  if ((avctx->ch_layout.nb_channels && !av_channel_layout_check(&avctx->ch_layout)) ||
360  ret = AVERROR(EINVAL);
361  goto free_and_end;
362  }
363  if (avctx->bits_per_coded_sample < 0) {
364  ret = AVERROR(EINVAL);
365  goto free_and_end;
366  }
367  }
368  if (codec->priv_class)
369  av_assert0(*(const AVClass **)avctx->priv_data == codec->priv_class);
370 
371 end:
372 
373  return ret;
374 free_and_end:
375  ff_codec_close(avctx);
376  goto end;
377 }
378 
380 {
381  AVCodecInternal *avci = avctx->internal;
382 
383  if (av_codec_is_encoder(avctx->codec)) {
384  int caps = avctx->codec->capabilities;
385 
386  if (!(caps & AV_CODEC_CAP_ENCODER_FLUSH)) {
387  // Only encoders that explicitly declare support for it can be
388  // flushed. Otherwise, this is a no-op.
389  av_log(avctx, AV_LOG_WARNING, "Ignoring attempt to flush encoder "
390  "that doesn't support it\n");
391  return;
392  }
394  } else
396 
397  avci->draining = 0;
398  avci->draining_done = 0;
399  if (avci->buffer_frame)
401  if (avci->buffer_pkt)
403 
404  if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME &&
405  !avci->is_frame_mt)
406  ff_thread_flush(avctx);
407  else if (ffcodec(avctx->codec)->flush)
408  ffcodec(avctx->codec)->flush(avctx);
409 }
410 
412 {
413  int i;
414 
415  for (i = 0; i < sub->num_rects; i++) {
416  AVSubtitleRect *const rect = sub->rects[i];
417 
418  av_freep(&rect->data[0]);
419  av_freep(&rect->data[1]);
420  av_freep(&rect->data[2]);
421  av_freep(&rect->data[3]);
422  av_freep(&rect->text);
423  av_freep(&rect->ass);
424 
425  av_freep(&sub->rects[i]);
426  }
427 
428  av_freep(&sub->rects);
429 
430  memset(sub, 0, sizeof(*sub));
431 }
432 
434 {
435  int i;
436 
437  if (avcodec_is_open(avctx)) {
438  AVCodecInternal *avci = avctx->internal;
439 
440 #if CONFIG_FRAME_THREAD_ENCODER
441  if (avci->frame_thread_encoder && avctx->thread_count > 1) {
443  }
444 #endif
445  if (HAVE_THREADS && avci->thread_ctx)
446  ff_thread_free(avctx);
447  if (avci->needs_close && ffcodec(avctx->codec)->close)
448  ffcodec(avctx->codec)->close(avctx);
449  avci->byte_buffer_size = 0;
450  av_freep(&avci->byte_buffer);
451  av_frame_free(&avci->buffer_frame);
452  av_packet_free(&avci->buffer_pkt);
454 
455  av_packet_free(&avci->in_pkt);
456  av_frame_free(&avci->in_frame);
457  av_frame_free(&avci->recon_frame);
458 
459  av_refstruct_unref(&avci->pool);
461  if (av_codec_is_decoder(avctx->codec))
463 
464  ff_hwaccel_uninit(avctx);
465 
466  av_bsf_free(&avci->bsf);
467 
468 #if CONFIG_LCMS2
469  ff_icc_context_uninit(&avci->icc);
470 #endif
471 
472  av_freep(&avctx->internal);
473  }
474 
475  for (i = 0; i < avctx->nb_coded_side_data; i++)
476  av_freep(&avctx->coded_side_data[i].data);
477  av_freep(&avctx->coded_side_data);
478  avctx->nb_coded_side_data = 0;
480  &avctx->nb_decoded_side_data);
481 
484 
485  if (avctx->priv_data && avctx->codec && avctx->codec->priv_class)
486  av_opt_free(avctx->priv_data);
487  av_opt_free(avctx);
488  av_freep(&avctx->priv_data);
489  if (av_codec_is_encoder(avctx->codec)) {
490  av_freep(&avctx->extradata);
491  avctx->extradata_size = 0;
492  } else if (av_codec_is_decoder(avctx->codec))
493  av_freep(&avctx->subtitle_header);
494 
495  avctx->codec = NULL;
496  avctx->active_thread_type = 0;
497 }
498 
499 static const char *unknown_if_null(const char *str)
500 {
501  return str ? str : "unknown";
502 }
503 
504 void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
505 {
506  const char *codec_type;
507  const char *codec_name;
508  const char *profile = NULL;
509  AVBPrint bprint;
511  int new_line = 0;
512  AVRational display_aspect_ratio;
513  const char *separator = enc->dump_separator ? (const char *)enc->dump_separator : ", ";
514  const char *str;
515 
516  if (!buf || buf_size <= 0)
517  return;
518  av_bprint_init_for_buffer(&bprint, buf, buf_size);
520  codec_name = avcodec_get_name(enc->codec_id);
522 
523  av_bprintf(&bprint, "%s: %s", codec_type ? codec_type : "unknown",
524  codec_name);
525  buf[0] ^= 'a' ^ 'A'; /* first letter in uppercase */
526 
527  if (enc->codec && strcmp(enc->codec->name, codec_name))
528  av_bprintf(&bprint, " (%s)", enc->codec->name);
529 
530  if (profile)
531  av_bprintf(&bprint, " (%s)", profile);
532  if ( enc->codec_type == AVMEDIA_TYPE_VIDEO
534  && enc->refs)
535  av_bprintf(&bprint, ", %d reference frame%s",
536  enc->refs, enc->refs > 1 ? "s" : "");
537 
538  if (enc->codec_tag)
539  av_bprintf(&bprint, " (%s / 0x%04X)",
540  av_fourcc2str(enc->codec_tag), enc->codec_tag);
541 
542  switch (enc->codec_type) {
543  case AVMEDIA_TYPE_VIDEO:
544  {
545  unsigned len;
546 
547  av_bprintf(&bprint, "%s%s", separator,
548  enc->pix_fmt == AV_PIX_FMT_NONE ? "none" :
550 
551  av_bprint_chars(&bprint, '(', 1);
552  len = bprint.len;
553 
554  /* The following check ensures that '(' has been written
555  * and therefore allows us to erase it if it turns out
556  * to be unnecessary. */
557  if (!av_bprint_is_complete(&bprint))
558  return;
559 
560  if (enc->bits_per_raw_sample && enc->pix_fmt != AV_PIX_FMT_NONE &&
562  av_bprintf(&bprint, "%d bpc, ", enc->bits_per_raw_sample);
563  if (enc->color_range != AVCOL_RANGE_UNSPECIFIED &&
564  (str = av_color_range_name(enc->color_range)))
565  av_bprintf(&bprint, "%s, ", str);
566 
567  if (enc->colorspace != AVCOL_SPC_UNSPECIFIED ||
570  const char *col = unknown_if_null(av_color_space_name(enc->colorspace));
572  const char *trc = unknown_if_null(av_color_transfer_name(enc->color_trc));
573  if (strcmp(col, pri) || strcmp(col, trc)) {
574  new_line = 1;
575  av_bprintf(&bprint, "%s/%s/%s, ", col, pri, trc);
576  } else
577  av_bprintf(&bprint, "%s, ", col);
578  }
579 
580  if (enc->field_order != AV_FIELD_UNKNOWN) {
581  const char *field_order = "progressive";
582  if (enc->field_order == AV_FIELD_TT)
583  field_order = "top first";
584  else if (enc->field_order == AV_FIELD_BB)
585  field_order = "bottom first";
586  else if (enc->field_order == AV_FIELD_TB)
587  field_order = "top coded first (swapped)";
588  else if (enc->field_order == AV_FIELD_BT)
589  field_order = "bottom coded first (swapped)";
590 
591  av_bprintf(&bprint, "%s, ", field_order);
592  }
593 
594  if (av_log_get_level() >= AV_LOG_VERBOSE &&
597  av_bprintf(&bprint, "%s, ", str);
598 
599  if (len == bprint.len) {
600  bprint.str[len - 1] = '\0';
601  bprint.len--;
602  } else {
603  if (bprint.len - 2 < bprint.size) {
604  /* Erase the last ", " */
605  bprint.len -= 2;
606  bprint.str[bprint.len] = '\0';
607  }
608  av_bprint_chars(&bprint, ')', 1);
609  }
610  }
611 
612  if (enc->width) {
613  av_bprintf(&bprint, "%s%dx%d", new_line ? separator : ", ",
614  enc->width, enc->height);
615 
616  if (av_log_get_level() >= AV_LOG_VERBOSE &&
617  enc->coded_width && enc->coded_height &&
618  (enc->width != enc->coded_width ||
619  enc->height != enc->coded_height))
620  av_bprintf(&bprint, " (%dx%d)",
621  enc->coded_width, enc->coded_height);
622 
623  if (enc->sample_aspect_ratio.num) {
624  av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
625  enc->width * (int64_t)enc->sample_aspect_ratio.num,
626  enc->height * (int64_t)enc->sample_aspect_ratio.den,
627  1024 * 1024);
628  av_bprintf(&bprint, " [SAR %d:%d DAR %d:%d]",
630  display_aspect_ratio.num, display_aspect_ratio.den);
631  }
632  if (av_log_get_level() >= AV_LOG_DEBUG) {
633  int g = av_gcd(enc->time_base.num, enc->time_base.den);
634  av_bprintf(&bprint, ", %d/%d",
635  enc->time_base.num / g, enc->time_base.den / g);
636  }
637  }
638  if (encode) {
639  av_bprintf(&bprint, ", q=%d-%d", enc->qmin, enc->qmax);
640  } else {
641 #if FF_API_CODEC_PROPS
644  av_bprintf(&bprint, ", Closed Captions");
646  av_bprintf(&bprint, ", Film Grain");
648  av_bprintf(&bprint, ", lossless");
650 #endif
651  }
652  break;
653  case AVMEDIA_TYPE_AUDIO:
654  av_bprintf(&bprint, "%s", separator);
655 
656  if (enc->sample_rate) {
657  av_bprintf(&bprint, "%d Hz, ", enc->sample_rate);
658  }
660  if (enc->sample_fmt != AV_SAMPLE_FMT_NONE &&
661  (str = av_get_sample_fmt_name(enc->sample_fmt))) {
662  av_bprintf(&bprint, ", %s", str);
663  }
664  if ( enc->bits_per_raw_sample > 0
666  av_bprintf(&bprint, " (%d bit)", enc->bits_per_raw_sample);
667  if (av_log_get_level() >= AV_LOG_VERBOSE) {
668  if (enc->initial_padding)
669  av_bprintf(&bprint, ", delay %d", enc->initial_padding);
670  if (enc->trailing_padding)
671  av_bprintf(&bprint, ", padding %d", enc->trailing_padding);
672  }
673  break;
674  case AVMEDIA_TYPE_DATA:
675  if (av_log_get_level() >= AV_LOG_DEBUG) {
676  int g = av_gcd(enc->time_base.num, enc->time_base.den);
677  if (g)
678  av_bprintf(&bprint, ", %d/%d",
679  enc->time_base.num / g, enc->time_base.den / g);
680  }
681  break;
683  if (enc->width)
684  av_bprintf(&bprint, ", %dx%d", enc->width, enc->height);
685  break;
686  default:
687  return;
688  }
689  if (encode) {
690  if (enc->flags & AV_CODEC_FLAG_PASS1)
691  av_bprintf(&bprint, ", pass 1");
692  if (enc->flags & AV_CODEC_FLAG_PASS2)
693  av_bprintf(&bprint, ", pass 2");
694  }
695  bitrate = get_bit_rate(enc);
696  if (bitrate != 0) {
697  av_bprintf(&bprint, ", %"PRId64" kb/s", bitrate / 1000);
698  } else if (enc->rc_max_rate > 0) {
699  av_bprintf(&bprint, ", max. %"PRId64" kb/s", enc->rc_max_rate / 1000);
700  }
701 }
702 
704 {
705  return !!s->internal;
706 }
707 
709 {
711 
712  if (!avcodec_is_open(avctx) || !avctx->codec)
713  return AVERROR(EINVAL);
714 
715  if (ff_codec_is_decoder(avctx->codec))
716  return ff_decode_receive_frame(avctx, frame);
717  return ff_encode_receive_frame(avctx, frame);
718 }
719 
720 #define WRAP_CONFIG(allowed_type, field, var, field_type, sentinel_check) \
721  do { \
722  if (codec->type != (allowed_type)) \
723  return AVERROR(EINVAL); \
724  const field_type *ptr = codec->field; \
725  *out_configs = ptr; \
726  if (ptr) { \
727  for (int i = 0;; i++) { \
728  const field_type var = ptr[i]; \
729  if (sentinel_check) { \
730  *out_num_configs = i; \
731  break; \
732  } \
733  } \
734  } else \
735  *out_num_configs = 0; \
736  return 0; \
737  } while (0)
738 
739 static const enum AVColorRange color_range_tab[] = {
742 };
743 
744 static const enum AVAlphaMode alpha_mode_tab[] = {
747 };
748 
749 static_assert((int)AVCOL_RANGE_MPEG == (int)AVALPHA_MODE_PREMULTIPLIED, "unexpected enum values");
750 static_assert((int)AVCOL_RANGE_JPEG == (int)AVALPHA_MODE_STRAIGHT, "unexpected enum values");
751 static_assert(AVCOL_RANGE_UNSPECIFIED == 0 && AVALPHA_MODE_UNSPECIFIED == 0, "unexpected enum values");
752 static_assert(AVCOL_RANGE_NB == 3 && AVALPHA_MODE_NB == 3, "unexpected enum values");
753 
754 static const uint8_t offset_tab[] = {
755  [AVCOL_RANGE_MPEG] = 3,
756  [AVCOL_RANGE_JPEG] = 1,
758 };
759 
761  const AVCodec *codec,
762  enum AVCodecConfig config,
763  unsigned flags,
764  const void **out_configs,
765  int *out_num_configs)
766 {
767  const FFCodec *codec2 = ffcodec(codec);
768 
769  switch (config) {
774  WRAP_CONFIG(AVMEDIA_TYPE_VIDEO, supported_framerates, framerate, AVRational, framerate.num == 0);
776  WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, supported_samplerates, samplerate, int, samplerate == 0);
782 
784  if (codec->type != AVMEDIA_TYPE_VIDEO)
785  return AVERROR(EINVAL);
786  unsigned color_ranges = codec2->color_ranges;
787  if (color_ranges)
788  *out_configs = color_range_tab + offset_tab[color_ranges];
789  else
790  *out_configs = NULL;
791  *out_num_configs = av_popcount(color_ranges);
792  return 0;
793 
795  *out_configs = NULL;
796  *out_num_configs = 0;
797  return 0;
798 
800  if (codec->type != AVMEDIA_TYPE_VIDEO)
801  return AVERROR(EINVAL);
802  unsigned alpha_modes = codec2->alpha_modes;
803  if (alpha_modes)
804  *out_configs = alpha_mode_tab + offset_tab[alpha_modes];
805  else
806  *out_configs = NULL;
807  *out_num_configs = av_popcount(alpha_modes);
808  return 0;
809 
810  default:
811  return AVERROR(EINVAL);
812  }
813 }
814 
815 int avcodec_get_supported_config(const AVCodecContext *avctx, const AVCodec *codec,
816  enum AVCodecConfig config, unsigned flags,
817  const void **out, int *out_num)
818 {
819  const FFCodec *codec2;
820  int dummy_num = 0;
821  if (!codec)
822  codec = avctx->codec;
823  if (!out_num)
824  out_num = &dummy_num;
825 
826  codec2 = ffcodec(codec);
827  if (codec2->get_supported_config) {
828  return codec2->get_supported_config(avctx, codec, config, flags, out, out_num);
829  } else {
830  return ff_default_get_supported_config(avctx, codec, config, flags, out, out_num);
831  }
832 }
833 
835  const AVFrameSideData *src, unsigned int flags)
836 {
837  AVPacketSideData *sd = NULL;
838 
839  for (unsigned j = 0; ff_sd_global_map[j].packet < AV_PKT_DATA_NB; j++) {
840  if (ff_sd_global_map[j].frame != src->type)
841  continue;
842 
843  sd = av_packet_side_data_new(psd, pnb_sd, ff_sd_global_map[j].packet,
844  src->size, 0);
845 
846  if (!sd)
847  return AVERROR(ENOMEM);
848 
849  memcpy(sd->data, src->data, src->size);
850  break;
851  }
852 
853  if (!sd)
854  return AVERROR(EINVAL);
855 
856  return 0;
857 }
858 
860  const AVPacketSideData *src, unsigned int flags)
861 {
862  AVFrameSideData *sd = NULL;
863 
864  for (unsigned j = 0; ff_sd_global_map[j].packet < AV_PKT_DATA_NB; j++) {
865  if (ff_sd_global_map[j].packet != src->type)
866  continue;
867 
868  sd = av_frame_side_data_new(psd, pnb_sd, ff_sd_global_map[j].frame,
869  src->size, flags);
870 
871  if (!sd)
872  return AVERROR(ENOMEM);
873 
874  memcpy(sd->data, src->data, src->size);
875  break;
876  }
877 
878  if (!sd)
879  return AVERROR(EINVAL);
880 
881  return 0;
882 }
AV_OPT_SEARCH_CHILDREN
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
Definition: opt.h:605
flags
const SwsFlags flags[]
Definition: swscale.c:61
AVSubtitle
Definition: avcodec.h:2082
func
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:66
hwconfig.h
AV_PKT_DATA_DISPLAYMATRIX
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition: packet.h:105
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: packet.c:432
AVCodec
AVCodec.
Definition: codec.h:172
FF_ENABLE_DEPRECATION_WARNINGS
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition: internal.h:73
AVMEDIA_TYPE_SUBTITLE
@ AVMEDIA_TYPE_SUBTITLE
Definition: avutil.h:203
AV_CODEC_ID_VP6F
@ AV_CODEC_ID_VP6F
Definition: codec_id.h:144
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:216
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
AVERROR_EXPERIMENTAL
#define AVERROR_EXPERIMENTAL
Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it.
Definition: error.h:74
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:1678
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: codec_internal.h:42
AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT
@ AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT
Ambient viewing environment metadata, as defined by H.274.
Definition: packet.h:327
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:218
r
const char * r
Definition: vf_curves.c:127
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
AVSubtitle::rects
AVSubtitleRect ** rects
Definition: avcodec.h:2087
opt.h
ff_thread_free
void ff_thread_free(struct AVCodecContext *s)
Definition: pthread.c:84
AVALPHA_MODE_STRAIGHT
@ AVALPHA_MODE_STRAIGHT
Alpha channel is independent of color values.
Definition: pixfmt.h:813
AVALPHA_MODE_PREMULTIPLIED
@ AVALPHA_MODE_PREMULTIPLIED
Alpha channel is multiplied into color values.
Definition: pixfmt.h:812
AVCodecContext::colorspace
enum AVColorSpace colorspace
YUV colorspace type.
Definition: avcodec.h:659
AVCodecContext::decoded_side_data
AVFrameSideData ** decoded_side_data
Array containing static side data, such as HDR10 CLL / MDCV structures.
Definition: avcodec.h:1924
out
FILE * out
Definition: movenc.c:55
AVCodecContext::sample_rate
int sample_rate
samples per second
Definition: avcodec.h:1024
AVCodec::priv_class
const AVClass * priv_class
AVClass for the private context.
Definition: codec.h:206
sample_fmts
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:948
thread.h
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3456
AV_CODEC_CONFIG_SAMPLE_RATE
@ AV_CODEC_CONFIG_SAMPLE_RATE
int, terminated by 0
Definition: avcodec.h:2533
AV_PKT_DATA_MASTERING_DISPLAY_METADATA
@ AV_PKT_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata (based on SMPTE-2086:2014).
Definition: packet.h:219
ff_decode_receive_frame
int ff_decode_receive_frame(struct AVCodecContext *avctx, struct AVFrame *frame)
avcodec_receive_frame() implementation for decoders.
Definition: decode.c:795
rect
Definition: f_ebur128.c:78
avcodec_string
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
Definition: avcodec.c:504
AVCodecContext::codec_descriptor
const struct AVCodecDescriptor * codec_descriptor
AVCodecDescriptor.
Definition: avcodec.h:1704
AVCodecContext::coded_side_data
AVPacketSideData * coded_side_data
Additional data associated with the entire coded stream.
Definition: avcodec.h:1763
int64_t
long long int64_t
Definition: coverity.c:34
AVSubtitleRect
Definition: avcodec.h:2055
AVSubtitle::num_rects
unsigned num_rects
Definition: avcodec.h:2086
ff_thread_flush
void ff_thread_flush(struct AVCodecContext *avctx)
Wait for decoding threads to finish and reset internal state.
Definition: pthread_frame.c:973
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:64
avcodec_find_encoder
const AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
Definition: allcodecs.c:1036
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:427
AVCodecContext::color_trc
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
Definition: avcodec.h:652
ff_encode_preinit
int ff_encode_preinit(struct AVCodecContext *avctx)
Definition: encode.c:747
AVPacketSideData
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
Definition: packet.h:409
AVCodec::capabilities
int capabilities
Codec capabilities.
Definition: codec.h:191
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:777
internal.h
AVComponentDescriptor::depth
int depth
Number of bits in the component.
Definition: pixdesc.h:57
AVCodecContext::field_order
enum AVFieldOrder field_order
Field order.
Definition: avcodec.h:682
AV_CODEC_CONFIG_COLOR_RANGE
@ AV_CODEC_CONFIG_COLOR_RANGE
AVColorRange, terminated by AVCOL_RANGE_UNSPECIFIED.
Definition: avcodec.h:2536
AVCodecInternal::frame_thread_encoder
void * frame_thread_encoder
Definition: internal.h:98
AVCodecInternal::in_frame
AVFrame * in_frame
The input frame is stored here for encoders implementing the simple encode API.
Definition: internal.h:106
AVCOL_TRC_UNSPECIFIED
@ AVCOL_TRC_UNSPECIFIED
Definition: pixfmt.h:669
unknown_if_null
static const char * unknown_if_null(const char *str)
Definition: avcodec.c:499
FF_CODEC_CAP_NOT_INIT_THREADSAFE
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
Definition: codec_internal.h:34
WRAP_CONFIG
#define WRAP_CONFIG(allowed_type, field, var, field_type, sentinel_check)
Definition: avcodec.c:720
FFCodec
Definition: codec_internal.h:127
AVCodecContext::subtitle_header
uint8_t * subtitle_header
Definition: avcodec.h:1739
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:226
AV_FRAME_DATA_DISPLAYMATRIX
@ AV_FRAME_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition: frame.h:85
FF_COMPLIANCE_EXPERIMENTAL
#define FF_COMPLIANCE_EXPERIMENTAL
Allow nonstandardized experimental things.
Definition: defs.h:62
AVDictionary
Definition: dict.c:32
AV_CODEC_CONFIG_PIX_FORMAT
@ AV_CODEC_CONFIG_PIX_FORMAT
AVPixelFormat, terminated by AV_PIX_FMT_NONE.
Definition: avcodec.h:2531
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:439
avcodec_is_open
int avcodec_is_open(AVCodecContext *s)
Definition: avcodec.c:703
av_popcount
#define av_popcount
Definition: common.h:154
AVCodecContext::qmax
int qmax
maximum quantizer
Definition: avcodec.h:1241
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:329
codec_type
enum AVMediaType codec_type
Definition: rtp.c:37
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:91
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:52
av_packet_side_data_to_frame
int av_packet_side_data_to_frame(AVFrameSideData ***psd, int *pnb_sd, const AVPacketSideData *src, unsigned int flags)
Add a new frame side data entry to an array based on existing packet side data, if a matching type ex...
Definition: avcodec.c:859
tf_sess_config.config
config
Definition: tf_sess_config.py:33
av_packet_free
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
Definition: packet.c:74
av_chroma_location_name
const char * av_chroma_location_name(enum AVChromaLocation location)
Definition: pixdesc.c:3877
av_channel_layout_describe_bprint
int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout, AVBPrint *bp)
bprint variant of av_channel_layout_describe().
Definition: channel_layout.c:599
AV_FIELD_BT
@ AV_FIELD_BT
Bottom coded first, top displayed first.
Definition: defs.h:217
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
ff_hwaccel_uninit
void ff_hwaccel_uninit(AVCodecContext *avctx)
Definition: decode.c:1195
ff_mutex_unlock
static int ff_mutex_unlock(AVMutex *mutex)
Definition: thread.h:189
FFCodec::priv_data_size
int priv_data_size
Definition: codec_internal.h:162
AV_PKT_DATA_REPLAYGAIN
@ AV_PKT_DATA_REPLAYGAIN
This side data should be associated with an audio stream and contains ReplayGain information in form ...
Definition: packet.h:96
AV_FIELD_TT
@ AV_FIELD_TT
Top coded_first, top displayed first.
Definition: defs.h:214
bsf.h
av_color_space_name
const char * av_color_space_name(enum AVColorSpace space)
Definition: pixdesc.c:3856
av_bprint_init_for_buffer
void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, unsigned size)
Init a print buffer using a pre-existing buffer.
Definition: bprint.c:85
AVCodecContext::codec
const struct AVCodec * codec
Definition: avcodec.h:440
AVCodecContext::ch_layout
AVChannelLayout ch_layout
Audio channel layout.
Definition: avcodec.h:1039
AVCodecContext::thread_count
int thread_count
thread count is used to decide how many independent tasks should be passed to execute()
Definition: avcodec.h:1561
get_bit_rate
static int64_t get_bit_rate(AVCodecContext *ctx)
Definition: avcodec.c:114
AVCodecContext::initial_padding
int initial_padding
Audio only.
Definition: avcodec.h:1096
AVCOL_RANGE_NB
@ AVCOL_RANGE_NB
Not part of ABI.
Definition: pixfmt.h:778
AVCodecContext::refs
int refs
number of reference frames
Definition: avcodec.h:689
av_opt_free
void av_opt_free(void *obj)
Free all allocated objects in obj.
Definition: opt.c:1949
AVCodecContext::flags
int flags
AV_CODEC_FLAG_*.
Definition: avcodec.h:488
ff_encode_internal_alloc
struct AVCodecInternal * ff_encode_internal_alloc(void)
Definition: encode.c:883
AVCodecContext::coded_height
int coded_height
Definition: avcodec.h:607
av_opt_set
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
Definition: opt.c:835
AV_CODEC_CAP_ENCODER_FLUSH
#define AV_CODEC_CAP_ENCODER_FLUSH
This encoder can be flushed using avcodec_flush_buffers().
Definition: codec.h:151
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_FIELD_TB
@ AV_FIELD_TB
Top coded first, bottom displayed first.
Definition: defs.h:216
refstruct.h
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:289
avsubtitle_free
void avsubtitle_free(AVSubtitle *sub)
Free all allocated data in the given subtitle struct.
Definition: avcodec.c:411
av_frame_alloc
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:52
AVFormatContext::bit_rate
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
Definition: avformat.h:1406
av_get_bits_per_sample
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
Definition: utils.c:549
avassert.h
AVCodecContext::color_primaries
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
Definition: avcodec.h:645
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
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:87
av_cold
#define av_cold
Definition: attributes.h:106
FF_CODEC_PROPERTY_LOSSLESS
#define FF_CODEC_PROPERTY_LOSSLESS
Definition: avcodec.h:1638
ff_encode_flush_buffers
void ff_encode_flush_buffers(struct AVCodecContext *avctx)
Definition: encode.c:873
AV_FIELD_UNKNOWN
@ AV_FIELD_UNKNOWN
Definition: defs.h:212
ff_codec_is_encoder
static int ff_codec_is_encoder(const AVCodec *avcodec)
Internal version of av_codec_is_encoder().
Definition: codec_internal.h:299
AVMutex
#define AVMutex
Definition: thread.h:184
av_dict_get
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
Definition: dict.c:60
emms_c
#define emms_c()
Definition: emms.h:63
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:515
av_packet_side_data_from_frame
int av_packet_side_data_from_frame(AVPacketSideData **psd, int *pnb_sd, const AVFrameSideData *src, unsigned int flags)
Definition: avcodec.c:834
AV_CODEC_CONFIG_SAMPLE_FORMAT
@ AV_CODEC_CONFIG_SAMPLE_FORMAT
AVSampleFormat, terminated by AV_SAMPLE_FMT_NONE.
Definition: avcodec.h:2534
s
#define s(width, name)
Definition: cbs_vp9.c:198
AVCodecInternal::buffer_pkt
AVPacket * buffer_pkt
Temporary buffers for newly received or not yet output packets/frames.
Definition: internal.h:144
ff_decode_preinit
int ff_decode_preinit(struct AVCodecContext *avctx)
Perform decoder initialization and validation.
Definition: decode.c:1971
AVCodecInternal::pool
struct FramePool * pool
Definition: internal.h:69
AVCodecContext::nb_decoded_side_data
int nb_decoded_side_data
Definition: avcodec.h:1925
bitrate
int64_t bitrate
Definition: av1_levels.c:47
g
const char * g
Definition: vf_curves.c:128
pix_fmt
static enum AVPixelFormat pix_fmt
Definition: demux_decode.c:41
AVDictionaryEntry::key
char * key
Definition: dict.h:91
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:201
unlock_avcodec
static void unlock_avcodec(const FFCodec *codec)
Definition: avcodec.c:108
AV_FRAME_DATA_AUDIO_SERVICE_TYPE
@ AV_FRAME_DATA_AUDIO_SERVICE_TYPE
This side data must be associated with an audio frame and corresponds to enum AVAudioServiceType defi...
Definition: frame.h:114
avcodec_receive_frame
int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Return decoded output data from a decoder or encoder (when the AV_CODEC_FLAG_RECON_FRAME flag is used...
Definition: avcodec.c:708
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:41
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:296
AVCodecContext::bits_per_raw_sample
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition: avcodec.h:1553
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:231
AVPacketSideData::data
uint8_t * data
Definition: packet.h:410
ctx
AVFormatContext * ctx
Definition: movenc.c:49
FFCodec::flush
void(* flush)(struct AVCodecContext *)
Flush buffers.
Definition: codec_internal.h:255
decode.h
AV_PKT_DATA_STEREO3D
@ AV_PKT_DATA_STEREO3D
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
Definition: packet.h:111
AV_FRAME_DATA_3D_REFERENCE_DISPLAYS
@ AV_FRAME_DATA_3D_REFERENCE_DISPLAYS
This side data contains information about the reference display width(s) and reference viewing distan...
Definition: frame.h:256
AVCodecContext::max_pixels
int64_t max_pixels
The number of pixels per image to maximally accept.
Definition: avcodec.h:1782
ff_icc_context_uninit
void ff_icc_context_uninit(FFIccContext *s)
Definition: fflcms2.c:42
AVCodecContext::rc_max_rate
int64_t rc_max_rate
maximum bitrate
Definition: avcodec.h:1270
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:51
AVMEDIA_TYPE_DATA
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
Definition: avutil.h:202
AVCOL_PRI_UNSPECIFIED
@ AVCOL_PRI_UNSPECIFIED
Definition: pixfmt.h:639
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
FFCodec::init
int(* init)(struct AVCodecContext *)
Definition: codec_internal.h:187
AVCodecContext::codec_id
enum AVCodecID codec_id
Definition: avcodec.h:441
FF_CODEC_PROPERTY_FILM_GRAIN
#define FF_CODEC_PROPERTY_FILM_GRAIN
Definition: avcodec.h:1640
arg
const char * arg
Definition: jacosubdec.c:65
if
if(ret)
Definition: filter_design.txt:179
av_color_range_name
const char * av_color_range_name(enum AVColorRange range)
Definition: pixdesc.c:3772
av_log_get_level
int av_log_get_level(void)
Get the current log level.
Definition: log.c:470
AVCodecInternal::progress_frame_pool
struct AVRefStructPool * progress_frame_pool
Definition: internal.h:71
FF_MAX_EXTRADATA_SIZE
#define FF_MAX_EXTRADATA_SIZE
Maximum size in bytes of extradata.
Definition: avcodec.c:55
AV_PKT_DATA_3D_REFERENCE_DISPLAYS
@ AV_PKT_DATA_3D_REFERENCE_DISPLAYS
This side data contains information about the reference display width(s) and reference viewing distan...
Definition: packet.h:357
framerate
float framerate
Definition: av1_levels.c:29
AV_PKT_DATA_EXIF
@ AV_PKT_DATA_EXIF
Extensible image file format metadata.
Definition: packet.h:369
AV_FRAME_DATA_SPHERICAL
@ AV_FRAME_DATA_SPHERICAL
The data represents the AVSphericalMapping structure defined in libavutil/spherical....
Definition: frame.h:131
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:76
NULL
#define NULL
Definition: coverity.c:32
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:445
AVCodecContext::color_range
enum AVColorRange color_range
MPEG vs JPEG YUV range.
Definition: avcodec.h:669
FFCodec::color_ranges
unsigned color_ranges
This field determines the video color ranges supported by an encoder.
Definition: codec_internal.h:147
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:139
AV_CODEC_CONFIG_FRAME_RATE
@ AV_CODEC_CONFIG_FRAME_RATE
AVRational, terminated by {0, 0}.
Definition: avcodec.h:2532
AVCodec::type
enum AVMediaType type
Definition: codec.h:185
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AVCodecContext::nb_coded_side_data
int nb_coded_side_data
Definition: avcodec.h:1764
AVCodecContext::internal
struct AVCodecInternal * internal
Private context used for internal data.
Definition: avcodec.h:466
AVCodecContext::bit_rate
int64_t bit_rate
the average bitrate
Definition: avcodec.h:481
AV_FRAME_DATA_ICC_PROFILE
@ AV_FRAME_DATA_ICC_PROFILE
The data contains an ICC profile as an opaque octet buffer following the format described by ISO 1507...
Definition: frame.h:144
FF_PTR_ADD
#define FF_PTR_ADD(ptr, off)
Definition: internal.h:80
AVCodecContext::trailing_padding
int trailing_padding
Audio only.
Definition: avcodec.h:1107
options
Definition: swscale.c:43
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
@ AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata associated with a video frame.
Definition: frame.h:120
av_color_primaries_name
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
Definition: pixdesc.c:3790
avcodec_open2
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
Definition: avcodec.c:144
FFCodec::get_supported_config
int(* get_supported_config)(const struct AVCodecContext *avctx, const AVCodec *codec, enum AVCodecConfig config, unsigned flags, const void **out_configs, int *out_num_configs)
Custom callback for avcodec_get_supported_config().
Definition: codec_internal.h:282
AVCodecInternal::draining_done
int draining_done
Definition: internal.h:146
ff_sd_global_map
const SideDataMap ff_sd_global_map[]
A map between packet and frame side data types.
Definition: avcodec.c:57
AV_PKT_DATA_CONTENT_LIGHT_LEVEL
@ AV_PKT_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
Definition: packet.h:232
AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_UNSPECIFIED
Definition: pixfmt.h:743
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
AVCodecInternal::last_pkt_props
AVPacket * last_pkt_props
Properties (timestamps+side data) extracted from the last packet passed for decoding.
Definition: internal.h:90
AV_PKT_DATA_NB
@ AV_PKT_DATA_NB
The number of side data types.
Definition: packet.h:379
avcodec_find_decoder
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
Definition: allcodecs.c:1041
AV_PKT_DATA_SPHERICAL
@ AV_PKT_DATA_SPHERICAL
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
Definition: packet.h:225
AV_CODEC_CAP_CHANNEL_CONF
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: codec.h:91
attribute_align_arg
#define attribute_align_arg
Definition: internal.h:50
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:535
AVAlphaMode
AVAlphaMode
Correlation between the alpha channel and color values.
Definition: pixfmt.h:810
av_codec_is_decoder
int av_codec_is_decoder(const AVCodec *codec)
Definition: utils.c:85
avcodec_get_supported_config
int avcodec_get_supported_config(const AVCodecContext *avctx, const AVCodec *codec, enum AVCodecConfig config, unsigned flags, const void **out, int *out_num)
Retrieve a list of all supported values for a given configuration type.
Definition: avcodec.c:815
AV_CODEC_CONFIG_CHANNEL_LAYOUT
@ AV_CODEC_CONFIG_CHANNEL_LAYOUT
AVChannelLayout, terminated by {0}.
Definition: avcodec.h:2535
alpha_mode_tab
static enum AVAlphaMode alpha_mode_tab[]
Definition: avcodec.c:744
SideDataMap::packet
enum AVPacketSideDataType packet
Definition: avcodec_internal.h:35
AV_FRAME_DATA_REPLAYGAIN
@ AV_FRAME_DATA_REPLAYGAIN
ReplayGain information in the form of the AVReplayGain struct.
Definition: frame.h:77
AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT
@ AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT
Ambient viewing environment metadata, as defined by H.274.
Definition: frame.h:220
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:319
codec_internal.h
color_range_tab
static enum AVColorRange color_range_tab[]
Definition: avcodec.c:739
ff_codec_is_decoder
static int ff_codec_is_decoder(const AVCodec *avcodec)
Internal version of av_codec_is_decoder().
Definition: codec_internal.h:309
AV_CODEC_ID_DXV
@ AV_CODEC_ID_DXV
Definition: codec_id.h:245
AVCodecInternal::bsf
struct AVBSFContext * bsf
Definition: internal.h:84
AVCodecContext::sample_fmt
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:1031
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
AV_MUTEX_INITIALIZER
#define AV_MUTEX_INITIALIZER
Definition: thread.h:185
size
int size
Definition: twinvq_data.h:10344
AV_CODEC_CONFIG_ALPHA_MODE
@ AV_CODEC_CONFIG_ALPHA_MODE
AVAlphaMode, terminated by AVALPHA_MODE_UNSPECIFIED.
Definition: avcodec.h:2538
AVFrameSideData::data
uint8_t * data
Definition: frame.h:284
AVCodecInternal::byte_buffer
uint8_t * byte_buffer
temporary buffer used for encoders to store their bitstream
Definition: internal.h:95
ffcodec
static const av_always_inline FFCodec * ffcodec(const AVCodec *codec)
Definition: codec_internal.h:290
AVCHROMA_LOC_UNSPECIFIED
@ AVCHROMA_LOC_UNSPECIFIED
Definition: pixfmt.h:797
AVALPHA_MODE_NB
@ AVALPHA_MODE_NB
Not part of ABI.
Definition: pixfmt.h:814
AVMEDIA_TYPE_UNKNOWN
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
Definition: avutil.h:199
codec_mutex
static AVMutex codec_mutex
Definition: avcodec.c:100
AV_CODEC_FLAG_PASS2
#define AV_CODEC_FLAG_PASS2
Use internal 2pass ratecontrol in second pass mode.
Definition: avcodec.h:294
encode
static void encode(AVCodecContext *ctx, AVFrame *frame, AVPacket *pkt, FILE *output)
Definition: encode_audio.c:94
avcodec_default_execute
int avcodec_default_execute(AVCodecContext *c, int(*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size)
Definition: avcodec.c:73
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
ff_mutex_lock
static int ff_mutex_lock(AVMutex *mutex)
Definition: thread.h:188
av_packet_alloc
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
Definition: packet.c:63
AVCodecInternal
Definition: internal.h:49
AVCodecInternal::byte_buffer_size
unsigned int byte_buffer_size
Definition: internal.h:96
FF_THREAD_FRAME
#define FF_THREAD_FRAME
Decode more than one frame at once.
Definition: avcodec.h:1572
AVCodec::id
enum AVCodecID id
Definition: codec.h:186
av_refstruct_unref
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
Definition: refstruct.c:120
av_codec_is_encoder
int av_codec_is_encoder(const AVCodec *codec)
Definition: utils.c:79
emms.h
avcodec_get_name
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
Definition: utils.c:406
AVCodecInternal::is_frame_mt
int is_frame_mt
This field is set to 1 when frame threading is being used and the parent AVCodecContext of this AVCod...
Definition: internal.h:61
AVCodecContext::bits_per_coded_sample
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
Definition: avcodec.h:1546
FFCodec::caps_internal
unsigned caps_internal
Internal codec capabilities FF_CODEC_CAP_*.
Definition: codec_internal.h:136
bprint.h
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
@ AV_FRAME_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
Definition: frame.h:137
ff_default_get_supported_config
int ff_default_get_supported_config(const AVCodecContext *avctx, const AVCodec *codec, enum AVCodecConfig config, unsigned flags, const void **out_configs, int *out_num_configs)
Definition: avcodec.c:760
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: avcodec.c:87
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
av_frame_side_data_free
void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd)
Free all side data entries and their contents, then zeroes out the values which the pointers are poin...
Definition: side_data.c:133
av_get_bytes_per_sample
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
Definition: samplefmt.c:108
AVCodecContext::extradata
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
Definition: avcodec.h:514
av_opt_set_dict2
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
Set all the options from a given dictionary on an object.
Definition: opt.c:1962
AV_FIELD_BB
@ AV_FIELD_BB
Bottom coded first, bottom displayed first.
Definition: defs.h:215
AV_PKT_DATA_ICC_PROFILE
@ AV_PKT_DATA_ICC_PROFILE
ICC profile data consisting of an opaque octet buffer following the format described by ISO 15076-1.
Definition: packet.h:271
common.h
AVCodecInternal::in_pkt
AVPacket * in_pkt
This packet is used to hold the packet given to decoders implementing the .decode API; it is unused b...
Definition: internal.h:83
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
AVMEDIA_TYPE_ATTACHMENT
@ AVMEDIA_TYPE_ATTACHMENT
Opaque data information usually sparse.
Definition: avutil.h:204
AV_FRAME_DATA_STEREO3D
@ AV_FRAME_DATA_STEREO3D
Stereoscopic 3d metadata.
Definition: frame.h:64
AVCodecContext::dump_separator
uint8_t * dump_separator
dump format separator.
Definition: avcodec.h:1747
ch_layouts
static const AVChannelLayout ch_layouts[]
Definition: adpcmenc.c:956
av_frame_unref
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
Definition: frame.c:496
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:256
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:179
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:1475
AVCodecContext::chroma_sample_location
enum AVChromaLocation chroma_sample_location
This defines the location of chroma samples.
Definition: avcodec.h:676
len
int len
Definition: vorbis_enc_data.h:426
profile
int profile
Definition: mxfenc.c:2297
AVCOL_SPC_UNSPECIFIED
@ AVCOL_SPC_UNSPECIFIED
Definition: pixfmt.h:703
AVCodecContext::height
int height
Definition: avcodec.h:592
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:631
AVCOL_RANGE_MPEG
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition: pixfmt.h:760
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:1453
avcodec.h
AVCodecContext::frame_num
int64_t frame_num
Frame counter, set by libavcodec.
Definition: avcodec.h:1878
ret
ret
Definition: filter_design.txt:187
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:1057
AVALPHA_MODE_UNSPECIFIED
@ AVALPHA_MODE_UNSPECIFIED
Unknown alpha handling, or no alpha channel.
Definition: pixfmt.h:811
avcodec_flush_buffers
void avcodec_flush_buffers(AVCodecContext *avctx)
Reset the internal codec state / flush internal buffers.
Definition: avcodec.c:379
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:265
ff_decode_internal_alloc
struct AVCodecInternal * ff_decode_internal_alloc(void)
Definition: decode.c:2325
AVCodecContext::strict_std_compliance
int strict_std_compliance
strictly follow the standard (MPEG-4, ...).
Definition: avcodec.h:1357
av_channel_layout_check
int av_channel_layout_check(const AVChannelLayout *channel_layout)
Check whether a channel layout is valid, i.e.
Definition: channel_layout.c:783
ff_decode_flush_buffers
void ff_decode_flush_buffers(struct AVCodecContext *avctx)
Definition: decode.c:2307
av_bprintf
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition: bprint.c:122
av_packet_side_data_new
AVPacketSideData * av_packet_side_data_new(AVPacketSideData **psd, int *pnb_sd, enum AVPacketSideDataType type, size_t size, int flags)
Allocate a new packet side data.
Definition: packet.c:694
AVCodecInternal::recon_frame
AVFrame * recon_frame
When the AV_CODEC_FLAG_RECON_FRAME flag is used.
Definition: internal.h:114
AVCodecInternal::needs_close
int needs_close
If this is set, then FFCodec->close (if existing) needs to be called for the parent AVCodecContext.
Definition: internal.h:120
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:28
AVCodecContext
main external API structure.
Definition: avcodec.h:431
AVCodecContext::active_thread_type
int active_thread_type
Which multithreading methods are in use by the codec.
Definition: avcodec.h:1580
c2
static const uint64_t c2
Definition: murmur3.c:53
channel_layout.h
avcodec_internal.h
av_frame_side_data_new
AVFrameSideData * av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd, enum AVFrameSideDataType type, size_t size, unsigned int flags)
Add new side data entry to an array.
Definition: side_data.c:198
AVCodecContext::qmin
int qmin
minimum quantizer
Definition: avcodec.h:1234
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AVCodecContext::profile
int profile
profile
Definition: avcodec.h:1618
AVPixFmtDescriptor::comp
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:105
FF_CODEC_PROPERTY_CLOSED_CAPTIONS
#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS
Definition: avcodec.h:1639
FFCodec::close
int(* close)(struct AVCodecContext *)
Definition: codec_internal.h:249
ff_frame_thread_encoder_free
av_cold void ff_frame_thread_encoder_free(AVCodecContext *avctx)
Definition: frame_thread_encoder.c:275
AVCodecInternal::buffer_frame
AVFrame * buffer_frame
Definition: internal.h:145
AVCodecInternal::draining
int draining
decoding: AVERROR_EOF has been returned from ff_decode_get_packet(); must not be used by decoders tha...
Definition: internal.h:139
FF_DISABLE_DEPRECATION_WARNINGS
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition: internal.h:72
AVCodecContext::coded_width
int coded_width
Bitstream width / height, may be different from width/height e.g.
Definition: avcodec.h:607
AV_PKT_DATA_AUDIO_SERVICE_TYPE
@ AV_PKT_DATA_AUDIO_SERVICE_TYPE
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.
Definition: packet.h:117
AVCodecContext::codec_type
enum AVMediaType codec_type
Definition: avcodec.h:439
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
mem.h
FF_CODEC_CAP_AUTO_THREADS
#define FF_CODEC_CAP_AUTO_THREADS
Codec handles avctx->thread_count == 0 (auto) internally.
Definition: codec_internal.h:72
ff_codec_close
av_cold void ff_codec_close(AVCodecContext *avctx)
Definition: avcodec.c:433
AVFrameSideData
Structure to hold side data for an AVFrame.
Definition: frame.h:282
av_refstruct_pool_uninit
static void av_refstruct_pool_uninit(AVRefStructPool **poolp)
Mark the pool as being available for freeing.
Definition: refstruct.h:292
AVCodecContext::codec_tag
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
Definition: avcodec.h:456
AVDictionaryEntry
Definition: dict.h:90
SideDataMap
Definition: avcodec_internal.h:34
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:458
FFCodec::alpha_modes
unsigned alpha_modes
This field determines the alpha modes supported by an encoder.
Definition: codec_internal.h:153
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
codec_string
Definition: codecstring.c:35
AVCodecInternal::thread_ctx
void * thread_ctx
Definition: internal.h:73
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:592
AV_FRAME_DATA_EXIF
@ AV_FRAME_DATA_EXIF
Extensible image file format metadata.
Definition: frame.h:262
ff_encode_receive_frame
int ff_encode_receive_frame(struct AVCodecContext *avctx, struct AVFrame *frame)
avcodec_receive_frame() implementation for encoders.
Definition: encode.c:860
imgutils.h
AVCodecContext::properties
attribute_deprecated unsigned properties
Properties of the stream that gets decoded.
Definition: avcodec.h:1637
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
ff_decode_internal_uninit
void ff_decode_internal_uninit(struct AVCodecContext *avctx)
Definition: decode.c:2343
ff_thread_init
int ff_thread_init(struct AVCodecContext *s)
Definition: pthread.c:72
av_bprint_chars
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
Definition: bprint.c:130
avcodec_descriptor_get
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
Definition: codec_desc.c:3878
AVDictionaryEntry::value
char * value
Definition: dict.h:92
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:323
avstring.h
FF_SANE_NB_CHANNELS
#define FF_SANE_NB_CHANNELS
Definition: internal.h:37
AVCodecContext::codec_whitelist
char * codec_whitelist
',' separated list of allowed decoders.
Definition: avcodec.h:1755
lock_avcodec
static void lock_avcodec(const FFCodec *codec)
Definition: avcodec.c:102
AVColorRange
AVColorRange
Visual content value range.
Definition: pixfmt.h:742
codec_desc.h
av_color_transfer_name
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
Definition: pixdesc.c:3823
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:616
AVCodecConfig
AVCodecConfig
Definition: avcodec.h:2530
src
#define src
Definition: vp8dsp.c:248
offset_tab
static const uint8_t offset_tab[]
Definition: avcodec.c:754
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:3376
AV_CODEC_FLAG_PASS1
#define AV_CODEC_FLAG_PASS1
Use internal 2pass ratecontrol in first pass mode.
Definition: avcodec.h:290
av_fourcc2str
#define av_fourcc2str(fourcc)
Definition: avutil.h:347
AV_CODEC_CONFIG_COLOR_SPACE
@ AV_CODEC_CONFIG_COLOR_SPACE
AVColorSpace, terminated by AVCOL_SPC_UNSPECIFIED.
Definition: avcodec.h:2537