| Line | Branch | Exec | Source |
|---|---|---|---|
| 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" | ||
| 26 | #include "libavutil/channel_layout.h" | ||
| 27 | #include "libavutil/display.h" | ||
| 28 | #include "libavutil/gain_map.h" | ||
| 29 | #include "libavutil/iamf.h" | ||
| 30 | #include "libavutil/intreadwrite.h" | ||
| 31 | #include "libavutil/log.h" | ||
| 32 | #include "libavutil/mastering_display_metadata.h" | ||
| 33 | #include "libavutil/ambient_viewing_environment.h" | ||
| 34 | #include "libavutil/dovi_meta.h" | ||
| 35 | #include "libavutil/mathematics.h" | ||
| 36 | #include "libavutil/mem.h" | ||
| 37 | #include "libavutil/opt.h" | ||
| 38 | #include "libavutil/replaygain.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 | |||
| 57 | 1 | static 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 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
|
3 | for (i = 0; i < size; i += 16) { |
| 63 | 2 | len = size - i; | |
| 64 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
|
2 | if (len > 16) |
| 65 | 1 | len = 16; | |
| 66 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | HEXDUMP_PRINT("%08x ", i); |
| 67 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 2 times.
|
34 | for (j = 0; j < 16; j++) { |
| 68 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 8 times.
|
32 | if (j < len) |
| 69 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | HEXDUMP_PRINT(" %02x", buf[i + j]); |
| 70 | else | ||
| 71 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | HEXDUMP_PRINT(" "); |
| 72 | } | ||
| 73 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | HEXDUMP_PRINT(" "); |
| 74 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 2 times.
|
26 | for (j = 0; j < len; j++) { |
| 75 | 24 | c = buf[i + j]; | |
| 76 |
4/4✓ Branch 0 taken 23 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 14 times.
✓ Branch 3 taken 9 times.
|
24 | if (c < ' ' || c > '~') |
| 77 | 15 | c = '.'; | |
| 78 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | HEXDUMP_PRINT("%c", c); |
| 79 | } | ||
| 80 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | HEXDUMP_PRINT("\n"); |
| 81 | } | ||
| 82 | 1 | } | |
| 83 | |||
| 84 | ✗ | void av_hex_dump(FILE *f, const uint8_t *buf, int size) | |
| 85 | { | ||
| 86 | ✗ | hex_dump_internal(NULL, f, 0, buf, size); | |
| 87 | ✗ | } | |
| 88 | |||
| 89 | 1 | void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size) | |
| 90 | { | ||
| 91 | 1 | hex_dump_internal(avcl, NULL, level, buf, size); | |
| 92 | 1 | } | |
| 93 | |||
| 94 | ✗ | static 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 | |||
| 118 | ✗ | void 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 | |||
| 123 | ✗ | void 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 | |||
| 130 | 34103 | static void print_fps(double d, const char *postfix, int log_level) | |
| 131 | { | ||
| 132 | 34103 | uint64_t v = lrintf(d * 100); | |
| 133 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34103 times.
|
34103 | if (!v) |
| 134 | ✗ | av_log(NULL, log_level, "%1.4f %s", d, postfix); | |
| 135 |
2/2✓ Branch 0 taken 2204 times.
✓ Branch 1 taken 31899 times.
|
34103 | else if (v % 100) |
| 136 | 2204 | av_log(NULL, log_level, "%3.2f %s", d, postfix); | |
| 137 |
2/2✓ Branch 0 taken 29406 times.
✓ Branch 1 taken 2493 times.
|
31899 | else if (v % (100 * 1000)) |
| 138 | 29406 | av_log(NULL, log_level, "%1.0f %s", d, postfix); | |
| 139 | else | ||
| 140 | 2493 | av_log(NULL, log_level, "%1.0fk %s", d / 1000, postfix); | |
| 141 | 34103 | } | |
| 142 | |||
| 143 | 13895 | static void dump_dictionary(void *ctx, const AVDictionary *m, | |
| 144 | const char *name, const char *indent, | ||
| 145 | int log_level) | ||
| 146 | { | ||
| 147 | 13895 | const AVDictionaryEntry *tag = NULL; | |
| 148 | |||
| 149 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13895 times.
|
13895 | if (!m) |
| 150 | ✗ | return; | |
| 151 | |||
| 152 | 13895 | av_log(ctx, log_level, "%s%s:\n", indent, name); | |
| 153 |
2/2✓ Branch 1 taken 23694 times.
✓ Branch 2 taken 13895 times.
|
37589 | while ((tag = av_dict_iterate(m, tag))) |
| 154 |
2/2✓ Branch 0 taken 22189 times.
✓ Branch 1 taken 1505 times.
|
23694 | if (strcmp("language", tag->key)) { |
| 155 | 22189 | const char *p = tag->value; | |
| 156 | 22189 | av_log(ctx, log_level, | |
| 157 | 22189 | "%s %-16s: ", indent, tag->key); | |
| 158 |
2/2✓ Branch 0 taken 22679 times.
✓ Branch 1 taken 22189 times.
|
44868 | while (*p) { |
| 159 | 22679 | size_t len = strcspn(p, "\x8\xa\xb\xc\xd"); | |
| 160 |
1/2✓ Branch 0 taken 22679 times.
✗ Branch 1 not taken.
|
22679 | av_log(ctx, log_level, "%.*s", (int)(FFMIN(255, len)), p); |
| 161 | 22679 | p += len; | |
| 162 |
2/2✓ Branch 0 taken 280 times.
✓ Branch 1 taken 22399 times.
|
22679 | if (*p == 0xd) av_log(ctx, log_level, " "); |
| 163 |
2/2✓ Branch 0 taken 390 times.
✓ Branch 1 taken 22289 times.
|
22679 | if (*p == 0xa) av_log(ctx, log_level, "\n%s %-16s: ", indent, ""); |
| 164 |
2/2✓ Branch 0 taken 692 times.
✓ Branch 1 taken 21987 times.
|
22679 | if (*p) p++; |
| 165 | } | ||
| 166 | 22189 | av_log(ctx, log_level, "\n"); | |
| 167 | } | ||
| 168 | } | ||
| 169 | |||
| 170 | 36325 | static void dump_metadata(void *ctx, const AVDictionary *m, const char *indent, | |
| 171 | int log_level) | ||
| 172 | { | ||
| 173 |
6/6✓ Branch 0 taken 14155 times.
✓ Branch 1 taken 22170 times.
✓ Branch 3 taken 10703 times.
✓ Branch 4 taken 3452 times.
✓ Branch 6 taken 10324 times.
✓ Branch 7 taken 379 times.
|
36325 | if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0))) |
| 174 | 13776 | dump_dictionary(ctx, m, "Metadata", indent, log_level); | |
| 175 | 36325 | } | |
| 176 | |||
| 177 | /* param change side data*/ | ||
| 178 | ✗ | static 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 | |||
| 191 | ✗ | if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) { | |
| 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 | } | ||
| 199 | ✗ | if (flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) { | |
| 200 | ✗ | if (size < 8) | |
| 201 | ✗ | goto fail; | |
| 202 | ✗ | width = AV_RL32(data); | |
| 203 | ✗ | data += 4; | |
| 204 | ✗ | size -= 4; | |
| 205 | ✗ | height = AV_RL32(data); | |
| 206 | ✗ | data += 4; | |
| 207 | ✗ | size -= 4; | |
| 208 | ✗ | av_log(ctx, log_level, "width %"PRIu32" height %"PRIu32, width, height); | |
| 209 | } | ||
| 210 | |||
| 211 | ✗ | return; | |
| 212 | ✗ | fail: | |
| 213 | ✗ | av_log(ctx, AV_LOG_ERROR, "unknown param\n"); | |
| 214 | } | ||
| 215 | |||
| 216 | /* replaygain side data*/ | ||
| 217 | 2 | static void print_gain(void *ctx, const char *str, int32_t gain, int log_level) | |
| 218 | { | ||
| 219 | 2 | av_log(ctx, log_level, "%s - ", str); | |
| 220 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
|
2 | if (gain == INT32_MIN) |
| 221 | 1 | av_log(ctx, log_level, "unknown"); | |
| 222 | else | ||
| 223 | 1 | av_log(ctx, log_level, "%f", gain / 100000.0f); | |
| 224 | 2 | av_log(ctx, log_level, ", "); | |
| 225 | 2 | } | |
| 226 | |||
| 227 | 2 | static void print_peak(void *ctx, const char *str, uint32_t peak, int log_level) | |
| 228 | { | ||
| 229 | 2 | av_log(ctx, log_level, "%s - ", str); | |
| 230 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if (!peak) |
| 231 | 2 | av_log(ctx, log_level, "unknown"); | |
| 232 | else | ||
| 233 | ✗ | av_log(ctx, log_level, "%f", (float) peak / UINT32_MAX); | |
| 234 | 2 | av_log(ctx, log_level, ", "); | |
| 235 | 2 | } | |
| 236 | |||
| 237 | 1 | static void dump_replaygain(void *ctx, const AVPacketSideData *sd, int log_level) | |
| 238 | { | ||
| 239 | const AVReplayGain *rg; | ||
| 240 | |||
| 241 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if (sd->size < sizeof(*rg)) { |
| 242 | ✗ | av_log(ctx, AV_LOG_ERROR, "invalid data\n"); | |
| 243 | ✗ | return; | |
| 244 | } | ||
| 245 | 1 | rg = (const AVReplayGain *)sd->data; | |
| 246 | |||
| 247 | 1 | print_gain(ctx, "track gain", rg->track_gain, log_level); | |
| 248 | 1 | print_peak(ctx, "track peak", rg->track_peak, log_level); | |
| 249 | 1 | print_gain(ctx, "album gain", rg->album_gain, log_level); | |
| 250 | 1 | print_peak(ctx, "album peak", rg->album_peak, log_level); | |
| 251 | } | ||
| 252 | |||
| 253 | 491 | static void dump_stereo3d(void *ctx, const AVPacketSideData *sd, int log_level) | |
| 254 | { | ||
| 255 | const AVStereo3D *stereo; | ||
| 256 | |||
| 257 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 491 times.
|
491 | if (sd->size < sizeof(*stereo)) { |
| 258 | ✗ | av_log(ctx, AV_LOG_ERROR, "invalid data\n"); | |
| 259 | ✗ | return; | |
| 260 | } | ||
| 261 | |||
| 262 | 491 | stereo = (const AVStereo3D *)sd->data; | |
| 263 | |||
| 264 | 491 | av_log(ctx, log_level, "%s, view: %s, primary eye: %s", | |
| 265 | 491 | av_stereo3d_type_name(stereo->type), av_stereo3d_view_name(stereo->view), | |
| 266 | 491 | av_stereo3d_primary_eye_name(stereo->primary_eye)); | |
| 267 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 484 times.
|
491 | if (stereo->baseline) |
| 268 | 7 | av_log(ctx, log_level, ", baseline: %"PRIu32"", stereo->baseline); | |
| 269 |
3/4✓ Branch 0 taken 7 times.
✓ Branch 1 taken 484 times.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
|
491 | if (stereo->horizontal_disparity_adjustment.num && stereo->horizontal_disparity_adjustment.den) |
| 270 | 7 | av_log(ctx, log_level, ", horizontal_disparity_adjustment: %0.4f", | |
| 271 | av_q2d(stereo->horizontal_disparity_adjustment)); | ||
| 272 |
3/4✓ Branch 0 taken 7 times.
✓ Branch 1 taken 484 times.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
|
491 | if (stereo->horizontal_field_of_view.num && stereo->horizontal_field_of_view.den) |
| 273 | 7 | av_log(ctx, log_level, ", horizontal_field_of_view: %0.3f", av_q2d(stereo->horizontal_field_of_view)); | |
| 274 | |||
| 275 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 481 times.
|
491 | if (stereo->flags & AV_STEREO3D_FLAG_INVERT) |
| 276 | 10 | av_log(ctx, log_level, " (inverted)"); | |
| 277 | } | ||
| 278 | |||
| 279 | 21 | static void dump_audioservicetype(void *ctx, const AVPacketSideData *sd, int log_level) | |
| 280 | { | ||
| 281 | 21 | const enum AVAudioServiceType *ast = (const enum AVAudioServiceType *)sd->data; | |
| 282 | |||
| 283 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | if (sd->size < sizeof(*ast)) { |
| 284 | ✗ | av_log(ctx, AV_LOG_ERROR, "invalid data\n"); | |
| 285 | ✗ | return; | |
| 286 | } | ||
| 287 | |||
| 288 |
1/10✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
21 | switch (*ast) { |
| 289 | 21 | case AV_AUDIO_SERVICE_TYPE_MAIN: | |
| 290 | 21 | av_log(ctx, log_level, "main"); | |
| 291 | 21 | break; | |
| 292 | ✗ | case AV_AUDIO_SERVICE_TYPE_EFFECTS: | |
| 293 | ✗ | av_log(ctx, log_level, "effects"); | |
| 294 | ✗ | break; | |
| 295 | ✗ | case AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED: | |
| 296 | ✗ | av_log(ctx, log_level, "visually impaired"); | |
| 297 | ✗ | break; | |
| 298 | ✗ | case AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED: | |
| 299 | ✗ | av_log(ctx, log_level, "hearing impaired"); | |
| 300 | ✗ | break; | |
| 301 | ✗ | case AV_AUDIO_SERVICE_TYPE_DIALOGUE: | |
| 302 | ✗ | av_log(ctx, log_level, "dialogue"); | |
| 303 | ✗ | break; | |
| 304 | ✗ | case AV_AUDIO_SERVICE_TYPE_COMMENTARY: | |
| 305 | ✗ | av_log(ctx, log_level, "commentary"); | |
| 306 | ✗ | break; | |
| 307 | ✗ | case AV_AUDIO_SERVICE_TYPE_EMERGENCY: | |
| 308 | ✗ | av_log(ctx, log_level, "emergency"); | |
| 309 | ✗ | break; | |
| 310 | ✗ | case AV_AUDIO_SERVICE_TYPE_VOICE_OVER: | |
| 311 | ✗ | av_log(ctx, log_level, "voice over"); | |
| 312 | ✗ | break; | |
| 313 | ✗ | case AV_AUDIO_SERVICE_TYPE_KARAOKE: | |
| 314 | ✗ | av_log(ctx, log_level, "karaoke"); | |
| 315 | ✗ | break; | |
| 316 | ✗ | default: | |
| 317 | ✗ | av_log(ctx, AV_LOG_WARNING, "unknown"); | |
| 318 | ✗ | break; | |
| 319 | } | ||
| 320 | } | ||
| 321 | |||
| 322 | 401 | static void dump_cpb(void *ctx, const AVPacketSideData *sd, int log_level) | |
| 323 | { | ||
| 324 | 401 | const AVCPBProperties *cpb = (const AVCPBProperties *)sd->data; | |
| 325 | |||
| 326 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 401 times.
|
401 | if (sd->size < sizeof(*cpb)) { |
| 327 | ✗ | av_log(ctx, AV_LOG_ERROR, "invalid data\n"); | |
| 328 | ✗ | return; | |
| 329 | } | ||
| 330 | |||
| 331 | 401 | av_log(ctx, log_level, | |
| 332 | "bitrate max/min/avg: %"PRId64"/%"PRId64"/%"PRId64" buffer size: %"PRId64" ", | ||
| 333 | 401 | cpb->max_bitrate, cpb->min_bitrate, cpb->avg_bitrate, | |
| 334 | 401 | cpb->buffer_size); | |
| 335 |
1/2✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
|
401 | if (cpb->vbv_delay == UINT64_MAX) |
| 336 | 401 | 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 | |||
| 341 | 43 | static void dump_mastering_display_metadata(void *ctx, const AVPacketSideData *sd, | |
| 342 | int log_level) | ||
| 343 | { | ||
| 344 | 43 | const AVMasteringDisplayMetadata *metadata = | |
| 345 | (const AVMasteringDisplayMetadata *)sd->data; | ||
| 346 | 43 | 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 | 43 | 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 | 43 | } | |
| 360 | |||
| 361 | 40 | static void dump_content_light_metadata(void *ctx, const AVPacketSideData *sd, | |
| 362 | int log_level) | ||
| 363 | { | ||
| 364 | 40 | const AVContentLightMetadata *metadata = | |
| 365 | (const AVContentLightMetadata *)sd->data; | ||
| 366 | 40 | av_log(ctx, log_level, | |
| 367 | "MaxCLL=%d, MaxFALL=%d", | ||
| 368 | 40 | metadata->MaxCLL, metadata->MaxFALL); | |
| 369 | 40 | } | |
| 370 | |||
| 371 | 6 | static void dump_ambient_viewing_environment_metadata(void *ctx, const AVPacketSideData *sd, int log_level) | |
| 372 | { | ||
| 373 | 6 | const AVAmbientViewingEnvironment *ambient = | |
| 374 | (const AVAmbientViewingEnvironment *)sd->data; | ||
| 375 | 6 | 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 | 6 | } | |
| 381 | |||
| 382 | 18 | static void dump_spherical(void *ctx, int w, int h, | |
| 383 | const AVPacketSideData *sd, int log_level) | ||
| 384 | { | ||
| 385 | 18 | const AVSphericalMapping *spherical = (const AVSphericalMapping *)sd->data; | |
| 386 | double yaw, pitch, roll; | ||
| 387 | |||
| 388 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | if (sd->size < sizeof(*spherical)) { |
| 389 | ✗ | av_log(ctx, AV_LOG_ERROR, "invalid data\n"); | |
| 390 | ✗ | return; | |
| 391 | } | ||
| 392 | |||
| 393 | 18 | av_log(ctx, log_level, "%s ", av_spherical_projection_name(spherical->projection)); | |
| 394 | |||
| 395 |
4/6✓ Branch 0 taken 7 times.
✓ Branch 1 taken 11 times.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7 times.
|
18 | if (spherical->yaw || spherical->pitch || spherical->roll) { |
| 396 | 11 | yaw = ((double)spherical->yaw) / (1 << 16); | |
| 397 | 11 | pitch = ((double)spherical->pitch) / (1 << 16); | |
| 398 | 11 | roll = ((double)spherical->roll) / (1 << 16); | |
| 399 | 11 | av_log(ctx, log_level, "(%f/%f/%f) ", yaw, pitch, roll); | |
| 400 | } | ||
| 401 | |||
| 402 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 7 times.
|
18 | if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) { |
| 403 | size_t l, t, r, b; | ||
| 404 | 11 | av_spherical_tile_bounds(spherical, w, h, | |
| 405 | &l, &t, &r, &b); | ||
| 406 | 11 | av_log(ctx, log_level, "[%zu, %zu, %zu, %zu] ", l, t, r, b); | |
| 407 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | } else if (spherical->projection == AV_SPHERICAL_CUBEMAP) { |
| 408 | ✗ | av_log(ctx, log_level, "[pad %"PRIu32"] ", spherical->padding); | |
| 409 | } | ||
| 410 | } | ||
| 411 | |||
| 412 | 49 | static void dump_dovi_conf(void *ctx, const AVPacketSideData *sd, | |
| 413 | int log_level) | ||
| 414 | { | ||
| 415 | 49 | const AVDOVIDecoderConfigurationRecord *dovi = | |
| 416 | (const AVDOVIDecoderConfigurationRecord *)sd->data; | ||
| 417 | |||
| 418 | 49 | 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", | ||
| 421 | 49 | dovi->dv_version_major, dovi->dv_version_minor, | |
| 422 | 49 | dovi->dv_profile, dovi->dv_level, | |
| 423 | 49 | dovi->rpu_present_flag, | |
| 424 | 49 | dovi->el_present_flag, | |
| 425 | 49 | dovi->bl_present_flag, | |
| 426 | 49 | dovi->dv_bl_signal_compatibility_id, | |
| 427 | 49 | dovi->dv_md_compression); | |
| 428 | 49 | } | |
| 429 | |||
| 430 | ✗ | static 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 | |||
| 447 | 31 | static void dump_cropping(void *ctx, const AVPacketSideData *sd, int log_level) | |
| 448 | { | ||
| 449 | uint32_t top, bottom, left, right; | ||
| 450 | |||
| 451 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 31 times.
|
31 | if (sd->size < sizeof(uint32_t) * 4) { |
| 452 | ✗ | av_log(ctx, log_level, "invalid data\n"); | |
| 453 | ✗ | return; | |
| 454 | } | ||
| 455 | |||
| 456 | 31 | top = AV_RL32(sd->data + 0); | |
| 457 | 31 | bottom = AV_RL32(sd->data + 4); | |
| 458 | 31 | left = AV_RL32(sd->data + 8); | |
| 459 | 31 | right = AV_RL32(sd->data + 12); | |
| 460 | |||
| 461 | 31 | av_log(ctx, log_level, "%"PRIu32"/%"PRIu32"/%"PRIu32"/%"PRIu32"", left, right, top, bottom); | |
| 462 | } | ||
| 463 | |||
| 464 | 2 | static void dump_tdrdi(void *ctx, const AVPacketSideData *sd, int log_level) | |
| 465 | { | ||
| 466 | 2 | const AV3DReferenceDisplaysInfo *tdrdi = | |
| 467 | (const AV3DReferenceDisplaysInfo *)sd->data; | ||
| 468 | |||
| 469 | 2 | av_log(ctx, log_level, "number of reference displays: %u", tdrdi->num_ref_displays); | |
| 470 | 2 | } | |
| 471 | |||
| 472 | 3 | static void dump_gain_map_params(void *ctx, const AVPacketSideData *sd, int log_level) | |
| 473 | { | ||
| 474 | 3 | const AVGainMapParams *p = (const AVGainMapParams *) sd->data; | |
| 475 | |||
| 476 | 3 | 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 | 3 | 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 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3 | if (!(p->nb_channels == 1 || p->nb_channels == 3)) { |
| 482 | ✗ | av_log(ctx, AV_LOG_ERROR, "invalid data }\n"); | |
| 483 | ✗ | return; | |
| 484 | } | ||
| 485 | |||
| 486 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3 times.
|
6 | for (int c = 0; c < p->nb_channels; c++) { |
| 487 | 3 | const struct AVGainMapChannel *ch = &p->channels[c]; | |
| 488 | 3 | 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 | 3 | av_log(ctx, log_level, "}"); | |
| 497 | } | ||
| 498 | |||
| 499 | 18924 | static 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 |
2/2✓ Branch 0 taken 1098 times.
✓ Branch 1 taken 17826 times.
|
18924 | if (nb_side_data) |
| 506 | 1098 | av_log(ctx, log_level, "%sSide data:\n", indent); | |
| 507 | |||
| 508 |
2/2✓ Branch 0 taken 1244 times.
✓ Branch 1 taken 18924 times.
|
20168 | for (i = 0; i < nb_side_data; i++) { |
| 509 | 1244 | const AVPacketSideData *sd = &side_data[i]; | |
| 510 | 1244 | const char *name = av_packet_side_data_name(sd->type); | |
| 511 | |||
| 512 | 1244 | av_log(ctx, log_level, "%s ", indent); | |
| 513 |
1/2✓ Branch 0 taken 1244 times.
✗ Branch 1 not taken.
|
1244 | if (name) |
| 514 | 1244 | av_log(ctx, log_level, "%s: ", name); | |
| 515 |
14/17✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 53 times.
✓ Branch 3 taken 491 times.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 401 times.
✓ Branch 7 taken 43 times.
✓ Branch 8 taken 18 times.
✓ Branch 9 taken 40 times.
✓ Branch 10 taken 49 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 6 times.
✓ Branch 13 taken 31 times.
✓ Branch 14 taken 2 times.
✓ Branch 15 taken 3 times.
✓ Branch 16 taken 85 times.
|
1244 | switch (sd->type) { |
| 516 | ✗ | case AV_PKT_DATA_PARAM_CHANGE: | |
| 517 | ✗ | dump_paramchange(ctx, sd, log_level); | |
| 518 | ✗ | break; | |
| 519 | 1 | case AV_PKT_DATA_REPLAYGAIN: | |
| 520 | 1 | dump_replaygain(ctx, sd, log_level); | |
| 521 | 1 | break; | |
| 522 | 53 | case AV_PKT_DATA_DISPLAYMATRIX: | |
| 523 | 53 | av_log(ctx, log_level, "rotation of %.2f degrees", | |
| 524 | 53 | av_display_rotation_get((const int32_t *)sd->data)); | |
| 525 | 53 | break; | |
| 526 | 491 | case AV_PKT_DATA_STEREO3D: | |
| 527 | 491 | dump_stereo3d(ctx, sd, log_level); | |
| 528 | 491 | break; | |
| 529 | 21 | case AV_PKT_DATA_AUDIO_SERVICE_TYPE: | |
| 530 | 21 | dump_audioservicetype(ctx, sd, log_level); | |
| 531 | 21 | break; | |
| 532 | ✗ | case AV_PKT_DATA_QUALITY_STATS: | |
| 533 | ✗ | av_log(ctx, log_level, "%"PRId32", pict_type: %c", | |
| 534 | ✗ | AV_RL32(sd->data), av_get_picture_type_char(sd->data[4])); | |
| 535 | ✗ | break; | |
| 536 | 401 | case AV_PKT_DATA_CPB_PROPERTIES: | |
| 537 | 401 | dump_cpb(ctx, sd, log_level); | |
| 538 | 401 | break; | |
| 539 | 43 | case AV_PKT_DATA_MASTERING_DISPLAY_METADATA: | |
| 540 | 43 | dump_mastering_display_metadata(ctx, sd, log_level); | |
| 541 | 43 | break; | |
| 542 | 18 | case AV_PKT_DATA_SPHERICAL: | |
| 543 | 18 | dump_spherical(ctx, w, h, sd, log_level); | |
| 544 | 18 | break; | |
| 545 | 40 | case AV_PKT_DATA_CONTENT_LIGHT_LEVEL: | |
| 546 | 40 | dump_content_light_metadata(ctx, sd, log_level); | |
| 547 | 40 | break; | |
| 548 | 49 | case AV_PKT_DATA_DOVI_CONF: | |
| 549 | 49 | dump_dovi_conf(ctx, sd, log_level); | |
| 550 | 49 | break; | |
| 551 | ✗ | case AV_PKT_DATA_S12M_TIMECODE: | |
| 552 | ✗ | dump_s12m_timecode(ctx, avg_frame_rate, sd, log_level); | |
| 553 | ✗ | break; | |
| 554 | 6 | case AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT: | |
| 555 | 6 | dump_ambient_viewing_environment_metadata(ctx, sd, log_level); | |
| 556 | 6 | break; | |
| 557 | 31 | case AV_PKT_DATA_FRAME_CROPPING: | |
| 558 | 31 | dump_cropping(ctx, sd, log_level); | |
| 559 | 31 | break; | |
| 560 | 2 | case AV_PKT_DATA_3D_REFERENCE_DISPLAYS: | |
| 561 | 2 | dump_tdrdi(ctx, sd, log_level); | |
| 562 | 2 | break; | |
| 563 | 3 | case AV_PKT_DATA_GAIN_MAP_PARAMS: | |
| 564 | 3 | dump_gain_map_params(ctx, sd, log_level); | |
| 565 | 3 | break; | |
| 566 | 85 | default: | |
| 567 |
1/2✓ Branch 0 taken 85 times.
✗ Branch 1 not taken.
|
85 | if (name) |
| 568 | 85 | 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 | 85 | break; | |
| 573 | } | ||
| 574 | |||
| 575 | 1244 | av_log(ctx, log_level, "\n"); | |
| 576 | } | ||
| 577 | 18924 | } | |
| 578 | |||
| 579 | 19037 | static void dump_disposition(int disposition, int log_level) | |
| 580 | { | ||
| 581 |
2/2✓ Branch 0 taken 2200 times.
✓ Branch 1 taken 16837 times.
|
19037 | if (disposition & AV_DISPOSITION_DEFAULT) |
| 582 | 2200 | av_log(NULL, log_level, " (default)"); | |
| 583 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 19033 times.
|
19037 | if (disposition & AV_DISPOSITION_DUB) |
| 584 | 4 | av_log(NULL, log_level, " (dub)"); | |
| 585 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 19033 times.
|
19037 | if (disposition & AV_DISPOSITION_ORIGINAL) |
| 586 | 4 | av_log(NULL, log_level, " (original)"); | |
| 587 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 19032 times.
|
19037 | if (disposition & AV_DISPOSITION_COMMENT) |
| 588 | 5 | av_log(NULL, log_level, " (comment)"); | |
| 589 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 19036 times.
|
19037 | if (disposition & AV_DISPOSITION_LYRICS) |
| 590 | 1 | av_log(NULL, log_level, " (lyrics)"); | |
| 591 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 19036 times.
|
19037 | if (disposition & AV_DISPOSITION_KARAOKE) |
| 592 | 1 | av_log(NULL, log_level, " (karaoke)"); | |
| 593 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 19030 times.
|
19037 | if (disposition & AV_DISPOSITION_FORCED) |
| 594 | 7 | av_log(NULL, log_level, " (forced)"); | |
| 595 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 19015 times.
|
19037 | if (disposition & AV_DISPOSITION_HEARING_IMPAIRED) |
| 596 | 22 | av_log(NULL, log_level, " (hearing impaired)"); | |
| 597 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 19021 times.
|
19037 | if (disposition & AV_DISPOSITION_VISUAL_IMPAIRED) |
| 598 | 16 | av_log(NULL, log_level, " (visual impaired)"); | |
| 599 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19037 times.
|
19037 | if (disposition & AV_DISPOSITION_CLEAN_EFFECTS) |
| 600 | ✗ | av_log(NULL, log_level, " (clean effects)"); | |
| 601 |
2/2✓ Branch 0 taken 110 times.
✓ Branch 1 taken 18927 times.
|
19037 | if (disposition & AV_DISPOSITION_ATTACHED_PIC) |
| 602 | 110 | av_log(NULL, log_level, " (attached pic)"); | |
| 603 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19037 times.
|
19037 | if (disposition & AV_DISPOSITION_TIMED_THUMBNAILS) |
| 604 | ✗ | av_log(NULL, log_level, " (timed thumbnails)"); | |
| 605 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 19031 times.
|
19037 | if (disposition & AV_DISPOSITION_CAPTIONS) |
| 606 | 6 | av_log(NULL, log_level, " (captions)"); | |
| 607 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 19019 times.
|
19037 | if (disposition & AV_DISPOSITION_DESCRIPTIONS) |
| 608 | 18 | av_log(NULL, log_level, " (descriptions)"); | |
| 609 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 19033 times.
|
19037 | if (disposition & AV_DISPOSITION_METADATA) |
| 610 | 4 | av_log(NULL, log_level, " (metadata)"); | |
| 611 |
2/2✓ Branch 0 taken 478 times.
✓ Branch 1 taken 18559 times.
|
19037 | if (disposition & AV_DISPOSITION_DEPENDENT) |
| 612 | 478 | av_log(NULL, log_level, " (dependent)"); | |
| 613 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19037 times.
|
19037 | if (disposition & AV_DISPOSITION_STILL_IMAGE) |
| 614 | ✗ | av_log(NULL, log_level, " (still image)"); | |
| 615 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19037 times.
|
19037 | if (disposition & AV_DISPOSITION_NON_DIEGETIC) |
| 616 | ✗ | av_log(NULL, log_level, " (non-diegetic)"); | |
| 617 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 19028 times.
|
19037 | if (disposition & AV_DISPOSITION_MULTILAYER) |
| 618 | 9 | av_log(NULL, log_level, " (multilayer)"); | |
| 619 | 19037 | } | |
| 620 | |||
| 621 | /* "user interface" functions */ | ||
| 622 | 18900 | static 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 |
2/2✓ Branch 0 taken 9621 times.
✓ Branch 1 taken 9279 times.
|
18900 | int flags = (is_output ? ic->oformat->flags : ic->iformat->flags); |
| 628 | 18900 | const AVStream *st = ic->streams[i]; | |
| 629 | 18900 | const FFStream *const sti = cffstream(st); | |
| 630 | 18900 | const AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); | |
| 631 | 18900 | const char *separator = ic->dump_separator; | |
| 632 |
2/2✓ Branch 0 taken 651 times.
✓ Branch 1 taken 18249 times.
|
18900 | const char *group_indent = group_index >= 0 ? " " : ""; |
| 633 |
2/2✓ Branch 0 taken 651 times.
✓ Branch 1 taken 18249 times.
|
18900 | const char *extra_indent = group_index >= 0 ? " " : " "; |
| 634 | AVCodecContext *avctx; | ||
| 635 | int ret; | ||
| 636 | |||
| 637 | 18900 | avctx = avcodec_alloc_context3(NULL); | |
| 638 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18900 times.
|
18900 | if (!avctx) |
| 639 | ✗ | return; | |
| 640 | |||
| 641 | 18900 | ret = avcodec_parameters_to_context(avctx, st->codecpar); | |
| 642 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18900 times.
|
18900 | 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 |
2/2✓ Branch 0 taken 9279 times.
✓ Branch 1 taken 9621 times.
|
18900 | if (sti->avctx) { |
| 649 | 9279 | avctx->codec = sti->avctx->codec; | |
| 650 | 9279 | avctx->qmin = sti->avctx->qmin; | |
| 651 | 9279 | avctx->qmax = sti->avctx->qmax; | |
| 652 | 9279 | avctx->coded_width = sti->avctx->coded_width; | |
| 653 | 9279 | avctx->coded_height = sti->avctx->coded_height; | |
| 654 | } | ||
| 655 | |||
| 656 |
1/2✓ Branch 0 taken 18900 times.
✗ Branch 1 not taken.
|
18900 | if (separator) |
| 657 | 18900 | av_opt_set(avctx, "dump_separator", separator, 0); | |
| 658 | 18900 | avcodec_string(buf, sizeof(buf), avctx, is_output); | |
| 659 | 18900 | avcodec_free_context(&avctx); | |
| 660 | |||
| 661 | 18900 | av_log(NULL, log_level, "%s Stream #%d", group_indent, index); | |
| 662 | 18900 | 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 |
2/2✓ Branch 0 taken 1491 times.
✓ Branch 1 taken 17409 times.
|
18900 | if (flags & AVFMT_SHOW_IDS) |
| 667 | 1491 | av_log(NULL, log_level, "[0x%x]", st->id); | |
| 668 |
2/2✓ Branch 0 taken 1843 times.
✓ Branch 1 taken 17057 times.
|
18900 | if (lang) |
| 669 | 1843 | av_log(NULL, log_level, "(%s)", lang->value); | |
| 670 | 18900 | av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", sti->codec_info_nb_frames, | |
| 671 | 18900 | st->time_base.num, st->time_base.den); | |
| 672 | 18900 | av_log(NULL, log_level, ": %s", buf); | |
| 673 | |||
| 674 |
4/4✓ Branch 0 taken 2808 times.
✓ Branch 1 taken 16092 times.
✓ Branch 2 taken 398 times.
✓ Branch 3 taken 2410 times.
|
21708 | if (st->sample_aspect_ratio.num && |
| 675 | 2808 | av_cmp_q(st->sample_aspect_ratio, st->codecpar->sample_aspect_ratio)) { | |
| 676 | AVRational display_aspect_ratio; | ||
| 677 | 398 | av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, | |
| 678 | 398 | st->codecpar->width * (int64_t)st->sample_aspect_ratio.num, | |
| 679 | 398 | st->codecpar->height * (int64_t)st->sample_aspect_ratio.den, | |
| 680 | 1024 * 1024); | ||
| 681 | 398 | av_log(NULL, log_level, ", SAR %d:%d DAR %d:%d", | |
| 682 | 398 | st->sample_aspect_ratio.num, st->sample_aspect_ratio.den, | |
| 683 | display_aspect_ratio.num, display_aspect_ratio.den); | ||
| 684 | } | ||
| 685 | |||
| 686 |
2/2✓ Branch 0 taken 13991 times.
✓ Branch 1 taken 4909 times.
|
18900 | if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { |
| 687 |
3/4✓ Branch 0 taken 13106 times.
✓ Branch 1 taken 885 times.
✓ Branch 2 taken 13106 times.
✗ Branch 3 not taken.
|
13991 | int fps = st->avg_frame_rate.den && st->avg_frame_rate.num; |
| 688 |
3/4✓ Branch 0 taken 7006 times.
✓ Branch 1 taken 6985 times.
✓ Branch 2 taken 7006 times.
✗ Branch 3 not taken.
|
13991 | int tbr = st->r_frame_rate.den && st->r_frame_rate.num; |
| 689 |
2/4✓ Branch 0 taken 13991 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13991 times.
✗ Branch 3 not taken.
|
13991 | int tbn = st->time_base.den && st->time_base.num; |
| 690 | |||
| 691 |
5/6✓ Branch 0 taken 885 times.
✓ Branch 1 taken 13106 times.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 865 times.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
|
13991 | if (fps || tbr || tbn) |
| 692 | 13991 | av_log(NULL, log_level, "%s", separator); | |
| 693 | |||
| 694 |
2/2✓ Branch 0 taken 13106 times.
✓ Branch 1 taken 885 times.
|
13991 | if (fps) |
| 695 |
3/4✓ Branch 0 taken 6965 times.
✓ Branch 1 taken 6141 times.
✓ Branch 2 taken 6965 times.
✗ Branch 3 not taken.
|
13106 | print_fps(av_q2d(st->avg_frame_rate), tbr || tbn ? "fps, " : "fps", log_level); |
| 696 |
2/2✓ Branch 0 taken 7006 times.
✓ Branch 1 taken 6985 times.
|
13991 | if (tbr) |
| 697 |
1/2✓ Branch 0 taken 7006 times.
✗ Branch 1 not taken.
|
7006 | print_fps(av_q2d(st->r_frame_rate), tbn ? "tbr, " : "tbr", log_level); |
| 698 |
1/2✓ Branch 0 taken 13991 times.
✗ Branch 1 not taken.
|
13991 | if (tbn) |
| 699 | 13991 | print_fps(1 / av_q2d(st->time_base), "tbn", log_level); | |
| 700 | } | ||
| 701 | |||
| 702 |
6/8✓ Branch 0 taken 7109 times.
✓ Branch 1 taken 11791 times.
✓ Branch 2 taken 531 times.
✓ Branch 3 taken 6578 times.
✓ Branch 4 taken 531 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 531 times.
✗ Branch 7 not taken.
|
18900 | if (st->start_time != AV_NOPTS_VALUE && st->start_time != 0 && st->time_base.den && st->time_base.num) { |
| 703 | 531 | const double stream_start = av_q2d(st->time_base) * st->start_time; | |
| 704 | 531 | av_log(NULL, log_level, ", start %.6f", stream_start); | |
| 705 | } | ||
| 706 | |||
| 707 | 18900 | dump_disposition(st->disposition, log_level); | |
| 708 | 18900 | av_log(NULL, log_level, "\n"); | |
| 709 | |||
| 710 | 18900 | dump_metadata(NULL, st->metadata, extra_indent, log_level); | |
| 711 | |||
| 712 | 18900 | dump_sidedata(NULL, st->codecpar->coded_side_data, st->codecpar->nb_coded_side_data, | |
| 713 | 18900 | st->codecpar->width, st->codecpar->height, st->avg_frame_rate, | |
| 714 | extra_indent, log_level); | ||
| 715 | } | ||
| 716 | |||
| 717 | 176 | static void dump_stream_group(const AVFormatContext *ic, uint8_t *printed, | |
| 718 | int i, int index, int is_output, int log_level) | ||
| 719 | { | ||
| 720 | 176 | const AVStreamGroup *stg = ic->stream_groups[i]; | |
| 721 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 174 times.
|
176 | const char *group_indent = log_level != AV_LOG_INFO ? " " : ""; |
| 722 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 174 times.
|
176 | const char *extra_indent = log_level != AV_LOG_INFO ? " " : " "; |
| 723 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 146 times.
|
176 | int flags = (is_output ? ic->oformat->flags : ic->iformat->flags); |
| 724 | char buf[512]; | ||
| 725 | int ret; | ||
| 726 | |||
| 727 | 176 | av_log(NULL, log_level, "%s Stream group #%d:%d", group_indent, index, i); | |
| 728 |
2/2✓ Branch 0 taken 144 times.
✓ Branch 1 taken 32 times.
|
176 | if (flags & AVFMT_SHOW_IDS) |
| 729 | 144 | av_log(NULL, log_level, "[0x%"PRIx64"]", stg->id); | |
| 730 | 176 | av_log(NULL, log_level, ":"); | |
| 731 | |||
| 732 |
6/7✓ Branch 0 taken 58 times.
✓ Branch 1 taken 55 times.
✓ Branch 2 taken 13 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 39 times.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
|
176 | switch (stg->type) { |
| 733 | 58 | case AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT: { | |
| 734 | 58 | const AVIAMFAudioElement *audio_element = stg->params.iamf_audio_element; | |
| 735 | 58 | av_log(NULL, log_level, " IAMF Audio Element:"); | |
| 736 | 58 | dump_disposition(stg->disposition, log_level); | |
| 737 | 58 | av_log(NULL, log_level, "\n"); | |
| 738 | 58 | dump_metadata(NULL, stg->metadata, " ", log_level); | |
| 739 |
2/2✓ Branch 0 taken 115 times.
✓ Branch 1 taken 58 times.
|
173 | for (int j = 0; j < audio_element->nb_layers; j++) { |
| 740 | 115 | const AVIAMFLayer *layer = audio_element->layers[j]; | |
| 741 | 115 | int channel_count = layer->ch_layout.nb_channels; | |
| 742 | 115 | av_log(NULL, log_level, " Layer %d:", j); | |
| 743 | 115 | ret = av_channel_layout_describe(&layer->ch_layout, buf, sizeof(buf)); | |
| 744 |
1/2✓ Branch 0 taken 115 times.
✗ Branch 1 not taken.
|
115 | if (ret >= 0) |
| 745 | 115 | av_log(NULL, log_level, " %s", buf); | |
| 746 | 115 | av_log(NULL, log_level, "\n"); | |
| 747 |
4/6✓ Branch 0 taken 633 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 518 times.
✓ Branch 3 taken 115 times.
✓ Branch 4 taken 518 times.
✗ Branch 5 not taken.
|
633 | for (int k = 0; log_level == AV_LOG_INFO && channel_count > 0 && k < stg->nb_entries; k++) { |
| 748 | 518 | const AVStreamGroupEntry *entry = stg->entries[k]; | |
| 749 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 518 times.
|
518 | if (entry->type != AV_STREAM_GROUP_ENTRY_STREAM) |
| 750 | ✗ | continue; | |
| 751 | 518 | const AVStream *st = entry->stream; | |
| 752 |
2/2✓ Branch 0 taken 187 times.
✓ Branch 1 taken 331 times.
|
518 | int loglevel = printed[st->index] ? AV_LOG_VERBOSE : AV_LOG_INFO; |
| 753 | 518 | av_log(NULL, loglevel, " "); | |
| 754 | 518 | dump_stream_format(ic, st->index, i, index, is_output, loglevel); | |
| 755 | 518 | printed[st->index] = 1; | |
| 756 | 518 | channel_count -= st->codecpar->ch_layout.nb_channels; | |
| 757 | } | ||
| 758 | } | ||
| 759 | 58 | break; | |
| 760 | } | ||
| 761 | 55 | case AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION: { | |
| 762 | 55 | const AVIAMFMixPresentation *mix_presentation = stg->params.iamf_mix_presentation; | |
| 763 | 55 | av_log(NULL, log_level, " IAMF Mix Presentation:"); | |
| 764 | 55 | dump_disposition(stg->disposition, log_level); | |
| 765 | 55 | av_log(NULL, log_level, "\n"); | |
| 766 | 55 | dump_metadata(NULL, stg->metadata, " ", log_level); | |
| 767 | 55 | dump_dictionary(NULL, mix_presentation->annotations, "Annotations", " ", log_level); | |
| 768 |
2/2✓ Branch 0 taken 61 times.
✓ Branch 1 taken 55 times.
|
116 | for (int j = 0; j < mix_presentation->nb_submixes; j++) { |
| 769 | 61 | AVIAMFSubmix *sub_mix = mix_presentation->submixes[j]; | |
| 770 | 61 | av_log(NULL, log_level, " Submix %d:\n", j); | |
| 771 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 61 times.
|
125 | for (int k = 0; k < sub_mix->nb_elements; k++) { |
| 772 | 64 | const AVIAMFSubmixElement *submix_element = sub_mix->elements[k]; | |
| 773 | 64 | const AVStreamGroup *audio_element = NULL; | |
| 774 |
1/2✓ Branch 0 taken 67 times.
✗ Branch 1 not taken.
|
67 | for (int l = 0; l < ic->nb_stream_groups; l++) |
| 775 |
1/2✓ Branch 0 taken 67 times.
✗ Branch 1 not taken.
|
67 | if (ic->stream_groups[l]->type == AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT && |
| 776 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 3 times.
|
67 | ic->stream_groups[l]->id == submix_element->audio_element_id) { |
| 777 | 64 | audio_element = ic->stream_groups[l]; | |
| 778 | 64 | break; | |
| 779 | } | ||
| 780 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if (audio_element) { |
| 781 | 64 | av_log(NULL, log_level, " IAMF Audio Element #%d:%d", | |
| 782 | 64 | index, audio_element->index); | |
| 783 |
2/2✓ Branch 0 taken 47 times.
✓ Branch 1 taken 17 times.
|
64 | if (flags & AVFMT_SHOW_IDS) |
| 784 | 47 | av_log(NULL, log_level, "[0x%"PRIx64"]", audio_element->id); | |
| 785 | 64 | av_log(NULL, log_level, "\n"); | |
| 786 | 64 | dump_dictionary(NULL, submix_element->annotations, "Annotations", " ", log_level); | |
| 787 | } | ||
| 788 | } | ||
| 789 |
2/2✓ Branch 0 taken 127 times.
✓ Branch 1 taken 61 times.
|
188 | for (int k = 0; k < sub_mix->nb_layouts; k++) { |
| 790 | 127 | const AVIAMFSubmixLayout *submix_layout = sub_mix->layouts[k]; | |
| 791 | 127 | av_log(NULL, log_level, " Layout #%d:", k); | |
| 792 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 115 times.
|
127 | if (submix_layout->layout_type == 2 || |
| 793 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | submix_layout->layout_type == 3) { |
| 794 | 127 | ret = av_channel_layout_describe(&submix_layout->sound_system, buf, sizeof(buf)); | |
| 795 |
1/2✓ Branch 0 taken 127 times.
✗ Branch 1 not taken.
|
127 | if (ret >= 0) |
| 796 | 127 | av_log(NULL, log_level, " %s", buf); | |
| 797 | } | ||
| 798 | 127 | av_log(NULL, log_level, "\n"); | |
| 799 | } | ||
| 800 | } | ||
| 801 | 55 | break; | |
| 802 | } | ||
| 803 | 13 | case AV_STREAM_GROUP_PARAMS_TILE_GRID: { | |
| 804 | 13 | const AVStreamGroupTileGrid *tile_grid = stg->params.tile_grid; | |
| 805 | 13 | AVCodecContext *avctx = avcodec_alloc_context3(NULL); | |
| 806 | 13 | const char *ptr = NULL; | |
| 807 | 13 | av_log(NULL, log_level, " Tile Grid:"); | |
| 808 |
3/6✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 13 times.
✗ Branch 5 not taken.
|
13 | if (avctx && stg->nb_entries && stg->entries[0]->type == AV_STREAM_GROUP_ENTRY_STREAM) { |
| 809 | 13 | const AVStream *st = stg->entries[0]->stream; | |
| 810 |
1/2✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
|
13 | if (!avcodec_parameters_to_context(avctx, st->codecpar)) { |
| 811 | 13 | avctx->width = tile_grid->width; | |
| 812 | 13 | avctx->height = tile_grid->height; | |
| 813 | 13 | avctx->coded_width = tile_grid->coded_width; | |
| 814 | 13 | avctx->coded_height = tile_grid->coded_height; | |
| 815 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | if (ic->dump_separator) |
| 816 | 13 | av_opt_set(avctx, "dump_separator", ic->dump_separator, 0); | |
| 817 | 13 | buf[0] = 0; | |
| 818 | 13 | avcodec_string(buf, sizeof(buf), avctx, is_output); | |
| 819 | 13 | ptr = av_stristr(buf, " "); | |
| 820 | } | ||
| 821 | } | ||
| 822 | 13 | avcodec_free_context(&avctx); | |
| 823 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | if (ptr) |
| 824 | 13 | av_log(NULL, log_level, "%s", ptr); | |
| 825 | 13 | dump_disposition(stg->disposition, log_level); | |
| 826 | 13 | av_log(NULL, log_level, "\n"); | |
| 827 | 13 | dump_metadata(NULL, stg->metadata, extra_indent, log_level); | |
| 828 | 13 | dump_sidedata(NULL, stg->coded_side_data, stg->nb_coded_side_data, | |
| 829 | 13 | tile_grid->width, tile_grid->height, (AVRational) {0,1}, | |
| 830 | extra_indent, log_level); | ||
| 831 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 13 times.
|
57 | for (int i = 0; i < tile_grid->nb_tiles; i++) { |
| 832 | 44 | const AVStream *st = NULL; | |
| 833 |
1/2✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
|
44 | if (tile_grid->offsets[i].idx < stg->nb_entries) { |
| 834 | 44 | const AVStreamGroupEntry *entry = stg->entries[tile_grid->offsets[i].idx]; | |
| 835 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44 times.
|
44 | if (entry->type != AV_STREAM_GROUP_ENTRY_STREAM) |
| 836 | ✗ | continue; | |
| 837 | 44 | st = entry->stream; | |
| 838 | } | ||
| 839 |
3/4✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 34 times.
✓ Branch 3 taken 10 times.
|
44 | if (st && !printed[st->index]) { |
| 840 | 34 | dump_stream_format(ic, st->index, i, index, is_output, AV_LOG_VERBOSE); | |
| 841 | 34 | printed[st->index] = 1; | |
| 842 | } | ||
| 843 | } | ||
| 844 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 13 times.
|
55 | for (int i = 0; i < stg->nb_entries; i++) { |
| 845 | 42 | const AVStreamGroupEntry *entry = stg->entries[i]; | |
| 846 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 42 times.
|
42 | if (entry->type != AV_STREAM_GROUP_ENTRY_STREAM) |
| 847 | ✗ | continue; | |
| 848 | 42 | const AVStream *st = entry->stream; | |
| 849 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 42 times.
|
42 | 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 | 13 | break; | |
| 855 | } | ||
| 856 | 8 | case AV_STREAM_GROUP_PARAMS_DOLBY_VISION: | |
| 857 | case AV_STREAM_GROUP_PARAMS_LCEVC: { | ||
| 858 | 8 | const AVStreamGroupLayeredVideo *layered_video = stg->params.layered_video; | |
| 859 | 8 | AVCodecContext *avctx = avcodec_alloc_context3(NULL); | |
| 860 | 8 | const char *ptr = NULL; | |
| 861 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
|
8 | av_log(NULL, AV_LOG_INFO, " %s:", stg->type == AV_STREAM_GROUP_PARAMS_DOLBY_VISION ? |
| 862 | "Dolby Vision" : "LCEVC"); | ||
| 863 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if (avctx && stg->nb_entries == 2 && |
| 864 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | stg->entries[!layered_video->el_index]->type == AV_STREAM_GROUP_ENTRY_STREAM) { |
| 865 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | const AVStream *st = stg->entries[!layered_video->el_index]->stream; |
| 866 |
1/2✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
|
8 | if (!avcodec_parameters_to_context(avctx, st->codecpar)) { |
| 867 | 8 | avctx->width = layered_video->width; | |
| 868 | 8 | avctx->height = layered_video->height; | |
| 869 | 8 | avctx->coded_width = layered_video->width; | |
| 870 | 8 | avctx->coded_height = layered_video->height; | |
| 871 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if (ic->dump_separator) |
| 872 | 8 | av_opt_set(avctx, "dump_separator", ic->dump_separator, 0); | |
| 873 | 8 | buf[0] = 0; | |
| 874 | 8 | avcodec_string(buf, sizeof(buf), avctx, is_output); | |
| 875 | 8 | ptr = av_stristr(buf, " "); | |
| 876 | } | ||
| 877 | } | ||
| 878 | 8 | avcodec_free_context(&avctx); | |
| 879 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if (ptr) |
| 880 | 8 | av_log(NULL, log_level, "%s", ptr); | |
| 881 | 8 | dump_disposition(stg->disposition, log_level); | |
| 882 | 8 | av_log(NULL, log_level, "\n"); | |
| 883 | 8 | dump_metadata(NULL, stg->metadata, extra_indent, log_level); | |
| 884 | 8 | dump_sidedata(NULL, stg->coded_side_data, stg->nb_coded_side_data, | |
| 885 | 8 | layered_video->width, layered_video->height, (AVRational) {0,1}, | |
| 886 | extra_indent, log_level); | ||
| 887 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 8 times.
|
24 | for (int i = 0; i < stg->nb_entries; i++) { |
| 888 | 16 | const AVStreamGroupEntry *entry = stg->entries[i]; | |
| 889 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if (entry->type != AV_STREAM_GROUP_ENTRY_STREAM) |
| 890 | ✗ | continue; | |
| 891 | 16 | const AVStream *st = entry->stream; | |
| 892 | 16 | dump_stream_format(ic, st->index, i, index, is_output, AV_LOG_VERBOSE); | |
| 893 | 16 | printed[st->index] = 1; | |
| 894 | } | ||
| 895 | 8 | break; | |
| 896 | } | ||
| 897 | 39 | case AV_STREAM_GROUP_PARAMS_TREF: { | |
| 898 | 39 | av_log(NULL, log_level, " Track Reference:\n"); | |
| 899 |
2/2✓ Branch 0 taken 79 times.
✓ Branch 1 taken 39 times.
|
118 | for (int i = 0; i < stg->nb_entries; i++) { |
| 900 | 79 | const AVStreamGroupEntry *entry = stg->entries[i]; | |
| 901 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 79 times.
|
79 | if (entry->type != AV_STREAM_GROUP_ENTRY_STREAM) |
| 902 | ✗ | continue; | |
| 903 | 79 | const AVStream *st = entry->stream; | |
| 904 | 79 | dump_stream_format(ic, st->index, i, index, is_output, log_level); | |
| 905 | 79 | printed[st->index] = 1; | |
| 906 | } | ||
| 907 | 39 | break; | |
| 908 | } | ||
| 909 | 3 | case AV_STREAM_GROUP_PARAMS_GAIN_MAP: { | |
| 910 | 3 | const AVStreamGroupLayeredVideo *layered_video = stg->params.layered_video; | |
| 911 | 3 | const char *ptr = NULL; | |
| 912 | 3 | av_log(NULL, AV_LOG_INFO, " Gain Map:"); | |
| 913 | 3 | buf[0] = 0; | |
| 914 | 3 | av_strlcatf(buf, sizeof(buf), " %dx%d", layered_video->width, layered_video->height); | |
| 915 | 3 | ptr = av_stristr(buf, " "); | |
| 916 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (ptr) |
| 917 | 3 | av_log(NULL, log_level, "%s", ptr); | |
| 918 | 3 | dump_disposition(stg->disposition, log_level); | |
| 919 | 3 | av_log(NULL, log_level, "\n"); | |
| 920 | 3 | dump_metadata(NULL, stg->metadata, extra_indent, log_level); | |
| 921 | 3 | dump_sidedata(NULL, stg->coded_side_data, stg->nb_coded_side_data, | |
| 922 | 3 | layered_video->width, layered_video->height, (AVRational) {0,1}, | |
| 923 | extra_indent, log_level); | ||
| 924 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 3 times.
|
9 | for (int i = 0; i < stg->nb_entries; i++) { |
| 925 | 6 | const AVStreamGroupEntry *entry = stg->entries[i]; | |
| 926 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
|
6 | if (entry->type == AV_STREAM_GROUP_ENTRY_STREAM) { |
| 927 | 4 | const AVStream *st = entry->stream; | |
| 928 | 4 | dump_stream_format(ic, st->index, i, index, is_output, log_level); | |
| 929 | 4 | printed[st->index] = 1; | |
| 930 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | } else if (entry->type == AV_STREAM_GROUP_ENTRY_STREAM_GROUP) |
| 931 | 2 | dump_stream_group(ic, printed, entry->stream_group->index, index, | |
| 932 | is_output, AV_LOG_VERBOSE); | ||
| 933 | } | ||
| 934 | 3 | break; | |
| 935 | } | ||
| 936 | ✗ | default: | |
| 937 | ✗ | break; | |
| 938 | } | ||
| 939 | 176 | } | |
| 940 | |||
| 941 | 16999 | void av_dump_format(AVFormatContext *ic, int index, | |
| 942 | const char *url, int is_output) | ||
| 943 | { | ||
| 944 | int i; | ||
| 945 |
2/2✓ Branch 0 taken 16997 times.
✓ Branch 1 taken 2 times.
|
16999 | uint8_t *printed = ic->nb_streams ? av_mallocz(ic->nb_streams) : NULL; |
| 946 |
3/4✓ Branch 0 taken 16997 times.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 16997 times.
|
16999 | if (ic->nb_streams && !printed) |
| 947 | ✗ | return; | |
| 948 | |||
| 949 |
6/6✓ Branch 0 taken 8909 times.
✓ Branch 1 taken 8090 times.
✓ Branch 2 taken 8909 times.
✓ Branch 3 taken 8090 times.
✓ Branch 4 taken 8909 times.
✓ Branch 5 taken 8090 times.
|
33998 | av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n", |
| 950 | is_output ? "Output" : "Input", | ||
| 951 | index, | ||
| 952 | 16999 | is_output ? ic->oformat->name : ic->iformat->name, | |
| 953 | is_output ? "to" : "from", url); | ||
| 954 | 16999 | dump_metadata(NULL, ic->metadata, " ", AV_LOG_INFO); | |
| 955 | |||
| 956 |
2/2✓ Branch 0 taken 8090 times.
✓ Branch 1 taken 8909 times.
|
16999 | if (!is_output) { |
| 957 | 8090 | av_log(NULL, AV_LOG_INFO, " Duration: "); | |
| 958 |
2/2✓ Branch 0 taken 6838 times.
✓ Branch 1 taken 1252 times.
|
8090 | if (ic->duration != AV_NOPTS_VALUE) { |
| 959 | int64_t hours, mins, secs, us; | ||
| 960 |
1/2✓ Branch 0 taken 6838 times.
✗ Branch 1 not taken.
|
6838 | int64_t duration = ic->duration + (ic->duration <= INT64_MAX - 5000 ? 5000 : 0); |
| 961 | 6838 | secs = duration / AV_TIME_BASE; | |
| 962 | 6838 | us = duration % AV_TIME_BASE; | |
| 963 | 6838 | mins = secs / 60; | |
| 964 | 6838 | secs %= 60; | |
| 965 | 6838 | hours = mins / 60; | |
| 966 | 6838 | mins %= 60; | |
| 967 | 6838 | av_log(NULL, AV_LOG_INFO, "%02"PRId64":%02"PRId64":%02"PRId64".%02"PRId64"", hours, mins, secs, | |
| 968 | (100 * us) / AV_TIME_BASE); | ||
| 969 | } else { | ||
| 970 | 1252 | av_log(NULL, AV_LOG_INFO, "N/A"); | |
| 971 | } | ||
| 972 |
2/2✓ Branch 0 taken 6166 times.
✓ Branch 1 taken 1924 times.
|
8090 | if (ic->start_time != AV_NOPTS_VALUE) { |
| 973 | int secs, us; | ||
| 974 | 6166 | av_log(NULL, AV_LOG_INFO, ", start: "); | |
| 975 | 6166 | secs = llabs(ic->start_time / AV_TIME_BASE); | |
| 976 | 6166 | us = llabs(ic->start_time % AV_TIME_BASE); | |
| 977 | 6166 | av_log(NULL, AV_LOG_INFO, "%s%d.%06d", | |
| 978 | 6166 | ic->start_time >= 0 ? "" : "-", | |
| 979 | secs, | ||
| 980 |
2/2✓ Branch 0 taken 6133 times.
✓ Branch 1 taken 33 times.
|
6166 | (int) av_rescale(us, 1000000, AV_TIME_BASE)); |
| 981 | } | ||
| 982 | 8090 | av_log(NULL, AV_LOG_INFO, ", bitrate: "); | |
| 983 |
2/2✓ Branch 0 taken 3765 times.
✓ Branch 1 taken 4325 times.
|
8090 | if (ic->bit_rate) |
| 984 | 3765 | av_log(NULL, AV_LOG_INFO, "%"PRId64" kb/s", ic->bit_rate / 1000); | |
| 985 | else | ||
| 986 | 4325 | av_log(NULL, AV_LOG_INFO, "N/A"); | |
| 987 | 8090 | av_log(NULL, AV_LOG_INFO, "\n"); | |
| 988 | } | ||
| 989 | |||
| 990 |
2/2✓ Branch 0 taken 95 times.
✓ Branch 1 taken 16904 times.
|
16999 | if (ic->nb_chapters) |
| 991 | 95 | av_log(NULL, AV_LOG_INFO, " Chapters:\n"); | |
| 992 |
2/2✓ Branch 0 taken 208 times.
✓ Branch 1 taken 16999 times.
|
17207 | for (i = 0; i < ic->nb_chapters; i++) { |
| 993 | 208 | const AVChapter *ch = ic->chapters[i]; | |
| 994 | 208 | av_log(NULL, AV_LOG_INFO, " Chapter #%d:%d: ", index, i); | |
| 995 | 208 | av_log(NULL, AV_LOG_INFO, | |
| 996 | 208 | "start %f, ", ch->start * av_q2d(ch->time_base)); | |
| 997 | 208 | av_log(NULL, AV_LOG_INFO, | |
| 998 | 208 | "end %f\n", ch->end * av_q2d(ch->time_base)); | |
| 999 | |||
| 1000 | 208 | dump_metadata(NULL, ch->metadata, " ", AV_LOG_INFO); | |
| 1001 | } | ||
| 1002 | |||
| 1003 |
2/2✓ Branch 0 taken 80 times.
✓ Branch 1 taken 16919 times.
|
16999 | if (ic->nb_programs) { |
| 1004 | 80 | int j, k, total = 0; | |
| 1005 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 80 times.
|
161 | for (j = 0; j < ic->nb_programs; j++) { |
| 1006 | 81 | const AVProgram *program = ic->programs[j]; | |
| 1007 | 81 | const AVDictionaryEntry *name = av_dict_get(program->metadata, | |
| 1008 | "name", NULL, 0); | ||
| 1009 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 81 times.
|
81 | av_log(NULL, AV_LOG_INFO, " Program %d %s\n", program->id, |
| 1010 | name ? name->value : ""); | ||
| 1011 | 81 | dump_metadata(NULL, program->metadata, " ", AV_LOG_INFO); | |
| 1012 |
2/2✓ Branch 0 taken 242 times.
✓ Branch 1 taken 81 times.
|
323 | for (k = 0; k < program->nb_stream_indexes; k++) { |
| 1013 | 242 | dump_stream_format(ic, program->stream_index[k], | |
| 1014 | -1, index, is_output, AV_LOG_INFO); | ||
| 1015 | 242 | printed[program->stream_index[k]] = 1; | |
| 1016 | } | ||
| 1017 | 81 | total += program->nb_stream_indexes; | |
| 1018 | } | ||
| 1019 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 74 times.
|
80 | if (total < ic->nb_streams) |
| 1020 | 6 | av_log(NULL, AV_LOG_INFO, " No Program\n"); | |
| 1021 | } | ||
| 1022 | |||
| 1023 |
2/2✓ Branch 0 taken 174 times.
✓ Branch 1 taken 16999 times.
|
17173 | for (i = 0; i < ic->nb_stream_groups; i++) |
| 1024 | 174 | dump_stream_group(ic, printed, i, index, is_output, AV_LOG_INFO); | |
| 1025 | |||
| 1026 |
2/2✓ Branch 0 taken 18685 times.
✓ Branch 1 taken 16999 times.
|
35684 | for (i = 0; i < ic->nb_streams; i++) |
| 1027 |
2/2✓ Branch 0 taken 18007 times.
✓ Branch 1 taken 678 times.
|
18685 | if (!printed[i]) |
| 1028 | 18007 | dump_stream_format(ic, i, -1, index, is_output, AV_LOG_INFO); | |
| 1029 | |||
| 1030 | 16999 | av_free(printed); | |
| 1031 | } | ||
| 1032 |