FFmpeg
Loading...
Searching...
No Matches
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
25#include "libavutil/avstring.h"
27#include "libavutil/display.h"
28#include "libavutil/gain_map.h"
29#include "libavutil/iamf.h"
31#include "libavutil/log.h"
34#include "libavutil/dovi_meta.h"
36#include "libavutil/mem.h"
37#include "libavutil/opt.h"
39#include "libavutil/spherical.h"
40#include "libavutil/stereo3d.h"
41#include "libavutil/tdrdi.h"
42#include "libavutil/timecode.h"
43
44#include "libavcodec/avcodec.h"
45
46#include "avformat.h"
47#include "internal.h"
48
49#define HEXDUMP_PRINT(...) \
50 do { \
51 if (!f) \
52 av_log(avcl, level, __VA_ARGS__); \
53 else \
54 fprintf(f, __VA_ARGS__); \
55 } while (0)
56
57static void hex_dump_internal(void *avcl, FILE *f, int level,
58 const uint8_t *buf, int size)
59{
60 int len, i, j, c;
61
62 for (i = 0; i < size; i += 16) {
63 len = size - i;
64 if (len > 16)
65 len = 16;
66 HEXDUMP_PRINT("%08x ", i);
67 for (j = 0; j < 16; j++) {
68 if (j < len)
69 HEXDUMP_PRINT(" %02x", buf[i + j]);
70 else
71 HEXDUMP_PRINT(" ");
72 }
73 HEXDUMP_PRINT(" ");
74 for (j = 0; j < len; j++) {
75 c = buf[i + j];
76 if (c < ' ' || c > '~')
77 c = '.';
78 HEXDUMP_PRINT("%c", c);
79 }
80 HEXDUMP_PRINT("\n");
81 }
82}
83
84void av_hex_dump(FILE *f, const uint8_t *buf, int size)
85{
86 hex_dump_internal(NULL, f, 0, buf, size);
87}
88
89void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
90{
91 hex_dump_internal(avcl, NULL, level, buf, size);
92}
93
94static void pkt_dump_internal(void *avcl, FILE *f, int level, const AVPacket *pkt,
95 int dump_payload, AVRational time_base)
96{
97 HEXDUMP_PRINT("stream #%d:\n", pkt->stream_index);
98 HEXDUMP_PRINT(" keyframe=%d\n", (pkt->flags & AV_PKT_FLAG_KEY) != 0);
99 HEXDUMP_PRINT(" duration=%0.3f\n", pkt->duration * av_q2d(time_base));
100 /* DTS is _always_ valid after av_read_frame() */
101 HEXDUMP_PRINT(" dts=");
102 if (pkt->dts == AV_NOPTS_VALUE)
103 HEXDUMP_PRINT("N/A");
104 else
105 HEXDUMP_PRINT("%0.3f", pkt->dts * av_q2d(time_base));
106 /* PTS may not be known if B-frames are present. */
107 HEXDUMP_PRINT(" pts=");
108 if (pkt->pts == AV_NOPTS_VALUE)
109 HEXDUMP_PRINT("N/A");
110 else
111 HEXDUMP_PRINT("%0.3f", pkt->pts * av_q2d(time_base));
112 HEXDUMP_PRINT("\n");
113 HEXDUMP_PRINT(" size=%d\n", pkt->size);
114 if (dump_payload)
115 hex_dump_internal(avcl, f, level, pkt->data, pkt->size);
116}
117
118void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st)
119{
120 pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base);
121}
122
123void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload,
124 const AVStream *st)
125{
126 pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base);
127}
128
129
130static void print_fps(double d, const char *postfix, int log_level)
131{
132 uint64_t v = lrintf(d * 100);
133 if (!v)
134 av_log(NULL, log_level, "%1.4f %s", d, postfix);
135 else if (v % 100)
136 av_log(NULL, log_level, "%3.2f %s", d, postfix);
137 else if (v % (100 * 1000))
138 av_log(NULL, log_level, "%1.0f %s", d, postfix);
139 else
140 av_log(NULL, log_level, "%1.0fk %s", d / 1000, postfix);
141}
142
143static void dump_dictionary(void *ctx, const AVDictionary *m,
144 const char *name, const char *indent,
145 int log_level)
146{
147 const AVDictionaryEntry *tag = NULL;
148
149 if (!m)
150 return;
151
152 av_log(ctx, log_level, "%s%s:\n", indent, name);
153 while ((tag = av_dict_iterate(m, tag)))
154 if (strcmp("language", tag->key)) {
155 const char *p = tag->value;
156 av_log(ctx, log_level,
157 "%s %-16s: ", indent, tag->key);
158 while (*p) {
159 size_t len = strcspn(p, "\x8\xa\xb\xc\xd");
160 av_log(ctx, log_level, "%.*s", (int)(FFMIN(255, len)), p);
161 p += len;
162 if (*p == 0xd) av_log(ctx, log_level, " ");
163 if (*p == 0xa) av_log(ctx, log_level, "\n%s %-16s: ", indent, "");
164 if (*p) p++;
165 }
166 av_log(ctx, log_level, "\n");
167 }
168}
169
170static void dump_metadata(void *ctx, const AVDictionary *m, const char *indent,
171 int log_level)
172{
173 if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0)))
174 dump_dictionary(ctx, m, "Metadata", indent, log_level);
175}
176
177/* param change side data*/
178static void dump_paramchange(void *ctx, const AVPacketSideData *sd, int log_level)
179{
180 int size = sd->size;
181 const uint8_t *data = sd->data;
182 uint32_t flags, sample_rate, width, height;
183
184 if (!data || sd->size < 4)
185 goto fail;
186
187 flags = AV_RL32(data);
188 data += 4;
189 size -= 4;
190
192 if (size < 4)
193 goto fail;
194 sample_rate = AV_RL32(data);
195 data += 4;
196 size -= 4;
197 av_log(ctx, log_level, "sample_rate %"PRIu32", ", sample_rate);
198 }
200 if (size < 8)
201 goto fail;
202 width = AV_RL32(data);
203 data += 4;
204 size -= 4;
206 data += 4;
207 size -= 4;
208 av_log(ctx, log_level, "width %"PRIu32" height %"PRIu32, width, height);
209 }
210
211 return;
212fail:
213 av_log(ctx, AV_LOG_ERROR, "unknown param\n");
214}
215
216/* replaygain side data*/
217static void print_gain(void *ctx, const char *str, int32_t gain, int log_level)
218{
219 av_log(ctx, log_level, "%s - ", str);
220 if (gain == INT32_MIN)
221 av_log(ctx, log_level, "unknown");
222 else
223 av_log(ctx, log_level, "%f", gain / 100000.0f);
224 av_log(ctx, log_level, ", ");
225}
226
227static void print_peak(void *ctx, const char *str, uint32_t peak, int log_level)
228{
229 av_log(ctx, log_level, "%s - ", str);
230 if (!peak)
231 av_log(ctx, log_level, "unknown");
232 else
233 av_log(ctx, log_level, "%f", (float) peak / UINT32_MAX);
234 av_log(ctx, log_level, ", ");
235}
236
237static void dump_replaygain(void *ctx, const AVPacketSideData *sd, int log_level)
238{
239 const AVReplayGain *rg;
240
241 if (sd->size < sizeof(*rg)) {
242 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
243 return;
244 }
245 rg = (const AVReplayGain *)sd->data;
246
247 print_gain(ctx, "track gain", rg->track_gain, log_level);
248 print_peak(ctx, "track peak", rg->track_peak, log_level);
249 print_gain(ctx, "album gain", rg->album_gain, log_level);
250 print_peak(ctx, "album peak", rg->album_peak, log_level);
251}
252
253static void dump_stereo3d(void *ctx, const AVPacketSideData *sd, int log_level)
254{
255 const AVStereo3D *stereo;
256
257 if (sd->size < sizeof(*stereo)) {
258 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
259 return;
260 }
261
262 stereo = (const AVStereo3D *)sd->data;
263
264 av_log(ctx, log_level, "%s, view: %s, primary eye: %s",
267 if (stereo->baseline)
268 av_log(ctx, log_level, ", baseline: %"PRIu32"", stereo->baseline);
270 av_log(ctx, log_level, ", horizontal_disparity_adjustment: %0.4f",
273 av_log(ctx, log_level, ", horizontal_field_of_view: %0.3f", av_q2d(stereo->horizontal_field_of_view));
274
275 if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
276 av_log(ctx, log_level, " (inverted)");
277}
278
279static void dump_audioservicetype(void *ctx, const AVPacketSideData *sd, int log_level)
280{
281 const enum AVAudioServiceType *ast = (const enum AVAudioServiceType *)sd->data;
282
283 if (sd->size < sizeof(*ast)) {
284 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
285 return;
286 }
287
288 switch (*ast) {
290 av_log(ctx, log_level, "main");
291 break;
293 av_log(ctx, log_level, "effects");
294 break;
296 av_log(ctx, log_level, "visually impaired");
297 break;
299 av_log(ctx, log_level, "hearing impaired");
300 break;
302 av_log(ctx, log_level, "dialogue");
303 break;
305 av_log(ctx, log_level, "commentary");
306 break;
308 av_log(ctx, log_level, "emergency");
309 break;
311 av_log(ctx, log_level, "voice over");
312 break;
314 av_log(ctx, log_level, "karaoke");
315 break;
316 default:
317 av_log(ctx, AV_LOG_WARNING, "unknown");
318 break;
319 }
320}
321
322static void dump_cpb(void *ctx, const AVPacketSideData *sd, int log_level)
323{
324 const AVCPBProperties *cpb = (const AVCPBProperties *)sd->data;
325
326 if (sd->size < sizeof(*cpb)) {
327 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
328 return;
329 }
330
331 av_log(ctx, log_level,
332 "bitrate max/min/avg: %"PRId64"/%"PRId64"/%"PRId64" buffer size: %"PRId64" ",
333 cpb->max_bitrate, cpb->min_bitrate, cpb->avg_bitrate,
334 cpb->buffer_size);
335 if (cpb->vbv_delay == UINT64_MAX)
336 av_log(ctx, log_level, "vbv_delay: N/A");
337 else
338 av_log(ctx, log_level, "vbv_delay: %"PRIu64"", cpb->vbv_delay);
339}
340
342 int log_level)
343{
345 (const AVMasteringDisplayMetadata *)sd->data;
346 av_log(ctx, log_level,
347 "has_primaries:%d has_luminance:%d "
348 "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f) "
349 "min_luminance=%f, max_luminance=%f",
350 metadata->has_primaries, metadata->has_luminance,
351 av_q2d(metadata->display_primaries[0][0]),
352 av_q2d(metadata->display_primaries[0][1]),
353 av_q2d(metadata->display_primaries[1][0]),
354 av_q2d(metadata->display_primaries[1][1]),
355 av_q2d(metadata->display_primaries[2][0]),
356 av_q2d(metadata->display_primaries[2][1]),
357 av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1]),
358 av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance));
359}
360
362 int log_level)
363{
365 (const AVContentLightMetadata *)sd->data;
366 av_log(ctx, log_level,
367 "MaxCLL=%d, MaxFALL=%d",
368 metadata->MaxCLL, metadata->MaxFALL);
369}
370
371static void dump_ambient_viewing_environment_metadata(void *ctx, const AVPacketSideData *sd, int log_level)
372{
373 const AVAmbientViewingEnvironment *ambient =
375 av_log(ctx, log_level,
376 "ambient_illuminance=%f, ambient_light_x=%f, ambient_light_y=%f",
377 av_q2d(ambient->ambient_illuminance),
378 av_q2d(ambient->ambient_light_x),
379 av_q2d(ambient->ambient_light_y));
380}
381
382static void dump_spherical(void *ctx, int w, int h,
383 const AVPacketSideData *sd, int log_level)
384{
385 const AVSphericalMapping *spherical = (const AVSphericalMapping *)sd->data;
386 double yaw, pitch, roll;
387
388 if (sd->size < sizeof(*spherical)) {
389 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
390 return;
391 }
392
393 av_log(ctx, log_level, "%s ", av_spherical_projection_name(spherical->projection));
394
395 if (spherical->yaw || spherical->pitch || spherical->roll) {
396 yaw = ((double)spherical->yaw) / (1 << 16);
397 pitch = ((double)spherical->pitch) / (1 << 16);
398 roll = ((double)spherical->roll) / (1 << 16);
399 av_log(ctx, log_level, "(%f/%f/%f) ", yaw, pitch, roll);
400 }
401
403 size_t l, t, r, b;
404 av_spherical_tile_bounds(spherical, w, h,
405 &l, &t, &r, &b);
406 av_log(ctx, log_level, "[%zu, %zu, %zu, %zu] ", l, t, r, b);
407 } else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
408 av_log(ctx, log_level, "[pad %"PRIu32"] ", spherical->padding);
409 }
410}
411
412static void dump_dovi_conf(void *ctx, const AVPacketSideData *sd,
413 int log_level)
414{
417
418 av_log(ctx, log_level, "version: %d.%d, profile: %d, level: %d, "
419 "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d, "
420 "compression: %d",
422 dovi->dv_profile, dovi->dv_level,
423 dovi->rpu_present_flag,
424 dovi->el_present_flag,
425 dovi->bl_present_flag,
427 dovi->dv_md_compression);
428}
429
430static void dump_s12m_timecode(void *ctx, AVRational avg_frame_rate, const AVPacketSideData *sd,
431 int log_level)
432{
433 const uint32_t *tc = (const uint32_t *)sd->data;
434
435 if ((sd->size != sizeof(uint32_t) * 4) || (tc[0] > 3)) {
436 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
437 return;
438 }
439
440 for (int j = 1; j <= tc[0]; j++) {
441 char tcbuf[AV_TIMECODE_STR_SIZE];
442 av_timecode_make_smpte_tc_string2(tcbuf, avg_frame_rate, tc[j], 0, 0);
443 av_log(ctx, log_level, "timecode - %s%s", tcbuf, j != tc[0] ? ", " : "");
444 }
445}
446
447static void dump_cropping(void *ctx, const AVPacketSideData *sd, int log_level)
448{
449 uint32_t top, bottom, left, right;
450
451 if (sd->size < sizeof(uint32_t) * 4) {
452 av_log(ctx, log_level, "invalid data\n");
453 return;
454 }
455
456 top = AV_RL32(sd->data + 0);
457 bottom = AV_RL32(sd->data + 4);
458 left = AV_RL32(sd->data + 8);
459 right = AV_RL32(sd->data + 12);
460
461 av_log(ctx, log_level, "%"PRIu32"/%"PRIu32"/%"PRIu32"/%"PRIu32"", left, right, top, bottom);
462}
463
464static void dump_tdrdi(void *ctx, const AVPacketSideData *sd, int log_level)
465{
466 const AV3DReferenceDisplaysInfo *tdrdi =
467 (const AV3DReferenceDisplaysInfo *)sd->data;
468
469 av_log(ctx, log_level, "number of reference displays: %u", tdrdi->num_ref_displays);
470}
471
472static void dump_gain_map_params(void *ctx, const AVPacketSideData *sd, int log_level)
473{
474 const AVGainMapParams *p = (const AVGainMapParams *) sd->data;
475
476 av_log(ctx, log_level, "version=%d, nb_channels=%d, use_base_color_space=%d, "
477 "base_hdr_headroom=%f, alternate_hdr_headroom=%f, channels={ ",
478 p->version, p->nb_channels, p->use_base_color_space,
479 av_q2d(p->base_hdr_headroom), av_q2d(p->alternate_hdr_headroom));
480
481 if (!(p->nb_channels == 1 || p->nb_channels == 3)) {
482 av_log(ctx, AV_LOG_ERROR, "invalid data }\n");
483 return;
484 }
485
486 for (int c = 0; c < p->nb_channels; c++) {
487 const struct AVGainMapChannel *ch = &p->channels[c];
488 av_log(ctx, log_level,
489 "{ gain_map_min=%f, gain_map_max=%f, gamma=%f, "
490 "base_offset=%f, alternate_offset=%f } ",
491 av_q2d(ch->gain_map_min), av_q2d(ch->gain_map_max),
492 av_q2d(ch->gamma), av_q2d(ch->base_offset),
493 av_q2d(ch->alternate_offset));
494 }
495
496 av_log(ctx, log_level, "}");
497}
498
499static void dump_sidedata(void *ctx, const AVPacketSideData *side_data, int nb_side_data,
500 int w, int h, AVRational avg_frame_rate,
501 const char *indent, int log_level)
502{
503 int i;
504
505 if (nb_side_data)
506 av_log(ctx, log_level, "%sSide data:\n", indent);
507
508 for (i = 0; i < nb_side_data; i++) {
509 const AVPacketSideData *sd = &side_data[i];
510 const char *name = av_packet_side_data_name(sd->type);
511
512 av_log(ctx, log_level, "%s ", indent);
513 if (name)
514 av_log(ctx, log_level, "%s: ", name);
515 switch (sd->type) {
517 dump_paramchange(ctx, sd, log_level);
518 break;
520 dump_replaygain(ctx, sd, log_level);
521 break;
523 av_log(ctx, log_level, "rotation of %.2f degrees",
524 av_display_rotation_get((const int32_t *)sd->data));
525 break;
527 dump_stereo3d(ctx, sd, log_level);
528 break;
530 dump_audioservicetype(ctx, sd, log_level);
531 break;
533 av_log(ctx, log_level, "%"PRId32", pict_type: %c",
535 break;
537 dump_cpb(ctx, sd, log_level);
538 break;
540 dump_mastering_display_metadata(ctx, sd, log_level);
541 break;
543 dump_spherical(ctx, w, h, sd, log_level);
544 break;
546 dump_content_light_metadata(ctx, sd, log_level);
547 break;
549 dump_dovi_conf(ctx, sd, log_level);
550 break;
552 dump_s12m_timecode(ctx, avg_frame_rate, sd, log_level);
553 break;
556 break;
558 dump_cropping(ctx, sd, log_level);
559 break;
561 dump_tdrdi(ctx, sd, log_level);
562 break;
564 dump_gain_map_params(ctx, sd, log_level);
565 break;
566 default:
567 if (name)
568 av_log(ctx, log_level, "(%zu bytes)", sd->size);
569 else
570 av_log(ctx, log_level, "unknown side data type %d "
571 "(%zu bytes)", sd->type, sd->size);
572 break;
573 }
574
575 av_log(ctx, log_level, "\n");
576 }
577}
578
579static void dump_disposition(int disposition, int log_level)
580{
581 if (disposition & AV_DISPOSITION_DEFAULT)
582 av_log(NULL, log_level, " (default)");
583 if (disposition & AV_DISPOSITION_DUB)
584 av_log(NULL, log_level, " (dub)");
585 if (disposition & AV_DISPOSITION_ORIGINAL)
586 av_log(NULL, log_level, " (original)");
587 if (disposition & AV_DISPOSITION_COMMENT)
588 av_log(NULL, log_level, " (comment)");
589 if (disposition & AV_DISPOSITION_LYRICS)
590 av_log(NULL, log_level, " (lyrics)");
591 if (disposition & AV_DISPOSITION_KARAOKE)
592 av_log(NULL, log_level, " (karaoke)");
593 if (disposition & AV_DISPOSITION_FORCED)
594 av_log(NULL, log_level, " (forced)");
595 if (disposition & AV_DISPOSITION_HEARING_IMPAIRED)
596 av_log(NULL, log_level, " (hearing impaired)");
597 if (disposition & AV_DISPOSITION_VISUAL_IMPAIRED)
598 av_log(NULL, log_level, " (visual impaired)");
599 if (disposition & AV_DISPOSITION_CLEAN_EFFECTS)
600 av_log(NULL, log_level, " (clean effects)");
601 if (disposition & AV_DISPOSITION_ATTACHED_PIC)
602 av_log(NULL, log_level, " (attached pic)");
603 if (disposition & AV_DISPOSITION_TIMED_THUMBNAILS)
604 av_log(NULL, log_level, " (timed thumbnails)");
605 if (disposition & AV_DISPOSITION_CAPTIONS)
606 av_log(NULL, log_level, " (captions)");
607 if (disposition & AV_DISPOSITION_DESCRIPTIONS)
608 av_log(NULL, log_level, " (descriptions)");
609 if (disposition & AV_DISPOSITION_METADATA)
610 av_log(NULL, log_level, " (metadata)");
611 if (disposition & AV_DISPOSITION_DEPENDENT)
612 av_log(NULL, log_level, " (dependent)");
613 if (disposition & AV_DISPOSITION_STILL_IMAGE)
614 av_log(NULL, log_level, " (still image)");
615 if (disposition & AV_DISPOSITION_NON_DIEGETIC)
616 av_log(NULL, log_level, " (non-diegetic)");
617 if (disposition & AV_DISPOSITION_MULTILAYER)
618 av_log(NULL, log_level, " (multilayer)");
619}
620
621/* "user interface" functions */
622static void dump_stream_format(const AVFormatContext *ic, int i,
623 int group_index, int index, int is_output,
624 int log_level)
625{
626 char buf[256];
627 int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
628 const AVStream *st = ic->streams[i];
629 const FFStream *const sti = cffstream(st);
630 const AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
631 const char *separator = ic->dump_separator;
632 const char *group_indent = group_index >= 0 ? " " : "";
633 const char *extra_indent = group_index >= 0 ? " " : " ";
634 AVCodecContext *avctx;
635 int ret;
636
638 if (!avctx)
639 return;
640
642 if (ret < 0) {
643 avcodec_free_context(&avctx);
644 return;
645 }
646
647 // Fields which are missing from AVCodecParameters need to be taken from the AVCodecContext
648 if (sti->avctx) {
649 avctx->codec = sti->avctx->codec;
650 avctx->qmin = sti->avctx->qmin;
651 avctx->qmax = sti->avctx->qmax;
652 avctx->coded_width = sti->avctx->coded_width;
653 avctx->coded_height = sti->avctx->coded_height;
654 }
655
656 if (separator)
657 av_opt_set(avctx, "dump_separator", separator, 0);
658 avcodec_string(buf, sizeof(buf), avctx, is_output);
659 avcodec_free_context(&avctx);
660
661 av_log(NULL, log_level, "%s Stream #%d", group_indent, index);
662 av_log(NULL, log_level, ":%d", i);
663
664 /* the pid is an important information, so we display it */
665 /* XXX: add a generic system */
666 if (flags & AVFMT_SHOW_IDS)
667 av_log(NULL, log_level, "[0x%x]", st->id);
668 if (lang)
669 av_log(NULL, log_level, "(%s)", lang->value);
670 av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", sti->codec_info_nb_frames,
671 st->time_base.num, st->time_base.den);
672 av_log(NULL, log_level, ": %s", buf);
673
674 if (st->sample_aspect_ratio.num &&
676 AVRational display_aspect_ratio;
677 av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
680 1024 * 1024);
681 av_log(NULL, log_level, ", SAR %d:%d DAR %d:%d",
683 display_aspect_ratio.num, display_aspect_ratio.den);
684 }
685
687 int fps = st->avg_frame_rate.den && st->avg_frame_rate.num;
688 int tbr = st->r_frame_rate.den && st->r_frame_rate.num;
689 int tbn = st->time_base.den && st->time_base.num;
690
691 if (fps || tbr || tbn)
692 av_log(NULL, log_level, "%s", separator);
693
694 if (fps)
695 print_fps(av_q2d(st->avg_frame_rate), tbr || tbn ? "fps, " : "fps", log_level);
696 if (tbr)
697 print_fps(av_q2d(st->r_frame_rate), tbn ? "tbr, " : "tbr", log_level);
698 if (tbn)
699 print_fps(1 / av_q2d(st->time_base), "tbn", log_level);
700 }
701
702 if (st->start_time != AV_NOPTS_VALUE && st->start_time != 0 && st->time_base.den && st->time_base.num) {
703 const double stream_start = av_q2d(st->time_base) * st->start_time;
704 av_log(NULL, log_level, ", start %.6f", stream_start);
705 }
706
707 dump_disposition(st->disposition, log_level);
708 av_log(NULL, log_level, "\n");
709
710 dump_metadata(NULL, st->metadata, extra_indent, log_level);
711
714 extra_indent, log_level);
715}
716
717static void dump_stream_group(const AVFormatContext *ic, uint8_t *printed,
718 int i, int index, int is_output, int log_level)
719{
720 const AVStreamGroup *stg = ic->stream_groups[i];
721 const char *group_indent = log_level != AV_LOG_INFO ? " " : "";
722 const char *extra_indent = log_level != AV_LOG_INFO ? " " : " ";
723 int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
724 char buf[512];
725 int ret;
726
727 av_log(NULL, log_level, "%s Stream group #%d:%d", group_indent, index, i);
728 if (flags & AVFMT_SHOW_IDS)
729 av_log(NULL, log_level, "[0x%"PRIx64"]", stg->id);
730 av_log(NULL, log_level, ":");
731
732 switch (stg->type) {
734 const AVIAMFAudioElement *audio_element = stg->params.iamf_audio_element;
735 av_log(NULL, log_level, " IAMF Audio Element:");
736 dump_disposition(stg->disposition, log_level);
737 av_log(NULL, log_level, "\n");
738 dump_metadata(NULL, stg->metadata, " ", log_level);
739 for (int j = 0; j < audio_element->nb_layers; j++) {
740 const AVIAMFLayer *layer = audio_element->layers[j];
741 int channel_count = layer->ch_layout.nb_channels;
742 av_log(NULL, log_level, " Layer %d:", j);
743 ret = av_channel_layout_describe(&layer->ch_layout, buf, sizeof(buf));
744 if (ret >= 0)
745 av_log(NULL, log_level, " %s", buf);
746 av_log(NULL, log_level, "\n");
747 for (int k = 0; log_level == AV_LOG_INFO && channel_count > 0 && k < stg->nb_entries; k++) {
748 const AVStreamGroupEntry *entry = stg->entries[k];
750 continue;
751 const AVStream *st = entry->stream;
752 int loglevel = printed[st->index] ? AV_LOG_VERBOSE : AV_LOG_INFO;
753 av_log(NULL, loglevel, " ");
754 dump_stream_format(ic, st->index, i, index, is_output, loglevel);
755 printed[st->index] = 1;
756 channel_count -= st->codecpar->ch_layout.nb_channels;
757 }
758 }
759 break;
760 }
762 const AVIAMFMixPresentation *mix_presentation = stg->params.iamf_mix_presentation;
763 av_log(NULL, log_level, " IAMF Mix Presentation:");
764 dump_disposition(stg->disposition, log_level);
765 av_log(NULL, log_level, "\n");
766 dump_metadata(NULL, stg->metadata, " ", log_level);
767 dump_dictionary(NULL, mix_presentation->annotations, "Annotations", " ", log_level);
768 for (int j = 0; j < mix_presentation->nb_submixes; j++) {
769 AVIAMFSubmix *sub_mix = mix_presentation->submixes[j];
770 av_log(NULL, log_level, " Submix %d:\n", j);
771 for (int k = 0; k < sub_mix->nb_elements; k++) {
772 const AVIAMFSubmixElement *submix_element = sub_mix->elements[k];
773 const AVStreamGroup *audio_element = NULL;
774 for (int l = 0; l < ic->nb_stream_groups; l++)
776 ic->stream_groups[l]->id == submix_element->audio_element_id) {
777 audio_element = ic->stream_groups[l];
778 break;
779 }
780 if (audio_element) {
781 av_log(NULL, log_level, " IAMF Audio Element #%d:%d",
782 index, audio_element->index);
783 if (flags & AVFMT_SHOW_IDS)
784 av_log(NULL, log_level, "[0x%"PRIx64"]", audio_element->id);
785 av_log(NULL, log_level, "\n");
786 dump_dictionary(NULL, submix_element->annotations, "Annotations", " ", log_level);
787 }
788 }
789 for (int k = 0; k < sub_mix->nb_layouts; k++) {
790 const AVIAMFSubmixLayout *submix_layout = sub_mix->layouts[k];
791 av_log(NULL, log_level, " Layout #%d:", k);
792 if (submix_layout->layout_type == 2 ||
793 submix_layout->layout_type == 3) {
794 ret = av_channel_layout_describe(&submix_layout->sound_system, buf, sizeof(buf));
795 if (ret >= 0)
796 av_log(NULL, log_level, " %s", buf);
797 }
798 av_log(NULL, log_level, "\n");
799 }
800 }
801 break;
802 }
804 const AVStreamGroupTileGrid *tile_grid = stg->params.tile_grid;
806 const char *ptr = NULL;
807 av_log(NULL, log_level, " Tile Grid:");
808 if (avctx && stg->nb_entries && stg->entries[0]->type == AV_STREAM_GROUP_ENTRY_STREAM) {
809 const AVStream *st = stg->entries[0]->stream;
810 if (!avcodec_parameters_to_context(avctx, st->codecpar)) {
811 avctx->width = tile_grid->width;
812 avctx->height = tile_grid->height;
813 avctx->coded_width = tile_grid->coded_width;
814 avctx->coded_height = tile_grid->coded_height;
815 if (ic->dump_separator)
816 av_opt_set(avctx, "dump_separator", ic->dump_separator, 0);
817 buf[0] = 0;
818 avcodec_string(buf, sizeof(buf), avctx, is_output);
819 ptr = av_stristr(buf, " ");
820 }
821 }
822 avcodec_free_context(&avctx);
823 if (ptr)
824 av_log(NULL, log_level, "%s", ptr);
825 dump_disposition(stg->disposition, log_level);
826 av_log(NULL, log_level, "\n");
827 dump_metadata(NULL, stg->metadata, extra_indent, log_level);
829 tile_grid->width, tile_grid->height, (AVRational) {0,1},
830 extra_indent, log_level);
831 for (int i = 0; i < tile_grid->nb_tiles; i++) {
832 const AVStream *st = NULL;
833 if (tile_grid->offsets[i].idx < stg->nb_entries) {
834 const AVStreamGroupEntry *entry = stg->entries[tile_grid->offsets[i].idx];
836 continue;
837 st = entry->stream;
838 }
839 if (st && !printed[st->index]) {
840 dump_stream_format(ic, st->index, i, index, is_output, AV_LOG_VERBOSE);
841 printed[st->index] = 1;
842 }
843 }
844 for (int i = 0; i < stg->nb_entries; i++) {
845 const AVStreamGroupEntry *entry = stg->entries[i];
847 continue;
848 const AVStream *st = entry->stream;
849 if (!printed[st->index]) {
850 dump_stream_format(ic, st->index, i, index, is_output, log_level);
851 printed[st->index] = 1;
852 }
853 }
854 break;
855 }
860 const AVStreamGroupLayeredVideo *layered_video = stg->params.layered_video;
862 const char *ptr = NULL;
863 switch (stg->type) {
865 av_log(NULL, AV_LOG_INFO, " Alpha:");
866 break;
868 av_log(NULL, AV_LOG_INFO, " Dolby Vision:");
869 break;
871 av_log(NULL, AV_LOG_INFO, " Gain Map:");
872 break;
874 av_log(NULL, AV_LOG_INFO, " LCEVC:");
875 break;
876 }
877 if (avctx && stg->nb_entries == 2 &&
878 (stg->entries[ layered_video->el_index]->type == AV_STREAM_GROUP_ENTRY_STREAM ||
879 stg->entries[!layered_video->el_index]->type == AV_STREAM_GROUP_ENTRY_STREAM)) {
880 const AVStream *st = stg->entries[!layered_video->el_index]->type == AV_STREAM_GROUP_ENTRY_STREAM ?
881 stg->entries[!layered_video->el_index]->stream :
882 stg->entries[ layered_video->el_index]->stream;
883 if (!avcodec_parameters_to_context(avctx, st->codecpar)) {
884 avctx->width = layered_video->width;
885 avctx->height = layered_video->height;
886 avctx->coded_width = layered_video->width;
887 avctx->coded_height = layered_video->height;
888 if (ic->dump_separator)
889 av_opt_set(avctx, "dump_separator", ic->dump_separator, 0);
890 buf[0] = 0;
891 avcodec_string(buf, sizeof(buf), avctx, is_output);
892 ptr = av_stristr(buf, " ");
893 }
894 } else {
895 buf[0] = 0;
896 av_strlcatf(buf, sizeof(buf), " %dx%d", layered_video->width, layered_video->height);
897 }
898 avcodec_free_context(&avctx);
899 if (ptr)
900 av_log(NULL, log_level, "%s", ptr);
901 dump_disposition(stg->disposition, log_level);
902 av_log(NULL, log_level, "\n");
903 dump_metadata(NULL, stg->metadata, extra_indent, log_level);
905 layered_video->width, layered_video->height, (AVRational) {0,1},
906 extra_indent, log_level);
907 for (int i = 0; i < stg->nb_entries; i++) {
908 const AVStreamGroupEntry *entry = stg->entries[i];
909 if (entry->type == AV_STREAM_GROUP_ENTRY_STREAM) {
910 const AVStream *st = entry->stream;
911 dump_stream_format(ic, st->index, i, index, is_output, log_level);
912 printed[st->index] = 1;
913 } else if (entry->type == AV_STREAM_GROUP_ENTRY_STREAM_GROUP)
914 dump_stream_group(ic, printed, entry->stream_group->index, index,
915 is_output, AV_LOG_VERBOSE);
916 }
917 break;
918 }
920 av_log(NULL, log_level, " Track Reference:\n");
921 for (int i = 0; i < stg->nb_entries; i++) {
922 const AVStreamGroupEntry *entry = stg->entries[i];
924 continue;
925 const AVStream *st = entry->stream;
926 dump_stream_format(ic, st->index, i, index, is_output, log_level);
927 printed[st->index] = 1;
928 }
929 break;
930 }
931 default:
932 break;
933 }
934}
935
937 const char *url, int is_output)
938{
939 int i;
940 uint8_t *printed = ic->nb_streams ? av_mallocz(ic->nb_streams) : NULL;
941 if (ic->nb_streams && !printed)
942 return;
943
944 av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n",
945 is_output ? "Output" : "Input",
946 index,
947 is_output ? ic->oformat->name : ic->iformat->name,
948 is_output ? "to" : "from", url);
950
951 if (!is_output) {
952 av_log(NULL, AV_LOG_INFO, " Duration: ");
953 if (ic->duration != AV_NOPTS_VALUE) {
954 int64_t hours, mins, secs, us;
955 int64_t duration = ic->duration + (ic->duration <= INT64_MAX - 5000 ? 5000 : 0);
956 secs = duration / AV_TIME_BASE;
958 mins = secs / 60;
959 secs %= 60;
960 hours = mins / 60;
961 mins %= 60;
962 av_log(NULL, AV_LOG_INFO, "%02"PRId64":%02"PRId64":%02"PRId64".%02"PRId64"", hours, mins, secs,
963 (100 * us) / AV_TIME_BASE);
964 } else {
965 av_log(NULL, AV_LOG_INFO, "N/A");
966 }
967 if (ic->start_time != AV_NOPTS_VALUE) {
968 int secs, us;
969 av_log(NULL, AV_LOG_INFO, ", start: ");
970 secs = llabs(ic->start_time / AV_TIME_BASE);
971 us = llabs(ic->start_time % AV_TIME_BASE);
972 av_log(NULL, AV_LOG_INFO, "%s%d.%06d",
973 ic->start_time >= 0 ? "" : "-",
974 secs,
975 (int) av_rescale(us, 1000000, AV_TIME_BASE));
976 }
977 av_log(NULL, AV_LOG_INFO, ", bitrate: ");
978 if (ic->bit_rate)
979 av_log(NULL, AV_LOG_INFO, "%"PRId64" kb/s", ic->bit_rate / 1000);
980 else
981 av_log(NULL, AV_LOG_INFO, "N/A");
982 av_log(NULL, AV_LOG_INFO, "\n");
983 }
984
985 if (ic->nb_chapters)
986 av_log(NULL, AV_LOG_INFO, " Chapters:\n");
987 for (i = 0; i < ic->nb_chapters; i++) {
988 const AVChapter *ch = ic->chapters[i];
989 av_log(NULL, AV_LOG_INFO, " Chapter #%d:%d: ", index, i);
991 "start %f, ", ch->start * av_q2d(ch->time_base));
993 "end %f\n", ch->end * av_q2d(ch->time_base));
994
996 }
997
998 if (ic->nb_programs) {
999 int j, k, total = 0;
1000 for (j = 0; j < ic->nb_programs; j++) {
1001 const AVProgram *program = ic->programs[j];
1002 const AVDictionaryEntry *name = av_dict_get(program->metadata,
1003 "name", NULL, 0);
1004 av_log(NULL, AV_LOG_INFO, " Program %d %s\n", program->id,
1005 name ? name->value : "");
1006 dump_metadata(NULL, program->metadata, " ", AV_LOG_INFO);
1007 for (k = 0; k < program->nb_stream_indexes; k++) {
1008 dump_stream_format(ic, program->stream_index[k],
1009 -1, index, is_output, AV_LOG_INFO);
1010 printed[program->stream_index[k]] = 1;
1011 }
1012 total += program->nb_stream_indexes;
1013 }
1014 if (total < ic->nb_streams)
1015 av_log(NULL, AV_LOG_INFO, " No Program\n");
1016 }
1017
1018 for (i = 0; i < ic->nb_stream_groups; i++)
1019 dump_stream_group(ic, printed, i, index, is_output, AV_LOG_INFO);
1020
1021 for (i = 0; i < ic->nb_streams; i++)
1022 if (!printed[i])
1023 dump_stream_format(ic, i, -1, index, is_output, AV_LOG_INFO);
1024
1025 av_free(printed);
1026}
#define entry
static AVFormatContext * ctx
int32_t
Libavcodec external API header.
Main libavformat public API header.
#define AV_DISPOSITION_LYRICS
The stream contains song lyrics.
Definition avformat.h:663
@ AV_STREAM_GROUP_ENTRY_STREAM
Definition avformat.h:1173
@ AV_STREAM_GROUP_ENTRY_STREAM_GROUP
Definition avformat.h:1174
#define AV_DISPOSITION_STILL_IMAGE
The video stream contains still images.
Definition avformat.h:733
#define AV_DISPOSITION_HEARING_IMPAIRED
The stream is intended for hearing impaired audiences.
Definition avformat.h:678
#define AV_DISPOSITION_COMMENT
The stream is a commentary track.
Definition avformat.h:659
@ AV_STREAM_GROUP_PARAMS_DOLBY_VISION
Definition avformat.h:1164
@ AV_STREAM_GROUP_PARAMS_TREF
Definition avformat.h:1163
@ AV_STREAM_GROUP_PARAMS_ALPHA
Definition avformat.h:1166
@ AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION
Definition avformat.h:1160
@ AV_STREAM_GROUP_PARAMS_TILE_GRID
Definition avformat.h:1161
@ AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT
Definition avformat.h:1159
@ AV_STREAM_GROUP_PARAMS_LCEVC
Definition avformat.h:1162
@ AV_STREAM_GROUP_PARAMS_GAIN_MAP
Definition avformat.h:1165
#define AV_DISPOSITION_KARAOKE
The stream contains karaoke audio.
Definition avformat.h:667
#define AV_DISPOSITION_CAPTIONS
The subtitle stream contains captions, providing a transcription and possibly a translation of audio.
Definition avformat.h:712
#define AV_DISPOSITION_DUB
The stream is not in original language.
Definition avformat.h:649
#define AV_DISPOSITION_METADATA
The subtitle stream contains time-aligned metadata that is not intended to be directly presented to t...
Definition avformat.h:723
#define AV_DISPOSITION_MULTILAYER
The video stream contains multiple layers, e.g.
Definition avformat.h:738
#define AV_DISPOSITION_DEPENDENT
The stream is intended to be mixed with another stream before presentation.
Definition avformat.h:729
#define AV_DISPOSITION_NON_DIEGETIC
The stream is intended to be mixed with a spatial audio track.
Definition avformat.h:706
#define AVFMT_SHOW_IDS
Show format stream IDs numbers.
Definition avformat.h:498
#define AV_DISPOSITION_CLEAN_EFFECTS
The audio stream contains music and sound effects without voice.
Definition avformat.h:686
#define AV_DISPOSITION_FORCED
Track should be used during playback by default.
Definition avformat.h:674
#define AV_DISPOSITION_VISUAL_IMPAIRED
The stream is intended for visually impaired audiences.
Definition avformat.h:682
#define AV_DISPOSITION_ATTACHED_PIC
The stream is stored in the file as an attached picture/"cover art" (e.g.
Definition avformat.h:694
#define AV_DISPOSITION_DESCRIPTIONS
The subtitle stream contains a textual description of the video content.
Definition avformat.h:718
#define AV_DISPOSITION_ORIGINAL
The stream is in original language.
Definition avformat.h:655
#define AV_DISPOSITION_DEFAULT
The stream should be chosen by default among other streams of the same type, unless the user has expl...
Definition avformat.h:641
#define AV_DISPOSITION_TIMED_THUMBNAILS
The stream is sparse, and contains thumbnail images, often corresponding to chapter markers.
Definition avformat.h:699
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
Definition avstring.c:103
static int BS_FUNC left(const BSCTX *bc)
Return the number of the bits left in a buffer.
static int FUNC metadata(CodedBitstreamContext *ctx, RWContext *rw, APVRawMetadata *current)
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define f(width, name)
Definition cbs_vp8.c:236
Public libavutil channel layout APIs header.
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
Definition codec_par.c:206
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
AVAudioServiceType
Definition defs.h:251
@ AV_AUDIO_SERVICE_TYPE_VOICE_OVER
Definition defs.h:259
@ AV_AUDIO_SERVICE_TYPE_EMERGENCY
Definition defs.h:258
@ AV_AUDIO_SERVICE_TYPE_EFFECTS
Definition defs.h:253
@ AV_AUDIO_SERVICE_TYPE_MAIN
Definition defs.h:252
@ AV_AUDIO_SERVICE_TYPE_DIALOGUE
Definition defs.h:256
@ AV_AUDIO_SERVICE_TYPE_KARAOKE
Definition defs.h:260
@ AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED
Definition defs.h:255
@ AV_AUDIO_SERVICE_TYPE_COMMENTARY
Definition defs.h:257
@ AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED
Definition defs.h:254
static AVPacket * pkt
Display matrix.
DOVI configuration.
static void dump_sidedata(void *ctx, const AVPacketSideData *side_data, int nb_side_data, int w, int h, AVRational avg_frame_rate, const char *indent, int log_level)
Definition dump.c:499
static void dump_replaygain(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:237
static void dump_dovi_conf(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:412
static void dump_content_light_metadata(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:361
static void pkt_dump_internal(void *avcl, FILE *f, int level, const AVPacket *pkt, int dump_payload, AVRational time_base)
Definition dump.c:94
static void dump_stream_format(const AVFormatContext *ic, int i, int group_index, int index, int is_output, int log_level)
Definition dump.c:622
static void dump_spherical(void *ctx, int w, int h, const AVPacketSideData *sd, int log_level)
Definition dump.c:382
static void dump_s12m_timecode(void *ctx, AVRational avg_frame_rate, const AVPacketSideData *sd, int log_level)
Definition dump.c:430
static void dump_tdrdi(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:464
static void dump_audioservicetype(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:279
static void dump_paramchange(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:178
static void dump_cpb(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:322
static void hex_dump_internal(void *avcl, FILE *f, int level, const uint8_t *buf, int size)
Definition dump.c:57
static void dump_cropping(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:447
static void dump_metadata(void *ctx, const AVDictionary *m, const char *indent, int log_level)
Definition dump.c:170
#define HEXDUMP_PRINT(...)
Definition dump.c:49
static void dump_disposition(int disposition, int log_level)
Definition dump.c:579
static void dump_dictionary(void *ctx, const AVDictionary *m, const char *name, const char *indent, int log_level)
Definition dump.c:143
static void dump_stream_group(const AVFormatContext *ic, uint8_t *printed, int i, int index, int is_output, int log_level)
Definition dump.c:717
static void dump_stereo3d(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:253
static void print_peak(void *ctx, const char *str, uint32_t peak, int log_level)
Definition dump.c:227
static void print_gain(void *ctx, const char *str, int32_t gain, int log_level)
Definition dump.c:217
static void dump_mastering_display_metadata(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:341
static void dump_ambient_viewing_environment_metadata(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:371
static void dump_gain_map_params(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:472
static void print_fps(double d, const char *postfix, int log_level)
Definition dump.c:130
static char separator(CheckasmFormat format)
Definition checkasm.c:149
static int64_t duration
Definition ffplay.c:359
int ret
Definition ffplay.c:391
static unsigned int nb_streams
Definition ffprobe.c:390
#define fail
Definition test.h:479
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
Definition options.c:149
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:168
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
Definition avcodec.c:512
const char * av_packet_side_data_name(enum AVPacketSideDataType type)
Definition packet.c:269
@ AV_PKT_DATA_S12M_TIMECODE
Timecode which conforms to SMPTE ST 12-1:2014.
Definition packet.h:288
@ AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT
Ambient viewing environment metadata, as defined by H.274.
Definition packet.h:327
@ AV_PKT_DATA_3D_REFERENCE_DISPLAYS
This side data contains information about the reference display width(s) and reference viewing distan...
Definition packet.h:357
@ AV_PKT_DATA_GAIN_MAP_PARAMS
Parameters describing how to combine this gain map with its base image to form an alternate rendition...
Definition packet.h:391
@ AV_PKT_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata (based on SMPTE-2086:2014).
Definition packet.h:219
@ AV_PKT_DATA_AUDIO_SERVICE_TYPE
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.
Definition packet.h:117
@ AV_PKT_DATA_SPHERICAL
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
Definition packet.h:225
@ AV_PKT_DATA_QUALITY_STATS
This side data contains quality related information from the encoder.
Definition packet.h:129
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition packet.h:105
@ AV_PKT_DATA_CPB_PROPERTIES
This side data corresponds to the AVCPBProperties struct.
Definition packet.h:142
@ AV_PKT_DATA_PARAM_CHANGE
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
Definition packet.h:69
@ AV_PKT_DATA_STEREO3D
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
Definition packet.h:111
@ AV_PKT_DATA_FRAME_CROPPING
The number of pixels to discard from the top/bottom/left/right border of the decoded frame to obtain ...
Definition packet.h:340
@ AV_PKT_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
Definition packet.h:232
@ AV_PKT_DATA_REPLAYGAIN
This side data should be associated with an audio stream and contains ReplayGain information in form ...
Definition packet.h:96
@ AV_PKT_DATA_DOVI_CONF
DOVI configuration ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2....
Definition packet.h:280
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition packet.h:657
@ AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE
Definition packet.h:688
@ AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS
Definition packet.h:689
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:118
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:89
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:123
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:84
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,...
Definition dump.c:936
int av_channel_layout_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
Get a human-readable string describing the channel layout properties.
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:61
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
Definition dict.c:43
int av_dict_count(const AVDictionary *m)
Get number of entries in dictionary.
Definition dict.c:38
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition log.h:231
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition log.h:216
#define AV_LOG_VERBOSE
Detailed information.
Definition log.h:226
#define AV_LOG_INFO
Standard information.
Definition log.h:221
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
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
static double av_q2d(AVRational a)
Convert an AVRational to a double.
Definition rational.h:104
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
Definition rational.h:89
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
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:40
char * av_stristr(const char *s1, const char *s2)
Locate the first case-independent occurrence in the string haystack of the string needle.
Definition avstring.c:58
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition avutil.h:247
#define AV_TIME_BASE
Internal time base represented as integer.
Definition avutil.h:253
double av_display_rotation_get(const int32_t matrix[9])
Extract the rotation component of the transformation matrix.
Definition display.c:34
const char * av_spherical_projection_name(enum AVSphericalProjection projection)
Provide a human-readable name of a given AVSphericalProjection.
Definition spherical.c:69
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:41
@ AV_SPHERICAL_EQUIRECTANGULAR_TILE
Video represents a portion of a sphere mapped on a flat surface using equirectangular projection.
Definition spherical.h:68
@ AV_SPHERICAL_CUBEMAP
Video frame is split into 6 faces of a cube, and arranged on a 3x2 layout.
Definition spherical.h:61
const char * av_stereo3d_view_name(unsigned int view)
Provide a human-readable name of a given stereo3d view.
Definition stereo3d.c:113
const char * av_stereo3d_type_name(unsigned int type)
Provide a human-readable name of a given stereo3d type.
Definition stereo3d.c:93
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
Definition stereo3d.h:194
const char * av_stereo3d_primary_eye_name(unsigned int eye)
Provide a human-readable name of a given stereo3d primary eye.
Definition stereo3d.c:133
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
Definition opt.c:904
int index
Definition gxfenc.c:90
#define r
Definition input.c:42
#define b
Definition input.c:43
#define AV_RL32(p)
#define us(width, name, range_min, range_max, subs,...)
Definition cbs_apv.c:70
static av_always_inline const FFStream * cffstream(const AVStream *st)
Definition internal.h:395
Immersive Audio Model and Formats API header.
Stereoscopic video.
#define lrintf(x)
Definition libm_mips.h:74
uint8_t w
Definition llvidencdsp.c:39
#define FFMIN(a, b)
Definition macros.h:49
Memory handling functions.
uint32_t tag
Definition movenc.c:2144
const char data[16]
Definition mxf.c:149
AVOptions.
const char * name
Definition qsvenc.c:142
Spherical video.
This structure describes information about the reference display width(s) and reference viewing dista...
Definition tdrdi.h:53
uint8_t num_ref_displays
The number of reference displays that are signalled in this struct.
Definition tdrdi.h:78
Ambient viewing environment metadata as defined by H.274.
AVRational ambient_illuminance
Environmental illuminance of the ambient viewing environment in lux.
AVRational ambient_light_x
Normalized x chromaticity coordinate of the environmental ambient light in the nominal viewing enviro...
AVRational ambient_light_y
Normalized y chromaticity coordinate of the environmental ambient light in the nominal viewing enviro...
This structure describes the bitrate properties of an encoded bitstream.
Definition defs.h:298
int64_t avg_bitrate
Average bitrate of the stream, in bits per second.
Definition defs.h:313
int64_t max_bitrate
Maximum bitrate of the stream, in bits per second.
Definition defs.h:303
int64_t buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
Definition defs.h:319
uint64_t vbv_delay
The delay between the time the packet this structure is associated with is received and the time when...
Definition defs.h:328
int64_t min_bitrate
Minimum bitrate of the stream, in bits per second.
Definition defs.h:308
int nb_channels
Number of channels in this layout.
int64_t start
Definition avformat.h:1363
AVDictionary * metadata
Definition avformat.h:1364
int64_t end
chapter start/end time in time_base units
Definition avformat.h:1363
AVRational time_base
time base in which the start/end timestamps are specified
Definition avformat.h:1362
main external API structure.
Definition avcodec.h:443
int width
picture width / height.
Definition avcodec.h:605
int qmin
minimum quantizer
Definition avcodec.h:1257
const struct AVCodec * codec
Definition avcodec.h:452
int qmax
maximum quantizer
Definition avcodec.h:1264
int coded_width
Bitstream width / height, may be different from width/height e.g.
Definition avcodec.h:620
int height
The height of the video frame in pixels.
Definition codec_par.h:150
int nb_coded_side_data
Amount of entries in coded_side_data.
Definition codec_par.h:88
AVChannelLayout ch_layout
The channel layout and number of channels.
Definition codec_par.h:207
int width
The width of the video frame in pixels.
Definition codec_par.h:143
enum AVMediaType codec_type
General type of the encoded data.
Definition codec_par.h:53
AVRational sample_aspect_ratio
The aspect ratio (width/height) which a single pixel should have when displayed.
Definition codec_par.h:161
AVPacketSideData * coded_side_data
Additional data associated with the entire stream.
Definition codec_par.h:83
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
char * value
Definition dict.h:92
Format I/O context.
Definition avformat.h:1401
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition avformat.h:1457
AVStreamGroup ** stream_groups
A list of all stream groups in the file.
Definition avformat.h:1489
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds.
Definition avformat.h:1527
AVDictionary * metadata
Metadata that applies to the whole file.
Definition avformat.h:1649
const struct AVOutputFormat * oformat
The output container format.
Definition avformat.h:1420
AVProgram ** programs
Definition avformat.h:1615
unsigned int nb_programs
Definition avformat.h:1614
const struct AVInputFormat * iformat
The input container format.
Definition avformat.h:1413
unsigned int nb_chapters
Number of chapters in AVChapter array.
Definition avformat.h:1502
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
Definition avformat.h:1544
AVChapter ** chapters
Definition avformat.h:1503
unsigned int nb_stream_groups
Number of elements in AVFormatContext.stream_groups.
Definition avformat.h:1476
AVStream ** streams
A list of all streams in the file.
Definition avformat.h:1469
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
Definition avformat.h:1537
uint8_t * dump_separator
dump format separator.
Definition avformat.h:2005
Parameters describing how to combine a gain map rendition with its base rendition to recover the alte...
Definition gain_map.h:39
Information on how to combine one or more audio streams, as defined in section 3.6 of IAMF.
Definition iamf.h:359
AVIAMFLayer ** layers
Definition iamf.h:362
unsigned int nb_layers
Number of layers, or channel groups, in the Audio Element.
Definition iamf.h:371
A layer defining a Channel Layout in the Audio Element.
Definition iamf.h:294
AVChannelLayout ch_layout
Definition iamf.h:297
Information on how to render and mix one or more AVIAMFAudioElement to generate the final audio outpu...
Definition iamf.h:616
unsigned int nb_submixes
Number of submixes in the presentation.
Definition iamf.h:632
AVDictionary * annotations
A dictionary of strings describing the mix in different languages.
Definition iamf.h:644
AVIAMFSubmix ** submixes
Array of submixes.
Definition iamf.h:625
Submix element as defined in section 3.7 of IAMF.
Definition iamf.h:449
unsigned int audio_element_id
The id of the Audio Element this submix element references.
Definition iamf.h:455
AVDictionary * annotations
A dictionary of strings describing the submix in different languages.
Definition iamf.h:493
Submix layout as defined in section 3.7.6 of IAMF.
Definition iamf.h:517
enum AVIAMFSubmixLayoutType layout_type
Definition iamf.h:520
AVChannelLayout sound_system
Channel layout matching one of Sound Systems A to J of ITU-2051-3, plus 7.1.2ch, 3....
Definition iamf.h:528
Submix layout as defined in section 3.7 of IAMF.
Definition iamf.h:559
unsigned int nb_elements
Number of elements in the submix.
Definition iamf.h:575
AVIAMFSubmixElement ** elements
Array of submix elements.
Definition iamf.h:568
AVIAMFSubmixLayout ** layouts
Array of submix layouts.
Definition iamf.h:583
unsigned int nb_layouts
Number of layouts in the submix.
Definition iamf.h:590
int flags
Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_EXPERIMENTAL, AVFMT_SHOW_IDS,...
Definition avformat.h:587
const char * name
A comma separated list of short names for the format.
Definition avformat.h:572
Mastering display metadata capable of representing the color volume of the display used to master the...
int flags
can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_EXPERIMENTAL, AVFMT_GLOBALHEADER,...
Definition avformat.h:548
const char * name
Definition avformat.h:529
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
Definition packet.h:431
uint8_t * data
Definition packet.h:432
enum AVPacketSideDataType type
Definition packet.h:434
This structure stores compressed data.
Definition packet.h:587
New fields can be added to the end with minor version bumps.
Definition avformat.h:1325
unsigned int nb_stream_indexes
Definition avformat.h:1330
unsigned int * stream_index
Definition avformat.h:1329
AVDictionary * metadata
Definition avformat.h:1331
Rational number (pair of numerator and denominator).
Definition rational.h:58
int num
Numerator.
Definition rational.h:59
int den
Denominator.
Definition rational.h:60
ReplayGain information (see http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1....
Definition replaygain.h:29
uint32_t track_peak
Peak track amplitude, with 100000 representing full scale (but values may overflow).
Definition replaygain.h:39
uint32_t album_peak
Same as track_peak, but for the whole album,.
Definition replaygain.h:47
int32_t track_gain
Track replay gain in microbels (divide by 100000 to get the value in dB).
Definition replaygain.h:34
int32_t album_gain
Same as track_gain, but for the whole album.
Definition replaygain.h:43
This structure describes how to handle spherical videos, outlining information about projection,...
Definition spherical.h:100
enum AVSphericalProjection projection
Projection type.
Definition spherical.h:104
int32_t pitch
Rotation around the right vector [-90, 90].
Definition spherical.h:145
int32_t roll
Rotation around the forward vector [-180, 180].
Definition spherical.h:146
int32_t yaw
Rotation around the up vector [-180, 180].
Definition spherical.h:144
uint32_t padding
Number of pixels to pad from the edge of each cube face.
Definition spherical.h:200
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
Definition stereo3d.h:203
enum AVStereo3DType type
How views are packed within the video.
Definition stereo3d.h:207
uint32_t baseline
The distance between the centres of the lenses of the camera system, in micrometers.
Definition stereo3d.h:228
AVRational horizontal_disparity_adjustment
Relative shift of the left and right images, which changes the zero parallax plane.
Definition stereo3d.h:234
enum AVStereo3DPrimaryEye primary_eye
Which eye is the primary eye when rendering in 2D.
Definition stereo3d.h:222
int flags
Additional information about the frame packing.
Definition stereo3d.h:212
AVRational horizontal_field_of_view
Horizontal field of view, in degrees.
Definition stereo3d.h:239
enum AVStereo3DView view
Determines which views are packed.
Definition stereo3d.h:217
enum AVStreamGroupEntryType type
Definition avformat.h:1178
AVStream * stream
Definition avformat.h:1180
AVStreamGroupLayeredVideo is meant to define the relation between a base layer video stream and a sep...
Definition avformat.h:1104
int height
Height of the final image for presentation.
Definition avformat.h:1129
unsigned int el_index
Index of the enhancement layer stream in AVStreamGroup.
Definition avformat.h:1113
int width
Width of the final stream for presentation.
Definition avformat.h:1125
AVStreamGroupTileGrid holds information on how to combine several independent images on a single canv...
Definition avformat.h:975
int width
Width of the final image for presentation.
Definition avformat.h:1060
int height
Height of the final image for presentation.
Definition avformat.h:1070
int coded_width
Width of the canvas.
Definition avformat.h:990
struct AVStreamGroupTileGrid::@036353327352337314037001273105074056331305251354 * offsets
An nb_tiles sized array of offsets in pixels from the topleft edge of the canvas, indicating where ea...
unsigned int nb_tiles
Amount of tiles in the grid.
Definition avformat.h:983
unsigned int idx
Index of the stream in the group this tile references.
Definition avformat.h:1014
int coded_height
Width of the canvas.
Definition avformat.h:996
unsigned int nb_entries
Number of elements in AVStreamGroup.entries.
Definition avformat.h:1286
enum AVStreamGroupParamsType type
Group type.
Definition avformat.h:1212
struct AVIAMFMixPresentation * iamf_mix_presentation
Definition avformat.h:1219
AVStreamGroupEntry ** entries
A list of streams or child groups in the group.
Definition avformat.h:1299
struct AVStreamGroupTileGrid * tile_grid
Definition avformat.h:1220
int nb_coded_side_data
Amount of entries in coded_side_data.
Definition avformat.h:1312
AVDictionary * metadata
Metadata that applies to the whole group.
Definition avformat.h:1240
unsigned int index
Group index in AVFormatContext.
Definition avformat.h:1196
union AVStreamGroup::@313244315204024013007202273061153315146016101155 params
Group type-specific parameters.
struct AVIAMFAudioElement * iamf_audio_element
Definition avformat.h:1218
int disposition
Stream group disposition - a combination of AV_DISPOSITION_* flags.
Definition avformat.h:1278
int64_t id
Group type-specific group ID.
Definition avformat.h:1204
AVPacketSideData * coded_side_data
Additional data associated with the group.
Definition avformat.h:1307
struct AVStreamGroupLayeredVideo * layered_video
Definition avformat.h:1221
Stream structure.
Definition avformat.h:768
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition avformat.h:791
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
Definition avformat.h:846
AVDictionary * metadata
Definition avformat.h:848
int id
Format-specific stream ID.
Definition avformat.h:780
int index
stream index in AVFormatContext
Definition avformat.h:774
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
Definition avformat.h:817
AVRational avg_frame_rate
Average framerate.
Definition avformat.h:857
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition avformat.h:807
AVRational r_frame_rate
Real base framerate of the stream.
Definition avformat.h:902
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
Definition avformat.h:837
struct AVCodecContext * avctx
The codec context used by avformat_find_stream_info, the parser, etc.
Definition internal.h:168
int codec_info_nb_frames
Number of frames that have been demuxed during avformat_find_stream_info()
Definition internal.h:367
uint8_t level
Definition svq3.c:208
#define av_free(p)
#define av_mallocz(s)
#define av_log(a,...)
Spherical video.
#define height
Definition dsp.h:99
#define width
Definition dsp.h:99
char * av_timecode_make_smpte_tc_string2(char *buf, AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field)
Get the timecode string from the SMPTE timecode format.
Definition timecode.c:131
Timecode helpers header.
#define AV_TIMECODE_STR_SIZE
Definition timecode.h:33
int size
int len
static double c[64]