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"
29 #include "libavutil/mathematics.h"
30 #include "libavutil/opt.h"
31 #include "libavutil/avstring.h"
32 #include "libavutil/replaygain.h"
33 #include "libavutil/stereo3d.h"
34 
35 #include "avformat.h"
36 
37 #define HEXDUMP_PRINT(...) \
38  do { \
39  if (!f) \
40  av_log(avcl, level, __VA_ARGS__); \
41  else \
42  fprintf(f, __VA_ARGS__); \
43  } while (0)
44 
45 static void hex_dump_internal(void *avcl, FILE *f, int level,
46  const uint8_t *buf, int size)
47 {
48  int len, i, j, c;
49 
50  for (i = 0; i < size; i += 16) {
51  len = size - i;
52  if (len > 16)
53  len = 16;
54  HEXDUMP_PRINT("%08x ", i);
55  for (j = 0; j < 16; j++) {
56  if (j < len)
57  HEXDUMP_PRINT(" %02x", buf[i + j]);
58  else
59  HEXDUMP_PRINT(" ");
60  }
61  HEXDUMP_PRINT(" ");
62  for (j = 0; j < len; j++) {
63  c = buf[i + j];
64  if (c < ' ' || c > '~')
65  c = '.';
66  HEXDUMP_PRINT("%c", c);
67  }
68  HEXDUMP_PRINT("\n");
69  }
70 }
71 
72 void av_hex_dump(FILE *f, const uint8_t *buf, int size)
73 {
74  hex_dump_internal(NULL, f, 0, buf, size);
75 }
76 
77 void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
78 {
79  hex_dump_internal(avcl, NULL, level, buf, size);
80 }
81 
82 static void pkt_dump_internal(void *avcl, FILE *f, int level, const AVPacket *pkt,
83  int dump_payload, AVRational time_base)
84 {
85  HEXDUMP_PRINT("stream #%d:\n", pkt->stream_index);
86  HEXDUMP_PRINT(" keyframe=%d\n", (pkt->flags & AV_PKT_FLAG_KEY) != 0);
87  HEXDUMP_PRINT(" duration=%0.3f\n", pkt->duration * av_q2d(time_base));
88  /* DTS is _always_ valid after av_read_frame() */
89  HEXDUMP_PRINT(" dts=");
90  if (pkt->dts == AV_NOPTS_VALUE)
91  HEXDUMP_PRINT("N/A");
92  else
93  HEXDUMP_PRINT("%0.3f", pkt->dts * av_q2d(time_base));
94  /* PTS may not be known if B-frames are present. */
95  HEXDUMP_PRINT(" pts=");
96  if (pkt->pts == AV_NOPTS_VALUE)
97  HEXDUMP_PRINT("N/A");
98  else
99  HEXDUMP_PRINT("%0.3f", pkt->pts * av_q2d(time_base));
100  HEXDUMP_PRINT("\n");
101  HEXDUMP_PRINT(" size=%d\n", pkt->size);
102  if (dump_payload)
103  av_hex_dump(f, pkt->data, pkt->size);
104 }
105 
106 void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st)
107 {
108  pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base);
109 }
110 
111 void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload,
112  const AVStream *st)
113 {
114  pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base);
115 }
116 
117 
118 static void print_fps(double d, const char *postfix)
119 {
120  uint64_t v = lrintf(d * 100);
121  if (!v)
122  av_log(NULL, AV_LOG_INFO, "%1.4f %s", d, postfix);
123  else if (v % 100)
124  av_log(NULL, AV_LOG_INFO, "%3.2f %s", d, postfix);
125  else if (v % (100 * 1000))
126  av_log(NULL, AV_LOG_INFO, "%1.0f %s", d, postfix);
127  else
128  av_log(NULL, AV_LOG_INFO, "%1.0fk %s", d / 1000, postfix);
129 }
130 
131 static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
132 {
133  if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0))) {
135 
136  av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent);
137  while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX)))
138  if (strcmp("language", tag->key)) {
139  const char *p = tag->value;
140  av_log(ctx, AV_LOG_INFO,
141  "%s %-16s: ", indent, tag->key);
142  while (*p) {
143  char tmp[256];
144  size_t len = strcspn(p, "\x8\xa\xb\xc\xd");
145  av_strlcpy(tmp, p, FFMIN(sizeof(tmp), len+1));
146  av_log(ctx, AV_LOG_INFO, "%s", tmp);
147  p += len;
148  if (*p == 0xd) av_log(ctx, AV_LOG_INFO, " ");
149  if (*p == 0xa) av_log(ctx, AV_LOG_INFO, "\n%s %-16s: ", indent, "");
150  if (*p) p++;
151  }
152  av_log(ctx, AV_LOG_INFO, "\n");
153  }
154  }
155 }
156 
157 /* param change side data*/
158 static void dump_paramchange(void *ctx, AVPacketSideData *sd)
159 {
160  int size = sd->size;
161  const uint8_t *data = sd->data;
162  uint32_t flags, channels, sample_rate, width, height;
163  uint64_t layout;
164 
165  if (!data || sd->size < 4)
166  goto fail;
167 
168  flags = AV_RL32(data);
169  data += 4;
170  size -= 4;
171 
173  if (size < 4)
174  goto fail;
175  channels = AV_RL32(data);
176  data += 4;
177  size -= 4;
178  av_log(ctx, AV_LOG_INFO, "channel count %"PRIu32", ", channels);
179  }
181  if (size < 8)
182  goto fail;
183  layout = AV_RL64(data);
184  data += 8;
185  size -= 8;
186  av_log(ctx, AV_LOG_INFO,
187  "channel layout: %s, ", av_get_channel_name(layout));
188  }
190  if (size < 4)
191  goto fail;
192  sample_rate = AV_RL32(data);
193  data += 4;
194  size -= 4;
195  av_log(ctx, AV_LOG_INFO, "sample_rate %"PRIu32", ", sample_rate);
196  }
198  if (size < 8)
199  goto fail;
200  width = AV_RL32(data);
201  data += 4;
202  size -= 4;
203  height = AV_RL32(data);
204  data += 4;
205  size -= 4;
206  av_log(ctx, AV_LOG_INFO, "width %"PRIu32" height %"PRIu32, width, height);
207  }
208 
209  return;
210 fail:
211  av_log(ctx, AV_LOG_INFO, "unknown param");
212 }
213 
214 /* replaygain side data*/
215 static void print_gain(void *ctx, const char *str, int32_t gain)
216 {
217  av_log(ctx, AV_LOG_INFO, "%s - ", str);
218  if (gain == INT32_MIN)
219  av_log(ctx, AV_LOG_INFO, "unknown");
220  else
221  av_log(ctx, AV_LOG_INFO, "%f", gain / 100000.0f);
222  av_log(ctx, AV_LOG_INFO, ", ");
223 }
224 
225 static void print_peak(void *ctx, const char *str, uint32_t peak)
226 {
227  av_log(ctx, AV_LOG_INFO, "%s - ", str);
228  if (!peak)
229  av_log(ctx, AV_LOG_INFO, "unknown");
230  else
231  av_log(ctx, AV_LOG_INFO, "%f", (float) peak / UINT32_MAX);
232  av_log(ctx, AV_LOG_INFO, ", ");
233 }
234 
235 static void dump_replaygain(void *ctx, AVPacketSideData *sd)
236 {
237  AVReplayGain *rg;
238 
239  if (sd->size < sizeof(*rg)) {
240  av_log(ctx, AV_LOG_INFO, "invalid data");
241  return;
242  }
243  rg = (AVReplayGain*)sd->data;
244 
245  print_gain(ctx, "track gain", rg->track_gain);
246  print_peak(ctx, "track peak", rg->track_peak);
247  print_gain(ctx, "album gain", rg->album_gain);
248  print_peak(ctx, "album peak", rg->album_peak);
249 }
250 
251 static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
252 {
253  AVStereo3D *stereo;
254 
255  if (sd->size < sizeof(*stereo)) {
256  av_log(ctx, AV_LOG_INFO, "invalid data");
257  return;
258  }
259 
260  stereo = (AVStereo3D *)sd->data;
261 
262  switch (stereo->type) {
263  case AV_STEREO3D_2D:
264  av_log(ctx, AV_LOG_INFO, "2D");
265  break;
267  av_log(ctx, AV_LOG_INFO, "side by side");
268  break;
270  av_log(ctx, AV_LOG_INFO, "top and bottom");
271  break;
273  av_log(ctx, AV_LOG_INFO, "frame alternate");
274  break;
276  av_log(ctx, AV_LOG_INFO, "checkerboard");
277  break;
278  case AV_STEREO3D_LINES:
279  av_log(ctx, AV_LOG_INFO, "interleaved lines");
280  break;
281  case AV_STEREO3D_COLUMNS:
282  av_log(ctx, AV_LOG_INFO, "interleaved columns");
283  break;
285  av_log(ctx, AV_LOG_INFO, "side by side (quincunx subsampling)");
286  break;
287  default:
288  av_log(ctx, AV_LOG_WARNING, "unknown");
289  break;
290  }
291 
292  if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
293  av_log(ctx, AV_LOG_INFO, " (inverted)");
294 }
295 
297 {
298  enum AVAudioServiceType *ast = (enum AVAudioServiceType *)sd->data;
299 
300  if (sd->size < sizeof(*ast)) {
301  av_log(ctx, AV_LOG_INFO, "invalid data");
302  return;
303  }
304 
305  switch (*ast) {
307  av_log(ctx, AV_LOG_INFO, "main");
308  break;
310  av_log(ctx, AV_LOG_INFO, "effects");
311  break;
313  av_log(ctx, AV_LOG_INFO, "visually impaired");
314  break;
316  av_log(ctx, AV_LOG_INFO, "hearing impaired");
317  break;
319  av_log(ctx, AV_LOG_INFO, "dialogue");
320  break;
322  av_log(ctx, AV_LOG_INFO, "comentary");
323  break;
325  av_log(ctx, AV_LOG_INFO, "emergency");
326  break;
328  av_log(ctx, AV_LOG_INFO, "voice over");
329  break;
331  av_log(ctx, AV_LOG_INFO, "karaoke");
332  break;
333  default:
334  av_log(ctx, AV_LOG_WARNING, "unknown");
335  break;
336  }
337 }
338 
339 static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
340 {
341  int i;
342 
343  if (st->nb_side_data)
344  av_log(ctx, AV_LOG_INFO, "%sSide data:\n", indent);
345 
346  for (i = 0; i < st->nb_side_data; i++) {
347  AVPacketSideData sd = st->side_data[i];
348  av_log(ctx, AV_LOG_INFO, "%s ", indent);
349 
350  switch (sd.type) {
351  case AV_PKT_DATA_PALETTE:
352  av_log(ctx, AV_LOG_INFO, "palette");
353  break;
355  av_log(ctx, AV_LOG_INFO, "new extradata");
356  break;
358  av_log(ctx, AV_LOG_INFO, "paramchange: ");
359  dump_paramchange(ctx, &sd);
360  break;
362  av_log(ctx, AV_LOG_INFO, "h263 macroblock info");
363  break;
365  av_log(ctx, AV_LOG_INFO, "replaygain: ");
366  dump_replaygain(ctx, &sd);
367  break;
369  av_log(ctx, AV_LOG_INFO, "displaymatrix: rotation of %.2f degrees",
371  break;
373  av_log(ctx, AV_LOG_INFO, "stereo3d: ");
374  dump_stereo3d(ctx, &sd);
375  break;
377  av_log(ctx, AV_LOG_INFO, "audio service type: ");
378  dump_audioservicetype(ctx, &sd);
379  break;
381  av_log(ctx, AV_LOG_INFO, "quality factor: %d, pict_type: %c", AV_RL32(sd.data), av_get_picture_type_char(sd.data[4]));
382  break;
383  default:
384  av_log(ctx, AV_LOG_WARNING,
385  "unknown side data type %d (%d bytes)", sd.type, sd.size);
386  break;
387  }
388 
389  av_log(ctx, AV_LOG_INFO, "\n");
390  }
391 }
392 
393 /* "user interface" functions */
394 static void dump_stream_format(AVFormatContext *ic, int i,
395  int index, int is_output)
396 {
397  char buf[256];
398  int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
399  AVStream *st = ic->streams[i];
400  AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
401  char *separator = ic->dump_separator;
402  char **codec_separator = av_opt_ptr(st->codec->av_class, st->codec, "dump_separator");
403  int use_format_separator = !*codec_separator;
404 
405  if (use_format_separator)
406  *codec_separator = av_strdup(separator);
407  avcodec_string(buf, sizeof(buf), st->codec, is_output);
408  if (use_format_separator)
409  av_freep(codec_separator);
410  av_log(NULL, AV_LOG_INFO, " Stream #%d:%d", index, i);
411 
412  /* the pid is an important information, so we display it */
413  /* XXX: add a generic system */
414  if (flags & AVFMT_SHOW_IDS)
415  av_log(NULL, AV_LOG_INFO, "[0x%x]", st->id);
416  if (lang)
417  av_log(NULL, AV_LOG_INFO, "(%s)", lang->value);
418  av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames,
419  st->time_base.num, st->time_base.den);
420  av_log(NULL, AV_LOG_INFO, ": %s", buf);
421 
422  if (st->sample_aspect_ratio.num && // default
424  AVRational display_aspect_ratio;
425  av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
426  st->codec->width * (int64_t)st->sample_aspect_ratio.num,
427  st->codec->height * (int64_t)st->sample_aspect_ratio.den,
428  1024 * 1024);
429  av_log(NULL, AV_LOG_INFO, ", SAR %d:%d DAR %d:%d",
431  display_aspect_ratio.num, display_aspect_ratio.den);
432  }
433 
434  if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
435  int fps = st->avg_frame_rate.den && st->avg_frame_rate.num;
436  int tbr = st->r_frame_rate.den && st->r_frame_rate.num;
437  int tbn = st->time_base.den && st->time_base.num;
438  int tbc = st->codec->time_base.den && st->codec->time_base.num;
439 
440  if (fps || tbr || tbn || tbc)
441  av_log(NULL, AV_LOG_INFO, "%s", separator);
442 
443  if (fps)
444  print_fps(av_q2d(st->avg_frame_rate), tbr || tbn || tbc ? "fps, " : "fps");
445  if (tbr)
446  print_fps(av_q2d(st->r_frame_rate), tbn || tbc ? "tbr, " : "tbr");
447  if (tbn)
448  print_fps(1 / av_q2d(st->time_base), tbc ? "tbn, " : "tbn");
449  if (tbc)
450  print_fps(1 / av_q2d(st->codec->time_base), "tbc");
451  }
452 
454  av_log(NULL, AV_LOG_INFO, " (default)");
456  av_log(NULL, AV_LOG_INFO, " (dub)");
458  av_log(NULL, AV_LOG_INFO, " (original)");
460  av_log(NULL, AV_LOG_INFO, " (comment)");
462  av_log(NULL, AV_LOG_INFO, " (lyrics)");
464  av_log(NULL, AV_LOG_INFO, " (karaoke)");
466  av_log(NULL, AV_LOG_INFO, " (forced)");
468  av_log(NULL, AV_LOG_INFO, " (hearing impaired)");
470  av_log(NULL, AV_LOG_INFO, " (visual impaired)");
472  av_log(NULL, AV_LOG_INFO, " (clean effects)");
473  av_log(NULL, AV_LOG_INFO, "\n");
474 
475  dump_metadata(NULL, st->metadata, " ");
476 
477  dump_sidedata(NULL, st, " ");
478 }
479 
481  const char *url, int is_output)
482 {
483  int i;
484  uint8_t *printed = ic->nb_streams ? av_mallocz(ic->nb_streams) : NULL;
485  if (ic->nb_streams && !printed)
486  return;
487 
488  av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n",
489  is_output ? "Output" : "Input",
490  index,
491  is_output ? ic->oformat->name : ic->iformat->name,
492  is_output ? "to" : "from", url);
493  dump_metadata(NULL, ic->metadata, " ");
494 
495  if (!is_output) {
496  av_log(NULL, AV_LOG_INFO, " Duration: ");
497  if (ic->duration != AV_NOPTS_VALUE) {
498  int hours, mins, secs, us;
499  int64_t duration = ic->duration + (ic->duration <= INT64_MAX - 5000 ? 5000 : 0);
500  secs = duration / AV_TIME_BASE;
501  us = duration % AV_TIME_BASE;
502  mins = secs / 60;
503  secs %= 60;
504  hours = mins / 60;
505  mins %= 60;
506  av_log(NULL, AV_LOG_INFO, "%02d:%02d:%02d.%02d", hours, mins, secs,
507  (100 * us) / AV_TIME_BASE);
508  } else {
509  av_log(NULL, AV_LOG_INFO, "N/A");
510  }
511  if (ic->start_time != AV_NOPTS_VALUE) {
512  int secs, us;
513  av_log(NULL, AV_LOG_INFO, ", start: ");
514  secs = ic->start_time / AV_TIME_BASE;
515  us = llabs(ic->start_time % AV_TIME_BASE);
516  av_log(NULL, AV_LOG_INFO, "%d.%06d",
517  secs, (int) av_rescale(us, 1000000, AV_TIME_BASE));
518  }
519  av_log(NULL, AV_LOG_INFO, ", bitrate: ");
520  if (ic->bit_rate)
521  av_log(NULL, AV_LOG_INFO, "%"PRId64" kb/s", (int64_t)ic->bit_rate / 1000);
522  else
523  av_log(NULL, AV_LOG_INFO, "N/A");
524  av_log(NULL, AV_LOG_INFO, "\n");
525  }
526 
527  for (i = 0; i < ic->nb_chapters; i++) {
528  AVChapter *ch = ic->chapters[i];
529  av_log(NULL, AV_LOG_INFO, " Chapter #%d:%d: ", index, i);
531  "start %f, ", ch->start * av_q2d(ch->time_base));
533  "end %f\n", ch->end * av_q2d(ch->time_base));
534 
535  dump_metadata(NULL, ch->metadata, " ");
536  }
537 
538  if (ic->nb_programs) {
539  int j, k, total = 0;
540  for (j = 0; j < ic->nb_programs; j++) {
542  "name", NULL, 0);
543  av_log(NULL, AV_LOG_INFO, " Program %d %s\n", ic->programs[j]->id,
544  name ? name->value : "");
545  dump_metadata(NULL, ic->programs[j]->metadata, " ");
546  for (k = 0; k < ic->programs[j]->nb_stream_indexes; k++) {
548  index, is_output);
549  printed[ic->programs[j]->stream_index[k]] = 1;
550  }
551  total += ic->programs[j]->nb_stream_indexes;
552  }
553  if (total < ic->nb_streams)
554  av_log(NULL, AV_LOG_INFO, " No Program\n");
555  }
556 
557  for (i = 0; i < ic->nb_streams; i++)
558  if (!printed[i])
559  dump_stream_format(ic, i, index, is_output);
560 
561  av_free(printed);
562 }
unsigned int nb_chapters
Number of chapters in AVChapter array.
Definition: avformat.h:1517
#define NULL
Definition: coverity.c:32
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:106
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
AVFormatContext * ctx
Definition: movenc-test.c:48
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
Definition: avcodec.h:1310
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
Definition: avformat.h:949
uint8_t * dump_separator
dump format separator.
Definition: avformat.h:1815
int num
numerator
Definition: rational.h:44
int size
Definition: avcodec.h:1468
int av_dict_count(const AVDictionary *m)
Get number of entries in dictionary.
Definition: dict.c:34
#define AV_DISPOSITION_DUB
Definition: avformat.h:831
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
Definition: avcodec.h:1935
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
Definition: avformat.h:1416
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:843
#define AV_DISPOSITION_CLEAN_EFFECTS
stream without voice
Definition: avformat.h:845
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:989
static AVPacket pkt
AVDictionary * metadata
Definition: avformat.h:1281
static void dump_audioservicetype(void *ctx, AVPacketSideData *sd)
Definition: dump.c:296
Views are next to each other.
Definition: stereo3d.h:45
An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of structures with info about macroblo...
Definition: avcodec.h:1289
uint32_t track_peak
Peak track amplitude, with 100000 representing full scale (but values may overflow).
Definition: replaygain.h:40
#define AV_DISPOSITION_KARAOKE
Definition: avformat.h:835
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
Definition: avcodec.h:1661
#define AVFMT_SHOW_IDS
Show format stream IDs numbers.
Definition: avformat.h:479
Format I/O context.
Definition: avformat.h:1314
static void pkt_dump_internal(void *avcl, FILE *f, int level, const AVPacket *pkt, int dump_payload, AVRational time_base)
Definition: dump.c:82
unsigned int nb_stream_indexes
Definition: avformat.h:1252
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
Definition: avformat.h:542
uint8_t
static int nb_streams
Definition: ffprobe.c:240
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:675
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:1485
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition: avcodec.h:1304
int id
Format-specific stream ID.
Definition: avformat.h:884
int nb_side_data
The number of elements in the AVStream.side_data array.
Definition: avformat.h:993
const AVClass * av_class
information on struct for av_log
Definition: avcodec.h:1537
AVStream ** streams
A list of all streams in the file.
Definition: avformat.h:1382
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:111
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:1467
uint32_t tag
Definition: movenc.c:1348
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:1411
ptrdiff_t size
Definition: opengl_enc.c:101
Views are alternated temporally.
Definition: stereo3d.h:66
unsigned int * stream_index
Definition: avformat.h:1251
int32_t album_gain
Same as track_gain, but for the whole album.
Definition: replaygain.h:44
#define av_log(a,...)
static void print_fps(double d, const char *postfix)
Definition: dump.c:118
unsigned m
Definition: audioconvert.c:187
struct AVOutputFormat * oformat
The output container format.
Definition: avformat.h:1333
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: avcodec.h:1499
static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
Definition: dump.c:131
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:480
AVDictionary * metadata
Metadata that applies to the whole file.
Definition: avformat.h:1528
int flags
Additional information about the frame packing.
Definition: stereo3d.h:132
void * av_opt_ptr(const AVClass *class, void *obj, const char *name)
Gets a pointer to the requested field in a struct.
Definition: opt.c:1562
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:72
AVAudioServiceType
Definition: avcodec.h:691
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
Definition: avcodec.h:1268
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
unsigned int nb_programs
Definition: avformat.h:1467
AVChapter ** chapters
Definition: avformat.h:1518
enum AVPacketSideDataType type
Definition: avcodec.h:1413
AVRational avg_frame_rate
Average framerate.
Definition: avformat.h:960
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:80
int flags
A combination of AV_PKT_FLAG values.
Definition: avcodec.h:1473
AVCodecContext * codec
Codec context associated with this stream.
Definition: avformat.h:896
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:834
#define AV_DISPOSITION_FORCED
Track should be used during playback by default.
Definition: avformat.h:842
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition: avformat.h:1370
Views are packed per line, as if interlaced.
Definition: stereo3d.h:97
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
This side data contains quality related information from the encoder.
Definition: avcodec.h:1328
#define HEXDUMP_PRINT(...)
Definition: dump.c:37
int width
picture width / height.
Definition: avcodec.h:1711
static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_output)
Definition: dump.c:394
const char * name
Definition: avformat.h:523
int32_t
int64_t duration
Definition: movenc-test.c:63
static void dump_paramchange(void *ctx, AVPacketSideData *sd)
Definition: dump.c:158
AVDictionary * metadata
Definition: avformat.h:951
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
Definition: stereo3d.h:114
Views are packed per column.
Definition: stereo3d.h:107
#define AV_DISPOSITION_VISUAL_IMPAIRED
stream for visual impaired audiences
Definition: avformat.h:844
Stream structure.
Definition: avformat.h:877
int64_t end
chapter start/end time in time_base units
Definition: avformat.h:1280
#define AV_DISPOSITION_DEFAULT
Definition: avformat.h:830
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
enum AVMediaType codec_type
Definition: avcodec.h:1540
char * av_strdup(const char *s)
Duplicate the string s.
Definition: mem.c:267
Views are next to each other, but when upscaling apply a checkerboard pattern.
Definition: stereo3d.h:87
static void dump_replaygain(void *ctx, AVPacketSideData *sd)
Definition: dump.c:235
void * buf
Definition: avisynth_c.h:553
BYTE int const BYTE int int int height
Definition: avisynth_c.h:676
int index
Definition: gxfenc.c:89
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:45
AVDictionary * metadata
Definition: avformat.h:1253
This side data should be associated with an audio stream and contains ReplayGain information in form ...
Definition: avcodec.h:1295
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:1399
uint8_t level
Definition: svq3.c:150
int64_t start
Definition: avformat.h:1280
Main libavformat public API header.
static void print_peak(void *ctx, const char *str, uint32_t peak)
Definition: dump.c:225
if(ret< 0)
Definition: vf_mcdeint.c:282
Video is not stereoscopic (and metadata has to be there).
Definition: stereo3d.h:35
static void print_gain(void *ctx, const char *str, int32_t gain)
Definition: dump.c:215
Views are packed in a checkerboard-like structure per pixel.
Definition: stereo3d.h:76
static double c[64]
int disposition
AV_DISPOSITION_* bit field.
Definition: avformat.h:940
AVRational time_base
time base in which the start/end timestamps are specified
Definition: avformat.h:1279
char * key
Definition: dict.h:87
int den
denominator
Definition: rational.h:45
struct AVInputFormat * iformat
The input container format.
Definition: avformat.h:1326
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:2688
uint32_t album_peak
Same as track_peak, but for the whole album,.
Definition: replaygain.h:48
#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:88
int len
int codec_info_nb_frames
Number of frames that have been demuxed during av_find_stream_info()
Definition: avformat.h:1066
Views are on top of each other.
Definition: stereo3d.h:55
#define AV_DISPOSITION_COMMENT
Definition: avformat.h:833
uint64_t layout
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
Definition: avcodec.h:1466
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
Definition: avformat.h:1409
static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
Definition: dump.c:251
#define av_freep(p)
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:661
#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:72
int32_t track_gain
Track replay gain in microbels (divide by 100000 to get the value in dB).
Definition: replaygain.h:35
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:77
int stream_index
Definition: avcodec.h:1469
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
Definition: avformat.h:919
AVRational r_frame_rate
Real base framerate of the stream.
Definition: avformat.h:1096
ReplayGain information (see http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification).
Definition: replaygain.h:30
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:87
This structure stores compressed data.
Definition: avcodec.h:1444
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:1460
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:240
AVProgram ** programs
Definition: avformat.h:1468
#define AV_DISPOSITION_ORIGINAL
Definition: avformat.h:832
const char * name
Definition: opengl_enc.c:103
static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
Definition: dump.c:339
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.
Definition: avcodec.h:1316
static int width