FFmpeg
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/dovi_meta.h"
31 #include "libavutil/mathematics.h"
32 #include "libavutil/opt.h"
33 #include "libavutil/avstring.h"
34 #include "libavutil/replaygain.h"
35 #include "libavutil/spherical.h"
36 #include "libavutil/stereo3d.h"
37 
38 #include "avformat.h"
39 
40 #define HEXDUMP_PRINT(...) \
41  do { \
42  if (!f) \
43  av_log(avcl, level, __VA_ARGS__); \
44  else \
45  fprintf(f, __VA_ARGS__); \
46  } while (0)
47 
48 static void hex_dump_internal(void *avcl, FILE *f, int level,
49  const uint8_t *buf, int size)
50 {
51  int len, i, j, c;
52 
53  for (i = 0; i < size; i += 16) {
54  len = size - i;
55  if (len > 16)
56  len = 16;
57  HEXDUMP_PRINT("%08x ", i);
58  for (j = 0; j < 16; j++) {
59  if (j < len)
60  HEXDUMP_PRINT(" %02x", buf[i + j]);
61  else
62  HEXDUMP_PRINT(" ");
63  }
64  HEXDUMP_PRINT(" ");
65  for (j = 0; j < len; j++) {
66  c = buf[i + j];
67  if (c < ' ' || c > '~')
68  c = '.';
69  HEXDUMP_PRINT("%c", c);
70  }
71  HEXDUMP_PRINT("\n");
72  }
73 }
74 
75 void av_hex_dump(FILE *f, const uint8_t *buf, int size)
76 {
77  hex_dump_internal(NULL, f, 0, buf, size);
78 }
79 
80 void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
81 {
82  hex_dump_internal(avcl, NULL, level, buf, size);
83 }
84 
85 static void pkt_dump_internal(void *avcl, FILE *f, int level, const AVPacket *pkt,
86  int dump_payload, AVRational time_base)
87 {
88  HEXDUMP_PRINT("stream #%d:\n", pkt->stream_index);
89  HEXDUMP_PRINT(" keyframe=%d\n", (pkt->flags & AV_PKT_FLAG_KEY) != 0);
90  HEXDUMP_PRINT(" duration=%0.3f\n", pkt->duration * av_q2d(time_base));
91  /* DTS is _always_ valid after av_read_frame() */
92  HEXDUMP_PRINT(" dts=");
93  if (pkt->dts == AV_NOPTS_VALUE)
94  HEXDUMP_PRINT("N/A");
95  else
96  HEXDUMP_PRINT("%0.3f", pkt->dts * av_q2d(time_base));
97  /* PTS may not be known if B-frames are present. */
98  HEXDUMP_PRINT(" pts=");
99  if (pkt->pts == AV_NOPTS_VALUE)
100  HEXDUMP_PRINT("N/A");
101  else
102  HEXDUMP_PRINT("%0.3f", pkt->pts * av_q2d(time_base));
103  HEXDUMP_PRINT("\n");
104  HEXDUMP_PRINT(" size=%d\n", pkt->size);
105  if (dump_payload)
106  hex_dump_internal(avcl, f, level, pkt->data, pkt->size);
107 }
108 
109 void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st)
110 {
111  pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base);
112 }
113 
114 void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload,
115  const AVStream *st)
116 {
117  pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base);
118 }
119 
120 
121 static void print_fps(double d, const char *postfix)
122 {
123  uint64_t v = lrintf(d * 100);
124  if (!v)
125  av_log(NULL, AV_LOG_INFO, "%1.4f %s", d, postfix);
126  else if (v % 100)
127  av_log(NULL, AV_LOG_INFO, "%3.2f %s", d, postfix);
128  else if (v % (100 * 1000))
129  av_log(NULL, AV_LOG_INFO, "%1.0f %s", d, postfix);
130  else
131  av_log(NULL, AV_LOG_INFO, "%1.0fk %s", d / 1000, postfix);
132 }
133 
134 static void dump_metadata(void *ctx, const AVDictionary *m, const char *indent)
135 {
136  if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0))) {
137  const AVDictionaryEntry *tag = NULL;
138 
139  av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent);
140  while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX)))
141  if (strcmp("language", tag->key)) {
142  const char *p = tag->value;
143  av_log(ctx, AV_LOG_INFO,
144  "%s %-16s: ", indent, tag->key);
145  while (*p) {
146  char tmp[256];
147  size_t len = strcspn(p, "\x8\xa\xb\xc\xd");
148  av_strlcpy(tmp, p, FFMIN(sizeof(tmp), len+1));
149  av_log(ctx, AV_LOG_INFO, "%s", tmp);
150  p += len;
151  if (*p == 0xd) av_log(ctx, AV_LOG_INFO, " ");
152  if (*p == 0xa) av_log(ctx, AV_LOG_INFO, "\n%s %-16s: ", indent, "");
153  if (*p) p++;
154  }
155  av_log(ctx, AV_LOG_INFO, "\n");
156  }
157  }
158 }
159 
160 /* param change side data*/
161 static void dump_paramchange(void *ctx, const AVPacketSideData *sd)
162 {
163  int size = sd->size;
164  const uint8_t *data = sd->data;
165  uint32_t flags, channels, sample_rate, width, height;
166  uint64_t layout;
167 
168  if (!data || sd->size < 4)
169  goto fail;
170 
171  flags = AV_RL32(data);
172  data += 4;
173  size -= 4;
174 
176  if (size < 4)
177  goto fail;
178  channels = AV_RL32(data);
179  data += 4;
180  size -= 4;
181  av_log(ctx, AV_LOG_INFO, "channel count %"PRIu32", ", channels);
182  }
184  if (size < 8)
185  goto fail;
186  layout = AV_RL64(data);
187  data += 8;
188  size -= 8;
189  av_log(ctx, AV_LOG_INFO,
190  "channel layout: %s, ", av_get_channel_name(layout));
191  }
193  if (size < 4)
194  goto fail;
195  sample_rate = AV_RL32(data);
196  data += 4;
197  size -= 4;
198  av_log(ctx, AV_LOG_INFO, "sample_rate %"PRIu32", ", sample_rate);
199  }
201  if (size < 8)
202  goto fail;
203  width = AV_RL32(data);
204  data += 4;
205  size -= 4;
206  height = AV_RL32(data);
207  data += 4;
208  size -= 4;
209  av_log(ctx, AV_LOG_INFO, "width %"PRIu32" height %"PRIu32, width, height);
210  }
211 
212  return;
213 fail:
214  av_log(ctx, AV_LOG_ERROR, "unknown param\n");
215 }
216 
217 /* replaygain side data*/
218 static void print_gain(void *ctx, const char *str, int32_t gain)
219 {
220  av_log(ctx, AV_LOG_INFO, "%s - ", str);
221  if (gain == INT32_MIN)
222  av_log(ctx, AV_LOG_INFO, "unknown");
223  else
224  av_log(ctx, AV_LOG_INFO, "%f", gain / 100000.0f);
225  av_log(ctx, AV_LOG_INFO, ", ");
226 }
227 
228 static void print_peak(void *ctx, const char *str, uint32_t peak)
229 {
230  av_log(ctx, AV_LOG_INFO, "%s - ", str);
231  if (!peak)
232  av_log(ctx, AV_LOG_INFO, "unknown");
233  else
234  av_log(ctx, AV_LOG_INFO, "%f", (float) peak / UINT32_MAX);
235  av_log(ctx, AV_LOG_INFO, ", ");
236 }
237 
238 static void dump_replaygain(void *ctx, const AVPacketSideData *sd)
239 {
240  const AVReplayGain *rg;
241 
242  if (sd->size < sizeof(*rg)) {
243  av_log(ctx, AV_LOG_ERROR, "invalid data\n");
244  return;
245  }
246  rg = (const AVReplayGain *)sd->data;
247 
248  print_gain(ctx, "track gain", rg->track_gain);
249  print_peak(ctx, "track peak", rg->track_peak);
250  print_gain(ctx, "album gain", rg->album_gain);
251  print_peak(ctx, "album peak", rg->album_peak);
252 }
253 
254 static void dump_stereo3d(void *ctx, const AVPacketSideData *sd)
255 {
256  const AVStereo3D *stereo;
257 
258  if (sd->size < sizeof(*stereo)) {
259  av_log(ctx, AV_LOG_ERROR, "invalid data\n");
260  return;
261  }
262 
263  stereo = (const AVStereo3D *)sd->data;
264 
265  av_log(ctx, AV_LOG_INFO, "%s", av_stereo3d_type_name(stereo->type));
266 
267  if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
268  av_log(ctx, AV_LOG_INFO, " (inverted)");
269 }
270 
271 static void dump_audioservicetype(void *ctx, const AVPacketSideData *sd)
272 {
273  const enum AVAudioServiceType *ast = (const enum AVAudioServiceType *)sd->data;
274 
275  if (sd->size < sizeof(*ast)) {
276  av_log(ctx, AV_LOG_ERROR, "invalid data\n");
277  return;
278  }
279 
280  switch (*ast) {
282  av_log(ctx, AV_LOG_INFO, "main");
283  break;
285  av_log(ctx, AV_LOG_INFO, "effects");
286  break;
288  av_log(ctx, AV_LOG_INFO, "visually impaired");
289  break;
291  av_log(ctx, AV_LOG_INFO, "hearing impaired");
292  break;
294  av_log(ctx, AV_LOG_INFO, "dialogue");
295  break;
297  av_log(ctx, AV_LOG_INFO, "commentary");
298  break;
300  av_log(ctx, AV_LOG_INFO, "emergency");
301  break;
303  av_log(ctx, AV_LOG_INFO, "voice over");
304  break;
306  av_log(ctx, AV_LOG_INFO, "karaoke");
307  break;
308  default:
309  av_log(ctx, AV_LOG_WARNING, "unknown");
310  break;
311  }
312 }
313 
314 static void dump_cpb(void *ctx, const AVPacketSideData *sd)
315 {
316  const AVCPBProperties *cpb = (const AVCPBProperties *)sd->data;
317 
318  if (sd->size < sizeof(*cpb)) {
319  av_log(ctx, AV_LOG_ERROR, "invalid data\n");
320  return;
321  }
322 
323  av_log(ctx, AV_LOG_INFO,
325  "bitrate max/min/avg: %d/%d/%d buffer size: %d ",
326 #else
327  "bitrate max/min/avg: %"PRId64"/%"PRId64"/%"PRId64" buffer size: %d ",
328 #endif
329  cpb->max_bitrate, cpb->min_bitrate, cpb->avg_bitrate,
330  cpb->buffer_size);
331  if (cpb->vbv_delay == UINT64_MAX)
332  av_log(ctx, AV_LOG_INFO, "vbv_delay: N/A");
333  else
334  av_log(ctx, AV_LOG_INFO, "vbv_delay: %"PRIu64"", cpb->vbv_delay);
335 }
336 
338 {
339  const AVMasteringDisplayMetadata *metadata =
340  (const AVMasteringDisplayMetadata *)sd->data;
341  av_log(ctx, AV_LOG_INFO, "Mastering Display Metadata, "
342  "has_primaries:%d has_luminance:%d "
343  "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f) "
344  "min_luminance=%f, max_luminance=%f",
345  metadata->has_primaries, metadata->has_luminance,
346  av_q2d(metadata->display_primaries[0][0]),
347  av_q2d(metadata->display_primaries[0][1]),
348  av_q2d(metadata->display_primaries[1][0]),
349  av_q2d(metadata->display_primaries[1][1]),
350  av_q2d(metadata->display_primaries[2][0]),
351  av_q2d(metadata->display_primaries[2][1]),
352  av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1]),
353  av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance));
354 }
355 
356 static void dump_content_light_metadata(void *ctx, const AVPacketSideData *sd)
357 {
358  const AVContentLightMetadata *metadata =
359  (const AVContentLightMetadata *)sd->data;
360  av_log(ctx, AV_LOG_INFO, "Content Light Level Metadata, "
361  "MaxCLL=%d, MaxFALL=%d",
362  metadata->MaxCLL, metadata->MaxFALL);
363 }
364 
365 static void dump_spherical(void *ctx, const AVCodecParameters *par,
366  const AVPacketSideData *sd)
367 {
368  const AVSphericalMapping *spherical = (const AVSphericalMapping *)sd->data;
369  double yaw, pitch, roll;
370 
371  if (sd->size < sizeof(*spherical)) {
372  av_log(ctx, AV_LOG_ERROR, "invalid data\n");
373  return;
374  }
375 
376  av_log(ctx, AV_LOG_INFO, "%s ", av_spherical_projection_name(spherical->projection));
377 
378  yaw = ((double)spherical->yaw) / (1 << 16);
379  pitch = ((double)spherical->pitch) / (1 << 16);
380  roll = ((double)spherical->roll) / (1 << 16);
381  av_log(ctx, AV_LOG_INFO, "(%f/%f/%f) ", yaw, pitch, roll);
382 
383  if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
384  size_t l, t, r, b;
385  av_spherical_tile_bounds(spherical, par->width, par->height,
386  &l, &t, &r, &b);
387  av_log(ctx, AV_LOG_INFO,
389  l, t, r, b);
390  } else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
391  av_log(ctx, AV_LOG_INFO, "[pad %"PRIu32"] ", spherical->padding);
392  }
393 }
394 
395 static void dump_dovi_conf(void *ctx, const AVPacketSideData *sd)
396 {
399 
400  av_log(ctx, AV_LOG_INFO, "version: %d.%d, profile: %d, level: %d, "
401  "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d",
402  dovi->dv_version_major, dovi->dv_version_minor,
403  dovi->dv_profile, dovi->dv_level,
404  dovi->rpu_present_flag,
405  dovi->el_present_flag,
406  dovi->bl_present_flag,
408 }
409 
410 static void dump_sidedata(void *ctx, const AVStream *st, const char *indent)
411 {
412  int i;
413 
414  if (st->nb_side_data)
415  av_log(ctx, AV_LOG_INFO, "%sSide data:\n", indent);
416 
417  for (i = 0; i < st->nb_side_data; i++) {
418  const AVPacketSideData *sd = &st->side_data[i];
419  av_log(ctx, AV_LOG_INFO, "%s ", indent);
420 
421  switch (sd->type) {
422  case AV_PKT_DATA_PALETTE:
423  av_log(ctx, AV_LOG_INFO, "palette");
424  break;
426  av_log(ctx, AV_LOG_INFO, "new extradata");
427  break;
429  av_log(ctx, AV_LOG_INFO, "paramchange: ");
430  dump_paramchange(ctx, sd);
431  break;
433  av_log(ctx, AV_LOG_INFO, "H.263 macroblock info");
434  break;
436  av_log(ctx, AV_LOG_INFO, "replaygain: ");
437  dump_replaygain(ctx, sd);
438  break;
440  av_log(ctx, AV_LOG_INFO, "displaymatrix: rotation of %.2f degrees",
441  av_display_rotation_get((const int32_t *)sd->data));
442  break;
444  av_log(ctx, AV_LOG_INFO, "stereo3d: ");
445  dump_stereo3d(ctx, sd);
446  break;
448  av_log(ctx, AV_LOG_INFO, "audio service type: ");
449  dump_audioservicetype(ctx, sd);
450  break;
452  av_log(ctx, AV_LOG_INFO, "quality factor: %"PRId32", pict_type: %c",
453  AV_RL32(sd->data), av_get_picture_type_char(sd->data[4]));
454  break;
456  av_log(ctx, AV_LOG_INFO, "cpb: ");
457  dump_cpb(ctx, sd);
458  break;
461  break;
463  av_log(ctx, AV_LOG_INFO, "spherical: ");
464  dump_spherical(ctx, st->codecpar, sd);
465  break;
468  break;
470  av_log(ctx, AV_LOG_INFO, "ICC Profile");
471  break;
473  av_log(ctx, AV_LOG_INFO, "DOVI configuration record: ");
474  dump_dovi_conf(ctx, sd);
475  break;
476  default:
477  av_log(ctx, AV_LOG_INFO,
478  "unknown side data type %d (%d bytes)", sd->type, sd->size);
479  break;
480  }
481 
482  av_log(ctx, AV_LOG_INFO, "\n");
483  }
484 }
485 
486 /* "user interface" functions */
487 static void dump_stream_format(const AVFormatContext *ic, int i,
488  int index, int is_output)
489 {
490  char buf[256];
491  int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
492  const AVStream *st = ic->streams[i];
493  const AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
494  const char *separator = ic->dump_separator;
495  AVCodecContext *avctx;
496  int ret;
497 
498  avctx = avcodec_alloc_context3(NULL);
499  if (!avctx)
500  return;
501 
502  ret = avcodec_parameters_to_context(avctx, st->codecpar);
503  if (ret < 0) {
504  avcodec_free_context(&avctx);
505  return;
506  }
507 
508 #if FF_API_LAVF_AVCTX
510  // Fields which are missing from AVCodecParameters need to be taken from the AVCodecContext
511  avctx->properties = st->codec->properties;
512  avctx->codec = st->codec->codec;
513  avctx->qmin = st->codec->qmin;
514  avctx->qmax = st->codec->qmax;
515  avctx->coded_width = st->codec->coded_width;
516  avctx->coded_height = st->codec->coded_height;
518 #endif
519 
520  if (separator)
521  av_opt_set(avctx, "dump_separator", separator, 0);
522  avcodec_string(buf, sizeof(buf), avctx, is_output);
523  avcodec_free_context(&avctx);
524 
525  av_log(NULL, AV_LOG_INFO, " Stream #%d:%d", index, i);
526 
527  /* the pid is an important information, so we display it */
528  /* XXX: add a generic system */
529  if (flags & AVFMT_SHOW_IDS)
530  av_log(NULL, AV_LOG_INFO, "[0x%x]", st->id);
531  if (lang)
532  av_log(NULL, AV_LOG_INFO, "(%s)", lang->value);
533  av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames,
534  st->time_base.num, st->time_base.den);
535  av_log(NULL, AV_LOG_INFO, ": %s", buf);
536 
537  if (st->sample_aspect_ratio.num &&
539  AVRational display_aspect_ratio;
540  av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
541  st->codecpar->width * (int64_t)st->sample_aspect_ratio.num,
542  st->codecpar->height * (int64_t)st->sample_aspect_ratio.den,
543  1024 * 1024);
544  av_log(NULL, AV_LOG_INFO, ", SAR %d:%d DAR %d:%d",
546  display_aspect_ratio.num, display_aspect_ratio.den);
547  }
548 
549  if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
550  int fps = st->avg_frame_rate.den && st->avg_frame_rate.num;
551  int tbr = st->r_frame_rate.den && st->r_frame_rate.num;
552  int tbn = st->time_base.den && st->time_base.num;
553 #if FF_API_LAVF_AVCTX
555  int tbc = st->codec->time_base.den && st->codec->time_base.num;
557 #else
558  int tbc = 0;
559 #endif
560 
561  if (fps || tbr || tbn || tbc)
562  av_log(NULL, AV_LOG_INFO, "%s", separator);
563 
564  if (fps)
565  print_fps(av_q2d(st->avg_frame_rate), tbr || tbn || tbc ? "fps, " : "fps");
566  if (tbr)
567  print_fps(av_q2d(st->r_frame_rate), tbn || tbc ? "tbr, " : "tbr");
568  if (tbn)
569  print_fps(1 / av_q2d(st->time_base), tbc ? "tbn, " : "tbn");
570 #if FF_API_LAVF_AVCTX
572  if (tbc)
573  print_fps(1 / av_q2d(st->codec->time_base), "tbc");
575 #endif
576  }
577 
579  av_log(NULL, AV_LOG_INFO, " (default)");
581  av_log(NULL, AV_LOG_INFO, " (dub)");
583  av_log(NULL, AV_LOG_INFO, " (original)");
585  av_log(NULL, AV_LOG_INFO, " (comment)");
587  av_log(NULL, AV_LOG_INFO, " (lyrics)");
589  av_log(NULL, AV_LOG_INFO, " (karaoke)");
591  av_log(NULL, AV_LOG_INFO, " (forced)");
593  av_log(NULL, AV_LOG_INFO, " (hearing impaired)");
595  av_log(NULL, AV_LOG_INFO, " (visual impaired)");
597  av_log(NULL, AV_LOG_INFO, " (clean effects)");
599  av_log(NULL, AV_LOG_INFO, " (attached pic)");
601  av_log(NULL, AV_LOG_INFO, " (timed thumbnails)");
603  av_log(NULL, AV_LOG_INFO, " (captions)");
605  av_log(NULL, AV_LOG_INFO, " (descriptions)");
607  av_log(NULL, AV_LOG_INFO, " (metadata)");
609  av_log(NULL, AV_LOG_INFO, " (dependent)");
611  av_log(NULL, AV_LOG_INFO, " (still image)");
612  av_log(NULL, AV_LOG_INFO, "\n");
613 
614  dump_metadata(NULL, st->metadata, " ");
615 
616  dump_sidedata(NULL, st, " ");
617 }
618 
620  const char *url, int is_output)
621 {
622  int i;
623  uint8_t *printed = ic->nb_streams ? av_mallocz(ic->nb_streams) : NULL;
624  if (ic->nb_streams && !printed)
625  return;
626 
627  av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n",
628  is_output ? "Output" : "Input",
629  index,
630  is_output ? ic->oformat->name : ic->iformat->name,
631  is_output ? "to" : "from", url);
632  dump_metadata(NULL, ic->metadata, " ");
633 
634  if (!is_output) {
635  av_log(NULL, AV_LOG_INFO, " Duration: ");
636  if (ic->duration != AV_NOPTS_VALUE) {
637  int64_t hours, mins, secs, us;
638  int64_t duration = ic->duration + (ic->duration <= INT64_MAX - 5000 ? 5000 : 0);
639  secs = duration / AV_TIME_BASE;
640  us = duration % AV_TIME_BASE;
641  mins = secs / 60;
642  secs %= 60;
643  hours = mins / 60;
644  mins %= 60;
645  av_log(NULL, AV_LOG_INFO, "%02"PRId64":%02"PRId64":%02"PRId64".%02"PRId64"", hours, mins, secs,
646  (100 * us) / AV_TIME_BASE);
647  } else {
648  av_log(NULL, AV_LOG_INFO, "N/A");
649  }
650  if (ic->start_time != AV_NOPTS_VALUE) {
651  int secs, us;
652  av_log(NULL, AV_LOG_INFO, ", start: ");
653  secs = llabs(ic->start_time / AV_TIME_BASE);
654  us = llabs(ic->start_time % AV_TIME_BASE);
655  av_log(NULL, AV_LOG_INFO, "%s%d.%06d",
656  ic->start_time >= 0 ? "" : "-",
657  secs,
658  (int) av_rescale(us, 1000000, AV_TIME_BASE));
659  }
660  av_log(NULL, AV_LOG_INFO, ", bitrate: ");
661  if (ic->bit_rate)
662  av_log(NULL, AV_LOG_INFO, "%"PRId64" kb/s", ic->bit_rate / 1000);
663  else
664  av_log(NULL, AV_LOG_INFO, "N/A");
665  av_log(NULL, AV_LOG_INFO, "\n");
666  }
667 
668  for (i = 0; i < ic->nb_chapters; i++) {
669  const AVChapter *ch = ic->chapters[i];
670  av_log(NULL, AV_LOG_INFO, " Chapter #%d:%d: ", index, i);
672  "start %f, ", ch->start * av_q2d(ch->time_base));
674  "end %f\n", ch->end * av_q2d(ch->time_base));
675 
676  dump_metadata(NULL, ch->metadata, " ");
677  }
678 
679  if (ic->nb_programs) {
680  int j, k, total = 0;
681  for (j = 0; j < ic->nb_programs; j++) {
682  const AVProgram *program = ic->programs[j];
683  const AVDictionaryEntry *name = av_dict_get(program->metadata,
684  "name", NULL, 0);
685  av_log(NULL, AV_LOG_INFO, " Program %d %s\n", program->id,
686  name ? name->value : "");
687  dump_metadata(NULL, program->metadata, " ");
688  for (k = 0; k < program->nb_stream_indexes; k++) {
689  dump_stream_format(ic, program->stream_index[k],
690  index, is_output);
691  printed[program->stream_index[k]] = 1;
692  }
693  total += program->nb_stream_indexes;
694  }
695  if (total < ic->nb_streams)
696  av_log(NULL, AV_LOG_INFO, " No Program\n");
697  }
698 
699  for (i = 0; i < ic->nb_streams; i++)
700  if (!printed[i])
701  dump_stream_format(ic, i, index, is_output);
702 
703  av_free(printed);
704 }
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 AV_DISPOSITION_METADATA
Definition: avformat.h:858
#define NULL
Definition: coverity.c:32
const struct AVCodec * codec
Definition: avcodec.h:535
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:109
unsigned MaxCLL
Max content light level (cd/m^2).
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:100
int coded_width
Bitstream width / height, may be different from width/height e.g.
Definition: avcodec.h:714
static void dump_sidedata(void *ctx, const AVStream *st, const char *indent)
Definition: dump.c:410
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:200
static void dump_paramchange(void *ctx, const AVPacketSideData *sd)
Definition: dump.c:161
int max_bitrate
Maximum bitrate of the stream, in bits per second.
Definition: avcodec.h:454
AVRational sample_aspect_ratio
Video only.
Definition: codec_par.h:136
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
Definition: packet.h:114
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.
static void dump_stream_format(const AVFormatContext *ic, int i, int index, int is_output)
Definition: dump.c:487
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
Definition: avformat.h:938
uint8_t * dump_separator
dump format separator.
Definition: avformat.h:1876
int num
Numerator.
Definition: rational.h:59
int size
Definition: packet.h:356
int av_dict_count(const AVDictionary *m)
Get number of entries in dictionary.
Definition: dict.c:35
#define us(width, name, range_min, range_max, subs,...)
Definition: cbs_h2645.c:276
#define AV_DISPOSITION_DUB
Definition: avformat.h:822
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
Definition: avformat.h:1473
static void dump_mastering_display_metadata(void *ctx, const AVPacketSideData *sd)
Definition: dump.c:337
#define AV_DISPOSITION_HEARING_IMPAIRED
stream for hearing impaired audiences
Definition: avformat.h:834
DOVI configuration.
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:836
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:237
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:978
static AVPacket pkt
AVDictionary * metadata
Definition: avformat.h:1312
An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of structures with info about macroblo...
Definition: packet.h:93
This struct describes the properties of an encoded stream.
Definition: codec_par.h:52
int min_bitrate
Minimum bitrate of the stream, in bits per second.
Definition: avcodec.h:463
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:826
Mastering display metadata (based on SMPTE-2086:2014).
Definition: packet.h:222
#define AVFMT_SHOW_IDS
Show format stream IDs numbers.
Definition: avformat.h:460
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:85
uint64_t vbv_delay
The delay between the time the packet this structure is associated with is received and the time when...
Definition: avcodec.h:490
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:519
uint8_t
static int nb_streams
Definition: ffprobe.c:282
int width
Video only.
Definition: codec_par.h:126
AVOptions.
int flags
Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, AVFMT_NOTIMESTAMPS, AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH, AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK, AVFMT_SEEK_TO_PTS.
Definition: avformat.h:664
Stereo 3D type: this structure describes how two videos are packed within a single video surface...
Definition: stereo3d.h:176
static void dump_stereo3d(void *ctx, const AVPacketSideData *sd)
Definition: dump.c:254
#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: packet.h:373
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
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition: packet.h:108
int id
Format-specific stream ID.
Definition: avformat.h:883
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:982
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:2148
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:114
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:859
uint8_t * data
Definition: packet.h:355
static double av_q2d(AVRational a)
Convert an AVRational to a double.
Definition: rational.h:104
uint32_t tag
Definition: movenc.c:1532
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
static void dump_audioservicetype(void *ctx, const AVPacketSideData *sd)
Definition: dump.c:271
uint8_t * data
Definition: packet.h:299
int buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
Definition: avcodec.h:481
ptrdiff_t size
Definition: opengl_enc.c:100
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.
channels
Definition: aptx.h:33
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:121
#define AV_DISPOSITION_CAPTIONS
To specify text track kind (different from subtitles default).
Definition: avformat.h:856
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:388
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:619
DOVI configuration ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.1.2, section 2.2 dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2, section 3.3 Tags are stored in struct AVDOVIDecoderConfigurationRecord.
Definition: packet.h:283
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:194
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: packet.h:46
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:75
AVAudioServiceType
Definition: avcodec.h:239
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
Definition: packet.h:72
int qmax
maximum quantizer
Definition: avcodec.h:1375
ICC profile data consisting of an opaque octet buffer following the format described by ISO 15076-1...
Definition: packet.h:274
Display matrix.
ff_const59 struct AVInputFormat * iformat
The input container format.
Definition: avformat.h:1363
const char * r
Definition: vf_curves.c:114
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:215
unsigned int nb_programs
Definition: avformat.h:1530
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:56
AVChapter ** chapters
Definition: avformat.h:1581
enum AVPacketSideDataType type
Definition: packet.h:301
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:949
New fields can be added to the end with minor version bumps.
Definition: avformat.h:1268
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:123
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:361
#define AV_DISPOSITION_LYRICS
Definition: avformat.h:825
#define AV_DISPOSITION_FORCED
Track should be used during playback by default.
Definition: avformat.h:833
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:1407
#define b
Definition: input.c:41
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:172
This side data contains quality related information from the encoder.
Definition: packet.h:132
AVRational min_luminance
Min luminance of mastering display (cd/m^2).
#define width
#define HEXDUMP_PRINT(...)
Definition: dump.c:40
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C program
Definition: undefined.txt:3
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
Definition: packet.h:228
const char * name
Definition: avformat.h:500
int32_t
AVFormatContext * ctx
Definition: movenc.c:48
int32_t yaw
Rotation around the up vector [-180, 180].
Definition: spherical.h:126
AVDictionary * metadata
Definition: avformat.h:940
#define AV_DISPOSITION_ATTACHED_PIC
The stream is stored in the file as an attached picture/"cover art" (e.g.
Definition: avformat.h:844
ff_const59 struct AVOutputFormat * oformat
The output container format.
Definition: avformat.h:1370
if(ret)
#define AV_DISPOSITION_VISUAL_IMPAIRED
stream for visual impaired audiences
Definition: avformat.h:835
uint32_t padding
Number of pixels to pad from the edge of each cube face.
Definition: spherical.h:182
Stream structure.
Definition: avformat.h:876
int64_t end
chapter start/end time in time_base units
Definition: avformat.h:1311
Content light level (based on CTA-861.3).
Definition: packet.h:235
static void dump_metadata(void *ctx, const AVDictionary *m, const char *indent)
Definition: dump.c:134
This structure describes the bitrate properties of an encoded bitstream.
Definition: avcodec.h:448
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
Definition: packet.h:55
#define AV_DISPOSITION_DEFAULT
Definition: avformat.h:821
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:205
#define AV_DISPOSITION_DESCRIPTIONS
Definition: avformat.h:857
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:187
main external API structure.
Definition: avcodec.h:526
int qmin
minimum quantizer
Definition: avcodec.h:1368
static void dump_cpb(void *ctx, const AVPacketSideData *sd)
Definition: dump.c:314
static void dump_content_light_metadata(void *ctx, const AVPacketSideData *sd)
Definition: dump.c:356
int coded_height
Definition: avcodec.h:714
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...
#define AV_DISPOSITION_TIMED_THUMBNAILS
The stream is sparse, and contains thumbnail images, often corresponding to chapter markers...
Definition: avformat.h:849
static void hex_dump_internal(void *avcl, FILE *f, int level, const uint8_t *buf, int size)
Definition: dump.c:48
This structure describes how to handle spherical videos, outlining information about projection...
Definition: spherical.h:82
static void dump_spherical(void *ctx, const AVCodecParameters *par, const AVPacketSideData *sd)
Definition: dump.c:365
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi-0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16,*(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16,*(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32,*(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32,*(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64,*(const int64_t *) pi *(1.0f/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64,*(const int64_t *) pi *(1.0/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(UINT64_C(1)<< 63)))#define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64),};static void cpy1(uint8_t **dst, const uint8_t **src, int len){memcpy(*dst,*src, len);}static void cpy2(uint8_t **dst, const uint8_t **src, int len){memcpy(*dst,*src, 2 *len);}static void cpy4(uint8_t **dst, const uint8_t **src, int len){memcpy(*dst,*src, 4 *len);}static void cpy8(uint8_t **dst, const uint8_t **src, int len){memcpy(*dst,*src, 8 *len);}AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags){AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;if(channels==1){in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);}ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map){switch(av_get_bytes_per_sample(in_fmt)){case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;}}if(HAVE_X86ASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);return ctx;}void swri_audio_convert_free(AudioConvert **ctx){av_freep(ctx);}int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len){int ch;int off=0;const int os=(out->planar?1:out->ch_count)*out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask){int planes=in->planar?in->ch_count:1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;}if(ctx->out_simd_align_mask){int planes=out->planar?out->ch_count:1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;}if(ctx->simd_f &&!ctx->ch_map &&!misaligned){off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){if(out->planar==in->planar){int planes=out->planar?out->ch_count:1;for(ch=0;ch< planes;ch++){ctx->simd_f(out-> ch ch
Definition: audioconvert.c:56
AVRational display_primaries[3][2]
CIE 1931 xy chromaticity coords of color primaries (r, g, b order).
static void dump_replaygain(void *ctx, const AVPacketSideData *sd)
Definition: dump.c:238
AVDictionary * metadata
Definition: avformat.h:1274
#define SIZE_SPECIFIER
Definition: internal.h:229
#define flags(name, subs,...)
Definition: cbs_av1.c:560
This side data should be associated with an audio stream and contains ReplayGain information in form ...
Definition: packet.h:99
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:209
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:228
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition: internal.h:84
#define FF_API_UNSANITIZED_BITRATES
Definition: version.h:136
enum AVSphericalProjection projection
Projection type.
Definition: spherical.h:86
static void print_gain(void *ctx, const char *str, int32_t gain)
Definition: dump.c:218
int disposition
AV_DISPOSITION_* bit field.
Definition: avformat.h:929
#define AV_DISPOSITION_STILL_IMAGE
still images in video stream (still_picture_flag=1 in mpegts)
Definition: avformat.h:860
Stereoscopic video.
static void dump_dovi_conf(void *ctx, const AVPacketSideData *sd)
Definition: dump.c:395
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:2191
char * key
Definition: dict.h:86
int den
Denominator.
Definition: rational.h:60
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
Definition: utils.c:1233
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
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition: internal.h:85
int len
int avg_bitrate
Average bitrate of the stream, in bits per second.
Definition: avcodec.h:472
int codec_info_nb_frames
Number of frames that have been demuxed during avformat_find_stream_info()
Definition: avformat.h:1091
This side data corresponds to the AVCPBProperties struct.
Definition: packet.h:145
#define AV_DISPOSITION_COMMENT
Definition: avformat.h:824
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
Definition: packet.h:354
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
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:650
#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:1023
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:80
int stream_index
Definition: packet.h:357
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
Definition: avformat.h:905
AVRational r_frame_rate
Real base framerate of the stream.
Definition: avformat.h:1000
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: packet.h:332
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:465
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:348
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 layout
int i
Definition: input.c:406
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
AVProgram ** programs
Definition: avformat.h:1531
#define AV_DISPOSITION_ORIGINAL
Definition: avformat.h:823
const char * name
Definition: opengl_enc.c:102
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.
Definition: packet.h:120
static uint8_t tmp[11]
Definition: aes_ctr.c:26