Libav
dump.c
Go to the documentation of this file.
1 /*
2  * Various pretty-printing functions for use within Libav
3  *
4  * This file is part of Libav.
5  *
6  * Libav is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * Libav is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with Libav; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include <stdio.h>
22 #include <stdint.h>
23 
25 #include "libavutil/display.h"
26 #include "libavutil/intreadwrite.h"
27 #include "libavutil/log.h"
28 #include "libavutil/mathematics.h"
29 #include "libavutil/replaygain.h"
30 #include "libavutil/stereo3d.h"
31 
32 #include "avformat.h"
33 
34 #define HEXDUMP_PRINT(...) \
35  do { \
36  if (!f) \
37  av_log(avcl, level, __VA_ARGS__); \
38  else \
39  fprintf(f, __VA_ARGS__); \
40  } while (0)
41 
42 static void hex_dump_internal(void *avcl, FILE *f, int level,
43  const uint8_t *buf, int size)
44 {
45  int len, i, j, c;
46 
47  for (i = 0; i < size; i += 16) {
48  len = size - i;
49  if (len > 16)
50  len = 16;
51  HEXDUMP_PRINT("%08x ", i);
52  for (j = 0; j < 16; j++) {
53  if (j < len)
54  HEXDUMP_PRINT(" %02x", buf[i + j]);
55  else
56  HEXDUMP_PRINT(" ");
57  }
58  HEXDUMP_PRINT(" ");
59  for (j = 0; j < len; j++) {
60  c = buf[i + j];
61  if (c < ' ' || c > '~')
62  c = '.';
63  HEXDUMP_PRINT("%c", c);
64  }
65  HEXDUMP_PRINT("\n");
66  }
67 }
68 
69 void av_hex_dump(FILE *f, const uint8_t *buf, int size)
70 {
71  hex_dump_internal(NULL, f, 0, buf, size);
72 }
73 
74 void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
75 {
76  hex_dump_internal(avcl, NULL, level, buf, size);
77 }
78 
79 static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt,
80  int dump_payload, AVRational time_base)
81 {
82  HEXDUMP_PRINT("stream #%d:\n", pkt->stream_index);
83  HEXDUMP_PRINT(" keyframe=%d\n", (pkt->flags & AV_PKT_FLAG_KEY) != 0);
84  HEXDUMP_PRINT(" duration=%0.3f\n", pkt->duration * av_q2d(time_base));
85  /* DTS is _always_ valid after av_read_frame() */
86  HEXDUMP_PRINT(" dts=");
87  if (pkt->dts == AV_NOPTS_VALUE)
88  HEXDUMP_PRINT("N/A");
89  else
90  HEXDUMP_PRINT("%0.3f", pkt->dts * av_q2d(time_base));
91  /* PTS may not be known if B-frames are present. */
92  HEXDUMP_PRINT(" pts=");
93  if (pkt->pts == AV_NOPTS_VALUE)
94  HEXDUMP_PRINT("N/A");
95  else
96  HEXDUMP_PRINT("%0.3f", pkt->pts * av_q2d(time_base));
97  HEXDUMP_PRINT("\n");
98  HEXDUMP_PRINT(" size=%d\n", pkt->size);
99  if (dump_payload)
100  av_hex_dump(f, pkt->data, pkt->size);
101 }
102 
103 void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st)
104 {
105  pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base);
106 }
107 
108 void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload,
109  AVStream *st)
110 {
111  pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base);
112 }
113 
114 
115 static void print_fps(double d, const char *postfix)
116 {
117  uint64_t v = lrintf(d * 100);
118  if (v % 100)
119  av_log(NULL, AV_LOG_INFO, "%3.2f %s", d, postfix);
120  else if (v % (100 * 1000))
121  av_log(NULL, AV_LOG_INFO, "%1.0f %s", d, postfix);
122  else
123  av_log(NULL, AV_LOG_INFO, "%1.0fk %s", d / 1000, postfix);
124 }
125 
126 static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
127 {
128  if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0))) {
130 
131  av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent);
132  while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX)))
133  if (strcmp("language", tag->key))
134  av_log(ctx, AV_LOG_INFO,
135  "%s %-16s: %s\n", indent, tag->key, tag->value);
136  }
137 }
138 
139 /* param change side data*/
140 static void dump_paramchange(void *ctx, AVPacketSideData *sd)
141 {
142  int size = sd->size;
143  const uint8_t *data = sd->data;
144  uint32_t flags, channels, sample_rate, width, height;
145  uint64_t layout;
146 
147  if (!data || sd->size < 4)
148  goto fail;
149 
150  flags = AV_RL32(data);
151  data += 4;
152  size -= 4;
153 
155  if (size < 4)
156  goto fail;
157  channels = AV_RL32(data);
158  data += 4;
159  size -= 4;
160  av_log(ctx, AV_LOG_INFO, "channel count %"PRIu32", ", channels);
161  }
163  if (size < 8)
164  goto fail;
165  layout = AV_RL64(data);
166  data += 8;
167  size -= 8;
168  av_log(ctx, AV_LOG_INFO,
169  "channel layout: %s, ", av_get_channel_name(layout));
170  }
172  if (size < 4)
173  goto fail;
174  sample_rate = AV_RL32(data);
175  data += 4;
176  size -= 4;
177  av_log(ctx, AV_LOG_INFO, "sample_rate %"PRIu32", ", sample_rate);
178  }
180  if (size < 8)
181  goto fail;
182  width = AV_RL32(data);
183  data += 4;
184  size -= 4;
185  height = AV_RL32(data);
186  data += 4;
187  size -= 4;
188  av_log(ctx, AV_LOG_INFO, "width %"PRIu32" height %"PRIu32, width, height);
189  }
190 
191  return;
192 fail:
193  av_log(ctx, AV_LOG_INFO, "unknown param");
194 }
195 
196 /* replaygain side data*/
197 static void print_gain(void *ctx, const char *str, int32_t gain)
198 {
199  av_log(ctx, AV_LOG_INFO, "%s - ", str);
200  if (gain == INT32_MIN)
201  av_log(ctx, AV_LOG_INFO, "unknown");
202  else
203  av_log(ctx, AV_LOG_INFO, "%f", gain / 100000.0f);
204  av_log(ctx, AV_LOG_INFO, ", ");
205 }
206 
207 static void print_peak(void *ctx, const char *str, uint32_t peak)
208 {
209  av_log(ctx, AV_LOG_INFO, "%s - ", str);
210  if (!peak)
211  av_log(ctx, AV_LOG_INFO, "unknown");
212  else
213  av_log(ctx, AV_LOG_INFO, "%f", (float) peak / UINT32_MAX);
214  av_log(ctx, AV_LOG_INFO, ", ");
215 }
216 
217 static void dump_replaygain(void *ctx, AVPacketSideData *sd)
218 {
219  AVReplayGain *rg;
220 
221  if (sd->size < sizeof(*rg)) {
222  av_log(ctx, AV_LOG_INFO, "invalid data");
223  return;
224  }
225  rg = (AVReplayGain*)sd->data;
226 
227  print_gain(ctx, "track gain", rg->track_gain);
228  print_peak(ctx, "track peak", rg->track_peak);
229  print_gain(ctx, "album gain", rg->album_gain);
230  print_peak(ctx, "album peak", rg->album_peak);
231 }
232 
233 static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
234 {
235  AVStereo3D *stereo;
236 
237  if (sd->size < sizeof(*stereo)) {
238  av_log(ctx, AV_LOG_INFO, "invalid data");
239  return;
240  }
241 
242  stereo = (AVStereo3D *)sd->data;
243 
244  av_log(ctx, AV_LOG_INFO, "%s", av_stereo3d_type_name(stereo->type));
245 
246  if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
247  av_log(ctx, AV_LOG_INFO, " (inverted)");
248 }
249 
251 {
252  enum AVAudioServiceType *ast = (enum AVAudioServiceType *)sd->data;
253 
254  if (sd->size < sizeof(*ast)) {
255  av_log(ctx, AV_LOG_INFO, "invalid data");
256  return;
257  }
258 
259  switch (*ast) {
261  av_log(ctx, AV_LOG_INFO, "main");
262  break;
264  av_log(ctx, AV_LOG_INFO, "effects");
265  break;
267  av_log(ctx, AV_LOG_INFO, "visually impaired");
268  break;
270  av_log(ctx, AV_LOG_INFO, "hearing impaired");
271  break;
273  av_log(ctx, AV_LOG_INFO, "dialogue");
274  break;
276  av_log(ctx, AV_LOG_INFO, "comentary");
277  break;
279  av_log(ctx, AV_LOG_INFO, "emergency");
280  break;
282  av_log(ctx, AV_LOG_INFO, "voice over");
283  break;
285  av_log(ctx, AV_LOG_INFO, "karaoke");
286  break;
287  default:
288  av_log(ctx, AV_LOG_WARNING, "unknown");
289  break;
290  }
291 }
292 
293 static void dump_cpb(void *ctx, AVPacketSideData *sd)
294 {
295  AVCPBProperties *cpb = (AVCPBProperties *)sd->data;
296 
297  if (sd->size < sizeof(*cpb)) {
298  av_log(ctx, AV_LOG_INFO, "invalid data");
299  return;
300  }
301 
302  av_log(ctx, AV_LOG_INFO,
303  "bitrate max/min/avg: %d/%d/%d buffer size: %d vbv_delay: %"PRId64,
304  cpb->max_bitrate, cpb->min_bitrate, cpb->avg_bitrate,
305  cpb->buffer_size,
306  cpb->vbv_delay);
307 }
308 
309 static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
310 {
311  int i;
312 
313  if (st->nb_side_data)
314  av_log(ctx, AV_LOG_INFO, "%sSide data:\n", indent);
315 
316  for (i = 0; i < st->nb_side_data; i++) {
317  AVPacketSideData sd = st->side_data[i];
318  av_log(ctx, AV_LOG_INFO, "%s ", indent);
319 
320  switch (sd.type) {
321  case AV_PKT_DATA_PALETTE:
322  av_log(ctx, AV_LOG_INFO, "palette");
323  break;
325  av_log(ctx, AV_LOG_INFO, "new extradata");
326  break;
328  av_log(ctx, AV_LOG_INFO, "paramchange: ");
329  dump_paramchange(ctx, &sd);
330  break;
332  av_log(ctx, AV_LOG_INFO, "H.263 macroblock info");
333  break;
335  av_log(ctx, AV_LOG_INFO, "replaygain: ");
336  dump_replaygain(ctx, &sd);
337  break;
339  av_log(ctx, AV_LOG_INFO, "displaymatrix: rotation of %.2f degrees",
341  break;
343  av_log(ctx, AV_LOG_INFO, "stereo3d: ");
344  dump_stereo3d(ctx, &sd);
345  break;
347  av_log(ctx, AV_LOG_INFO, "audio service type: ");
348  dump_audioservicetype(ctx, &sd);
349  break;
351  av_log(ctx, AV_LOG_INFO, "quality factor: %d", *(int *)sd.data);
352  break;
354  av_log(ctx, AV_LOG_INFO, "cpb: ");
355  dump_cpb(ctx, &sd);
356  break;
357  default:
358  av_log(ctx, AV_LOG_WARNING,
359  "unknown side data type %d (%d bytes)", sd.type, sd.size);
360  break;
361  }
362 
363  av_log(ctx, AV_LOG_INFO, "\n");
364  }
365 }
366 
367 /* "user interface" functions */
368 static void dump_stream_format(AVFormatContext *ic, int i,
369  int index, int is_output)
370 {
371  char buf[256];
372  int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
373  AVStream *st = ic->streams[i];
374  AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
375  AVCodecContext *avctx;
376  int ret;
377 
378  avctx = avcodec_alloc_context3(NULL);
379  if (!avctx)
380  return;
381 
382  ret = avcodec_parameters_to_context(avctx, st->codecpar);
383  if (ret < 0) {
384  avcodec_free_context(&avctx);
385  return;
386  }
387 
388  avcodec_string(buf, sizeof(buf), avctx, is_output);
389  avcodec_free_context(&avctx);
390 
391  av_log(NULL, AV_LOG_INFO, " Stream #%d:%d", index, i);
392 
393  /* the pid is an important information, so we display it */
394  /* XXX: add a generic system */
395  if (flags & AVFMT_SHOW_IDS)
396  av_log(NULL, AV_LOG_INFO, "[0x%x]", st->id);
397  if (lang)
398  av_log(NULL, AV_LOG_INFO, "(%s)", lang->value);
399  av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames,
400  st->time_base.num, st->time_base.den);
401  av_log(NULL, AV_LOG_INFO, ": %s", buf);
402 
403  if (st->sample_aspect_ratio.num) {
404  AVRational display_aspect_ratio;
405  av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
408  1024 * 1024);
409  av_log(NULL, AV_LOG_INFO, ", PAR %d:%d DAR %d:%d",
411  display_aspect_ratio.num, display_aspect_ratio.den);
412  }
413 
414  if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
415  int fps = st->avg_frame_rate.den && st->avg_frame_rate.num;
416  int tbn = st->time_base.den && st->time_base.num;
417 
418  if (fps || tbn)
419  av_log(NULL, AV_LOG_INFO, "\n ");
420  if (fps)
421  print_fps(av_q2d(st->avg_frame_rate), tbn ? "fps, " : "fps");
422  if (tbn)
423  print_fps(1 / av_q2d(st->time_base), "tbn");
424  }
425 
427  av_log(NULL, AV_LOG_INFO, " (default)");
429  av_log(NULL, AV_LOG_INFO, " (dub)");
431  av_log(NULL, AV_LOG_INFO, " (original)");
433  av_log(NULL, AV_LOG_INFO, " (comment)");
435  av_log(NULL, AV_LOG_INFO, " (lyrics)");
437  av_log(NULL, AV_LOG_INFO, " (karaoke)");
439  av_log(NULL, AV_LOG_INFO, " (forced)");
441  av_log(NULL, AV_LOG_INFO, " (hearing impaired)");
443  av_log(NULL, AV_LOG_INFO, " (visual impaired)");
445  av_log(NULL, AV_LOG_INFO, " (clean effects)");
446  av_log(NULL, AV_LOG_INFO, "\n");
447 
448  dump_metadata(NULL, st->metadata, " ");
449 
450  dump_sidedata(NULL, st, " ");
451 }
452 
454  const char *url, int is_output)
455 {
456  int i;
457  uint8_t *printed = ic->nb_streams ? av_mallocz(ic->nb_streams) : NULL;
458  if (ic->nb_streams && !printed)
459  return;
460 
461  av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n",
462  is_output ? "Output" : "Input",
463  index,
464  is_output ? ic->oformat->name : ic->iformat->name,
465  is_output ? "to" : "from", url);
466  dump_metadata(NULL, ic->metadata, " ");
467 
468  if (!is_output) {
469  av_log(NULL, AV_LOG_INFO, " Duration: ");
470  if (ic->duration != AV_NOPTS_VALUE) {
471  int hours, mins, secs, us;
472  secs = ic->duration / AV_TIME_BASE;
473  us = ic->duration % AV_TIME_BASE;
474  mins = secs / 60;
475  secs %= 60;
476  hours = mins / 60;
477  mins %= 60;
478  av_log(NULL, AV_LOG_INFO, "%02d:%02d:%02d.%02d", hours, mins, secs,
479  (100 * us) / AV_TIME_BASE);
480  } else {
481  av_log(NULL, AV_LOG_INFO, "N/A");
482  }
483  if (ic->start_time != AV_NOPTS_VALUE) {
484  int secs, us;
485  av_log(NULL, AV_LOG_INFO, ", start: ");
486  secs = ic->start_time / AV_TIME_BASE;
487  us = llabs(ic->start_time % AV_TIME_BASE);
488  av_log(NULL, AV_LOG_INFO, "%d.%06d",
489  secs, (int) av_rescale(us, 1000000, AV_TIME_BASE));
490  }
491  av_log(NULL, AV_LOG_INFO, ", bitrate: ");
492  if (ic->bit_rate)
493  av_log(NULL, AV_LOG_INFO, "%d kb/s", ic->bit_rate / 1000);
494  else
495  av_log(NULL, AV_LOG_INFO, "N/A");
496  av_log(NULL, AV_LOG_INFO, "\n");
497  }
498 
499  for (i = 0; i < ic->nb_chapters; i++) {
500  AVChapter *ch = ic->chapters[i];
501  av_log(NULL, AV_LOG_INFO, " Chapter #%d:%d: ", index, i);
503  "start %f, ", ch->start * av_q2d(ch->time_base));
505  "end %f\n", ch->end * av_q2d(ch->time_base));
506 
507  dump_metadata(NULL, ch->metadata, " ");
508  }
509 
510  if (ic->nb_programs) {
511  int j, k, total = 0;
512  for (j = 0; j < ic->nb_programs; j++) {
514  "name", NULL, 0);
515  av_log(NULL, AV_LOG_INFO, " Program %d %s\n", ic->programs[j]->id,
516  name ? name->value : "");
517  dump_metadata(NULL, ic->programs[j]->metadata, " ");
518  for (k = 0; k < ic->programs[j]->nb_stream_indexes; k++) {
520  index, is_output);
521  printed[ic->programs[j]->stream_index[k]] = 1;
522  }
523  total += ic->programs[j]->nb_stream_indexes;
524  }
525  if (total < ic->nb_streams)
526  av_log(NULL, AV_LOG_INFO, " No Program\n");
527  }
528 
529  for (i = 0; i < ic->nb_streams; i++)
530  if (!printed[i])
531  dump_stream_format(ic, i, index, is_output);
532 
533  av_free(printed);
534 }
unsigned int nb_chapters
Number of chapters in AVChapter array.
Definition: avformat.h:1137
int size
static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int dump_payload, AVRational time_base)
Definition: dump.c:79
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:130
int max_bitrate
Maximum bitrate of the stream, in bits per second.
Definition: avcodec.h:1145
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
Definition: avcodec.h:1260
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
Definition: avformat.h:770
int num
numerator
Definition: rational.h:44
int size
Definition: avcodec.h:1347
int av_dict_count(const AVDictionary *m)
Get number of entries in dictionary.
Definition: dict.c:33
av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (%s)\, len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic ? ac->func_descr_generic :ac->func_descr)
#define AV_DISPOSITION_DUB
Definition: avformat.h:673
void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st)
Send a nice dump of a packet to the specified file stream.
Definition: dump.c:103
#define AV_DISPOSITION_HEARING_IMPAIRED
stream for hearing impaired audiences
Definition: avformat.h:685
#define AV_DISPOSITION_CLEAN_EFFECTS
stream without voice
Definition: avformat.h:687
AVPacketSideData * side_data
An array of side data that applies to the whole stream (i.e.
Definition: avformat.h:808
AVDictionary * metadata
Definition: avformat.h:927
static void dump_audioservicetype(void *ctx, AVPacketSideData *sd)
Definition: dump.c:250
int id
Definition: avformat.h:911
An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of structures with info about macroblo...
Definition: avcodec.h:1239
int min_bitrate
Minimum bitrate of the stream, in bits per second.
Definition: avcodec.h:1150
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:677
#define AVFMT_SHOW_IDS
Show format stream IDs numbers.
Definition: avformat.h:414
Format I/O context.
Definition: avformat.h:940
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:1170
#define AV_RL64
Definition: intreadwrite.h:173
unsigned int nb_stream_indexes
Definition: avformat.h:915
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:469
uint8_t
int width
Video only.
Definition: avcodec.h:3525
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.
Definition: avformat.h:543
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:1364
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition: avcodec.h:1254
int id
Format-specific stream ID.
Definition: avformat.h:712
int nb_side_data
The number of elements in the AVStream.side_data array.
Definition: avformat.h:812
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1008
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:2885
const char data[16]
Definition: mxf.c:70
static double av_q2d(AVRational a)
Convert rational to double.
Definition: rational.h:69
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:38
uint8_t * data
Definition: avcodec.h:1346
static int flags
Definition: log.c:50
uint32_t tag
Definition: movenc.c:854
uint8_t * data
Definition: avcodec.h:1290
int buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
Definition: avcodec.h:1161
unsigned int * stream_index
Definition: avformat.h:914
int32_t album_gain
Same as track_gain, but for the whole album.
Definition: replaygain.h:43
static void print_fps(double d, const char *postfix)
Definition: dump.c:115
struct AVOutputFormat * oformat
The output container format.
Definition: avformat.h:959
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: avcodec.h:1378
static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
Definition: dump.c:126
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:453
AVDictionary * metadata
Metadata that applies to the whole file.
Definition: avformat.h:1148
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
Definition: mem.c:190
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:69
AVAudioServiceType
Definition: avcodec.h:692
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
Definition: avcodec.h:1218
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:145
unsigned int nb_programs
Definition: avformat.h:1087
enum AVMediaType codec_type
General type of the encoded data.
Definition: avcodec.h:3479
AVChapter ** chapters
Definition: avformat.h:1138
enum AVPacketSideDataType type
Definition: avcodec.h:1292
static void dump_cpb(void *ctx, AVPacketSideData *sd)
Definition: dump.c:293
const char * av_get_channel_name(uint64_t channel)
Get the name of a given channel.
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:781
#define fail()
Definition: checkasm.h:80
int flags
A combination of AV_PKT_FLAG values.
Definition: avcodec.h:1352
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:676
#define AV_DISPOSITION_FORCED
Track should be used during playback by default.
Definition: avformat.h:684
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:996
const char * name
Definition: qsvenc.c:44
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:86
#define AV_TIME_BASE
Internal time base represented as integer.
Definition: avutil.h:241
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
Definition: options.c:136
#define HEXDUMP_PRINT(...)
Definition: dump.c:34
static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_output)
Definition: dump.c:368
const char * name
Definition: avformat.h:450
int32_t
AVFormatContext * ctx
Definition: movenc.c:48
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
Definition: stereo3d.h:114
static void dump_paramchange(void *ctx, AVPacketSideData *sd)
Definition: dump.c:140
static av_always_inline av_const long int lrintf(float x)
Definition: libm.h:144
#define AV_RL32
Definition: intreadwrite.h:146
AVDictionary * metadata
Definition: avformat.h:772
if(ac->has_optimized_func)
#define AV_DISPOSITION_VISUAL_IMPAIRED
stream for visual impaired audiences
Definition: avformat.h:686
Stream structure.
Definition: avformat.h:705
int64_t end
chapter start/end time in time_base units
Definition: avformat.h:926
This structure describes the bitrate properties of an encoded bitstream.
Definition: avcodec.h:1140
NULL
Definition: eval.c:55
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
Definition: avcodec.h:1201
#define AV_DISPOSITION_DEFAULT
Definition: avformat.h:672
static int width
Definition: utils.c:156
enum AVStereo3DType type
How views are packed within the video.
Definition: stereo3d.h:127
#define AV_LOG_INFO
Standard information.
Definition: log.h:135
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:151
static void dump_replaygain(void *ctx, AVPacketSideData *sd)
Definition: dump.c:217
main external API structure.
Definition: avcodec.h:1409
int index
Definition: gxfenc.c:72
rational number numerator/denominator
Definition: rational.h:43
static void hex_dump_internal(void *avcl, FILE *f, int level, const uint8_t *buf, int size)
Definition: dump.c:42
This side data contains an integer value representing the quality factor of the compressed frame...
Definition: avcodec.h:1273
AVDictionary * metadata
Definition: avformat.h:916
This side data should be associated with an audio stream and contains ReplayGain information in form ...
Definition: avcodec.h:1245
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds. ...
Definition: avformat.h:1025
uint8_t level
Definition: svq3.c:204
int height
Definition: gxfenc.c:72
int64_t start
Definition: avformat.h:926
Main libavformat public API header.
static void print_peak(void *ctx, const char *str, uint32_t peak)
Definition: dump.c:207
static void print_gain(void *ctx, const char *str, int32_t gain)
Definition: dump.c:197
int disposition
AV_DISPOSITION_* bit field.
Definition: avformat.h:761
AVRational time_base
time base in which the start/end timestamps are specified
Definition: avformat.h:925
char * key
Definition: dict.h:73
int den
denominator
Definition: rational.h:45
struct AVInputFormat * iformat
The input container format.
Definition: avformat.h:952
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:2091
uint32_t album_peak
Same as track_peak, but for the whole album,.
Definition: replaygain.h:47
char * value
Definition: dict.h:74
int len
int avg_bitrate
Average bitrate of the stream, in bits per second.
Definition: avcodec.h:1155
int codec_info_nb_frames
Number of frames that have been demuxed during av_find_stream_info()
Definition: avformat.h:876
This side data corresponds to the AVCPBProperties struct.
Definition: avcodec.h:1286
#define AV_DISPOSITION_COMMENT
Definition: avformat.h:675
uint64_t layout
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
Definition: avcodec.h:1345
int bit_rate
Total stream bitrate in bit/s, 0 if not available.
Definition: avformat.h:1042
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
Definition: avformat.h:1035
static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
Definition: dump.c:233
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:529
#define AV_DICT_IGNORE_SUFFIX
Definition: dict.h:60
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:831
void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, AVStream *st)
Send a nice dump of a packet to the log.
Definition: dump.c:108
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:74
int stream_index
Definition: avcodec.h:1348
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
Definition: avformat.h:742
ReplayGain information (see http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification).
Definition: replaygain.h:29
This structure stores compressed data.
Definition: avcodec.h:1323
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:211
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: avcodec.h:1339
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:235
AVProgram ** programs
Definition: avformat.h:1088
#define AV_DISPOSITION_ORIGINAL
Definition: avformat.h:674
static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
Definition: dump.c:309
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.
Definition: avcodec.h:1266