FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dump.c
Go to the documentation of this file.
1 /*
2  * Various pretty-printing functions for use within FFmpeg
3  * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include <stdio.h>
23 #include <stdint.h>
24 
26 #include "libavutil/display.h"
27 #include "libavutil/intreadwrite.h"
28 #include "libavutil/log.h"
30 #include "libavutil/mathematics.h"
31 #include "libavutil/opt.h"
32 #include "libavutil/avstring.h"
33 #include "libavutil/replaygain.h"
34 #include "libavutil/spherical.h"
35 #include "libavutil/stereo3d.h"
36 
37 #include "avformat.h"
38 
39 #define HEXDUMP_PRINT(...) \
40  do { \
41  if (!f) \
42  av_log(avcl, level, __VA_ARGS__); \
43  else \
44  fprintf(f, __VA_ARGS__); \
45  } while (0)
46 
47 static void hex_dump_internal(void *avcl, FILE *f, int level,
48  const uint8_t *buf, int size)
49 {
50  int len, i, j, c;
51 
52  for (i = 0; i < size; i += 16) {
53  len = size - i;
54  if (len > 16)
55  len = 16;
56  HEXDUMP_PRINT("%08x ", i);
57  for (j = 0; j < 16; j++) {
58  if (j < len)
59  HEXDUMP_PRINT(" %02x", buf[i + j]);
60  else
61  HEXDUMP_PRINT(" ");
62  }
63  HEXDUMP_PRINT(" ");
64  for (j = 0; j < len; j++) {
65  c = buf[i + j];
66  if (c < ' ' || c > '~')
67  c = '.';
68  HEXDUMP_PRINT("%c", c);
69  }
70  HEXDUMP_PRINT("\n");
71  }
72 }
73 
74 void av_hex_dump(FILE *f, const uint8_t *buf, int size)
75 {
76  hex_dump_internal(NULL, f, 0, buf, size);
77 }
78 
79 void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
80 {
81  hex_dump_internal(avcl, NULL, level, buf, size);
82 }
83 
84 static void pkt_dump_internal(void *avcl, FILE *f, int level, const AVPacket *pkt,
85  int dump_payload, AVRational time_base)
86 {
87  HEXDUMP_PRINT("stream #%d:\n", pkt->stream_index);
88  HEXDUMP_PRINT(" keyframe=%d\n", (pkt->flags & AV_PKT_FLAG_KEY) != 0);
89  HEXDUMP_PRINT(" duration=%0.3f\n", pkt->duration * av_q2d(time_base));
90  /* DTS is _always_ valid after av_read_frame() */
91  HEXDUMP_PRINT(" dts=");
92  if (pkt->dts == AV_NOPTS_VALUE)
93  HEXDUMP_PRINT("N/A");
94  else
95  HEXDUMP_PRINT("%0.3f", pkt->dts * av_q2d(time_base));
96  /* PTS may not be known if B-frames are present. */
97  HEXDUMP_PRINT(" pts=");
98  if (pkt->pts == AV_NOPTS_VALUE)
99  HEXDUMP_PRINT("N/A");
100  else
101  HEXDUMP_PRINT("%0.3f", pkt->pts * av_q2d(time_base));
102  HEXDUMP_PRINT("\n");
103  HEXDUMP_PRINT(" size=%d\n", pkt->size);
104  if (dump_payload)
105  hex_dump_internal(avcl, f, level, pkt->data, pkt->size);
106 }
107 
108 void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st)
109 {
110  pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base);
111 }
112 
113 void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload,
114  const AVStream *st)
115 {
116  pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base);
117 }
118 
119 
120 static void print_fps(double d, const char *postfix)
121 {
122  uint64_t v = lrintf(d * 100);
123  if (!v)
124  av_log(NULL, AV_LOG_INFO, "%1.4f %s", d, postfix);
125  else if (v % 100)
126  av_log(NULL, AV_LOG_INFO, "%3.2f %s", d, postfix);
127  else if (v % (100 * 1000))
128  av_log(NULL, AV_LOG_INFO, "%1.0f %s", d, postfix);
129  else
130  av_log(NULL, AV_LOG_INFO, "%1.0fk %s", d / 1000, postfix);
131 }
132 
133 static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
134 {
135  if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0))) {
137 
138  av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent);
139  while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX)))
140  if (strcmp("language", tag->key)) {
141  const char *p = tag->value;
142  av_log(ctx, AV_LOG_INFO,
143  "%s %-16s: ", indent, tag->key);
144  while (*p) {
145  char tmp[256];
146  size_t len = strcspn(p, "\x8\xa\xb\xc\xd");
147  av_strlcpy(tmp, p, FFMIN(sizeof(tmp), len+1));
148  av_log(ctx, AV_LOG_INFO, "%s", tmp);
149  p += len;
150  if (*p == 0xd) av_log(ctx, AV_LOG_INFO, " ");
151  if (*p == 0xa) av_log(ctx, AV_LOG_INFO, "\n%s %-16s: ", indent, "");
152  if (*p) p++;
153  }
154  av_log(ctx, AV_LOG_INFO, "\n");
155  }
156  }
157 }
158 
159 /* param change side data*/
160 static void dump_paramchange(void *ctx, AVPacketSideData *sd)
161 {
162  int size = sd->size;
163  const uint8_t *data = sd->data;
164  uint32_t flags, channels, sample_rate, width, height;
165  uint64_t layout;
166 
167  if (!data || sd->size < 4)
168  goto fail;
169 
170  flags = AV_RL32(data);
171  data += 4;
172  size -= 4;
173 
175  if (size < 4)
176  goto fail;
177  channels = AV_RL32(data);
178  data += 4;
179  size -= 4;
180  av_log(ctx, AV_LOG_INFO, "channel count %"PRIu32", ", channels);
181  }
183  if (size < 8)
184  goto fail;
185  layout = AV_RL64(data);
186  data += 8;
187  size -= 8;
188  av_log(ctx, AV_LOG_INFO,
189  "channel layout: %s, ", av_get_channel_name(layout));
190  }
192  if (size < 4)
193  goto fail;
194  sample_rate = AV_RL32(data);
195  data += 4;
196  size -= 4;
197  av_log(ctx, AV_LOG_INFO, "sample_rate %"PRIu32", ", sample_rate);
198  }
200  if (size < 8)
201  goto fail;
202  width = AV_RL32(data);
203  data += 4;
204  size -= 4;
205  height = AV_RL32(data);
206  data += 4;
207  size -= 4;
208  av_log(ctx, AV_LOG_INFO, "width %"PRIu32" height %"PRIu32, width, height);
209  }
210 
211  return;
212 fail:
213  av_log(ctx, AV_LOG_INFO, "unknown param");
214 }
215 
216 /* replaygain side data*/
217 static void print_gain(void *ctx, const char *str, int32_t gain)
218 {
219  av_log(ctx, AV_LOG_INFO, "%s - ", str);
220  if (gain == INT32_MIN)
221  av_log(ctx, AV_LOG_INFO, "unknown");
222  else
223  av_log(ctx, AV_LOG_INFO, "%f", gain / 100000.0f);
224  av_log(ctx, AV_LOG_INFO, ", ");
225 }
226 
227 static void print_peak(void *ctx, const char *str, uint32_t peak)
228 {
229  av_log(ctx, AV_LOG_INFO, "%s - ", str);
230  if (!peak)
231  av_log(ctx, AV_LOG_INFO, "unknown");
232  else
233  av_log(ctx, AV_LOG_INFO, "%f", (float) peak / UINT32_MAX);
234  av_log(ctx, AV_LOG_INFO, ", ");
235 }
236 
237 static void dump_replaygain(void *ctx, AVPacketSideData *sd)
238 {
239  AVReplayGain *rg;
240 
241  if (sd->size < sizeof(*rg)) {
242  av_log(ctx, AV_LOG_INFO, "invalid data");
243  return;
244  }
245  rg = (AVReplayGain*)sd->data;
246 
247  print_gain(ctx, "track gain", rg->track_gain);
248  print_peak(ctx, "track peak", rg->track_peak);
249  print_gain(ctx, "album gain", rg->album_gain);
250  print_peak(ctx, "album peak", rg->album_peak);
251 }
252 
253 static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
254 {
255  AVStereo3D *stereo;
256 
257  if (sd->size < sizeof(*stereo)) {
258  av_log(ctx, AV_LOG_INFO, "invalid data");
259  return;
260  }
261 
262  stereo = (AVStereo3D *)sd->data;
263 
264  av_log(ctx, AV_LOG_INFO, "%s", av_stereo3d_type_name(stereo->type));
265 
266  if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
267  av_log(ctx, AV_LOG_INFO, " (inverted)");
268 }
269 
271 {
272  enum AVAudioServiceType *ast = (enum AVAudioServiceType *)sd->data;
273 
274  if (sd->size < sizeof(*ast)) {
275  av_log(ctx, AV_LOG_INFO, "invalid data");
276  return;
277  }
278 
279  switch (*ast) {
281  av_log(ctx, AV_LOG_INFO, "main");
282  break;
284  av_log(ctx, AV_LOG_INFO, "effects");
285  break;
287  av_log(ctx, AV_LOG_INFO, "visually impaired");
288  break;
290  av_log(ctx, AV_LOG_INFO, "hearing impaired");
291  break;
293  av_log(ctx, AV_LOG_INFO, "dialogue");
294  break;
296  av_log(ctx, AV_LOG_INFO, "commentary");
297  break;
299  av_log(ctx, AV_LOG_INFO, "emergency");
300  break;
302  av_log(ctx, AV_LOG_INFO, "voice over");
303  break;
305  av_log(ctx, AV_LOG_INFO, "karaoke");
306  break;
307  default:
308  av_log(ctx, AV_LOG_WARNING, "unknown");
309  break;
310  }
311 }
312 
313 static void dump_cpb(void *ctx, AVPacketSideData *sd)
314 {
315  AVCPBProperties *cpb = (AVCPBProperties *)sd->data;
316 
317  if (sd->size < sizeof(*cpb)) {
318  av_log(ctx, AV_LOG_INFO, "invalid data");
319  return;
320  }
321 
322  av_log(ctx, AV_LOG_INFO,
323  "bitrate max/min/avg: %d/%d/%d buffer size: %d vbv_delay: %"PRId64,
324  cpb->max_bitrate, cpb->min_bitrate, cpb->avg_bitrate,
325  cpb->buffer_size,
326  cpb->vbv_delay);
327 }
328 
331  av_log(ctx, AV_LOG_INFO, "Mastering Display Metadata, "
332  "has_primaries:%d has_luminance:%d "
333  "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f) "
334  "min_luminance=%f, max_luminance=%f",
335  metadata->has_primaries, metadata->has_luminance,
336  av_q2d(metadata->display_primaries[0][0]),
337  av_q2d(metadata->display_primaries[0][1]),
338  av_q2d(metadata->display_primaries[1][0]),
339  av_q2d(metadata->display_primaries[1][1]),
340  av_q2d(metadata->display_primaries[2][0]),
341  av_q2d(metadata->display_primaries[2][1]),
342  av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1]),
343  av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance));
344 }
345 
347 {
349  av_log(ctx, AV_LOG_INFO, "Content Light Level Metadata, "
350  "MaxCLL=%d, MaxFALL=%d",
351  metadata->MaxCLL, metadata->MaxFALL);
352 }
353 
355 {
356  AVSphericalMapping *spherical = (AVSphericalMapping *)sd->data;
357  double yaw, pitch, roll;
358 
359  if (sd->size < sizeof(*spherical)) {
360  av_log(ctx, AV_LOG_INFO, "invalid data");
361  return;
362  }
363 
364  av_log(ctx, AV_LOG_INFO, "%s ", av_spherical_projection_name(spherical->projection));
365 
366  yaw = ((double)spherical->yaw) / (1 << 16);
367  pitch = ((double)spherical->pitch) / (1 << 16);
368  roll = ((double)spherical->roll) / (1 << 16);
369  av_log(ctx, AV_LOG_INFO, "(%f/%f/%f) ", yaw, pitch, roll);
370 
371  if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
372  size_t l, t, r, b;
373  av_spherical_tile_bounds(spherical, par->width, par->height,
374  &l, &t, &r, &b);
375  av_log(ctx, AV_LOG_INFO,
377  l, t, r, b);
378  } else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
379  av_log(ctx, AV_LOG_INFO, "[pad %"PRIu32"] ", spherical->padding);
380  }
381 }
382 
383 static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
384 {
385  int i;
386 
387  if (st->nb_side_data)
388  av_log(ctx, AV_LOG_INFO, "%sSide data:\n", indent);
389 
390  for (i = 0; i < st->nb_side_data; i++) {
391  AVPacketSideData sd = st->side_data[i];
392  av_log(ctx, AV_LOG_INFO, "%s ", indent);
393 
394  switch (sd.type) {
395  case AV_PKT_DATA_PALETTE:
396  av_log(ctx, AV_LOG_INFO, "palette");
397  break;
399  av_log(ctx, AV_LOG_INFO, "new extradata");
400  break;
402  av_log(ctx, AV_LOG_INFO, "paramchange: ");
403  dump_paramchange(ctx, &sd);
404  break;
406  av_log(ctx, AV_LOG_INFO, "H.263 macroblock info");
407  break;
409  av_log(ctx, AV_LOG_INFO, "replaygain: ");
410  dump_replaygain(ctx, &sd);
411  break;
413  av_log(ctx, AV_LOG_INFO, "displaymatrix: rotation of %.2f degrees",
415  break;
417  av_log(ctx, AV_LOG_INFO, "stereo3d: ");
418  dump_stereo3d(ctx, &sd);
419  break;
421  av_log(ctx, AV_LOG_INFO, "audio service type: ");
422  dump_audioservicetype(ctx, &sd);
423  break;
425  av_log(ctx, AV_LOG_INFO, "quality factor: %"PRId32", pict_type: %c",
427  break;
429  av_log(ctx, AV_LOG_INFO, "cpb: ");
430  dump_cpb(ctx, &sd);
431  break;
434  break;
436  av_log(ctx, AV_LOG_INFO, "spherical: ");
437  dump_spherical(ctx, st->codecpar, &sd);
438  break;
440  dump_content_light_metadata(ctx, &sd);
441  break;
442  default:
443  av_log(ctx, AV_LOG_INFO,
444  "unknown side data type %d (%d bytes)", sd.type, sd.size);
445  break;
446  }
447 
448  av_log(ctx, AV_LOG_INFO, "\n");
449  }
450 }
451 
452 /* "user interface" functions */
453 static void dump_stream_format(AVFormatContext *ic, int i,
454  int index, int is_output)
455 {
456  char buf[256];
457  int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
458  AVStream *st = ic->streams[i];
459  AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
460  char *separator = ic->dump_separator;
461  AVCodecContext *avctx;
462  int ret;
463 
464  avctx = avcodec_alloc_context3(NULL);
465  if (!avctx)
466  return;
467 
468  ret = avcodec_parameters_to_context(avctx, st->codecpar);
469  if (ret < 0) {
470  avcodec_free_context(&avctx);
471  return;
472  }
473 
474  // Fields which are missing from AVCodecParameters need to be taken from the AVCodecContext
475  avctx->properties = st->codec->properties;
476  avctx->codec = st->codec->codec;
477  avctx->qmin = st->codec->qmin;
478  avctx->qmax = st->codec->qmax;
479  avctx->coded_width = st->codec->coded_width;
480  avctx->coded_height = st->codec->coded_height;
481 
482  if (separator)
483  av_opt_set(avctx, "dump_separator", separator, 0);
484  avcodec_string(buf, sizeof(buf), avctx, is_output);
485  avcodec_free_context(&avctx);
486 
487  av_log(NULL, AV_LOG_INFO, " Stream #%d:%d", index, i);
488 
489  /* the pid is an important information, so we display it */
490  /* XXX: add a generic system */
491  if (flags & AVFMT_SHOW_IDS)
492  av_log(NULL, AV_LOG_INFO, "[0x%x]", st->id);
493  if (lang)
494  av_log(NULL, AV_LOG_INFO, "(%s)", lang->value);
495  av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames,
496  st->time_base.num, st->time_base.den);
497  av_log(NULL, AV_LOG_INFO, ": %s", buf);
498 
499  if (st->sample_aspect_ratio.num &&
501  AVRational display_aspect_ratio;
502  av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
503  st->codecpar->width * (int64_t)st->sample_aspect_ratio.num,
504  st->codecpar->height * (int64_t)st->sample_aspect_ratio.den,
505  1024 * 1024);
506  av_log(NULL, AV_LOG_INFO, ", SAR %d:%d DAR %d:%d",
508  display_aspect_ratio.num, display_aspect_ratio.den);
509  }
510 
511  if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
512  int fps = st->avg_frame_rate.den && st->avg_frame_rate.num;
513  int tbr = st->r_frame_rate.den && st->r_frame_rate.num;
514  int tbn = st->time_base.den && st->time_base.num;
515  int tbc = st->codec->time_base.den && st->codec->time_base.num;
516 
517  if (fps || tbr || tbn || tbc)
518  av_log(NULL, AV_LOG_INFO, "%s", separator);
519 
520  if (fps)
521  print_fps(av_q2d(st->avg_frame_rate), tbr || tbn || tbc ? "fps, " : "fps");
522  if (tbr)
523  print_fps(av_q2d(st->r_frame_rate), tbn || tbc ? "tbr, " : "tbr");
524  if (tbn)
525  print_fps(1 / av_q2d(st->time_base), tbc ? "tbn, " : "tbn");
526  if (tbc)
527  print_fps(1 / av_q2d(st->codec->time_base), "tbc");
528  }
529 
531  av_log(NULL, AV_LOG_INFO, " (default)");
533  av_log(NULL, AV_LOG_INFO, " (dub)");
535  av_log(NULL, AV_LOG_INFO, " (original)");
537  av_log(NULL, AV_LOG_INFO, " (comment)");
539  av_log(NULL, AV_LOG_INFO, " (lyrics)");
541  av_log(NULL, AV_LOG_INFO, " (karaoke)");
543  av_log(NULL, AV_LOG_INFO, " (forced)");
545  av_log(NULL, AV_LOG_INFO, " (hearing impaired)");
547  av_log(NULL, AV_LOG_INFO, " (visual impaired)");
549  av_log(NULL, AV_LOG_INFO, " (clean effects)");
551  av_log(NULL, AV_LOG_INFO, " (descriptions)");
553  av_log(NULL, AV_LOG_INFO, " (dependent)");
555  av_log(NULL, AV_LOG_INFO, " (still image)");
556  av_log(NULL, AV_LOG_INFO, "\n");
557 
558  dump_metadata(NULL, st->metadata, " ");
559 
560  dump_sidedata(NULL, st, " ");
561 }
562 
564  const char *url, int is_output)
565 {
566  int i;
567  uint8_t *printed = ic->nb_streams ? av_mallocz(ic->nb_streams) : NULL;
568  if (ic->nb_streams && !printed)
569  return;
570 
571  av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n",
572  is_output ? "Output" : "Input",
573  index,
574  is_output ? ic->oformat->name : ic->iformat->name,
575  is_output ? "to" : "from", url);
576  dump_metadata(NULL, ic->metadata, " ");
577 
578  if (!is_output) {
579  av_log(NULL, AV_LOG_INFO, " Duration: ");
580  if (ic->duration != AV_NOPTS_VALUE) {
581  int hours, mins, secs, us;
582  int64_t duration = ic->duration + (ic->duration <= INT64_MAX - 5000 ? 5000 : 0);
583  secs = duration / AV_TIME_BASE;
584  us = duration % AV_TIME_BASE;
585  mins = secs / 60;
586  secs %= 60;
587  hours = mins / 60;
588  mins %= 60;
589  av_log(NULL, AV_LOG_INFO, "%02d:%02d:%02d.%02d", hours, mins, secs,
590  (100 * us) / AV_TIME_BASE);
591  } else {
592  av_log(NULL, AV_LOG_INFO, "N/A");
593  }
594  if (ic->start_time != AV_NOPTS_VALUE) {
595  int secs, us;
596  av_log(NULL, AV_LOG_INFO, ", start: ");
597  secs = llabs(ic->start_time / AV_TIME_BASE);
598  us = llabs(ic->start_time % AV_TIME_BASE);
599  av_log(NULL, AV_LOG_INFO, "%s%d.%06d",
600  ic->start_time >= 0 ? "" : "-",
601  secs,
602  (int) av_rescale(us, 1000000, AV_TIME_BASE));
603  }
604  av_log(NULL, AV_LOG_INFO, ", bitrate: ");
605  if (ic->bit_rate)
606  av_log(NULL, AV_LOG_INFO, "%"PRId64" kb/s", ic->bit_rate / 1000);
607  else
608  av_log(NULL, AV_LOG_INFO, "N/A");
609  av_log(NULL, AV_LOG_INFO, "\n");
610  }
611 
612  for (i = 0; i < ic->nb_chapters; i++) {
613  AVChapter *ch = ic->chapters[i];
614  av_log(NULL, AV_LOG_INFO, " Chapter #%d:%d: ", index, i);
616  "start %f, ", ch->start * av_q2d(ch->time_base));
618  "end %f\n", ch->end * av_q2d(ch->time_base));
619 
620  dump_metadata(NULL, ch->metadata, " ");
621  }
622 
623  if (ic->nb_programs) {
624  int j, k, total = 0;
625  for (j = 0; j < ic->nb_programs; j++) {
627  "name", NULL, 0);
628  av_log(NULL, AV_LOG_INFO, " Program %d %s\n", ic->programs[j]->id,
629  name ? name->value : "");
630  dump_metadata(NULL, ic->programs[j]->metadata, " ");
631  for (k = 0; k < ic->programs[j]->nb_stream_indexes; k++) {
633  index, is_output);
634  printed[ic->programs[j]->stream_index[k]] = 1;
635  }
636  total += ic->programs[j]->nb_stream_indexes;
637  }
638  if (total < ic->nb_streams)
639  av_log(NULL, AV_LOG_INFO, " No Program\n");
640  }
641 
642  for (i = 0; i < ic->nb_streams; i++)
643  if (!printed[i])
644  dump_stream_format(ic, i, index, is_output);
645 
646  av_free(printed);
647 }
unsigned int nb_chapters
Number of chapters in AVChapter array.
Definition: avformat.h:1580
int32_t pitch
Rotation around the right vector [-90, 90].
Definition: spherical.h:127
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
Definition: stereo3d.h:167
#define NULL
Definition: coverity.c:32
const struct AVCodec * codec
Definition: avcodec.h:1542
void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st)
Send a nice dump of a packet to the specified file stream.
Definition: dump.c:108
unsigned MaxCLL
Max content light level (cd/m^2).
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
int coded_width
Bitstream width / height, may be different from width/height e.g.
Definition: avcodec.h:1721
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
static void dump_spherical(void *ctx, AVCodecParameters *par, AVPacketSideData *sd)
Definition: dump.c:354
int max_bitrate
Maximum bitrate of the stream, in bits per second.
Definition: avcodec.h:1113
AVRational sample_aspect_ratio
Video only.
Definition: avcodec.h:3976
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
Definition: avcodec.h:1226
channels
Definition: aptx.c:30
Video represents a portion of a sphere mapped on a flat surface using equirectangular projection...
Definition: spherical.h:72
AVRational white_point[2]
CIE 1931 xy chromaticity coords of white point.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
Definition: avformat.h:936
uint8_t * dump_separator
dump format separator.
Definition: avformat.h:1876
int num
Numerator.
Definition: rational.h:59
int size
Definition: avcodec.h:1446
int av_dict_count(const AVDictionary *m)
Get number of entries in dictionary.
Definition: dict.c:35
const char * b
Definition: vf_curves.c:116
#define us(width, name, range_min, range_max, subs,...)
Definition: cbs_h2645.c:261
#define AV_DISPOSITION_DUB
Definition: avformat.h:820
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
Definition: avformat.h:1473
#define AV_DISPOSITION_HEARING_IMPAIRED
stream for hearing impaired audiences
Definition: avformat.h:832
int has_primaries
Flag indicating whether the display primaries (and white point) are set.
#define AV_DISPOSITION_CLEAN_EFFECTS
stream without voice
Definition: avformat.h:834
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:236
uint64_t_TMPL AV_RL64
Definition: bytestream.h:87
AVPacketSideData * side_data
An array of side data that applies to the whole stream (i.e.
Definition: avformat.h:976
static AVPacket pkt
AVDictionary * metadata
Definition: avformat.h:1312
static void dump_audioservicetype(void *ctx, AVPacketSideData *sd)
Definition: dump.c:270
An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of structures with info about macroblo...
Definition: avcodec.h:1205
This struct describes the properties of an encoded stream.
Definition: avcodec.h:3892
int min_bitrate
Minimum bitrate of the stream, in bits per second.
Definition: avcodec.h:1118
uint32_t track_peak
Peak track amplitude, with 100000 representing full scale (but values may overflow).
Definition: replaygain.h:39
#define AV_DISPOSITION_KARAOKE
Definition: avformat.h:824
Mastering display metadata (based on SMPTE-2086:2014).
Definition: avcodec.h:1334
#define AVFMT_SHOW_IDS
Show format stream IDs numbers.
Definition: avformat.h:467
Format I/O context.
Definition: avformat.h:1351
static void pkt_dump_internal(void *avcl, FILE *f, int level, const AVPacket *pkt, int dump_payload, AVRational time_base)
Definition: dump.c:84
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:1138
unsigned int nb_stream_indexes
Definition: avformat.h:1273
int flags
can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS, AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH, AVFMT_TS_NONSTRICT, AVFMT_TS_NEGATIVE
Definition: avformat.h:526
uint8_t
static int nb_streams
Definition: ffprobe.c:276
int width
Video only.
Definition: avcodec.h:3966
AVOptions.
int flags
Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH, AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS.
Definition: avformat.h:661
Stereo 3D type: this structure describes how two videos are packed within a single video surface...
Definition: stereo3d.h:176
#define f(width, name)
Definition: cbs_vp9.c:255
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: avcodec.h:1463
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition: avcodec.h:1220
int id
Format-specific stream ID.
Definition: avformat.h:881
void av_spherical_tile_bounds(const AVSphericalMapping *map, size_t width, size_t height, size_t *left, size_t *top, size_t *right, size_t *bottom)
Convert the bounding fields from an AVSphericalVideo from 0.32 fixed point to pixels.
Definition: spherical.c:36
int nb_side_data
The number of elements in the AVStream.side_data array.
Definition: avformat.h:980
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1419
int64_t duration
Definition: movenc.c:63
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:2088
void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload, const AVStream *st)
Send a nice dump of a packet to the log.
Definition: dump.c:113
const char * av_stereo3d_type_name(unsigned int type)
Provide a human-readable name of a given stereo3d type.
Definition: stereo3d.c:57
#define height
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
Definition: dict.c:40
#define AV_DISPOSITION_DEPENDENT
dependent audio stream (mix_type=0 in mpegts)
Definition: avformat.h:857
uint8_t * data
Definition: avcodec.h:1445
static double av_q2d(AVRational a)
Convert an AVRational to a double.
Definition: rational.h:104
uint32_t tag
Definition: movenc.c:1483
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
Definition: utils.c:88
#define lrintf(x)
Definition: libm_mips.h:70
uint8_t * data
Definition: avcodec.h:1389
int buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
Definition: avcodec.h:1129
ptrdiff_t size
Definition: opengl_enc.c:101
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
int has_luminance
Flag indicating whether the luminance (min_ and max_) have been set.
unsigned int * stream_index
Definition: avformat.h:1272
int32_t album_gain
Same as track_gain, but for the whole album.
Definition: replaygain.h:43
#define av_log(a,...)
static void print_fps(double d, const char *postfix)
Definition: dump.c:120
struct AVOutputFormat * oformat
The output container format.
Definition: avformat.h:1370
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: avcodec.h:1477
static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
Definition: dump.c:133
void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)
Print detailed information about the input or output format, such as duration, bitrate, streams, container, programs, metadata, side data, codec and time base.
Definition: dump.c:563
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
AVDictionary * metadata
Metadata that applies to the whole file.
Definition: avformat.h:1591
int flags
Additional information about the frame packing.
Definition: stereo3d.h:185
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette...
Definition: avcodec.h:1158
void av_hex_dump(FILE *f, const uint8_t *buf, int size)
Send a nice hexadecimal dump of a buffer to the specified file stream.
Definition: dump.c:74
AVAudioServiceType
Definition: avcodec.h:806
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
Definition: avcodec.h:1184
int qmax
maximum quantizer
Definition: avcodec.h:2378
Display matrix.
const char * r
Definition: vf_curves.c:114
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
unsigned int nb_programs
Definition: avformat.h:1530
enum AVMediaType codec_type
General type of the encoded data.
Definition: avcodec.h:3896
AVChapter ** chapters
Definition: avformat.h:1581
enum AVPacketSideDataType type
Definition: avcodec.h:1391
static void dump_cpb(void *ctx, AVPacketSideData *sd)
Definition: dump.c:313
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:947
AVRational max_luminance
Max luminance of mastering display (cd/m^2).
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
Definition: avstring.c:83
#define fail()
Definition: checkasm.h:117
int flags
A combination of AV_PKT_FLAG values.
Definition: avcodec.h:1451
#define AV_DISPOSITION_LYRICS
Definition: avformat.h:823
#define AV_DISPOSITION_FORCED
Track should be used during playback by default.
Definition: avformat.h:831
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:1407
Video frame is split into 6 faces of a cube, and arranged on a 3x2 layout.
Definition: spherical.h:65
audio channel layout utility functions
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
Definition: mathematics.c:129
Spherical video.
#define AV_TIME_BASE
Internal time base represented as integer.
Definition: avutil.h:254
#define FFMIN(a, b)
Definition: common.h:96
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
Definition: options.c:156
This side data contains quality related information from the encoder.
Definition: avcodec.h:1244
AVRational min_luminance
Min luminance of mastering display (cd/m^2).
#define width
#define HEXDUMP_PRINT(...)
Definition: dump.c:39
static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_output)
Definition: dump.c:453
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
Definition: avcodec.h:1340
const char * name
Definition: avformat.h:507
int32_t
AVFormatContext * ctx
Definition: movenc.c:48
static void dump_paramchange(void *ctx, AVPacketSideData *sd)
Definition: dump.c:160
int32_t yaw
Rotation around the up vector [-180, 180].
Definition: spherical.h:126
AVDictionary * metadata
Definition: avformat.h:938
#define AV_DISPOSITION_VISUAL_IMPAIRED
stream for visual impaired audiences
Definition: avformat.h:833
uint32_t padding
Number of pixels to pad from the edge of each cube face.
Definition: spherical.h:182
Stream structure.
Definition: avformat.h:874
int64_t end
chapter start/end time in time_base units
Definition: avformat.h:1311
Content light level (based on CTA-861.3).
Definition: avcodec.h:1347
This structure describes the bitrate properties of an encoded bitstream.
Definition: avcodec.h:1108
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
Definition: avcodec.h:1167
#define AV_DISPOSITION_DEFAULT
Definition: avformat.h:819
sample_rate
enum AVStereo3DType type
How views are packed within the video.
Definition: stereo3d.h:180
#define AV_LOG_INFO
Standard information.
Definition: log.h:187
#define AV_DISPOSITION_DESCRIPTIONS
Definition: avformat.h:855
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer...
Definition: options.c:171
static void dump_replaygain(void *ctx, AVPacketSideData *sd)
Definition: dump.c:237
main external API structure.
Definition: avcodec.h:1533
int qmin
minimum quantizer
Definition: avcodec.h:2371
void * buf
Definition: avisynth_c.h:690
int coded_height
Definition: avcodec.h:1721
int index
Definition: gxfenc.c:89
int32_t roll
Rotation around the forward vector [-180, 180].
Definition: spherical.h:128
Rational number (pair of numerator and denominator).
Definition: rational.h:58
Mastering display metadata capable of representing the color volume of the display used to master the...
static void dump_content_light_metadata(void *ctx, AVPacketSideData *sd)
Definition: dump.c:346
static void hex_dump_internal(void *avcl, FILE *f, int level, const uint8_t *buf, int size)
Definition: dump.c:47
This structure describes how to handle spherical videos, outlining information about projection...
Definition: spherical.h:82
AVRational display_primaries[3][2]
CIE 1931 xy chromaticity coords of color primaries (r, g, b order).
AVDictionary * metadata
Definition: avformat.h:1274
#define SIZE_SPECIFIER
Definition: internal.h:262
#define flags(name, subs,...)
Definition: cbs_av1.c:596
This side data should be associated with an audio stream and contains ReplayGain information in form ...
Definition: avcodec.h:1211
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds. ...
Definition: avformat.h:1456
uint8_t level
Definition: svq3.c:207
int64_t start
Definition: avformat.h:1311
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
Definition: rational.h:89
Main libavformat public API header.
static void print_peak(void *ctx, const char *str, uint32_t peak)
Definition: dump.c:227
if(ret< 0)
Definition: vf_mcdeint.c:279
enum AVSphericalProjection projection
Projection type.
Definition: spherical.h:86
static void print_gain(void *ctx, const char *str, int32_t gain)
Definition: dump.c:217
static double c[64]
int disposition
AV_DISPOSITION_* bit field.
Definition: avformat.h:927
#define AV_DISPOSITION_STILL_IMAGE
still images in video stream (still_picture_flag=1 in mpegts)
Definition: avformat.h:858
Stereoscopic video.
AVRational time_base
time base in which the start/end timestamps are specified
Definition: avformat.h:1310
unsigned properties
Properties of the stream that gets decoded.
Definition: avcodec.h:3178
char * key
Definition: dict.h:86
int den
Denominator.
Definition: rational.h:60
struct AVInputFormat * iformat
The input container format.
Definition: avformat.h:1363
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
Definition: utils.c:1175
uint32_t album_peak
Same as track_peak, but for the whole album,.
Definition: replaygain.h:47
#define av_free(p)
const char * av_get_channel_name(uint64_t channel)
Get the name of a given channel.
char * value
Definition: dict.h:87
int len
int avg_bitrate
Average bitrate of the stream, in bits per second.
Definition: avcodec.h:1123
int codec_info_nb_frames
Number of frames that have been demuxed during avformat_find_stream_info()
Definition: avformat.h:1089
This side data corresponds to the AVCPBProperties struct.
Definition: avcodec.h:1257
#define AV_DISPOSITION_COMMENT
Definition: avformat.h:822
uint64_t layout
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
Definition: avcodec.h:1444
double av_display_rotation_get(const int32_t matrix[9])
Extract the rotation component of the transformation matrix.
Definition: display.c:34
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
Definition: avformat.h:1466
static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
Definition: dump.c:253
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:647
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key, ignoring the suffix of the found key string.
Definition: dict.h:70
int32_t track_gain
Track replay gain in microbels (divide by 100000 to get the value in dB).
Definition: replaygain.h:34
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:1021
static void dump_mastering_display_metadata(void *ctx, AVPacketSideData *sd)
Definition: dump.c:329
void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
Send a nice hexadecimal dump of a buffer to the log.
Definition: dump.c:79
int stream_index
Definition: avcodec.h:1447
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
Definition: avformat.h:903
AVRational r_frame_rate
Real base framerate of the stream.
Definition: avformat.h:998
ReplayGain information (see http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification).
Definition: replaygain.h:29
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:87
unsigned MaxFALL
Max average light level per frame (cd/m^2).
This structure stores compressed data.
Definition: avcodec.h:1422
const char * av_spherical_projection_name(enum AVSphericalProjection projection)
Provide a human-readable name of a given AVSphericalProjection.
Definition: spherical.c:60
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
Definition: opt.c:449
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: avcodec.h:1438
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
AVProgram ** programs
Definition: avformat.h:1531
#define AV_DISPOSITION_ORIGINAL
Definition: avformat.h:821
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(constuint8_t *) pi-0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(constint16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(constint32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(constint64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(constfloat *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(constdouble *) pi *(INT64_C(1)<< 63)))#defineFMT_PAIR_FUNC(out, in) staticconv_func_type *constfmt_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),};staticvoidcpy1(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, len);}staticvoidcpy2(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 2 *len);}staticvoidcpy4(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 4 *len);}staticvoidcpy8(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 8 *len);}AudioConvert *swri_audio_convert_alloc(enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, constint *ch_map, intflags){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) returnNULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) returnNULL;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)){case1:ctx->simd_f=cpy1;break;case2:ctx->simd_f=cpy2;break;case4:ctx->simd_f=cpy4;break;case8: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);returnctx;}voidswri_audio_convert_free(AudioConvert **ctx){av_freep(ctx);}intswri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, intlen){intch;intoff=0;constintos=(out->planar?1:out->ch_count)*out->bps;unsignedmisaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask){intplanes=in->planar?in->ch_count:1;unsignedm=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){intplanes=out->planar?out->ch_count:1;unsignedm=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){intplanes=out->planar?out->ch_count:1;for(ch=0;ch< planes;ch++){ctx->simd_f(out-> ch ch
Definition: audioconvert.c:56
const char * name
Definition: opengl_enc.c:103
static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
Definition: dump.c:383
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.
Definition: avcodec.h:1232
static uint8_t tmp[11]
Definition: aes_ctr.c:26