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/iamf.h"
30#include "libavutil/log.h"
33#include "libavutil/dovi_meta.h"
35#include "libavutil/mem.h"
36#include "libavutil/opt.h"
38#include "libavutil/spherical.h"
39#include "libavutil/stereo3d.h"
40#include "libavutil/tdrdi.h"
41#include "libavutil/timecode.h"
42
43#include "libavcodec/avcodec.h"
44
45#include "avformat.h"
46#include "internal.h"
47
48#define HEXDUMP_PRINT(...) \
49 do { \
50 if (!f) \
51 av_log(avcl, level, __VA_ARGS__); \
52 else \
53 fprintf(f, __VA_ARGS__); \
54 } while (0)
55
56static void hex_dump_internal(void *avcl, FILE *f, int level,
57 const uint8_t *buf, int size)
58{
59 int len, i, j, c;
60
61 for (i = 0; i < size; i += 16) {
62 len = size - i;
63 if (len > 16)
64 len = 16;
65 HEXDUMP_PRINT("%08x ", i);
66 for (j = 0; j < 16; j++) {
67 if (j < len)
68 HEXDUMP_PRINT(" %02x", buf[i + j]);
69 else
70 HEXDUMP_PRINT(" ");
71 }
72 HEXDUMP_PRINT(" ");
73 for (j = 0; j < len; j++) {
74 c = buf[i + j];
75 if (c < ' ' || c > '~')
76 c = '.';
77 HEXDUMP_PRINT("%c", c);
78 }
79 HEXDUMP_PRINT("\n");
80 }
81}
82
83void av_hex_dump(FILE *f, const uint8_t *buf, int size)
84{
85 hex_dump_internal(NULL, f, 0, buf, size);
86}
87
88void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
89{
90 hex_dump_internal(avcl, NULL, level, buf, size);
91}
92
93static void pkt_dump_internal(void *avcl, FILE *f, int level, const AVPacket *pkt,
94 int dump_payload, AVRational time_base)
95{
96 HEXDUMP_PRINT("stream #%d:\n", pkt->stream_index);
97 HEXDUMP_PRINT(" keyframe=%d\n", (pkt->flags & AV_PKT_FLAG_KEY) != 0);
98 HEXDUMP_PRINT(" duration=%0.3f\n", pkt->duration * av_q2d(time_base));
99 /* DTS is _always_ valid after av_read_frame() */
100 HEXDUMP_PRINT(" dts=");
101 if (pkt->dts == AV_NOPTS_VALUE)
102 HEXDUMP_PRINT("N/A");
103 else
104 HEXDUMP_PRINT("%0.3f", pkt->dts * av_q2d(time_base));
105 /* PTS may not be known if B-frames are present. */
106 HEXDUMP_PRINT(" pts=");
107 if (pkt->pts == AV_NOPTS_VALUE)
108 HEXDUMP_PRINT("N/A");
109 else
110 HEXDUMP_PRINT("%0.3f", pkt->pts * av_q2d(time_base));
111 HEXDUMP_PRINT("\n");
112 HEXDUMP_PRINT(" size=%d\n", pkt->size);
113 if (dump_payload)
114 hex_dump_internal(avcl, f, level, pkt->data, pkt->size);
115}
116
117void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st)
118{
119 pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base);
120}
121
122void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload,
123 const AVStream *st)
124{
125 pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base);
126}
127
128
129static void print_fps(double d, const char *postfix, int log_level)
130{
131 uint64_t v = lrintf(d * 100);
132 if (!v)
133 av_log(NULL, log_level, "%1.4f %s", d, postfix);
134 else if (v % 100)
135 av_log(NULL, log_level, "%3.2f %s", d, postfix);
136 else if (v % (100 * 1000))
137 av_log(NULL, log_level, "%1.0f %s", d, postfix);
138 else
139 av_log(NULL, log_level, "%1.0fk %s", d / 1000, postfix);
140}
141
142static void dump_dictionary(void *ctx, const AVDictionary *m,
143 const char *name, const char *indent,
144 int log_level)
145{
146 const AVDictionaryEntry *tag = NULL;
147
148 if (!m)
149 return;
150
151 av_log(ctx, log_level, "%s%s:\n", indent, name);
152 while ((tag = av_dict_iterate(m, tag)))
153 if (strcmp("language", tag->key)) {
154 const char *p = tag->value;
155 av_log(ctx, log_level,
156 "%s %-16s: ", indent, tag->key);
157 while (*p) {
158 size_t len = strcspn(p, "\x8\xa\xb\xc\xd");
159 av_log(ctx, log_level, "%.*s", (int)(FFMIN(255, len)), p);
160 p += len;
161 if (*p == 0xd) av_log(ctx, log_level, " ");
162 if (*p == 0xa) av_log(ctx, log_level, "\n%s %-16s: ", indent, "");
163 if (*p) p++;
164 }
165 av_log(ctx, log_level, "\n");
166 }
167}
168
169static void dump_metadata(void *ctx, const AVDictionary *m, const char *indent,
170 int log_level)
171{
172 if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0)))
173 dump_dictionary(ctx, m, "Metadata", indent, log_level);
174}
175
176/* param change side data*/
177static void dump_paramchange(void *ctx, const AVPacketSideData *sd, int log_level)
178{
179 int size = sd->size;
180 const uint8_t *data = sd->data;
181 uint32_t flags, sample_rate, width, height;
182
183 if (!data || sd->size < 4)
184 goto fail;
185
186 flags = AV_RL32(data);
187 data += 4;
188 size -= 4;
189
191 if (size < 4)
192 goto fail;
193 sample_rate = AV_RL32(data);
194 data += 4;
195 size -= 4;
196 av_log(ctx, log_level, "sample_rate %"PRIu32", ", sample_rate);
197 }
199 if (size < 8)
200 goto fail;
201 width = AV_RL32(data);
202 data += 4;
203 size -= 4;
205 data += 4;
206 size -= 4;
207 av_log(ctx, log_level, "width %"PRIu32" height %"PRIu32, width, height);
208 }
209
210 return;
211fail:
212 av_log(ctx, AV_LOG_ERROR, "unknown param\n");
213}
214
215/* replaygain side data*/
216static void print_gain(void *ctx, const char *str, int32_t gain, int log_level)
217{
218 av_log(ctx, log_level, "%s - ", str);
219 if (gain == INT32_MIN)
220 av_log(ctx, log_level, "unknown");
221 else
222 av_log(ctx, log_level, "%f", gain / 100000.0f);
223 av_log(ctx, log_level, ", ");
224}
225
226static void print_peak(void *ctx, const char *str, uint32_t peak, int log_level)
227{
228 av_log(ctx, log_level, "%s - ", str);
229 if (!peak)
230 av_log(ctx, log_level, "unknown");
231 else
232 av_log(ctx, log_level, "%f", (float) peak / UINT32_MAX);
233 av_log(ctx, log_level, ", ");
234}
235
236static void dump_replaygain(void *ctx, const AVPacketSideData *sd, int log_level)
237{
238 const AVReplayGain *rg;
239
240 if (sd->size < sizeof(*rg)) {
241 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
242 return;
243 }
244 rg = (const AVReplayGain *)sd->data;
245
246 print_gain(ctx, "track gain", rg->track_gain, log_level);
247 print_peak(ctx, "track peak", rg->track_peak, log_level);
248 print_gain(ctx, "album gain", rg->album_gain, log_level);
249 print_peak(ctx, "album peak", rg->album_peak, log_level);
250}
251
252static void dump_stereo3d(void *ctx, const AVPacketSideData *sd, int log_level)
253{
254 const AVStereo3D *stereo;
255
256 if (sd->size < sizeof(*stereo)) {
257 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
258 return;
259 }
260
261 stereo = (const AVStereo3D *)sd->data;
262
263 av_log(ctx, log_level, "%s, view: %s, primary eye: %s",
266 if (stereo->baseline)
267 av_log(ctx, log_level, ", baseline: %"PRIu32"", stereo->baseline);
269 av_log(ctx, log_level, ", horizontal_disparity_adjustment: %0.4f",
272 av_log(ctx, log_level, ", horizontal_field_of_view: %0.3f", av_q2d(stereo->horizontal_field_of_view));
273
274 if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
275 av_log(ctx, log_level, " (inverted)");
276}
277
278static void dump_audioservicetype(void *ctx, const AVPacketSideData *sd, int log_level)
279{
280 const enum AVAudioServiceType *ast = (const enum AVAudioServiceType *)sd->data;
281
282 if (sd->size < sizeof(*ast)) {
283 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
284 return;
285 }
286
287 switch (*ast) {
289 av_log(ctx, log_level, "main");
290 break;
292 av_log(ctx, log_level, "effects");
293 break;
295 av_log(ctx, log_level, "visually impaired");
296 break;
298 av_log(ctx, log_level, "hearing impaired");
299 break;
301 av_log(ctx, log_level, "dialogue");
302 break;
304 av_log(ctx, log_level, "commentary");
305 break;
307 av_log(ctx, log_level, "emergency");
308 break;
310 av_log(ctx, log_level, "voice over");
311 break;
313 av_log(ctx, log_level, "karaoke");
314 break;
315 default:
316 av_log(ctx, AV_LOG_WARNING, "unknown");
317 break;
318 }
319}
320
321static void dump_cpb(void *ctx, const AVPacketSideData *sd, int log_level)
322{
323 const AVCPBProperties *cpb = (const AVCPBProperties *)sd->data;
324
325 if (sd->size < sizeof(*cpb)) {
326 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
327 return;
328 }
329
330 av_log(ctx, log_level,
331 "bitrate max/min/avg: %"PRId64"/%"PRId64"/%"PRId64" buffer size: %"PRId64" ",
332 cpb->max_bitrate, cpb->min_bitrate, cpb->avg_bitrate,
333 cpb->buffer_size);
334 if (cpb->vbv_delay == UINT64_MAX)
335 av_log(ctx, log_level, "vbv_delay: N/A");
336 else
337 av_log(ctx, log_level, "vbv_delay: %"PRIu64"", cpb->vbv_delay);
338}
339
341 int log_level)
342{
344 (const AVMasteringDisplayMetadata *)sd->data;
345 av_log(ctx, log_level,
346 "has_primaries:%d has_luminance:%d "
347 "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f) "
348 "min_luminance=%f, max_luminance=%f",
349 metadata->has_primaries, metadata->has_luminance,
350 av_q2d(metadata->display_primaries[0][0]),
351 av_q2d(metadata->display_primaries[0][1]),
352 av_q2d(metadata->display_primaries[1][0]),
353 av_q2d(metadata->display_primaries[1][1]),
354 av_q2d(metadata->display_primaries[2][0]),
355 av_q2d(metadata->display_primaries[2][1]),
356 av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1]),
357 av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance));
358}
359
361 int log_level)
362{
364 (const AVContentLightMetadata *)sd->data;
365 av_log(ctx, log_level,
366 "MaxCLL=%d, MaxFALL=%d",
367 metadata->MaxCLL, metadata->MaxFALL);
368}
369
370static void dump_ambient_viewing_environment_metadata(void *ctx, const AVPacketSideData *sd, int log_level)
371{
372 const AVAmbientViewingEnvironment *ambient =
374 av_log(ctx, log_level,
375 "ambient_illuminance=%f, ambient_light_x=%f, ambient_light_y=%f",
376 av_q2d(ambient->ambient_illuminance),
377 av_q2d(ambient->ambient_light_x),
378 av_q2d(ambient->ambient_light_y));
379}
380
381static void dump_spherical(void *ctx, int w, int h,
382 const AVPacketSideData *sd, int log_level)
383{
384 const AVSphericalMapping *spherical = (const AVSphericalMapping *)sd->data;
385 double yaw, pitch, roll;
386
387 if (sd->size < sizeof(*spherical)) {
388 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
389 return;
390 }
391
392 av_log(ctx, log_level, "%s ", av_spherical_projection_name(spherical->projection));
393
394 if (spherical->yaw || spherical->pitch || spherical->roll) {
395 yaw = ((double)spherical->yaw) / (1 << 16);
396 pitch = ((double)spherical->pitch) / (1 << 16);
397 roll = ((double)spherical->roll) / (1 << 16);
398 av_log(ctx, log_level, "(%f/%f/%f) ", yaw, pitch, roll);
399 }
400
402 size_t l, t, r, b;
403 av_spherical_tile_bounds(spherical, w, h,
404 &l, &t, &r, &b);
405 av_log(ctx, log_level, "[%zu, %zu, %zu, %zu] ", l, t, r, b);
406 } else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
407 av_log(ctx, log_level, "[pad %"PRIu32"] ", spherical->padding);
408 }
409}
410
411static void dump_dovi_conf(void *ctx, const AVPacketSideData *sd,
412 int log_level)
413{
416
417 av_log(ctx, log_level, "version: %d.%d, profile: %d, level: %d, "
418 "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d, "
419 "compression: %d",
421 dovi->dv_profile, dovi->dv_level,
422 dovi->rpu_present_flag,
423 dovi->el_present_flag,
424 dovi->bl_present_flag,
426 dovi->dv_md_compression);
427}
428
429static void dump_s12m_timecode(void *ctx, AVRational avg_frame_rate, const AVPacketSideData *sd,
430 int log_level)
431{
432 const uint32_t *tc = (const uint32_t *)sd->data;
433
434 if ((sd->size != sizeof(uint32_t) * 4) || (tc[0] > 3)) {
435 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
436 return;
437 }
438
439 for (int j = 1; j <= tc[0]; j++) {
440 char tcbuf[AV_TIMECODE_STR_SIZE];
441 av_timecode_make_smpte_tc_string2(tcbuf, avg_frame_rate, tc[j], 0, 0);
442 av_log(ctx, log_level, "timecode - %s%s", tcbuf, j != tc[0] ? ", " : "");
443 }
444}
445
446static void dump_cropping(void *ctx, const AVPacketSideData *sd, int log_level)
447{
448 uint32_t top, bottom, left, right;
449
450 if (sd->size < sizeof(uint32_t) * 4) {
451 av_log(ctx, log_level, "invalid data\n");
452 return;
453 }
454
455 top = AV_RL32(sd->data + 0);
456 bottom = AV_RL32(sd->data + 4);
457 left = AV_RL32(sd->data + 8);
458 right = AV_RL32(sd->data + 12);
459
460 av_log(ctx, log_level, "%"PRIu32"/%"PRIu32"/%"PRIu32"/%"PRIu32"", left, right, top, bottom);
461}
462
463static void dump_tdrdi(void *ctx, const AVPacketSideData *sd, int log_level)
464{
465 const AV3DReferenceDisplaysInfo *tdrdi =
466 (const AV3DReferenceDisplaysInfo *)sd->data;
467
468 av_log(ctx, log_level, "number of reference displays: %u", tdrdi->num_ref_displays);
469}
470
471static void dump_sidedata(void *ctx, const AVPacketSideData *side_data, int nb_side_data,
472 int w, int h, AVRational avg_frame_rate,
473 const char *indent, int log_level)
474{
475 int i;
476
477 if (nb_side_data)
478 av_log(ctx, log_level, "%sSide data:\n", indent);
479
480 for (i = 0; i < nb_side_data; i++) {
481 const AVPacketSideData *sd = &side_data[i];
482 const char *name = av_packet_side_data_name(sd->type);
483
484 av_log(ctx, log_level, "%s ", indent);
485 if (name)
486 av_log(ctx, log_level, "%s: ", name);
487 switch (sd->type) {
489 dump_paramchange(ctx, sd, log_level);
490 break;
492 dump_replaygain(ctx, sd, log_level);
493 break;
495 av_log(ctx, log_level, "rotation of %.2f degrees",
496 av_display_rotation_get((const int32_t *)sd->data));
497 break;
499 dump_stereo3d(ctx, sd, log_level);
500 break;
502 dump_audioservicetype(ctx, sd, log_level);
503 break;
505 av_log(ctx, log_level, "%"PRId32", pict_type: %c",
507 break;
509 dump_cpb(ctx, sd, log_level);
510 break;
512 dump_mastering_display_metadata(ctx, sd, log_level);
513 break;
515 dump_spherical(ctx, w, h, sd, log_level);
516 break;
518 dump_content_light_metadata(ctx, sd, log_level);
519 break;
521 dump_dovi_conf(ctx, sd, log_level);
522 break;
524 dump_s12m_timecode(ctx, avg_frame_rate, sd, log_level);
525 break;
528 break;
530 dump_cropping(ctx, sd, log_level);
531 break;
533 dump_tdrdi(ctx, sd, log_level);
534 break;
535 default:
536 if (name)
537 av_log(ctx, log_level, "(%zu bytes)", sd->size);
538 else
539 av_log(ctx, log_level, "unknown side data type %d "
540 "(%zu bytes)", sd->type, sd->size);
541 break;
542 }
543
544 av_log(ctx, log_level, "\n");
545 }
546}
547
548static void dump_disposition(int disposition, int log_level)
549{
550 if (disposition & AV_DISPOSITION_DEFAULT)
551 av_log(NULL, log_level, " (default)");
552 if (disposition & AV_DISPOSITION_DUB)
553 av_log(NULL, log_level, " (dub)");
554 if (disposition & AV_DISPOSITION_ORIGINAL)
555 av_log(NULL, log_level, " (original)");
556 if (disposition & AV_DISPOSITION_COMMENT)
557 av_log(NULL, log_level, " (comment)");
558 if (disposition & AV_DISPOSITION_LYRICS)
559 av_log(NULL, log_level, " (lyrics)");
560 if (disposition & AV_DISPOSITION_KARAOKE)
561 av_log(NULL, log_level, " (karaoke)");
562 if (disposition & AV_DISPOSITION_FORCED)
563 av_log(NULL, log_level, " (forced)");
564 if (disposition & AV_DISPOSITION_HEARING_IMPAIRED)
565 av_log(NULL, log_level, " (hearing impaired)");
566 if (disposition & AV_DISPOSITION_VISUAL_IMPAIRED)
567 av_log(NULL, log_level, " (visual impaired)");
568 if (disposition & AV_DISPOSITION_CLEAN_EFFECTS)
569 av_log(NULL, log_level, " (clean effects)");
570 if (disposition & AV_DISPOSITION_ATTACHED_PIC)
571 av_log(NULL, log_level, " (attached pic)");
572 if (disposition & AV_DISPOSITION_TIMED_THUMBNAILS)
573 av_log(NULL, log_level, " (timed thumbnails)");
574 if (disposition & AV_DISPOSITION_CAPTIONS)
575 av_log(NULL, log_level, " (captions)");
576 if (disposition & AV_DISPOSITION_DESCRIPTIONS)
577 av_log(NULL, log_level, " (descriptions)");
578 if (disposition & AV_DISPOSITION_METADATA)
579 av_log(NULL, log_level, " (metadata)");
580 if (disposition & AV_DISPOSITION_DEPENDENT)
581 av_log(NULL, log_level, " (dependent)");
582 if (disposition & AV_DISPOSITION_STILL_IMAGE)
583 av_log(NULL, log_level, " (still image)");
584 if (disposition & AV_DISPOSITION_NON_DIEGETIC)
585 av_log(NULL, log_level, " (non-diegetic)");
586 if (disposition & AV_DISPOSITION_MULTILAYER)
587 av_log(NULL, log_level, " (multilayer)");
588}
589
590/* "user interface" functions */
591static void dump_stream_format(const AVFormatContext *ic, int i,
592 int group_index, int index, int is_output,
593 int log_level)
594{
595 char buf[256];
596 int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
597 const AVStream *st = ic->streams[i];
598 const FFStream *const sti = cffstream(st);
599 const AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
600 const char *separator = ic->dump_separator;
601 const char *group_indent = group_index >= 0 ? " " : "";
602 const char *extra_indent = group_index >= 0 ? " " : " ";
603 AVCodecContext *avctx;
604 int ret;
605
607 if (!avctx)
608 return;
609
610 ret = avcodec_parameters_to_context(avctx, st->codecpar);
611 if (ret < 0) {
612 avcodec_free_context(&avctx);
613 return;
614 }
615
616 // Fields which are missing from AVCodecParameters need to be taken from the AVCodecContext
617 if (sti->avctx) {
618 avctx->codec = sti->avctx->codec;
619 avctx->qmin = sti->avctx->qmin;
620 avctx->qmax = sti->avctx->qmax;
621 avctx->coded_width = sti->avctx->coded_width;
622 avctx->coded_height = sti->avctx->coded_height;
623 }
624
625 if (separator)
626 av_opt_set(avctx, "dump_separator", separator, 0);
627 avcodec_string(buf, sizeof(buf), avctx, is_output);
628 avcodec_free_context(&avctx);
629
630 av_log(NULL, log_level, "%s Stream #%d", group_indent, index);
631 av_log(NULL, log_level, ":%d", i);
632
633 /* the pid is an important information, so we display it */
634 /* XXX: add a generic system */
635 if (flags & AVFMT_SHOW_IDS)
636 av_log(NULL, log_level, "[0x%x]", st->id);
637 if (lang)
638 av_log(NULL, log_level, "(%s)", lang->value);
639 av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", sti->codec_info_nb_frames,
640 st->time_base.num, st->time_base.den);
641 av_log(NULL, log_level, ": %s", buf);
642
643 if (st->sample_aspect_ratio.num &&
645 AVRational display_aspect_ratio;
646 av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
649 1024 * 1024);
650 av_log(NULL, log_level, ", SAR %d:%d DAR %d:%d",
652 display_aspect_ratio.num, display_aspect_ratio.den);
653 }
654
656 int fps = st->avg_frame_rate.den && st->avg_frame_rate.num;
657 int tbr = st->r_frame_rate.den && st->r_frame_rate.num;
658 int tbn = st->time_base.den && st->time_base.num;
659
660 if (fps || tbr || tbn)
661 av_log(NULL, log_level, "%s", separator);
662
663 if (fps)
664 print_fps(av_q2d(st->avg_frame_rate), tbr || tbn ? "fps, " : "fps", log_level);
665 if (tbr)
666 print_fps(av_q2d(st->r_frame_rate), tbn ? "tbr, " : "tbr", log_level);
667 if (tbn)
668 print_fps(1 / av_q2d(st->time_base), "tbn", log_level);
669 }
670
671 if (st->start_time != AV_NOPTS_VALUE && st->start_time != 0 && st->time_base.den && st->time_base.num) {
672 const double stream_start = av_q2d(st->time_base) * st->start_time;
673 av_log(NULL, log_level, ", start %.6f", stream_start);
674 }
675
676 dump_disposition(st->disposition, log_level);
677 av_log(NULL, log_level, "\n");
678
679 dump_metadata(NULL, st->metadata, extra_indent, log_level);
680
683 extra_indent, log_level);
684}
685
686static void dump_stream_group(const AVFormatContext *ic, uint8_t *printed,
687 int i, int index, int is_output)
688{
689 const AVStreamGroup *stg = ic->stream_groups[i];
690 int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
691 char buf[512];
692 int ret;
693
694 av_log(NULL, AV_LOG_INFO, " Stream group #%d:%d", index, i);
695 if (flags & AVFMT_SHOW_IDS)
696 av_log(NULL, AV_LOG_INFO, "[0x%"PRIx64"]", stg->id);
697 av_log(NULL, AV_LOG_INFO, ":");
698
699 switch (stg->type) {
701 const AVIAMFAudioElement *audio_element = stg->params.iamf_audio_element;
702 av_log(NULL, AV_LOG_INFO, " IAMF Audio Element:");
704 av_log(NULL, AV_LOG_INFO, "\n");
706 for (int j = 0; j < audio_element->nb_layers; j++) {
707 const AVIAMFLayer *layer = audio_element->layers[j];
708 int channel_count = layer->ch_layout.nb_channels;
709 av_log(NULL, AV_LOG_INFO, " Layer %d:", j);
710 ret = av_channel_layout_describe(&layer->ch_layout, buf, sizeof(buf));
711 if (ret >= 0)
712 av_log(NULL, AV_LOG_INFO, " %s", buf);
713 av_log(NULL, AV_LOG_INFO, "\n");
714 for (int k = 0; channel_count > 0 && k < stg->nb_streams; k++) {
715 AVStream *st = stg->streams[k];
716 dump_stream_format(ic, st->index, i, index, is_output, AV_LOG_VERBOSE);
717 printed[st->index] = 1;
718 channel_count -= st->codecpar->ch_layout.nb_channels;
719 }
720 }
721 break;
722 }
724 const AVIAMFMixPresentation *mix_presentation = stg->params.iamf_mix_presentation;
725 av_log(NULL, AV_LOG_INFO, " IAMF Mix Presentation:");
727 av_log(NULL, AV_LOG_INFO, "\n");
729 dump_dictionary(NULL, mix_presentation->annotations, "Annotations", " ", AV_LOG_INFO);
730 for (int j = 0; j < mix_presentation->nb_submixes; j++) {
731 AVIAMFSubmix *sub_mix = mix_presentation->submixes[j];
732 av_log(NULL, AV_LOG_INFO, " Submix %d:\n", j);
733 for (int k = 0; k < sub_mix->nb_elements; k++) {
734 const AVIAMFSubmixElement *submix_element = sub_mix->elements[k];
735 const AVStreamGroup *audio_element = NULL;
736 for (int l = 0; l < ic->nb_stream_groups; l++)
738 ic->stream_groups[l]->id == submix_element->audio_element_id) {
739 audio_element = ic->stream_groups[l];
740 break;
741 }
742 if (audio_element) {
743 av_log(NULL, AV_LOG_INFO, " IAMF Audio Element #%d:%d",
744 index, audio_element->index);
745 if (flags & AVFMT_SHOW_IDS)
746 av_log(NULL, AV_LOG_INFO, "[0x%"PRIx64"]", audio_element->id);
747 av_log(NULL, AV_LOG_INFO, "\n");
748 dump_dictionary(NULL, submix_element->annotations, "Annotations", " ", AV_LOG_INFO);
749 }
750 }
751 for (int k = 0; k < sub_mix->nb_layouts; k++) {
752 const AVIAMFSubmixLayout *submix_layout = sub_mix->layouts[k];
753 av_log(NULL, AV_LOG_INFO, " Layout #%d:", k);
754 if (submix_layout->layout_type == 2 ||
755 submix_layout->layout_type == 3) {
756 ret = av_channel_layout_describe(&submix_layout->sound_system, buf, sizeof(buf));
757 if (ret >= 0)
758 av_log(NULL, AV_LOG_INFO, " %s", buf);
759 }
760 av_log(NULL, AV_LOG_INFO, "\n");
761 }
762 }
763 break;
764 }
766 const AVStreamGroupTileGrid *tile_grid = stg->params.tile_grid;
768 const char *ptr = NULL;
769 av_log(NULL, AV_LOG_INFO, " Tile Grid:");
770 if (avctx && stg->nb_streams && !avcodec_parameters_to_context(avctx, stg->streams[0]->codecpar)) {
771 avctx->width = tile_grid->width;
772 avctx->height = tile_grid->height;
773 avctx->coded_width = tile_grid->coded_width;
774 avctx->coded_height = tile_grid->coded_height;
775 if (ic->dump_separator)
776 av_opt_set(avctx, "dump_separator", ic->dump_separator, 0);
777 buf[0] = 0;
778 avcodec_string(buf, sizeof(buf), avctx, is_output);
779 ptr = av_stristr(buf, " ");
780 }
781 avcodec_free_context(&avctx);
782 if (ptr)
783 av_log(NULL, AV_LOG_INFO, "%s", ptr);
785 av_log(NULL, AV_LOG_INFO, "\n");
788 tile_grid->width, tile_grid->height, (AVRational) {0,1},
789 " ", AV_LOG_INFO);
790 for (int i = 0; i < tile_grid->nb_tiles; i++) {
791 const AVStream *st = NULL;
792 if (tile_grid->offsets[i].idx < stg->nb_streams)
793 st = stg->streams[tile_grid->offsets[i].idx];
794 if (st && !printed[st->index]) {
795 dump_stream_format(ic, st->index, i, index, is_output, AV_LOG_VERBOSE);
796 printed[st->index] = 1;
797 }
798 }
799 for (int i = 0; i < stg->nb_streams; i++) {
800 const AVStream *st = stg->streams[i];
801 if (!printed[st->index]) {
802 dump_stream_format(ic, st->index, i, index, is_output, AV_LOG_INFO);
803 printed[st->index] = 1;
804 }
805 }
806 break;
807 }
810 const AVStreamGroupLayeredVideo *layered_video = stg->params.layered_video;
812 const char *ptr = NULL;
814 "Dolby Vision" : "LCEVC");
815 if (avctx && stg->nb_streams == 2 &&
816 !avcodec_parameters_to_context(avctx, stg->streams[!layered_video->el_index]->codecpar)) {
817 avctx->width = layered_video->width;
818 avctx->height = layered_video->height;
819 avctx->coded_width = layered_video->width;
820 avctx->coded_height = layered_video->height;
821 if (ic->dump_separator)
822 av_opt_set(avctx, "dump_separator", ic->dump_separator, 0);
823 buf[0] = 0;
824 avcodec_string(buf, sizeof(buf), avctx, is_output);
825 ptr = av_stristr(buf, " ");
826 }
827 avcodec_free_context(&avctx);
828 if (ptr)
829 av_log(NULL, AV_LOG_INFO, "%s", ptr);
830 av_log(NULL, AV_LOG_INFO, "\n");
831 for (int i = 0; i < stg->nb_streams; i++) {
832 const AVStream *st = stg->streams[i];
833 dump_stream_format(ic, st->index, i, index, is_output, AV_LOG_VERBOSE);
834 printed[st->index] = 1;
835 }
836 break;
837 }
839 av_log(NULL, AV_LOG_INFO, " Track Reference:\n");
840 for (int i = 0; i < stg->nb_streams; i++) {
841 const AVStream *st = stg->streams[i];
842 dump_stream_format(ic, st->index, i, index, is_output, AV_LOG_INFO);
843 printed[st->index] = 1;
844 }
845 break;
846 }
847 default:
848 break;
849 }
850}
851
853 const char *url, int is_output)
854{
855 int i;
856 uint8_t *printed = ic->nb_streams ? av_mallocz(ic->nb_streams) : NULL;
857 if (ic->nb_streams && !printed)
858 return;
859
860 av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n",
861 is_output ? "Output" : "Input",
862 index,
863 is_output ? ic->oformat->name : ic->iformat->name,
864 is_output ? "to" : "from", url);
866
867 if (!is_output) {
868 av_log(NULL, AV_LOG_INFO, " Duration: ");
869 if (ic->duration != AV_NOPTS_VALUE) {
870 int64_t hours, mins, secs, us;
871 int64_t duration = ic->duration + (ic->duration <= INT64_MAX - 5000 ? 5000 : 0);
872 secs = duration / AV_TIME_BASE;
874 mins = secs / 60;
875 secs %= 60;
876 hours = mins / 60;
877 mins %= 60;
878 av_log(NULL, AV_LOG_INFO, "%02"PRId64":%02"PRId64":%02"PRId64".%02"PRId64"", hours, mins, secs,
879 (100 * us) / AV_TIME_BASE);
880 } else {
881 av_log(NULL, AV_LOG_INFO, "N/A");
882 }
883 if (ic->start_time != AV_NOPTS_VALUE) {
884 int secs, us;
885 av_log(NULL, AV_LOG_INFO, ", start: ");
886 secs = llabs(ic->start_time / AV_TIME_BASE);
887 us = llabs(ic->start_time % AV_TIME_BASE);
888 av_log(NULL, AV_LOG_INFO, "%s%d.%06d",
889 ic->start_time >= 0 ? "" : "-",
890 secs,
891 (int) av_rescale(us, 1000000, AV_TIME_BASE));
892 }
893 av_log(NULL, AV_LOG_INFO, ", bitrate: ");
894 if (ic->bit_rate)
895 av_log(NULL, AV_LOG_INFO, "%"PRId64" kb/s", ic->bit_rate / 1000);
896 else
897 av_log(NULL, AV_LOG_INFO, "N/A");
898 av_log(NULL, AV_LOG_INFO, "\n");
899 }
900
901 if (ic->nb_chapters)
902 av_log(NULL, AV_LOG_INFO, " Chapters:\n");
903 for (i = 0; i < ic->nb_chapters; i++) {
904 const AVChapter *ch = ic->chapters[i];
905 av_log(NULL, AV_LOG_INFO, " Chapter #%d:%d: ", index, i);
907 "start %f, ", ch->start * av_q2d(ch->time_base));
909 "end %f\n", ch->end * av_q2d(ch->time_base));
910
912 }
913
914 if (ic->nb_programs) {
915 int j, k, total = 0;
916 for (j = 0; j < ic->nb_programs; j++) {
917 const AVProgram *program = ic->programs[j];
918 const AVDictionaryEntry *name = av_dict_get(program->metadata,
919 "name", NULL, 0);
920 av_log(NULL, AV_LOG_INFO, " Program %d %s\n", program->id,
921 name ? name->value : "");
922 dump_metadata(NULL, program->metadata, " ", AV_LOG_INFO);
923 for (k = 0; k < program->nb_stream_indexes; k++) {
924 dump_stream_format(ic, program->stream_index[k],
925 -1, index, is_output, AV_LOG_INFO);
926 printed[program->stream_index[k]] = 1;
927 }
928 total += program->nb_stream_indexes;
929 }
930 if (total < ic->nb_streams)
931 av_log(NULL, AV_LOG_INFO, " No Program\n");
932 }
933
934 for (i = 0; i < ic->nb_stream_groups; i++)
935 dump_stream_group(ic, printed, i, index, is_output);
936
937 for (i = 0; i < ic->nb_streams; i++)
938 if (!printed[i])
939 dump_stream_format(ic, i, -1, index, is_output, AV_LOG_INFO);
940
941 av_free(printed);
942}
int32_t
Libavcodec external API header.
Main libavformat public API header.
#define AV_DISPOSITION_LYRICS
The stream contains song lyrics.
Definition avformat.h:661
#define AV_DISPOSITION_STILL_IMAGE
The video stream contains still images.
Definition avformat.h:731
#define AV_DISPOSITION_HEARING_IMPAIRED
The stream is intended for hearing impaired audiences.
Definition avformat.h:676
#define AV_DISPOSITION_COMMENT
The stream is a commentary track.
Definition avformat.h:657
@ AV_STREAM_GROUP_PARAMS_DOLBY_VISION
Definition avformat.h:1153
@ AV_STREAM_GROUP_PARAMS_TREF
Definition avformat.h:1152
@ AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION
Definition avformat.h:1149
@ AV_STREAM_GROUP_PARAMS_TILE_GRID
Definition avformat.h:1150
@ AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT
Definition avformat.h:1148
@ AV_STREAM_GROUP_PARAMS_LCEVC
Definition avformat.h:1151
#define AV_DISPOSITION_KARAOKE
The stream contains karaoke audio.
Definition avformat.h:665
#define AV_DISPOSITION_CAPTIONS
The subtitle stream contains captions, providing a transcription and possibly a translation of audio.
Definition avformat.h:710
#define AV_DISPOSITION_DUB
The stream is not in original language.
Definition avformat.h:647
#define AV_DISPOSITION_METADATA
The subtitle stream contains time-aligned metadata that is not intended to be directly presented to t...
Definition avformat.h:721
#define AV_DISPOSITION_MULTILAYER
The video stream contains multiple layers, e.g.
Definition avformat.h:736
#define AV_DISPOSITION_DEPENDENT
The stream is intended to be mixed with another stream before presentation.
Definition avformat.h:727
#define AV_DISPOSITION_NON_DIEGETIC
The stream is intended to be mixed with a spatial audio track.
Definition avformat.h:704
#define AVFMT_SHOW_IDS
Show format stream IDs numbers.
Definition avformat.h:496
#define AV_DISPOSITION_CLEAN_EFFECTS
The audio stream contains music and sound effects without voice.
Definition avformat.h:684
#define AV_DISPOSITION_FORCED
Track should be used during playback by default.
Definition avformat.h:672
#define AV_DISPOSITION_VISUAL_IMPAIRED
The stream is intended for visually impaired audiences.
Definition avformat.h:680
#define AV_DISPOSITION_ATTACHED_PIC
The stream is stored in the file as an attached picture/"cover art" (e.g.
Definition avformat.h:692
#define AV_DISPOSITION_DESCRIPTIONS
The subtitle stream contains a textual description of the video content.
Definition avformat.h:716
#define AV_DISPOSITION_ORIGINAL
The stream is in original language.
Definition avformat.h:653
#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:639
#define AV_DISPOSITION_TIMED_THUMBNAILS
The stream is sparse, and contains thumbnail images, often corresponding to chapter markers.
Definition avformat.h:697
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:235
@ AV_AUDIO_SERVICE_TYPE_VOICE_OVER
Definition defs.h:243
@ AV_AUDIO_SERVICE_TYPE_EMERGENCY
Definition defs.h:242
@ AV_AUDIO_SERVICE_TYPE_EFFECTS
Definition defs.h:237
@ AV_AUDIO_SERVICE_TYPE_MAIN
Definition defs.h:236
@ AV_AUDIO_SERVICE_TYPE_DIALOGUE
Definition defs.h:240
@ AV_AUDIO_SERVICE_TYPE_KARAOKE
Definition defs.h:244
@ AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED
Definition defs.h:239
@ AV_AUDIO_SERVICE_TYPE_COMMENTARY
Definition defs.h:241
@ AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED
Definition defs.h:238
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:471
static void dump_replaygain(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:236
static void dump_dovi_conf(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:411
static void dump_content_light_metadata(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:360
static void pkt_dump_internal(void *avcl, FILE *f, int level, const AVPacket *pkt, int dump_payload, AVRational time_base)
Definition dump.c:93
static void dump_stream_format(const AVFormatContext *ic, int i, int group_index, int index, int is_output, int log_level)
Definition dump.c:591
static void dump_spherical(void *ctx, int w, int h, const AVPacketSideData *sd, int log_level)
Definition dump.c:381
static void dump_s12m_timecode(void *ctx, AVRational avg_frame_rate, const AVPacketSideData *sd, int log_level)
Definition dump.c:429
static void dump_tdrdi(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:463
static void dump_audioservicetype(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:278
static void dump_paramchange(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:177
static void dump_cpb(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:321
static void hex_dump_internal(void *avcl, FILE *f, int level, const uint8_t *buf, int size)
Definition dump.c:56
static void dump_cropping(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:446
static void dump_metadata(void *ctx, const AVDictionary *m, const char *indent, int log_level)
Definition dump.c:169
#define HEXDUMP_PRINT(...)
Definition dump.c:48
static void dump_disposition(int disposition, int log_level)
Definition dump.c:548
static void dump_dictionary(void *ctx, const AVDictionary *m, const char *name, const char *indent, int log_level)
Definition dump.c:142
static void dump_stereo3d(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:252
static void dump_stream_group(const AVFormatContext *ic, uint8_t *printed, int i, int index, int is_output)
Definition dump.c:686
static void print_peak(void *ctx, const char *str, uint32_t peak, int log_level)
Definition dump.c:226
static void print_gain(void *ctx, const char *str, int32_t gain, int log_level)
Definition dump.c:216
static void dump_mastering_display_metadata(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:340
static void dump_ambient_viewing_environment_metadata(void *ctx, const AVPacketSideData *sd, int log_level)
Definition dump.c:370
static void print_fps(double d, const char *postfix, int log_level)
Definition dump.c:129
static char separator(CheckasmFormat format)
Definition checkasm.c:149
static int64_t duration
Definition ffplay.c:330
static unsigned int nb_streams
Definition ffprobe.c:352
#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:164
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
Definition avcodec.c:514
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_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:650
@ AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE
Definition packet.h:672
@ AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS
Definition packet.h:673
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:117
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:88
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:122
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:83
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:852
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:60
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
Definition dict.c:42
int av_dict_count(const AVDictionary *m)
Get number of entries in dictionary.
Definition dict.c:37
#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:35
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:887
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:370
Immersive Audio Model and Formats API header.
Stereoscopic video.
#define lrintf(x)
Definition libm_mips.h:72
uint8_t w
Definition llvidencdsp.c:39
#define FFMIN(a, b)
Definition macros.h:49
Memory handling functions.
uint32_t tag
Definition movenc.c:2073
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:282
int64_t avg_bitrate
Average bitrate of the stream, in bits per second.
Definition defs.h:297
int64_t max_bitrate
Maximum bitrate of the stream, in bits per second.
Definition defs.h:287
int64_t buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
Definition defs.h:303
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:312
int64_t min_bitrate
Minimum bitrate of the stream, in bits per second.
Definition defs.h:292
int nb_channels
Number of channels in this layout.
int64_t start
Definition avformat.h:1295
AVDictionary * metadata
Definition avformat.h:1296
int64_t end
chapter start/end time in time_base units
Definition avformat.h:1295
AVRational time_base
time base in which the start/end timestamps are specified
Definition avformat.h:1294
main external API structure.
Definition avcodec.h:443
int width
picture width / height.
Definition avcodec.h:604
int qmin
minimum quantizer
Definition avcodec.h:1252
const struct AVCodec * codec
Definition avcodec.h:452
int qmax
maximum quantizer
Definition avcodec.h:1259
int coded_width
Bitstream width / height, may be different from width/height e.g.
Definition avcodec.h:619
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:1333
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
Definition avformat.h:1389
AVStreamGroup ** stream_groups
A list of all stream groups in the file.
Definition avformat.h:1420
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds.
Definition avformat.h:1458
AVDictionary * metadata
Metadata that applies to the whole file.
Definition avformat.h:1580
const struct AVOutputFormat * oformat
The output container format.
Definition avformat.h:1352
AVProgram ** programs
Definition avformat.h:1546
unsigned int nb_programs
Definition avformat.h:1545
const struct AVInputFormat * iformat
The input container format.
Definition avformat.h:1345
unsigned int nb_chapters
Number of chapters in AVChapter array.
Definition avformat.h:1433
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
Definition avformat.h:1475
AVChapter ** chapters
Definition avformat.h:1434
unsigned int nb_stream_groups
Number of elements in AVFormatContext.stream_groups.
Definition avformat.h:1408
AVStream ** streams
A list of all streams in the file.
Definition avformat.h:1401
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
Definition avformat.h:1468
uint8_t * dump_separator
dump format separator.
Definition avformat.h:1931
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:585
const char * name
A comma separated list of short names for the format.
Definition avformat.h:570
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:546
const char * name
Definition avformat.h:527
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
Definition packet.h:424
uint8_t * data
Definition packet.h:425
enum AVPacketSideDataType type
Definition packet.h:427
This structure stores compressed data.
Definition packet.h:580
New fields can be added to the end with minor version bumps.
Definition avformat.h:1257
unsigned int nb_stream_indexes
Definition avformat.h:1262
unsigned int * stream_index
Definition avformat.h:1261
AVDictionary * metadata
Definition avformat.h:1263
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
AVStreamGroupLayeredVideo is meant to define the relation between a base layer video stream and a sep...
Definition avformat.h:1093
int height
Height of the final image for presentation.
Definition avformat.h:1118
unsigned int el_index
Index of the enhancement layer stream in AVStreamGroup.
Definition avformat.h:1102
int width
Width of the final stream for presentation.
Definition avformat.h:1114
AVStreamGroupTileGrid holds information on how to combine several independent images on a single canv...
Definition avformat.h:973
int nb_coded_side_data
Amount of entries in coded_side_data.
Definition avformat.h:1081
int width
Width of the final image for presentation.
Definition avformat.h:1058
int height
Height of the final image for presentation.
Definition avformat.h:1068
int coded_width
Width of the canvas.
Definition avformat.h:988
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:981
unsigned int idx
Index of the stream in the group this tile references.
Definition avformat.h:1012
int coded_height
Width of the canvas.
Definition avformat.h:994
AVPacketSideData * coded_side_data
Additional data associated with the grid.
Definition avformat.h:1076
union AVStreamGroup::@166361102046003066253145020066347265153020354020 params
Group type-specific parameters.
enum AVStreamGroupParamsType type
Group type.
Definition avformat.h:1186
struct AVIAMFMixPresentation * iamf_mix_presentation
Definition avformat.h:1193
struct AVStreamGroupTileGrid * tile_grid
Definition avformat.h:1194
unsigned int nb_streams
Number of elements in AVStreamGroup.streams.
Definition avformat.h:1221
AVDictionary * metadata
Metadata that applies to the whole group.
Definition avformat.h:1214
unsigned int index
Group index in AVFormatContext.
Definition avformat.h:1170
struct AVIAMFAudioElement * iamf_audio_element
Definition avformat.h:1192
int disposition
Stream group disposition - a combination of AV_DISPOSITION_* flags.
Definition avformat.h:1244
int64_t id
Group type-specific group ID.
Definition avformat.h:1178
AVStream ** streams
A list of streams in the group.
Definition avformat.h:1234
struct AVStreamGroupLayeredVideo * layered_video
Definition avformat.h:1195
Stream structure.
Definition avformat.h:766
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition avformat.h:789
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
Definition avformat.h:844
AVDictionary * metadata
Definition avformat.h:846
int id
Format-specific stream ID.
Definition avformat.h:778
int index
stream index in AVFormatContext
Definition avformat.h:772
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
Definition avformat.h:815
AVRational avg_frame_rate
Average framerate.
Definition avformat.h:855
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
Definition avformat.h:805
AVRational r_frame_rate
Real base framerate of the stream.
Definition avformat.h:900
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
Definition avformat.h:835
struct AVCodecContext * avctx
The codec context used by avformat_find_stream_info, the parser, etc.
Definition internal.h:163
int codec_info_nb_frames
Number of frames that have been demuxed during avformat_find_stream_info()
Definition internal.h:342
uint8_t level
Definition svq3.c:208
#define av_free(p)
#define av_mallocz(s)
#define av_log(a,...)
Spherical video.
static AVFormatContext * ctx
Definition movenc.c:49
#define height
Definition dsp.h:89
#define width
Definition dsp.h:89
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]