2 * Various pretty-printing functions for use within FFmpeg
3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
5 * This file is part of FFmpeg.
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.
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.
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
25 #include "libavutil/channel_layout.h"
26 #include "libavutil/display.h"
27 #include "libavutil/intreadwrite.h"
28 #include "libavutil/log.h"
29 #include "libavutil/mastering_display_metadata.h"
30 #include "libavutil/dovi_meta.h"
31 #include "libavutil/mathematics.h"
32 #include "libavutil/opt.h"
33 #include "libavutil/avstring.h"
34 #include "libavutil/replaygain.h"
35 #include "libavutil/spherical.h"
36 #include "libavutil/stereo3d.h"
40 #define HEXDUMP_PRINT(...) \
43 av_log(avcl, level, __VA_ARGS__); \
45 fprintf(f, __VA_ARGS__); \
48 static void hex_dump_internal(void *avcl, FILE *f, int level,
49 const uint8_t *buf, int size)
53 for (i = 0; i < size; i += 16) {
57 HEXDUMP_PRINT("%08x ", i);
58 for (j = 0; j < 16; j++) {
60 HEXDUMP_PRINT(" %02x", buf[i + j]);
65 for (j = 0; j < len; j++) {
67 if (c < ' ' || c > '~')
69 HEXDUMP_PRINT("%c", c);
75 void av_hex_dump(FILE *f, const uint8_t *buf, int size)
77 hex_dump_internal(NULL, f, 0, buf, size);
80 void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
82 hex_dump_internal(avcl, NULL, level, buf, size);
85 static void pkt_dump_internal(void *avcl, FILE *f, int level, const AVPacket *pkt,
86 int dump_payload, AVRational time_base)
88 HEXDUMP_PRINT("stream #%d:\n", pkt->stream_index);
89 HEXDUMP_PRINT(" keyframe=%d\n", (pkt->flags & AV_PKT_FLAG_KEY) != 0);
90 HEXDUMP_PRINT(" duration=%0.3f\n", pkt->duration * av_q2d(time_base));
91 /* DTS is _always_ valid after av_read_frame() */
92 HEXDUMP_PRINT(" dts=");
93 if (pkt->dts == AV_NOPTS_VALUE)
96 HEXDUMP_PRINT("%0.3f", pkt->dts * av_q2d(time_base));
97 /* PTS may not be known if B-frames are present. */
98 HEXDUMP_PRINT(" pts=");
99 if (pkt->pts == AV_NOPTS_VALUE)
100 HEXDUMP_PRINT("N/A");
102 HEXDUMP_PRINT("%0.3f", pkt->pts * av_q2d(time_base));
104 HEXDUMP_PRINT(" size=%d\n", pkt->size);
106 hex_dump_internal(avcl, f, level, pkt->data, pkt->size);
109 void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st)
111 pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base);
114 void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload,
117 pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base);
121 static void print_fps(double d, const char *postfix)
123 uint64_t v = lrintf(d * 100);
125 av_log(NULL, AV_LOG_INFO, "%1.4f %s", d, postfix);
127 av_log(NULL, AV_LOG_INFO, "%3.2f %s", d, postfix);
128 else if (v % (100 * 1000))
129 av_log(NULL, AV_LOG_INFO, "%1.0f %s", d, postfix);
131 av_log(NULL, AV_LOG_INFO, "%1.0fk %s", d / 1000, postfix);
134 static void dump_metadata(void *ctx, AVDictionary *m, const char *indent)
136 if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0))) {
137 AVDictionaryEntry *tag = NULL;
139 av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent);
140 while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX)))
141 if (strcmp("language", tag->key)) {
142 const char *p = tag->value;
143 av_log(ctx, AV_LOG_INFO,
144 "%s %-16s: ", indent, tag->key);
147 size_t len = strcspn(p, "\x8\xa\xb\xc\xd");
148 av_strlcpy(tmp, p, FFMIN(sizeof(tmp), len+1));
149 av_log(ctx, AV_LOG_INFO, "%s", tmp);
151 if (*p == 0xd) av_log(ctx, AV_LOG_INFO, " ");
152 if (*p == 0xa) av_log(ctx, AV_LOG_INFO, "\n%s %-16s: ", indent, "");
155 av_log(ctx, AV_LOG_INFO, "\n");
160 /* param change side data*/
161 static void dump_paramchange(void *ctx, AVPacketSideData *sd)
164 const uint8_t *data = sd->data;
165 uint32_t flags, channels, sample_rate, width, height;
168 if (!data || sd->size < 4)
171 flags = AV_RL32(data);
175 if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
178 channels = AV_RL32(data);
181 av_log(ctx, AV_LOG_INFO, "channel count %"PRIu32", ", channels);
183 if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) {
186 layout = AV_RL64(data);
189 av_log(ctx, AV_LOG_INFO,
190 "channel layout: %s, ", av_get_channel_name(layout));
192 if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
195 sample_rate = AV_RL32(data);
198 av_log(ctx, AV_LOG_INFO, "sample_rate %"PRIu32", ", sample_rate);
200 if (flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) {
203 width = AV_RL32(data);
206 height = AV_RL32(data);
209 av_log(ctx, AV_LOG_INFO, "width %"PRIu32" height %"PRIu32, width, height);
214 av_log(ctx, AV_LOG_ERROR, "unknown param");
217 /* replaygain side data*/
218 static void print_gain(void *ctx, const char *str, int32_t gain)
220 av_log(ctx, AV_LOG_INFO, "%s - ", str);
221 if (gain == INT32_MIN)
222 av_log(ctx, AV_LOG_INFO, "unknown");
224 av_log(ctx, AV_LOG_INFO, "%f", gain / 100000.0f);
225 av_log(ctx, AV_LOG_INFO, ", ");
228 static void print_peak(void *ctx, const char *str, uint32_t peak)
230 av_log(ctx, AV_LOG_INFO, "%s - ", str);
232 av_log(ctx, AV_LOG_INFO, "unknown");
234 av_log(ctx, AV_LOG_INFO, "%f", (float) peak / UINT32_MAX);
235 av_log(ctx, AV_LOG_INFO, ", ");
238 static void dump_replaygain(void *ctx, AVPacketSideData *sd)
242 if (sd->size < sizeof(*rg)) {
243 av_log(ctx, AV_LOG_ERROR, "invalid data");
246 rg = (AVReplayGain*)sd->data;
248 print_gain(ctx, "track gain", rg->track_gain);
249 print_peak(ctx, "track peak", rg->track_peak);
250 print_gain(ctx, "album gain", rg->album_gain);
251 print_peak(ctx, "album peak", rg->album_peak);
254 static void dump_stereo3d(void *ctx, AVPacketSideData *sd)
258 if (sd->size < sizeof(*stereo)) {
259 av_log(ctx, AV_LOG_ERROR, "invalid data");
263 stereo = (AVStereo3D *)sd->data;
265 av_log(ctx, AV_LOG_INFO, "%s", av_stereo3d_type_name(stereo->type));
267 if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
268 av_log(ctx, AV_LOG_INFO, " (inverted)");
271 static void dump_audioservicetype(void *ctx, AVPacketSideData *sd)
273 enum AVAudioServiceType *ast = (enum AVAudioServiceType *)sd->data;
275 if (sd->size < sizeof(*ast)) {
276 av_log(ctx, AV_LOG_ERROR, "invalid data");
281 case AV_AUDIO_SERVICE_TYPE_MAIN:
282 av_log(ctx, AV_LOG_INFO, "main");
284 case AV_AUDIO_SERVICE_TYPE_EFFECTS:
285 av_log(ctx, AV_LOG_INFO, "effects");
287 case AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED:
288 av_log(ctx, AV_LOG_INFO, "visually impaired");
290 case AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED:
291 av_log(ctx, AV_LOG_INFO, "hearing impaired");
293 case AV_AUDIO_SERVICE_TYPE_DIALOGUE:
294 av_log(ctx, AV_LOG_INFO, "dialogue");
296 case AV_AUDIO_SERVICE_TYPE_COMMENTARY:
297 av_log(ctx, AV_LOG_INFO, "commentary");
299 case AV_AUDIO_SERVICE_TYPE_EMERGENCY:
300 av_log(ctx, AV_LOG_INFO, "emergency");
302 case AV_AUDIO_SERVICE_TYPE_VOICE_OVER:
303 av_log(ctx, AV_LOG_INFO, "voice over");
305 case AV_AUDIO_SERVICE_TYPE_KARAOKE:
306 av_log(ctx, AV_LOG_INFO, "karaoke");
309 av_log(ctx, AV_LOG_WARNING, "unknown");
314 static void dump_cpb(void *ctx, AVPacketSideData *sd)
316 AVCPBProperties *cpb = (AVCPBProperties *)sd->data;
318 if (sd->size < sizeof(*cpb)) {
319 av_log(ctx, AV_LOG_ERROR, "invalid data");
323 av_log(ctx, AV_LOG_INFO,
324 #if FF_API_UNSANITIZED_BITRATES
325 "bitrate max/min/avg: %d/%d/%d buffer size: %d ",
327 "bitrate max/min/avg: %"PRId64"/%"PRId64"/%"PRId64" buffer size: %d ",
329 cpb->max_bitrate, cpb->min_bitrate, cpb->avg_bitrate,
331 if (cpb->vbv_delay == UINT64_MAX)
332 av_log(ctx, AV_LOG_INFO, "vbv_delay: N/A");
334 av_log(ctx, AV_LOG_INFO, "vbv_delay: %"PRIu64"", cpb->vbv_delay);
337 static void dump_mastering_display_metadata(void *ctx, AVPacketSideData* sd) {
338 AVMasteringDisplayMetadata* metadata = (AVMasteringDisplayMetadata*)sd->data;
339 av_log(ctx, AV_LOG_INFO, "Mastering Display Metadata, "
340 "has_primaries:%d has_luminance:%d "
341 "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f) "
342 "min_luminance=%f, max_luminance=%f",
343 metadata->has_primaries, metadata->has_luminance,
344 av_q2d(metadata->display_primaries[0][0]),
345 av_q2d(metadata->display_primaries[0][1]),
346 av_q2d(metadata->display_primaries[1][0]),
347 av_q2d(metadata->display_primaries[1][1]),
348 av_q2d(metadata->display_primaries[2][0]),
349 av_q2d(metadata->display_primaries[2][1]),
350 av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1]),
351 av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance));
354 static void dump_content_light_metadata(void *ctx, AVPacketSideData* sd)
356 AVContentLightMetadata* metadata = (AVContentLightMetadata*)sd->data;
357 av_log(ctx, AV_LOG_INFO, "Content Light Level Metadata, "
358 "MaxCLL=%d, MaxFALL=%d",
359 metadata->MaxCLL, metadata->MaxFALL);
362 static void dump_spherical(void *ctx, AVCodecParameters *par, AVPacketSideData *sd)
364 AVSphericalMapping *spherical = (AVSphericalMapping *)sd->data;
365 double yaw, pitch, roll;
367 if (sd->size < sizeof(*spherical)) {
368 av_log(ctx, AV_LOG_ERROR, "invalid data");
372 av_log(ctx, AV_LOG_INFO, "%s ", av_spherical_projection_name(spherical->projection));
374 yaw = ((double)spherical->yaw) / (1 << 16);
375 pitch = ((double)spherical->pitch) / (1 << 16);
376 roll = ((double)spherical->roll) / (1 << 16);
377 av_log(ctx, AV_LOG_INFO, "(%f/%f/%f) ", yaw, pitch, roll);
379 if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
381 av_spherical_tile_bounds(spherical, par->width, par->height,
383 av_log(ctx, AV_LOG_INFO,
384 "[%"SIZE_SPECIFIER", %"SIZE_SPECIFIER", %"SIZE_SPECIFIER", %"SIZE_SPECIFIER"] ",
386 } else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
387 av_log(ctx, AV_LOG_INFO, "[pad %"PRIu32"] ", spherical->padding);
391 static void dump_dovi_conf(void *ctx, AVPacketSideData* sd)
393 AVDOVIDecoderConfigurationRecord *dovi = (AVDOVIDecoderConfigurationRecord *)sd->data;
395 av_log(ctx, AV_LOG_INFO, "version: %d.%d, profile: %d, level: %d, "
396 "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d",
397 dovi->dv_version_major, dovi->dv_version_minor,
398 dovi->dv_profile, dovi->dv_level,
399 dovi->rpu_present_flag,
400 dovi->el_present_flag,
401 dovi->bl_present_flag,
402 dovi->dv_bl_signal_compatibility_id);
405 static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
409 if (st->nb_side_data)
410 av_log(ctx, AV_LOG_INFO, "%sSide data:\n", indent);
412 for (i = 0; i < st->nb_side_data; i++) {
413 AVPacketSideData sd = st->side_data[i];
414 av_log(ctx, AV_LOG_INFO, "%s ", indent);
417 case AV_PKT_DATA_PALETTE:
418 av_log(ctx, AV_LOG_INFO, "palette");
420 case AV_PKT_DATA_NEW_EXTRADATA:
421 av_log(ctx, AV_LOG_INFO, "new extradata");
423 case AV_PKT_DATA_PARAM_CHANGE:
424 av_log(ctx, AV_LOG_INFO, "paramchange: ");
425 dump_paramchange(ctx, &sd);
427 case AV_PKT_DATA_H263_MB_INFO:
428 av_log(ctx, AV_LOG_INFO, "H.263 macroblock info");
430 case AV_PKT_DATA_REPLAYGAIN:
431 av_log(ctx, AV_LOG_INFO, "replaygain: ");
432 dump_replaygain(ctx, &sd);
434 case AV_PKT_DATA_DISPLAYMATRIX:
435 av_log(ctx, AV_LOG_INFO, "displaymatrix: rotation of %.2f degrees",
436 av_display_rotation_get((int32_t *)sd.data));
438 case AV_PKT_DATA_STEREO3D:
439 av_log(ctx, AV_LOG_INFO, "stereo3d: ");
440 dump_stereo3d(ctx, &sd);
442 case AV_PKT_DATA_AUDIO_SERVICE_TYPE:
443 av_log(ctx, AV_LOG_INFO, "audio service type: ");
444 dump_audioservicetype(ctx, &sd);
446 case AV_PKT_DATA_QUALITY_STATS:
447 av_log(ctx, AV_LOG_INFO, "quality factor: %"PRId32", pict_type: %c",
448 AV_RL32(sd.data), av_get_picture_type_char(sd.data[4]));
450 case AV_PKT_DATA_CPB_PROPERTIES:
451 av_log(ctx, AV_LOG_INFO, "cpb: ");
454 case AV_PKT_DATA_MASTERING_DISPLAY_METADATA:
455 dump_mastering_display_metadata(ctx, &sd);
457 case AV_PKT_DATA_SPHERICAL:
458 av_log(ctx, AV_LOG_INFO, "spherical: ");
459 dump_spherical(ctx, st->codecpar, &sd);
461 case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:
462 dump_content_light_metadata(ctx, &sd);
464 case AV_PKT_DATA_ICC_PROFILE:
465 av_log(ctx, AV_LOG_INFO, "ICC Profile");
467 case AV_PKT_DATA_DOVI_CONF:
468 av_log(ctx, AV_LOG_INFO, "DOVI configuration record: ");
469 dump_dovi_conf(ctx, &sd);
472 av_log(ctx, AV_LOG_INFO,
473 "unknown side data type %d (%d bytes)", sd.type, sd.size);
477 av_log(ctx, AV_LOG_INFO, "\n");
481 /* "user interface" functions */
482 static void dump_stream_format(AVFormatContext *ic, int i,
483 int index, int is_output)
486 int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
487 AVStream *st = ic->streams[i];
488 AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
489 char *separator = ic->dump_separator;
490 AVCodecContext *avctx;
493 avctx = avcodec_alloc_context3(NULL);
497 ret = avcodec_parameters_to_context(avctx, st->codecpar);
499 avcodec_free_context(&avctx);
503 // Fields which are missing from AVCodecParameters need to be taken from the AVCodecContext
504 avctx->properties = st->codec->properties;
505 avctx->codec = st->codec->codec;
506 avctx->qmin = st->codec->qmin;
507 avctx->qmax = st->codec->qmax;
508 avctx->coded_width = st->codec->coded_width;
509 avctx->coded_height = st->codec->coded_height;
512 av_opt_set(avctx, "dump_separator", separator, 0);
513 avcodec_string(buf, sizeof(buf), avctx, is_output);
514 avcodec_free_context(&avctx);
516 av_log(NULL, AV_LOG_INFO, " Stream #%d:%d", index, i);
518 /* the pid is an important information, so we display it */
519 /* XXX: add a generic system */
520 if (flags & AVFMT_SHOW_IDS)
521 av_log(NULL, AV_LOG_INFO, "[0x%x]", st->id);
523 av_log(NULL, AV_LOG_INFO, "(%s)", lang->value);
524 av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames,
525 st->time_base.num, st->time_base.den);
526 av_log(NULL, AV_LOG_INFO, ": %s", buf);
528 if (st->sample_aspect_ratio.num &&
529 av_cmp_q(st->sample_aspect_ratio, st->codecpar->sample_aspect_ratio)) {
530 AVRational display_aspect_ratio;
531 av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
532 st->codecpar->width * (int64_t)st->sample_aspect_ratio.num,
533 st->codecpar->height * (int64_t)st->sample_aspect_ratio.den,
535 av_log(NULL, AV_LOG_INFO, ", SAR %d:%d DAR %d:%d",
536 st->sample_aspect_ratio.num, st->sample_aspect_ratio.den,
537 display_aspect_ratio.num, display_aspect_ratio.den);
540 if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
541 int fps = st->avg_frame_rate.den && st->avg_frame_rate.num;
542 int tbr = st->r_frame_rate.den && st->r_frame_rate.num;
543 int tbn = st->time_base.den && st->time_base.num;
544 int tbc = st->codec->time_base.den && st->codec->time_base.num;
546 if (fps || tbr || tbn || tbc)
547 av_log(NULL, AV_LOG_INFO, "%s", separator);
550 print_fps(av_q2d(st->avg_frame_rate), tbr || tbn || tbc ? "fps, " : "fps");
552 print_fps(av_q2d(st->r_frame_rate), tbn || tbc ? "tbr, " : "tbr");
554 print_fps(1 / av_q2d(st->time_base), tbc ? "tbn, " : "tbn");
556 print_fps(1 / av_q2d(st->codec->time_base), "tbc");
559 if (st->disposition & AV_DISPOSITION_DEFAULT)
560 av_log(NULL, AV_LOG_INFO, " (default)");
561 if (st->disposition & AV_DISPOSITION_DUB)
562 av_log(NULL, AV_LOG_INFO, " (dub)");
563 if (st->disposition & AV_DISPOSITION_ORIGINAL)
564 av_log(NULL, AV_LOG_INFO, " (original)");
565 if (st->disposition & AV_DISPOSITION_COMMENT)
566 av_log(NULL, AV_LOG_INFO, " (comment)");
567 if (st->disposition & AV_DISPOSITION_LYRICS)
568 av_log(NULL, AV_LOG_INFO, " (lyrics)");
569 if (st->disposition & AV_DISPOSITION_KARAOKE)
570 av_log(NULL, AV_LOG_INFO, " (karaoke)");
571 if (st->disposition & AV_DISPOSITION_FORCED)
572 av_log(NULL, AV_LOG_INFO, " (forced)");
573 if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED)
574 av_log(NULL, AV_LOG_INFO, " (hearing impaired)");
575 if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED)
576 av_log(NULL, AV_LOG_INFO, " (visual impaired)");
577 if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS)
578 av_log(NULL, AV_LOG_INFO, " (clean effects)");
579 if (st->disposition & AV_DISPOSITION_ATTACHED_PIC)
580 av_log(NULL, AV_LOG_INFO, " (attached pic)");
581 if (st->disposition & AV_DISPOSITION_TIMED_THUMBNAILS)
582 av_log(NULL, AV_LOG_INFO, " (timed thumbnails)");
583 if (st->disposition & AV_DISPOSITION_CAPTIONS)
584 av_log(NULL, AV_LOG_INFO, " (captions)");
585 if (st->disposition & AV_DISPOSITION_DESCRIPTIONS)
586 av_log(NULL, AV_LOG_INFO, " (descriptions)");
587 if (st->disposition & AV_DISPOSITION_METADATA)
588 av_log(NULL, AV_LOG_INFO, " (metadata)");
589 if (st->disposition & AV_DISPOSITION_DEPENDENT)
590 av_log(NULL, AV_LOG_INFO, " (dependent)");
591 if (st->disposition & AV_DISPOSITION_STILL_IMAGE)
592 av_log(NULL, AV_LOG_INFO, " (still image)");
593 av_log(NULL, AV_LOG_INFO, "\n");
595 dump_metadata(NULL, st->metadata, " ");
597 dump_sidedata(NULL, st, " ");
600 void av_dump_format(AVFormatContext *ic, int index,
601 const char *url, int is_output)
604 uint8_t *printed = ic->nb_streams ? av_mallocz(ic->nb_streams) : NULL;
605 if (ic->nb_streams && !printed)
608 av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n",
609 is_output ? "Output" : "Input",
611 is_output ? ic->oformat->name : ic->iformat->name,
612 is_output ? "to" : "from", url);
613 dump_metadata(NULL, ic->metadata, " ");
616 av_log(NULL, AV_LOG_INFO, " Duration: ");
617 if (ic->duration != AV_NOPTS_VALUE) {
618 int64_t hours, mins, secs, us;
619 int64_t duration = ic->duration + (ic->duration <= INT64_MAX - 5000 ? 5000 : 0);
620 secs = duration / AV_TIME_BASE;
621 us = duration % AV_TIME_BASE;
626 av_log(NULL, AV_LOG_INFO, "%02"PRId64":%02"PRId64":%02"PRId64".%02"PRId64"", hours, mins, secs,
627 (100 * us) / AV_TIME_BASE);
629 av_log(NULL, AV_LOG_INFO, "N/A");
631 if (ic->start_time != AV_NOPTS_VALUE) {
633 av_log(NULL, AV_LOG_INFO, ", start: ");
634 secs = llabs(ic->start_time / AV_TIME_BASE);
635 us = llabs(ic->start_time % AV_TIME_BASE);
636 av_log(NULL, AV_LOG_INFO, "%s%d.%06d",
637 ic->start_time >= 0 ? "" : "-",
639 (int) av_rescale(us, 1000000, AV_TIME_BASE));
641 av_log(NULL, AV_LOG_INFO, ", bitrate: ");
643 av_log(NULL, AV_LOG_INFO, "%"PRId64" kb/s", ic->bit_rate / 1000);
645 av_log(NULL, AV_LOG_INFO, "N/A");
646 av_log(NULL, AV_LOG_INFO, "\n");
649 for (i = 0; i < ic->nb_chapters; i++) {
650 AVChapter *ch = ic->chapters[i];
651 av_log(NULL, AV_LOG_INFO, " Chapter #%d:%d: ", index, i);
652 av_log(NULL, AV_LOG_INFO,
653 "start %f, ", ch->start * av_q2d(ch->time_base));
654 av_log(NULL, AV_LOG_INFO,
655 "end %f\n", ch->end * av_q2d(ch->time_base));
657 dump_metadata(NULL, ch->metadata, " ");
660 if (ic->nb_programs) {
662 for (j = 0; j < ic->nb_programs; j++) {
663 AVDictionaryEntry *name = av_dict_get(ic->programs[j]->metadata,
665 av_log(NULL, AV_LOG_INFO, " Program %d %s\n", ic->programs[j]->id,
666 name ? name->value : "");
667 dump_metadata(NULL, ic->programs[j]->metadata, " ");
668 for (k = 0; k < ic->programs[j]->nb_stream_indexes; k++) {
669 dump_stream_format(ic, ic->programs[j]->stream_index[k],
671 printed[ic->programs[j]->stream_index[k]] = 1;
673 total += ic->programs[j]->nb_stream_indexes;
675 if (total < ic->nb_streams)
676 av_log(NULL, AV_LOG_INFO, " No Program\n");
679 for (i = 0; i < ic->nb_streams; i++)
681 dump_stream_format(ic, i, index, is_output);