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/stereo3d.h"
35 
36 #include "avformat.h"
37 
38 #define HEXDUMP_PRINT(...) \
39  do { \
40  if (!f) \
41  av_log(avcl, level, __VA_ARGS__); \
42  else \
43  fprintf(f, __VA_ARGS__); \
44  } while (0)
45 
46 static void hex_dump_internal(void *avcl, FILE *f, int level,
47  const uint8_t *buf, int size)
48 {
49  int len, i, j, c;
50 
51  for (i = 0; i < size; i += 16) {
52  len = size - i;
53  if (len > 16)
54  len = 16;
55  HEXDUMP_PRINT("%08x ", i);
56  for (j = 0; j < 16; j++) {
57  if (j < len)
58  HEXDUMP_PRINT(" %02x", buf[i + j]);
59  else
60  HEXDUMP_PRINT(" ");
61  }
62  HEXDUMP_PRINT(" ");
63  for (j = 0; j < len; j++) {
64  c = buf[i + j];
65  if (c < ' ' || c > '~')
66  c = '.';
67  HEXDUMP_PRINT("%c", c);
68  }
69  HEXDUMP_PRINT("\n");
70  }
71 }
72 
73 void av_hex_dump(FILE *f, const uint8_t *buf, int size)
74 {
75  hex_dump_internal(NULL, f, 0, buf, size);
76 }
77 
78 void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
79 {
80  hex_dump_internal(avcl, NULL, level, buf, size);
81 }
82 
83 static void pkt_dump_internal(void *avcl, FILE *f, int level, const AVPacket *pkt,
84  int dump_payload, AVRational time_base)
85 {
86  HEXDUMP_PRINT("stream #%d:\n", pkt->stream_index);
87  HEXDUMP_PRINT(" keyframe=%d\n", (pkt->flags & AV_PKT_FLAG_KEY) != 0);
88  HEXDUMP_PRINT(" duration=%0.3f\n", pkt->duration * av_q2d(time_base));
89  /* DTS is _always_ valid after av_read_frame() */
90  HEXDUMP_PRINT(" dts=");
91  if (pkt->dts == AV_NOPTS_VALUE)
92  HEXDUMP_PRINT("N/A");
93  else
94  HEXDUMP_PRINT("%0.3f", pkt->dts * av_q2d(time_base));
95  /* PTS may not be known if B-frames are present. */
96  HEXDUMP_PRINT(" pts=");
97  if (pkt->pts == AV_NOPTS_VALUE)
98  HEXDUMP_PRINT("N/A");
99  else
100  HEXDUMP_PRINT("%0.3f", pkt->pts * av_q2d(time_base));
101  HEXDUMP_PRINT("\n");
102  HEXDUMP_PRINT(" size=%d\n", pkt->size);
103  if (dump_payload)
104  hex_dump_internal(avcl, f, level, pkt->data, pkt->size);
105 }
106 
107 void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st)
108 {
109  pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base);
110 }
111 
112 void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload,
113  const AVStream *st)
114 {
115  pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base);
116 }
117 
118 
119 static void print_fps(double d, const char *postfix)
120 {
121  uint64_t v = lrintf(d * 100);
122  if (!v)
123  av_log(NULL, AV_LOG_INFO, "%1.4f %s", d, postfix);
124  else if (v % 100)
125  av_log(NULL, AV_LOG_INFO, "%3.2f %s", d, postfix);
126  else if (v % (100 * 1000))
127  av_log(NULL, AV_LOG_INFO, "%1.0f %s", d, postfix);
128  else
129  av_log(NULL, AV_LOG_INFO, "%1.0fk %s", d / 1000, postfix);
130 }
131 
132 static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
133 {
134  if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0))) {
136 
137  av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent);
138  while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX)))
139  if (strcmp("language", tag->key)) {
140  const char *p = tag->value;
141  av_log(ctx, AV_LOG_INFO,
142  "%s %-16s: ", indent, tag->key);
143  while (*p) {
144  char tmp[256];
145  size_t len = strcspn(p, "\x8\xa\xb\xc\xd");
146  av_strlcpy(tmp, p, FFMIN(sizeof(tmp), len+1));
147  av_log(ctx, AV_LOG_INFO, "%s", tmp);
148  p += len;
149  if (*p == 0xd) av_log(ctx, AV_LOG_INFO, " ");
150  if (*p == 0xa) av_log(ctx, AV_LOG_INFO, "\n%s %-16s: ", indent, "");
151  if (*p) p++;
152  }
153  av_log(ctx, AV_LOG_INFO, "\n");
154  }
155  }
156 }
157 
158 /* param change side data*/
159 static void dump_paramchange(void *ctx, AVPacketSideData *sd)
160 {
161  int size = sd->size;
162  const uint8_t *data = sd->data;
163  uint32_t flags, channels, sample_rate, width, height;
164  uint64_t layout;
165 
166  if (!data || sd->size < 4)
167  goto fail;
168 
169  flags = AV_RL32(data);
170  data += 4;
171  size -= 4;
172 
174  if (size < 4)
175  goto fail;
176  channels = AV_RL32(data);
177  data += 4;
178  size -= 4;
179  av_log(ctx, AV_LOG_INFO, "channel count %"PRIu32", ", channels);
180  }
182  if (size < 8)
183  goto fail;
184  layout = AV_RL64(data);
185  data += 8;
186  size -= 8;
187  av_log(ctx, AV_LOG_INFO,
188  "channel layout: %s, ", av_get_channel_name(layout));
189  }
191  if (size < 4)
192  goto fail;
193  sample_rate = AV_RL32(data);
194  data += 4;
195  size -= 4;
196  av_log(ctx, AV_LOG_INFO, "sample_rate %"PRIu32", ", sample_rate);
197  }
199  if (size < 8)
200  goto fail;
201  width = AV_RL32(data);
202  data += 4;
203  size -= 4;
204  height = AV_RL32(data);
205  data += 4;
206  size -= 4;
207  av_log(ctx, AV_LOG_INFO, "width %"PRIu32" height %"PRIu32, width, height);
208  }
209 
210  return;
211 fail:
212  av_log(ctx, AV_LOG_INFO, "unknown param");
213 }
214 
215 /* replaygain side data*/
216 static void print_gain(void *ctx, const char *str, int32_t gain)
217 {
218  av_log(ctx, AV_LOG_INFO, "%s - ", str);
219  if (gain == INT32_MIN)
220  av_log(ctx, AV_LOG_INFO, "unknown");
221  else
222  av_log(ctx, AV_LOG_INFO, "%f", gain / 100000.0f);
223  av_log(ctx, AV_LOG_INFO, ", ");
224 }
225 
226 static void print_peak(void *ctx, const char *str, uint32_t peak)
227 {
228  av_log(ctx, AV_LOG_INFO, "%s - ", str);
229  if (!peak)
230  av_log(ctx, AV_LOG_INFO, "unknown");
231  else
232  av_log(ctx, AV_LOG_INFO, "%f", (float) peak / UINT32_MAX);
233  av_log(ctx, AV_LOG_INFO, ", ");
234 }
235 
236 static void dump_replaygain(void *ctx, AVPacketSideData *sd)
237 {
238  AVReplayGain *rg;
239 
240  if (sd->size < sizeof(*rg)) {
241  av_log(ctx, AV_LOG_INFO, "invalid data");
242  return;
243  }
244  rg = (AVReplayGain*)sd->data;
245 
246  print_gain(ctx, "track gain", rg->track_gain);
247  print_peak(ctx, "track peak", rg->track_peak);
248  print_gain(ctx, "album gain", rg->album_gain);
249  print_peak(ctx, "album peak", rg->album_peak);
250 }
251 
252 static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
253 {
254  AVStereo3D *stereo;
255 
256  if (sd->size < sizeof(*stereo)) {
257  av_log(ctx, AV_LOG_INFO, "invalid data");
258  return;
259  }
260 
261  stereo = (AVStereo3D *)sd->data;
262 
263  av_log(ctx, AV_LOG_INFO, "%s", av_stereo3d_type_name(stereo->type));
264 
265  if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
266  av_log(ctx, AV_LOG_INFO, " (inverted)");
267 }
268 
270 {
271  enum AVAudioServiceType *ast = (enum AVAudioServiceType *)sd->data;
272 
273  if (sd->size < sizeof(*ast)) {
274  av_log(ctx, AV_LOG_INFO, "invalid data");
275  return;
276  }
277 
278  switch (*ast) {
280  av_log(ctx, AV_LOG_INFO, "main");
281  break;
283  av_log(ctx, AV_LOG_INFO, "effects");
284  break;
286  av_log(ctx, AV_LOG_INFO, "visually impaired");
287  break;
289  av_log(ctx, AV_LOG_INFO, "hearing impaired");
290  break;
292  av_log(ctx, AV_LOG_INFO, "dialogue");
293  break;
295  av_log(ctx, AV_LOG_INFO, "comentary");
296  break;
298  av_log(ctx, AV_LOG_INFO, "emergency");
299  break;
301  av_log(ctx, AV_LOG_INFO, "voice over");
302  break;
304  av_log(ctx, AV_LOG_INFO, "karaoke");
305  break;
306  default:
307  av_log(ctx, AV_LOG_WARNING, "unknown");
308  break;
309  }
310 }
311 
312 static void dump_cpb(void *ctx, AVPacketSideData *sd)
313 {
314  AVCPBProperties *cpb = (AVCPBProperties *)sd->data;
315 
316  if (sd->size < sizeof(*cpb)) {
317  av_log(ctx, AV_LOG_INFO, "invalid data");
318  return;
319  }
320 
321  av_log(ctx, AV_LOG_INFO,
322  "bitrate max/min/avg: %d/%d/%d buffer size: %d vbv_delay: %"PRId64,
323  cpb->max_bitrate, cpb->min_bitrate, cpb->avg_bitrate,
324  cpb->buffer_size,
325  cpb->vbv_delay);
326 }
327 
330  av_log(ctx, AV_LOG_INFO, "Mastering Display Metadata, "
331  "has_primaries:%d has_luminance:%d "
332  "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f) "
333  "min_luminance=%f, max_luminance=%f\n",
334  metadata->has_primaries, metadata->has_luminance,
335  av_q2d(metadata->display_primaries[0][0]),
336  av_q2d(metadata->display_primaries[0][1]),
337  av_q2d(metadata->display_primaries[1][0]),
338  av_q2d(metadata->display_primaries[1][1]),
339  av_q2d(metadata->display_primaries[2][0]),
340  av_q2d(metadata->display_primaries[2][1]),
341  av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1]),
342  av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance));
343 }
344 
345 static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
346 {
347  int i;
348 
349  if (st->nb_side_data)
350  av_log(ctx, AV_LOG_INFO, "%sSide data:\n", indent);
351 
352  for (i = 0; i < st->nb_side_data; i++) {
353  AVPacketSideData sd = st->side_data[i];
354  av_log(ctx, AV_LOG_INFO, "%s ", indent);
355 
356  switch (sd.type) {
357  case AV_PKT_DATA_PALETTE:
358  av_log(ctx, AV_LOG_INFO, "palette");
359  break;
361  av_log(ctx, AV_LOG_INFO, "new extradata");
362  break;
364  av_log(ctx, AV_LOG_INFO, "paramchange: ");
365  dump_paramchange(ctx, &sd);
366  break;
368  av_log(ctx, AV_LOG_INFO, "H.263 macroblock info");
369  break;
371  av_log(ctx, AV_LOG_INFO, "replaygain: ");
372  dump_replaygain(ctx, &sd);
373  break;
375  av_log(ctx, AV_LOG_INFO, "displaymatrix: rotation of %.2f degrees",
377  break;
379  av_log(ctx, AV_LOG_INFO, "stereo3d: ");
380  dump_stereo3d(ctx, &sd);
381  break;
383  av_log(ctx, AV_LOG_INFO, "audio service type: ");
384  dump_audioservicetype(ctx, &sd);
385  break;
387  av_log(ctx, AV_LOG_INFO, "quality factor: %d, pict_type: %c", AV_RL32(sd.data), av_get_picture_type_char(sd.data[4]));
388  break;
390  av_log(ctx, AV_LOG_INFO, "cpb: ");
391  dump_cpb(ctx, &sd);
392  break;
395  break;
396  default:
397  av_log(ctx, AV_LOG_INFO,
398  "unknown side data type %d (%d bytes)", sd.type, sd.size);
399  break;
400  }
401 
402  av_log(ctx, AV_LOG_INFO, "\n");
403  }
404 }
405 
406 /* "user interface" functions */
407 static void dump_stream_format(AVFormatContext *ic, int i,
408  int index, int is_output)
409 {
410  char buf[256];
411  int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
412  AVStream *st = ic->streams[i];
413  AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
414  char *separator = ic->dump_separator;
415  AVCodecContext *avctx;
416  int ret;
417 
418  avctx = avcodec_alloc_context3(NULL);
419  if (!avctx)
420  return;
421 
422  ret = avcodec_parameters_to_context(avctx, st->codecpar);
423  if (ret < 0) {
424  avcodec_free_context(&avctx);
425  return;
426  }
427 
428  // Fields which are missing from AVCodecParameters need to be taken from the AVCodecContext
429  avctx->properties = st->codec->properties;
430  avctx->codec = st->codec->codec;
431  avctx->qmin = st->codec->qmin;
432  avctx->qmax = st->codec->qmax;
433  avctx->coded_width = st->codec->coded_width;
434  avctx->coded_height = st->codec->coded_height;
435 
436  if (separator)
437  av_opt_set(avctx, "dump_separator", separator, 0);
438  avcodec_string(buf, sizeof(buf), avctx, is_output);
439  avcodec_free_context(&avctx);
440 
441  av_log(NULL, AV_LOG_INFO, " Stream #%d:%d", index, i);
442 
443  /* the pid is an important information, so we display it */
444  /* XXX: add a generic system */
445  if (flags & AVFMT_SHOW_IDS)
446  av_log(NULL, AV_LOG_INFO, "[0x%x]", st->id);
447  if (lang)
448  av_log(NULL, AV_LOG_INFO, "(%s)", lang->value);
449  av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames,
450  st->time_base.num, st->time_base.den);
451  av_log(NULL, AV_LOG_INFO, ": %s", buf);
452 
453  if (st->sample_aspect_ratio.num &&
455  AVRational display_aspect_ratio;
456  av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
457  st->codecpar->width * (int64_t)st->sample_aspect_ratio.num,
458  st->codecpar->height * (int64_t)st->sample_aspect_ratio.den,
459  1024 * 1024);
460  av_log(NULL, AV_LOG_INFO, ", SAR %d:%d DAR %d:%d",
462  display_aspect_ratio.num, display_aspect_ratio.den);
463  }
464 
465  if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
466  int fps = st->avg_frame_rate.den && st->avg_frame_rate.num;
467  int tbr = st->r_frame_rate.den && st->r_frame_rate.num;
468  int tbn = st->time_base.den && st->time_base.num;
469  int tbc = st->codec->time_base.den && st->codec->time_base.num;
470 
471  if (fps || tbr || tbn || tbc)
472  av_log(NULL, AV_LOG_INFO, "%s", separator);
473 
474  if (fps)
475  print_fps(av_q2d(st->avg_frame_rate), tbr || tbn || tbc ? "fps, " : "fps");
476  if (tbr)
477  print_fps(av_q2d(st->r_frame_rate), tbn || tbc ? "tbr, " : "tbr");
478  if (tbn)
479  print_fps(1 / av_q2d(st->time_base), tbc ? "tbn, " : "tbn");
480  if (tbc)
481  print_fps(1 / av_q2d(st->codec->time_base), "tbc");
482  }
483 
485  av_log(NULL, AV_LOG_INFO, " (default)");
487  av_log(NULL, AV_LOG_INFO, " (dub)");
489  av_log(NULL, AV_LOG_INFO, " (original)");
491  av_log(NULL, AV_LOG_INFO, " (comment)");
493  av_log(NULL, AV_LOG_INFO, " (lyrics)");
495  av_log(NULL, AV_LOG_INFO, " (karaoke)");
497  av_log(NULL, AV_LOG_INFO, " (forced)");
499  av_log(NULL, AV_LOG_INFO, " (hearing impaired)");
501  av_log(NULL, AV_LOG_INFO, " (visual impaired)");
503  av_log(NULL, AV_LOG_INFO, " (clean effects)");
504  av_log(NULL, AV_LOG_INFO, "\n");
505 
506  dump_metadata(NULL, st->metadata, " ");
507 
508  dump_sidedata(NULL, st, " ");
509 }
510 
512  const char *url, int is_output)
513 {
514  int i;
515  uint8_t *printed = ic->nb_streams ? av_mallocz(ic->nb_streams) : NULL;
516  if (ic->nb_streams && !printed)
517  return;
518 
519  av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n",
520  is_output ? "Output" : "Input",
521  index,
522  is_output ? ic->oformat->name : ic->iformat->name,
523  is_output ? "to" : "from", url);
524  dump_metadata(NULL, ic->metadata, " ");
525 
526  if (!is_output) {
527  av_log(NULL, AV_LOG_INFO, " Duration: ");
528  if (ic->duration != AV_NOPTS_VALUE) {
529  int hours, mins, secs, us;
530  int64_t duration = ic->duration + (ic->duration <= INT64_MAX - 5000 ? 5000 : 0);
531  secs = duration / AV_TIME_BASE;
532  us = duration % AV_TIME_BASE;
533  mins = secs / 60;
534  secs %= 60;
535  hours = mins / 60;
536  mins %= 60;
537  av_log(NULL, AV_LOG_INFO, "%02d:%02d:%02d.%02d", hours, mins, secs,
538  (100 * us) / AV_TIME_BASE);
539  } else {
540  av_log(NULL, AV_LOG_INFO, "N/A");
541  }
542  if (ic->start_time != AV_NOPTS_VALUE) {
543  int secs, us;
544  av_log(NULL, AV_LOG_INFO, ", start: ");
545  secs = llabs(ic->start_time / AV_TIME_BASE);
546  us = llabs(ic->start_time % AV_TIME_BASE);
547  av_log(NULL, AV_LOG_INFO, "%s%d.%06d",
548  ic->start_time >= 0 ? "" : "-",
549  secs,
550  (int) av_rescale(us, 1000000, AV_TIME_BASE));
551  }
552  av_log(NULL, AV_LOG_INFO, ", bitrate: ");
553  if (ic->bit_rate)
554  av_log(NULL, AV_LOG_INFO, "%"PRId64" kb/s", (int64_t)ic->bit_rate / 1000);
555  else
556  av_log(NULL, AV_LOG_INFO, "N/A");
557  av_log(NULL, AV_LOG_INFO, "\n");
558  }
559 
560  for (i = 0; i < ic->nb_chapters; i++) {
561  AVChapter *ch = ic->chapters[i];
562  av_log(NULL, AV_LOG_INFO, " Chapter #%d:%d: ", index, i);
564  "start %f, ", ch->start * av_q2d(ch->time_base));
566  "end %f\n", ch->end * av_q2d(ch->time_base));
567 
568  dump_metadata(NULL, ch->metadata, " ");
569  }
570 
571  if (ic->nb_programs) {
572  int j, k, total = 0;
573  for (j = 0; j < ic->nb_programs; j++) {
575  "name", NULL, 0);
576  av_log(NULL, AV_LOG_INFO, " Program %d %s\n", ic->programs[j]->id,
577  name ? name->value : "");
578  dump_metadata(NULL, ic->programs[j]->metadata, " ");
579  for (k = 0; k < ic->programs[j]->nb_stream_indexes; k++) {
581  index, is_output);
582  printed[ic->programs[j]->stream_index[k]] = 1;
583  }
584  total += ic->programs[j]->nb_stream_indexes;
585  }
586  if (total < ic->nb_streams)
587  av_log(NULL, AV_LOG_INFO, " No Program\n");
588  }
589 
590  for (i = 0; i < ic->nb_streams; i++)
591  if (!printed[i])
592  dump_stream_format(ic, i, index, is_output);
593 
594  av_free(printed);
595 }
unsigned int nb_chapters
Number of chapters in AVChapter array.
Definition: avformat.h:1528
#define NULL
Definition: coverity.c:32
const struct AVCodec * codec
Definition: avcodec.h:1658
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:107
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:1851
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
int max_bitrate
Maximum bitrate of the stream, in bits per second.
Definition: avcodec.h:1303
AVRational sample_aspect_ratio
Video only.
Definition: avcodec.h:3998
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
Definition: avcodec.h:1410
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:943
uint8_t * dump_separator
dump format separator.
Definition: avformat.h:1826
int num
numerator
Definition: rational.h:44
int size
Definition: avcodec.h:1581
int av_dict_count(const AVDictionary *m)
Get number of entries in dictionary.
Definition: dict.c:34
#define AV_DISPOSITION_DUB
Definition: avformat.h:830
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
Definition: avformat.h:1427
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
Definition: rational.h:66
#define AV_DISPOSITION_HEARING_IMPAIRED
stream for hearing impaired audiences
Definition: avformat.h:842
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:844
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:983
static AVPacket pkt
AVDictionary * metadata
Definition: avformat.h:1286
static void dump_audioservicetype(void *ctx, AVPacketSideData *sd)
Definition: dump.c:269
An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of structures with info about macroblo...
Definition: avcodec.h:1389
int min_bitrate
Minimum bitrate of the stream, in bits per second.
Definition: avcodec.h:1308
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:834
Mastering display metadata (based on SMPTE-2086:2014).
Definition: avcodec.h:1518
#define AVFMT_SHOW_IDS
Show format stream IDs numbers.
Definition: avformat.h:478
Format I/O context.
Definition: avformat.h:1325
static void pkt_dump_internal(void *avcl, FILE *f, int level, const AVPacket *pkt, int dump_payload, AVRational time_base)
Definition: dump.c:83
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:1328
unsigned int nb_stream_indexes
Definition: avformat.h:1257
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:541
uint8_t
static int nb_streams
Definition: ffprobe.c:254
int width
Video only.
Definition: avcodec.h:3988
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:674
const char * av_stereo3d_type_name(unsigned int type)
Provide a human-readable name of a given stereo3d type.
Definition: stereo3d.c:57
Stereo 3D type: this structure describes how two videos are packed within a single video surface...
Definition: stereo3d.h:123
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: avcodec.h:1598
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition: avcodec.h:1404
int id
Format-specific stream ID.
Definition: avformat.h:883
int nb_side_data
The number of elements in the AVStream.side_data array.
Definition: avformat.h:987
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1393
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:4133
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:112
#define height
static double av_q2d(AVRational a)
Convert rational to double.
Definition: rational.h:80
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:39
uint8_t * data
Definition: avcodec.h:1580
uint32_t tag
Definition: movenc.c:1367
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:91
#define lrintf(x)
Definition: libm_mips.h:70
uint8_t * data
Definition: avcodec.h:1524
int buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
Definition: avcodec.h:1319
ptrdiff_t size
Definition: opengl_enc.c:101
int has_luminance
Flag indicating whether the luminance (min_ and max_) have been set.
unsigned int * stream_index
Definition: avformat.h:1256
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:119
unsigned m
Definition: audioconvert.c:187
struct AVOutputFormat * oformat
The output container format.
Definition: avformat.h:1344
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: avcodec.h:1612
static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
Definition: dump.c:132
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:511
AVDictionary * metadata
Metadata that applies to the whole file.
Definition: avformat.h:1539
int flags
Additional information about the frame packing.
Definition: stereo3d.h:132
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:73
AVAudioServiceType
Definition: avcodec.h:787
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
Definition: avcodec.h:1368
int qmax
maximum quantizer
Definition: avcodec.h:2598
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
unsigned int nb_programs
Definition: avformat.h:1478
enum AVMediaType codec_type
General type of the encoded data.
Definition: avcodec.h:3918
AVChapter ** chapters
Definition: avformat.h:1529
enum AVPacketSideDataType type
Definition: avcodec.h:1526
static void dump_cpb(void *ctx, AVPacketSideData *sd)
Definition: dump.c:312
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:954
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:81
int flags
A combination of AV_PKT_FLAG values.
Definition: avcodec.h:1586
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
#define AV_DISPOSITION_LYRICS
Definition: avformat.h:833
#define AV_DISPOSITION_FORCED
Track should be used during playback by default.
Definition: avformat.h:841
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:1381
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
#define AV_TIME_BASE
Internal time base represented as integer.
Definition: avutil.h:246
#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:1428
AVRational min_luminance
Min luminance of mastering display (cd/m^2).
#define width
#define HEXDUMP_PRINT(...)
Definition: dump.c:38
static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_output)
Definition: dump.c:407
const char * name
Definition: avformat.h:522
int32_t
AVFormatContext * ctx
Definition: movenc.c:48
static void dump_paramchange(void *ctx, AVPacketSideData *sd)
Definition: dump.c:159
AVDictionary * metadata
Definition: avformat.h:945
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
Definition: stereo3d.h:114
#define AV_DISPOSITION_VISUAL_IMPAIRED
stream for visual impaired audiences
Definition: avformat.h:843
Stream structure.
Definition: avformat.h:876
int64_t end
chapter start/end time in time_base units
Definition: avformat.h:1285
This structure describes the bitrate properties of an encoded bitstream.
Definition: avcodec.h:1298
#define AV_DISPOSITION_DEFAULT
Definition: avformat.h:829
sample_rate
enum AVStereo3DType type
How views are packed within the video.
Definition: stereo3d.h:127
#define AV_LOG_INFO
Standard information.
Definition: log.h:187
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:236
main external API structure.
Definition: avcodec.h:1649
int qmin
minimum quantizer
Definition: avcodec.h:2591
void * buf
Definition: avisynth_c.h:553
int coded_height
Definition: avcodec.h:1851
int index
Definition: gxfenc.c:89
rational number numerator/denominator
Definition: rational.h:43
Copyright (c) 2016 Neil Birkbeck neil.birkbeck@gmail.com
static void hex_dump_internal(void *avcl, FILE *f, int level, const uint8_t *buf, int size)
Definition: dump.c:46
AVRational display_primaries[3][2]
CIE 1931 xy chromaticity coords of color primaries (r, g, b order).
AVDictionary * metadata
Definition: avformat.h:1258
This side data should be associated with an audio stream and contains ReplayGain information in form ...
Definition: avcodec.h:1395
static int flags
Definition: cpu.c:47
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds. ...
Definition: avformat.h:1410
uint8_t level
Definition: svq3.c:193
int64_t start
Definition: avformat.h:1285
Main libavformat public API header.
static void print_peak(void *ctx, const char *str, uint32_t peak)
Definition: dump.c:226
if(ret< 0)
Definition: vf_mcdeint.c:282
static void print_gain(void *ctx, const char *str, int32_t gain)
Definition: dump.c:216
static double c[64]
int disposition
AV_DISPOSITION_* bit field.
Definition: avformat.h:934
AVRational time_base
time base in which the start/end timestamps are specified
Definition: avformat.h:1284
unsigned properties
Definition: avcodec.h:3471
char * key
Definition: dict.h:86
int den
denominator
Definition: rational.h:45
struct AVInputFormat * iformat
The input container format.
Definition: avformat.h:1337
double av_display_rotation_get(const int32_t matrix[9])
The display transformation matrix specifies an affine transformation that should be applied to video ...
Definition: display.c:34
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
Definition: utils.c:3122
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:1313
static uint8_t tmp[8]
Definition: des.c:38
int codec_info_nb_frames
Number of frames that have been demuxed during av_find_stream_info()
Definition: avformat.h:1071
This side data corresponds to the AVCPBProperties struct.
Definition: avcodec.h:1441
#define AV_DISPOSITION_COMMENT
Definition: avformat.h:832
uint64_t layout
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
Definition: avcodec.h:1579
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
Definition: avformat.h:1420
static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
Definition: dump.c:252
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:660
#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
Definition: avformat.h:1006
static void dump_mastering_display_metadata(void *ctx, AVPacketSideData *sd)
Definition: dump.c:328
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:78
int stream_index
Definition: avcodec.h:1582
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
Definition: avformat.h:913
AVRational r_frame_rate
Real base framerate of the stream.
Definition: avformat.h:1101
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
This structure stores compressed data.
Definition: avcodec.h:1557
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
Definition: opt.c:431
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Definition: mem.c:252
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: avcodec.h:1573
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:240
AVProgram ** programs
Definition: avformat.h:1479
#define AV_DISPOSITION_ORIGINAL
Definition: avformat.h:831
const char * name
Definition: opengl_enc.c:103
static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
Definition: dump.c:345
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.
Definition: avcodec.h:1416