FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavformat/dump.c
Date: 2025-01-20 09:27:23
Exec Total Coverage
Lines: 427 614 69.5%
Functions: 19 28 67.9%
Branches: 245 384 63.8%

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/iamf.h"
29 #include "libavutil/intreadwrite.h"
30 #include "libavutil/log.h"
31 #include "libavutil/mastering_display_metadata.h"
32 #include "libavutil/ambient_viewing_environment.h"
33 #include "libavutil/dovi_meta.h"
34 #include "libavutil/mathematics.h"
35 #include "libavutil/mem.h"
36 #include "libavutil/opt.h"
37 #include "libavutil/replaygain.h"
38 #include "libavutil/spherical.h"
39 #include "libavutil/stereo3d.h"
40 #include "libavutil/timecode.h"
41
42 #include "libavcodec/avcodec.h"
43
44 #include "avformat.h"
45 #include "internal.h"
46
47 #define HEXDUMP_PRINT(...) \
48 do { \
49 if (!f) \
50 av_log(avcl, level, __VA_ARGS__); \
51 else \
52 fprintf(f, __VA_ARGS__); \
53 } while (0)
54
55 1 static void hex_dump_internal(void *avcl, FILE *f, int level,
56 const uint8_t *buf, int size)
57 {
58 int len, i, j, c;
59
60
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 for (i = 0; i < size; i += 16) {
61 2 len = size - i;
62
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
2 if (len > 16)
63 1 len = 16;
64
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 HEXDUMP_PRINT("%08x ", i);
65
2/2
✓ Branch 0 taken 32 times.
✓ Branch 1 taken 2 times.
34 for (j = 0; j < 16; j++) {
66
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 8 times.
32 if (j < len)
67
1/2
✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
24 HEXDUMP_PRINT(" %02x", buf[i + j]);
68 else
69
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 HEXDUMP_PRINT(" ");
70 }
71
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 HEXDUMP_PRINT(" ");
72
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 2 times.
26 for (j = 0; j < len; j++) {
73 24 c = buf[i + j];
74
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 > '~')
75 15 c = '.';
76
1/2
✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
24 HEXDUMP_PRINT("%c", c);
77 }
78
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 HEXDUMP_PRINT("\n");
79 }
80 1 }
81
82 void av_hex_dump(FILE *f, const uint8_t *buf, int size)
83 {
84 hex_dump_internal(NULL, f, 0, buf, size);
85 }
86
87 1 void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
88 {
89 1 hex_dump_internal(avcl, NULL, level, buf, size);
90 1 }
91
92 static void pkt_dump_internal(void *avcl, FILE *f, int level, const AVPacket *pkt,
93 int dump_payload, AVRational time_base)
94 {
95 HEXDUMP_PRINT("stream #%d:\n", pkt->stream_index);
96 HEXDUMP_PRINT(" keyframe=%d\n", (pkt->flags & AV_PKT_FLAG_KEY) != 0);
97 HEXDUMP_PRINT(" duration=%0.3f\n", pkt->duration * av_q2d(time_base));
98 /* DTS is _always_ valid after av_read_frame() */
99 HEXDUMP_PRINT(" dts=");
100 if (pkt->dts == AV_NOPTS_VALUE)
101 HEXDUMP_PRINT("N/A");
102 else
103 HEXDUMP_PRINT("%0.3f", pkt->dts * av_q2d(time_base));
104 /* PTS may not be known if B-frames are present. */
105 HEXDUMP_PRINT(" pts=");
106 if (pkt->pts == AV_NOPTS_VALUE)
107 HEXDUMP_PRINT("N/A");
108 else
109 HEXDUMP_PRINT("%0.3f", pkt->pts * av_q2d(time_base));
110 HEXDUMP_PRINT("\n");
111 HEXDUMP_PRINT(" size=%d\n", pkt->size);
112 if (dump_payload)
113 hex_dump_internal(avcl, f, level, pkt->data, pkt->size);
114 }
115
116 void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st)
117 {
118 pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base);
119 }
120
121 void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload,
122 const AVStream *st)
123 {
124 pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base);
125 }
126
127
128 31039 static void print_fps(double d, const char *postfix, int log_level)
129 {
130 31039 uint64_t v = lrintf(d * 100);
131
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 31039 times.
31039 if (!v)
132 av_log(NULL, log_level, "%1.4f %s", d, postfix);
133
2/2
✓ Branch 0 taken 2017 times.
✓ Branch 1 taken 29022 times.
31039 else if (v % 100)
134 2017 av_log(NULL, log_level, "%3.2f %s", d, postfix);
135
2/2
✓ Branch 0 taken 26816 times.
✓ Branch 1 taken 2206 times.
29022 else if (v % (100 * 1000))
136 26816 av_log(NULL, log_level, "%1.0f %s", d, postfix);
137 else
138 2206 av_log(NULL, log_level, "%1.0fk %s", d / 1000, postfix);
139 31039 }
140
141 12085 static void dump_dictionary(void *ctx, const AVDictionary *m,
142 const char *name, const char *indent,
143 int log_level)
144 {
145 12085 const AVDictionaryEntry *tag = NULL;
146
147
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 12085 times.
12085 if (!m)
148 return;
149
150 12085 av_log(ctx, log_level, "%s%s:\n", indent, name);
151
2/2
✓ Branch 1 taken 21079 times.
✓ Branch 2 taken 12085 times.
33164 while ((tag = av_dict_iterate(m, tag)))
152
2/2
✓ Branch 0 taken 19992 times.
✓ Branch 1 taken 1087 times.
21079 if (strcmp("language", tag->key)) {
153 19992 const char *p = tag->value;
154 19992 av_log(ctx, log_level,
155 19992 "%s %-16s: ", indent, tag->key);
156
2/2
✓ Branch 0 taken 20512 times.
✓ Branch 1 taken 19992 times.
40504 while (*p) {
157 20512 size_t len = strcspn(p, "\x8\xa\xb\xc\xd");
158
1/2
✓ Branch 0 taken 20512 times.
✗ Branch 1 not taken.
20512 av_log(ctx, log_level, "%.*s", (int)(FFMIN(255, len)), p);
159 20512 p += len;
160
2/2
✓ Branch 0 taken 280 times.
✓ Branch 1 taken 20232 times.
20512 if (*p == 0xd) av_log(ctx, log_level, " ");
161
2/2
✓ Branch 0 taken 359 times.
✓ Branch 1 taken 20153 times.
20512 if (*p == 0xa) av_log(ctx, log_level, "\n%s %-16s: ", indent, "");
162
2/2
✓ Branch 0 taken 661 times.
✓ Branch 1 taken 19851 times.
20512 if (*p) p++;
163 }
164 19992 av_log(ctx, log_level, "\n");
165 }
166 }
167
168 32108 static void dump_metadata(void *ctx, const AVDictionary *m, const char *indent,
169 int log_level)
170 {
171
6/6
✓ Branch 0 taken 12368 times.
✓ Branch 1 taken 19740 times.
✓ Branch 3 taken 9403 times.
✓ Branch 4 taken 2965 times.
✓ Branch 6 taken 9035 times.
✓ Branch 7 taken 368 times.
32108 if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0)))
172 12000 dump_dictionary(ctx, m, "Metadata", indent, log_level);
173 32108 }
174
175 /* param change side data*/
176 static void dump_paramchange(void *ctx, const AVPacketSideData *sd, int log_level)
177 {
178 int size = sd->size;
179 const uint8_t *data = sd->data;
180 uint32_t flags, sample_rate, width, height;
181
182 if (!data || sd->size < 4)
183 goto fail;
184
185 flags = AV_RL32(data);
186 data += 4;
187 size -= 4;
188
189 if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
190 if (size < 4)
191 goto fail;
192 sample_rate = AV_RL32(data);
193 data += 4;
194 size -= 4;
195 av_log(ctx, log_level, "sample_rate %"PRIu32", ", sample_rate);
196 }
197 if (flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) {
198 if (size < 8)
199 goto fail;
200 width = AV_RL32(data);
201 data += 4;
202 size -= 4;
203 height = AV_RL32(data);
204 data += 4;
205 size -= 4;
206 av_log(ctx, log_level, "width %"PRIu32" height %"PRIu32, width, height);
207 }
208
209 return;
210 fail:
211 av_log(ctx, AV_LOG_ERROR, "unknown param\n");
212 }
213
214 /* replaygain side data*/
215 static void print_gain(void *ctx, const char *str, int32_t gain, int log_level)
216 {
217 av_log(ctx, log_level, "%s - ", str);
218 if (gain == INT32_MIN)
219 av_log(ctx, log_level, "unknown");
220 else
221 av_log(ctx, log_level, "%f", gain / 100000.0f);
222 av_log(ctx, log_level, ", ");
223 }
224
225 static void print_peak(void *ctx, const char *str, uint32_t peak, int log_level)
226 {
227 av_log(ctx, log_level, "%s - ", str);
228 if (!peak)
229 av_log(ctx, log_level, "unknown");
230 else
231 av_log(ctx, log_level, "%f", (float) peak / UINT32_MAX);
232 av_log(ctx, log_level, ", ");
233 }
234
235 static void dump_replaygain(void *ctx, const AVPacketSideData *sd, int log_level)
236 {
237 const AVReplayGain *rg;
238
239 if (sd->size < sizeof(*rg)) {
240 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
241 return;
242 }
243 rg = (const AVReplayGain *)sd->data;
244
245 print_gain(ctx, "track gain", rg->track_gain, log_level);
246 print_peak(ctx, "track peak", rg->track_peak, log_level);
247 print_gain(ctx, "album gain", rg->album_gain, log_level);
248 print_peak(ctx, "album peak", rg->album_peak, log_level);
249 }
250
251 476 static void dump_stereo3d(void *ctx, const AVPacketSideData *sd, int log_level)
252 {
253 const AVStereo3D *stereo;
254
255
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 476 times.
476 if (sd->size < sizeof(*stereo)) {
256 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
257 return;
258 }
259
260 476 stereo = (const AVStereo3D *)sd->data;
261
262 476 av_log(ctx, log_level, "%s, view: %s, primary eye: %s",
263 476 av_stereo3d_type_name(stereo->type), av_stereo3d_view_name(stereo->view),
264 476 av_stereo3d_primary_eye_name(stereo->primary_eye));
265
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 469 times.
476 if (stereo->baseline)
266 7 av_log(ctx, log_level, ", baseline: %"PRIu32"", stereo->baseline);
267
3/4
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 469 times.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
476 if (stereo->horizontal_disparity_adjustment.num && stereo->horizontal_disparity_adjustment.den)
268 7 av_log(ctx, log_level, ", horizontal_disparity_adjustment: %0.4f",
269 av_q2d(stereo->horizontal_disparity_adjustment));
270
3/4
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 469 times.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
476 if (stereo->horizontal_field_of_view.num && stereo->horizontal_field_of_view.den)
271 7 av_log(ctx, log_level, ", horizontal_field_of_view: %0.3f", av_q2d(stereo->horizontal_field_of_view));
272
273
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 467 times.
476 if (stereo->flags & AV_STEREO3D_FLAG_INVERT)
274 9 av_log(ctx, log_level, " (inverted)");
275 }
276
277 12 static void dump_audioservicetype(void *ctx, const AVPacketSideData *sd, int log_level)
278 {
279 12 const enum AVAudioServiceType *ast = (const enum AVAudioServiceType *)sd->data;
280
281
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
12 if (sd->size < sizeof(*ast)) {
282 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
283 return;
284 }
285
286
1/10
✓ Branch 0 taken 12 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.
12 switch (*ast) {
287 12 case AV_AUDIO_SERVICE_TYPE_MAIN:
288 12 av_log(ctx, log_level, "main");
289 12 break;
290 case AV_AUDIO_SERVICE_TYPE_EFFECTS:
291 av_log(ctx, log_level, "effects");
292 break;
293 case AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED:
294 av_log(ctx, log_level, "visually impaired");
295 break;
296 case AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED:
297 av_log(ctx, log_level, "hearing impaired");
298 break;
299 case AV_AUDIO_SERVICE_TYPE_DIALOGUE:
300 av_log(ctx, log_level, "dialogue");
301 break;
302 case AV_AUDIO_SERVICE_TYPE_COMMENTARY:
303 av_log(ctx, log_level, "commentary");
304 break;
305 case AV_AUDIO_SERVICE_TYPE_EMERGENCY:
306 av_log(ctx, log_level, "emergency");
307 break;
308 case AV_AUDIO_SERVICE_TYPE_VOICE_OVER:
309 av_log(ctx, log_level, "voice over");
310 break;
311 case AV_AUDIO_SERVICE_TYPE_KARAOKE:
312 av_log(ctx, log_level, "karaoke");
313 break;
314 default:
315 av_log(ctx, AV_LOG_WARNING, "unknown");
316 break;
317 }
318 }
319
320 322 static void dump_cpb(void *ctx, const AVPacketSideData *sd, int log_level)
321 {
322 322 const AVCPBProperties *cpb = (const AVCPBProperties *)sd->data;
323
324
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 322 times.
322 if (sd->size < sizeof(*cpb)) {
325 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
326 return;
327 }
328
329 322 av_log(ctx, log_level,
330 "bitrate max/min/avg: %"PRId64"/%"PRId64"/%"PRId64" buffer size: %"PRId64" ",
331 322 cpb->max_bitrate, cpb->min_bitrate, cpb->avg_bitrate,
332 322 cpb->buffer_size);
333
1/2
✓ Branch 0 taken 322 times.
✗ Branch 1 not taken.
322 if (cpb->vbv_delay == UINT64_MAX)
334 322 av_log(ctx, log_level, "vbv_delay: N/A");
335 else
336 av_log(ctx, log_level, "vbv_delay: %"PRIu64"", cpb->vbv_delay);
337 }
338
339 23 static void dump_mastering_display_metadata(void *ctx, const AVPacketSideData *sd,
340 int log_level)
341 {
342 23 const AVMasteringDisplayMetadata *metadata =
343 (const AVMasteringDisplayMetadata *)sd->data;
344 23 av_log(ctx, log_level, "Mastering Display Metadata, "
345 "has_primaries:%d has_luminance:%d "
346 "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f) "
347 "min_luminance=%f, max_luminance=%f",
348 23 metadata->has_primaries, metadata->has_luminance,
349 av_q2d(metadata->display_primaries[0][0]),
350 av_q2d(metadata->display_primaries[0][1]),
351 av_q2d(metadata->display_primaries[1][0]),
352 av_q2d(metadata->display_primaries[1][1]),
353 av_q2d(metadata->display_primaries[2][0]),
354 av_q2d(metadata->display_primaries[2][1]),
355 av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1]),
356 av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance));
357 23 }
358
359 20 static void dump_content_light_metadata(void *ctx, const AVPacketSideData *sd,
360 int log_level)
361 {
362 20 const AVContentLightMetadata *metadata =
363 (const AVContentLightMetadata *)sd->data;
364 20 av_log(ctx, log_level, "Content Light Level Metadata, "
365 "MaxCLL=%d, MaxFALL=%d",
366 20 metadata->MaxCLL, metadata->MaxFALL);
367 20 }
368
369 6 static void dump_ambient_viewing_environment_metadata(void *ctx, const AVPacketSideData *sd)
370 {
371 6 const AVAmbientViewingEnvironment *ambient =
372 (const AVAmbientViewingEnvironment *)sd->data;
373 6 av_log(ctx, AV_LOG_INFO, "Ambient Viewing Environment, "
374 "ambient_illuminance=%f, ambient_light_x=%f, ambient_light_y=%f",
375 av_q2d(ambient->ambient_illuminance),
376 av_q2d(ambient->ambient_light_x),
377 av_q2d(ambient->ambient_light_y));
378 6 }
379
380 18 static void dump_spherical(void *ctx, int w, int h,
381 const AVPacketSideData *sd, int log_level)
382 {
383 18 const AVSphericalMapping *spherical = (const AVSphericalMapping *)sd->data;
384 double yaw, pitch, roll;
385
386
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
18 if (sd->size < sizeof(*spherical)) {
387 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
388 return;
389 }
390
391 18 av_log(ctx, log_level, "%s ", av_spherical_projection_name(spherical->projection));
392
393
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) {
394 11 yaw = ((double)spherical->yaw) / (1 << 16);
395 11 pitch = ((double)spherical->pitch) / (1 << 16);
396 11 roll = ((double)spherical->roll) / (1 << 16);
397 11 av_log(ctx, log_level, "(%f/%f/%f) ", yaw, pitch, roll);
398 }
399
400
2/2
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 7 times.
18 if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
401 size_t l, t, r, b;
402 11 av_spherical_tile_bounds(spherical, w, h,
403 &l, &t, &r, &b);
404 11 av_log(ctx, log_level,
405 "[%"SIZE_SPECIFIER", %"SIZE_SPECIFIER", %"SIZE_SPECIFIER", %"SIZE_SPECIFIER"] ",
406 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 13 static void dump_dovi_conf(void *ctx, const AVPacketSideData *sd,
413 int log_level)
414 {
415 13 const AVDOVIDecoderConfigurationRecord *dovi =
416 (const AVDOVIDecoderConfigurationRecord *)sd->data;
417
418 13 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 13 dovi->dv_version_major, dovi->dv_version_minor,
422 13 dovi->dv_profile, dovi->dv_level,
423 13 dovi->rpu_present_flag,
424 13 dovi->el_present_flag,
425 13 dovi->bl_present_flag,
426 13 dovi->dv_bl_signal_compatibility_id,
427 13 dovi->dv_md_compression);
428 13 }
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 11 static void dump_cropping(void *ctx, const AVPacketSideData *sd)
448 {
449 uint32_t top, bottom, left, right;
450
451
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
11 if (sd->size < sizeof(uint32_t) * 4) {
452 av_log(ctx, AV_LOG_ERROR, "invalid data\n");
453 return;
454 }
455
456 11 top = AV_RL32(sd->data + 0);
457 11 bottom = AV_RL32(sd->data + 4);
458 11 left = AV_RL32(sd->data + 8);
459 11 right = AV_RL32(sd->data + 12);
460
461 11 av_log(ctx, AV_LOG_INFO, "%d/%d/%d/%d", left, right, top, bottom);
462 }
463
464 16622 static void dump_sidedata(void *ctx, const AVPacketSideData *side_data, int nb_side_data,
465 int w, int h, AVRational avg_frame_rate,
466 const char *indent, int log_level)
467 {
468 int i;
469
470
2/2
✓ Branch 0 taken 882 times.
✓ Branch 1 taken 15740 times.
16622 if (nb_side_data)
471 882 av_log(ctx, log_level, "%sSide data:\n", indent);
472
473
2/2
✓ Branch 0 taken 936 times.
✓ Branch 1 taken 16622 times.
17558 for (i = 0; i < nb_side_data; i++) {
474 936 const AVPacketSideData *sd = &side_data[i];
475 936 av_log(ctx, log_level, "%s ", indent);
476
477
12/19
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 25 times.
✓ Branch 6 taken 476 times.
✓ Branch 7 taken 12 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 322 times.
✓ Branch 10 taken 23 times.
✓ Branch 11 taken 18 times.
✓ Branch 12 taken 20 times.
✓ Branch 13 taken 8 times.
✓ Branch 14 taken 13 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 6 times.
✓ Branch 17 taken 11 times.
✓ Branch 18 taken 2 times.
936 switch (sd->type) {
478 case AV_PKT_DATA_PALETTE:
479 av_log(ctx, log_level, "palette");
480 break;
481 case AV_PKT_DATA_NEW_EXTRADATA:
482 av_log(ctx, log_level, "new extradata");
483 break;
484 case AV_PKT_DATA_PARAM_CHANGE:
485 av_log(ctx, log_level, "paramchange: ");
486 dump_paramchange(ctx, sd, log_level);
487 break;
488 case AV_PKT_DATA_H263_MB_INFO:
489 av_log(ctx, log_level, "H.263 macroblock info");
490 break;
491 case AV_PKT_DATA_REPLAYGAIN:
492 av_log(ctx, log_level, "replaygain: ");
493 dump_replaygain(ctx, sd, log_level);
494 break;
495 25 case AV_PKT_DATA_DISPLAYMATRIX:
496 25 av_log(ctx, log_level, "displaymatrix: rotation of %.2f degrees",
497 25 av_display_rotation_get((const int32_t *)sd->data));
498 25 break;
499 476 case AV_PKT_DATA_STEREO3D:
500 476 av_log(ctx, log_level, "stereo3d: ");
501 476 dump_stereo3d(ctx, sd, log_level);
502 476 break;
503 12 case AV_PKT_DATA_AUDIO_SERVICE_TYPE:
504 12 av_log(ctx, log_level, "audio service type: ");
505 12 dump_audioservicetype(ctx, sd, log_level);
506 12 break;
507 case AV_PKT_DATA_QUALITY_STATS:
508 av_log(ctx, log_level, "quality factor: %"PRId32", pict_type: %c",
509 AV_RL32(sd->data), av_get_picture_type_char(sd->data[4]));
510 break;
511 322 case AV_PKT_DATA_CPB_PROPERTIES:
512 322 av_log(ctx, log_level, "cpb: ");
513 322 dump_cpb(ctx, sd, log_level);
514 322 break;
515 23 case AV_PKT_DATA_MASTERING_DISPLAY_METADATA:
516 23 dump_mastering_display_metadata(ctx, sd, log_level);
517 23 break;
518 18 case AV_PKT_DATA_SPHERICAL:
519 18 av_log(ctx, log_level, "spherical: ");
520 18 dump_spherical(ctx, w, h, sd, log_level);
521 18 break;
522 20 case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:
523 20 dump_content_light_metadata(ctx, sd, log_level);
524 20 break;
525 8 case AV_PKT_DATA_ICC_PROFILE:
526 8 av_log(ctx, log_level, "ICC Profile");
527 8 break;
528 13 case AV_PKT_DATA_DOVI_CONF:
529 13 av_log(ctx, log_level, "DOVI configuration record: ");
530 13 dump_dovi_conf(ctx, sd, log_level);
531 13 break;
532 case AV_PKT_DATA_S12M_TIMECODE:
533 av_log(ctx, log_level, "SMPTE ST 12-1:2014: ");
534 dump_s12m_timecode(ctx, avg_frame_rate, sd, log_level);
535 break;
536 6 case AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT:
537 6 dump_ambient_viewing_environment_metadata(ctx, sd);
538 6 break;
539 11 case AV_PKT_DATA_FRAME_CROPPING:
540 11 av_log(ctx, AV_LOG_INFO, "Frame cropping: ");
541 11 dump_cropping(ctx, sd);
542 11 break;
543 2 default:
544 2 av_log(ctx, log_level, "unknown side data type %d "
545 2 "(%"SIZE_SPECIFIER" bytes)", sd->type, sd->size);
546 2 break;
547 }
548
549 936 av_log(ctx, log_level, "\n");
550 }
551 16622 }
552
553 16701 static void dump_disposition(int disposition, int log_level)
554 {
555
2/2
✓ Branch 0 taken 1811 times.
✓ Branch 1 taken 14890 times.
16701 if (disposition & AV_DISPOSITION_DEFAULT)
556 1811 av_log(NULL, log_level, " (default)");
557
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 16697 times.
16701 if (disposition & AV_DISPOSITION_DUB)
558 4 av_log(NULL, log_level, " (dub)");
559
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 16697 times.
16701 if (disposition & AV_DISPOSITION_ORIGINAL)
560 4 av_log(NULL, log_level, " (original)");
561
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 16696 times.
16701 if (disposition & AV_DISPOSITION_COMMENT)
562 5 av_log(NULL, log_level, " (comment)");
563
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 16700 times.
16701 if (disposition & AV_DISPOSITION_LYRICS)
564 1 av_log(NULL, log_level, " (lyrics)");
565
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 16700 times.
16701 if (disposition & AV_DISPOSITION_KARAOKE)
566 1 av_log(NULL, log_level, " (karaoke)");
567
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 16694 times.
16701 if (disposition & AV_DISPOSITION_FORCED)
568 7 av_log(NULL, log_level, " (forced)");
569
2/2
✓ Branch 0 taken 22 times.
✓ Branch 1 taken 16679 times.
16701 if (disposition & AV_DISPOSITION_HEARING_IMPAIRED)
570 22 av_log(NULL, log_level, " (hearing impaired)");
571
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 16685 times.
16701 if (disposition & AV_DISPOSITION_VISUAL_IMPAIRED)
572 16 av_log(NULL, log_level, " (visual impaired)");
573
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16701 times.
16701 if (disposition & AV_DISPOSITION_CLEAN_EFFECTS)
574 av_log(NULL, log_level, " (clean effects)");
575
2/2
✓ Branch 0 taken 97 times.
✓ Branch 1 taken 16604 times.
16701 if (disposition & AV_DISPOSITION_ATTACHED_PIC)
576 97 av_log(NULL, log_level, " (attached pic)");
577
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16701 times.
16701 if (disposition & AV_DISPOSITION_TIMED_THUMBNAILS)
578 av_log(NULL, log_level, " (timed thumbnails)");
579
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 16695 times.
16701 if (disposition & AV_DISPOSITION_CAPTIONS)
580 6 av_log(NULL, log_level, " (captions)");
581
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 16683 times.
16701 if (disposition & AV_DISPOSITION_DESCRIPTIONS)
582 18 av_log(NULL, log_level, " (descriptions)");
583
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 16697 times.
16701 if (disposition & AV_DISPOSITION_METADATA)
584 4 av_log(NULL, log_level, " (metadata)");
585
2/2
✓ Branch 0 taken 250 times.
✓ Branch 1 taken 16451 times.
16701 if (disposition & AV_DISPOSITION_DEPENDENT)
586 250 av_log(NULL, log_level, " (dependent)");
587
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16701 times.
16701 if (disposition & AV_DISPOSITION_STILL_IMAGE)
588 av_log(NULL, log_level, " (still image)");
589
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16701 times.
16701 if (disposition & AV_DISPOSITION_NON_DIEGETIC)
590 av_log(NULL, log_level, " (non-diegetic)");
591
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 16694 times.
16701 if (disposition & AV_DISPOSITION_MULTILAYER)
592 7 av_log(NULL, log_level, " (multilayer)");
593 16701 }
594
595 /* "user interface" functions */
596 16616 static void dump_stream_format(const AVFormatContext *ic, int i,
597 int group_index, int index, int is_output,
598 int log_level)
599 {
600 char buf[256];
601
2/2
✓ Branch 0 taken 8456 times.
✓ Branch 1 taken 8160 times.
16616 int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
602 16616 const AVStream *st = ic->streams[i];
603 16616 const FFStream *const sti = cffstream(st);
604 16616 const AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0);
605 16616 const char *separator = ic->dump_separator;
606
2/2
✓ Branch 0 taken 364 times.
✓ Branch 1 taken 16252 times.
16616 const char *group_indent = group_index >= 0 ? " " : "";
607
2/2
✓ Branch 0 taken 364 times.
✓ Branch 1 taken 16252 times.
16616 const char *extra_indent = group_index >= 0 ? " " : " ";
608 AVCodecContext *avctx;
609 int ret;
610
611 16616 avctx = avcodec_alloc_context3(NULL);
612
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16616 times.
16616 if (!avctx)
613 return;
614
615 16616 ret = avcodec_parameters_to_context(avctx, st->codecpar);
616
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16616 times.
16616 if (ret < 0) {
617 avcodec_free_context(&avctx);
618 return;
619 }
620
621 // Fields which are missing from AVCodecParameters need to be taken from the AVCodecContext
622
2/2
✓ Branch 0 taken 8160 times.
✓ Branch 1 taken 8456 times.
16616 if (sti->avctx) {
623 #if FF_API_CODEC_PROPS
624 FF_DISABLE_DEPRECATION_WARNINGS
625 8160 avctx->properties = sti->avctx->properties;
626 FF_ENABLE_DEPRECATION_WARNINGS
627 #endif
628 8160 avctx->codec = sti->avctx->codec;
629 8160 avctx->qmin = sti->avctx->qmin;
630 8160 avctx->qmax = sti->avctx->qmax;
631 8160 avctx->coded_width = sti->avctx->coded_width;
632 8160 avctx->coded_height = sti->avctx->coded_height;
633 }
634
635
1/2
✓ Branch 0 taken 16616 times.
✗ Branch 1 not taken.
16616 if (separator)
636 16616 av_opt_set(avctx, "dump_separator", separator, 0);
637 16616 avcodec_string(buf, sizeof(buf), avctx, is_output);
638 16616 avcodec_free_context(&avctx);
639
640 16616 av_log(NULL, log_level, "%s Stream #%d", group_indent, index);
641 16616 av_log(NULL, log_level, ":%d", i);
642
643 /* the pid is an important information, so we display it */
644 /* XXX: add a generic system */
645
2/2
✓ Branch 0 taken 987 times.
✓ Branch 1 taken 15629 times.
16616 if (flags & AVFMT_SHOW_IDS)
646 987 av_log(NULL, log_level, "[0x%x]", st->id);
647
2/2
✓ Branch 0 taken 1435 times.
✓ Branch 1 taken 15181 times.
16616 if (lang)
648 1435 av_log(NULL, log_level, "(%s)", lang->value);
649 16616 av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", sti->codec_info_nb_frames,
650 16616 st->time_base.num, st->time_base.den);
651 16616 av_log(NULL, log_level, ": %s", buf);
652
653
4/4
✓ Branch 0 taken 2145 times.
✓ Branch 1 taken 14471 times.
✓ Branch 2 taken 375 times.
✓ Branch 3 taken 1770 times.
18761 if (st->sample_aspect_ratio.num &&
654 2145 av_cmp_q(st->sample_aspect_ratio, st->codecpar->sample_aspect_ratio)) {
655 AVRational display_aspect_ratio;
656 375 av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
657 375 st->codecpar->width * (int64_t)st->sample_aspect_ratio.num,
658 375 st->codecpar->height * (int64_t)st->sample_aspect_ratio.den,
659 1024 * 1024);
660 375 av_log(NULL, log_level, ", SAR %d:%d DAR %d:%d",
661 375 st->sample_aspect_ratio.num, st->sample_aspect_ratio.den,
662 display_aspect_ratio.num, display_aspect_ratio.den);
663 }
664
665
2/2
✓ Branch 0 taken 12744 times.
✓ Branch 1 taken 3872 times.
16616 if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
666
3/4
✓ Branch 0 taken 11895 times.
✓ Branch 1 taken 849 times.
✓ Branch 2 taken 11895 times.
✗ Branch 3 not taken.
12744 int fps = st->avg_frame_rate.den && st->avg_frame_rate.num;
667
3/4
✓ Branch 0 taken 6400 times.
✓ Branch 1 taken 6344 times.
✓ Branch 2 taken 6400 times.
✗ Branch 3 not taken.
12744 int tbr = st->r_frame_rate.den && st->r_frame_rate.num;
668
2/4
✓ Branch 0 taken 12744 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12744 times.
✗ Branch 3 not taken.
12744 int tbn = st->time_base.den && st->time_base.num;
669
670
5/6
✓ Branch 0 taken 849 times.
✓ Branch 1 taken 11895 times.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 829 times.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
12744 if (fps || tbr || tbn)
671 12744 av_log(NULL, log_level, "%s", separator);
672
673
2/2
✓ Branch 0 taken 11895 times.
✓ Branch 1 taken 849 times.
12744 if (fps)
674
3/4
✓ Branch 0 taken 6324 times.
✓ Branch 1 taken 5571 times.
✓ Branch 2 taken 6324 times.
✗ Branch 3 not taken.
11895 print_fps(av_q2d(st->avg_frame_rate), tbr || tbn ? "fps, " : "fps", log_level);
675
2/2
✓ Branch 0 taken 6400 times.
✓ Branch 1 taken 6344 times.
12744 if (tbr)
676
1/2
✓ Branch 0 taken 6400 times.
✗ Branch 1 not taken.
6400 print_fps(av_q2d(st->r_frame_rate), tbn ? "tbr, " : "tbr", log_level);
677
1/2
✓ Branch 0 taken 12744 times.
✗ Branch 1 not taken.
12744 if (tbn)
678 12744 print_fps(1 / av_q2d(st->time_base), "tbn", log_level);
679 }
680
681 16616 dump_disposition(st->disposition, log_level);
682 16616 av_log(NULL, log_level, "\n");
683
684 16616 dump_metadata(NULL, st->metadata, extra_indent, log_level);
685
686 16616 dump_sidedata(NULL, st->codecpar->coded_side_data, st->codecpar->nb_coded_side_data,
687 16616 st->codecpar->width, st->codecpar->height, st->avg_frame_rate,
688 extra_indent, log_level);
689 }
690
691 85 static void dump_stream_group(const AVFormatContext *ic, uint8_t *printed,
692 int i, int index, int is_output)
693 {
694 85 const AVStreamGroup *stg = ic->stream_groups[i];
695
2/2
✓ Branch 0 taken 23 times.
✓ Branch 1 taken 62 times.
85 int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
696 char buf[512];
697 int ret;
698
699 85 av_log(NULL, AV_LOG_INFO, " Stream group #%d:%d", index, i);
700
2/2
✓ Branch 0 taken 62 times.
✓ Branch 1 taken 23 times.
85 if (flags & AVFMT_SHOW_IDS)
701 62 av_log(NULL, AV_LOG_INFO, "[0x%"PRIx64"]", stg->id);
702 85 av_log(NULL, AV_LOG_INFO, ":");
703
704
3/5
✓ Branch 0 taken 41 times.
✓ Branch 1 taken 38 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
85 switch (stg->type) {
705 41 case AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT: {
706 41 const AVIAMFAudioElement *audio_element = stg->params.iamf_audio_element;
707 41 av_log(NULL, AV_LOG_INFO, " IAMF Audio Element:");
708 41 dump_disposition(stg->disposition, AV_LOG_INFO);
709 41 av_log(NULL, AV_LOG_INFO, "\n");
710 41 dump_metadata(NULL, stg->metadata, " ", AV_LOG_INFO);
711
2/2
✓ Branch 0 taken 92 times.
✓ Branch 1 taken 41 times.
133 for (int j = 0; j < audio_element->nb_layers; j++) {
712 92 const AVIAMFLayer *layer = audio_element->layers[j];
713 92 int channel_count = layer->ch_layout.nb_channels;
714 92 av_log(NULL, AV_LOG_INFO, " Layer %d:", j);
715 92 ret = av_channel_layout_describe(&layer->ch_layout, buf, sizeof(buf));
716
1/2
✓ Branch 0 taken 92 times.
✗ Branch 1 not taken.
92 if (ret >= 0)
717 92 av_log(NULL, AV_LOG_INFO, " %s", buf);
718 92 av_log(NULL, AV_LOG_INFO, "\n");
719
3/4
✓ Branch 0 taken 350 times.
✓ Branch 1 taken 92 times.
✓ Branch 2 taken 350 times.
✗ Branch 3 not taken.
442 for (int k = 0; channel_count > 0 && k < stg->nb_streams; k++) {
720 350 AVStream *st = stg->streams[k];
721 350 dump_stream_format(ic, st->index, i, index, is_output, AV_LOG_VERBOSE);
722 350 printed[st->index] = 1;
723 350 channel_count -= st->codecpar->ch_layout.nb_channels;
724 }
725 }
726 41 break;
727 }
728 38 case AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION: {
729 38 const AVIAMFMixPresentation *mix_presentation = stg->params.iamf_mix_presentation;
730 38 av_log(NULL, AV_LOG_INFO, " IAMF Mix Presentation:");
731 38 dump_disposition(stg->disposition, AV_LOG_INFO);
732 38 av_log(NULL, AV_LOG_INFO, "\n");
733 38 dump_metadata(NULL, stg->metadata, " ", AV_LOG_INFO);
734 38 dump_dictionary(NULL, mix_presentation->annotations, "Annotations", " ", AV_LOG_INFO);
735
2/2
✓ Branch 0 taken 44 times.
✓ Branch 1 taken 38 times.
82 for (int j = 0; j < mix_presentation->nb_submixes; j++) {
736 44 AVIAMFSubmix *sub_mix = mix_presentation->submixes[j];
737 44 av_log(NULL, AV_LOG_INFO, " Submix %d:\n", j);
738
2/2
✓ Branch 0 taken 47 times.
✓ Branch 1 taken 44 times.
91 for (int k = 0; k < sub_mix->nb_elements; k++) {
739 47 const AVIAMFSubmixElement *submix_element = sub_mix->elements[k];
740 47 const AVStreamGroup *audio_element = NULL;
741
1/2
✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
50 for (int l = 0; l < ic->nb_stream_groups; l++)
742
1/2
✓ Branch 0 taken 50 times.
✗ Branch 1 not taken.
50 if (ic->stream_groups[l]->type == AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT &&
743
2/2
✓ Branch 0 taken 47 times.
✓ Branch 1 taken 3 times.
50 ic->stream_groups[l]->id == submix_element->audio_element_id) {
744 47 audio_element = ic->stream_groups[l];
745 47 break;
746 }
747
1/2
✓ Branch 0 taken 47 times.
✗ Branch 1 not taken.
47 if (audio_element) {
748 47 av_log(NULL, AV_LOG_INFO, " IAMF Audio Element #%d:%d",
749 47 index, audio_element->index);
750
2/2
✓ Branch 0 taken 33 times.
✓ Branch 1 taken 14 times.
47 if (flags & AVFMT_SHOW_IDS)
751 33 av_log(NULL, AV_LOG_INFO, "[0x%"PRIx64"]", audio_element->id);
752 47 av_log(NULL, AV_LOG_INFO, "\n");
753 47 dump_dictionary(NULL, submix_element->annotations, "Annotations", " ", AV_LOG_INFO);
754 }
755 }
756
2/2
✓ Branch 0 taken 98 times.
✓ Branch 1 taken 44 times.
142 for (int k = 0; k < sub_mix->nb_layouts; k++) {
757 98 const AVIAMFSubmixLayout *submix_layout = sub_mix->layouts[k];
758 98 av_log(NULL, AV_LOG_INFO, " Layout #%d:", k);
759
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 92 times.
98 if (submix_layout->layout_type == 2 ||
760
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 submix_layout->layout_type == 3) {
761 98 ret = av_channel_layout_describe(&submix_layout->sound_system, buf, sizeof(buf));
762
1/2
✓ Branch 0 taken 98 times.
✗ Branch 1 not taken.
98 if (ret >= 0)
763 98 av_log(NULL, AV_LOG_INFO, " %s", buf);
764 }
765 98 av_log(NULL, AV_LOG_INFO, "\n");
766 }
767 }
768 38 break;
769 }
770 6 case AV_STREAM_GROUP_PARAMS_TILE_GRID: {
771 6 const AVStreamGroupTileGrid *tile_grid = stg->params.tile_grid;
772 6 AVCodecContext *avctx = avcodec_alloc_context3(NULL);
773 6 const char *ptr = NULL;
774 6 av_log(NULL, AV_LOG_INFO, " Tile Grid:");
775
3/6
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
6 if (avctx && stg->nb_streams && !avcodec_parameters_to_context(avctx, stg->streams[0]->codecpar)) {
776 6 avctx->width = tile_grid->width;
777 6 avctx->height = tile_grid->height;
778 6 avctx->coded_width = tile_grid->coded_width;
779 6 avctx->coded_height = tile_grid->coded_height;
780
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (ic->dump_separator)
781 6 av_opt_set(avctx, "dump_separator", ic->dump_separator, 0);
782 6 buf[0] = 0;
783 6 avcodec_string(buf, sizeof(buf), avctx, is_output);
784 6 ptr = av_stristr(buf, " ");
785 }
786 6 avcodec_free_context(&avctx);
787
1/2
✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
6 if (ptr)
788 6 av_log(NULL, AV_LOG_INFO, "%s", ptr);
789 6 dump_disposition(stg->disposition, AV_LOG_INFO);
790 6 av_log(NULL, AV_LOG_INFO, "\n");
791 6 dump_metadata(NULL, stg->metadata, " ", AV_LOG_INFO);
792 6 dump_sidedata(NULL, tile_grid->coded_side_data, tile_grid->nb_coded_side_data,
793 6 tile_grid->width, tile_grid->height, (AVRational) {0,1},
794 " ", AV_LOG_INFO);
795
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 6 times.
22 for (int i = 0; i < tile_grid->nb_tiles; i++) {
796 16 const AVStream *st = NULL;
797
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 if (tile_grid->offsets[i].idx < stg->nb_streams)
798 16 st = stg->streams[tile_grid->offsets[i].idx];
799
3/4
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
✓ Branch 3 taken 2 times.
16 if (st && !printed[st->index]) {
800 14 dump_stream_format(ic, st->index, i, index, is_output, AV_LOG_VERBOSE);
801 14 printed[st->index] = 1;
802 }
803 }
804
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 6 times.
20 for (int i = 0; i < stg->nb_streams; i++) {
805 14 const AVStream *st = stg->streams[i];
806
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if (!printed[st->index]) {
807 dump_stream_format(ic, st->index, i, index, is_output, AV_LOG_INFO);
808 printed[st->index] = 1;
809 }
810 }
811 6 break;
812 }
813 case AV_STREAM_GROUP_PARAMS_LCEVC: {
814 const AVStreamGroupLCEVC *lcevc = stg->params.lcevc;
815 AVCodecContext *avctx = avcodec_alloc_context3(NULL);
816 const char *ptr = NULL;
817 av_log(NULL, AV_LOG_INFO, " LCEVC:");
818 if (avctx && stg->nb_streams && !avcodec_parameters_to_context(avctx, stg->streams[0]->codecpar)) {
819 avctx->width = lcevc->width;
820 avctx->height = lcevc->height;
821 avctx->coded_width = lcevc->width;
822 avctx->coded_height = lcevc->height;
823 if (ic->dump_separator)
824 av_opt_set(avctx, "dump_separator", ic->dump_separator, 0);
825 buf[0] = 0;
826 avcodec_string(buf, sizeof(buf), avctx, is_output);
827 ptr = av_stristr(buf, " ");
828 }
829 avcodec_free_context(&avctx);
830 if (ptr)
831 av_log(NULL, AV_LOG_INFO, "%s", ptr);
832 av_log(NULL, AV_LOG_INFO, "\n");
833 for (int i = 0; i < stg->nb_streams; i++) {
834 const AVStream *st = stg->streams[i];
835 dump_stream_format(ic, st->index, i, index, is_output, AV_LOG_VERBOSE);
836 printed[st->index] = 1;
837 }
838 break;
839 }
840 default:
841 break;
842 }
843 85 }
844
845 15252 void av_dump_format(AVFormatContext *ic, int index,
846 const char *url, int is_output)
847 {
848 int i;
849
1/2
✓ Branch 0 taken 15252 times.
✗ Branch 1 not taken.
15252 uint8_t *printed = ic->nb_streams ? av_mallocz(ic->nb_streams) : NULL;
850
2/4
✓ Branch 0 taken 15252 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 15252 times.
15252 if (ic->nb_streams && !printed)
851 return;
852
853
6/6
✓ Branch 0 taken 7925 times.
✓ Branch 1 taken 7327 times.
✓ Branch 2 taken 7925 times.
✓ Branch 3 taken 7327 times.
✓ Branch 4 taken 7925 times.
✓ Branch 5 taken 7327 times.
30504 av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n",
854 is_output ? "Output" : "Input",
855 index,
856 15252 is_output ? ic->oformat->name : ic->iformat->name,
857 is_output ? "to" : "from", url);
858 15252 dump_metadata(NULL, ic->metadata, " ", AV_LOG_INFO);
859
860
2/2
✓ Branch 0 taken 7327 times.
✓ Branch 1 taken 7925 times.
15252 if (!is_output) {
861 7327 av_log(NULL, AV_LOG_INFO, " Duration: ");
862
2/2
✓ Branch 0 taken 6210 times.
✓ Branch 1 taken 1117 times.
7327 if (ic->duration != AV_NOPTS_VALUE) {
863 int64_t hours, mins, secs, us;
864
1/2
✓ Branch 0 taken 6210 times.
✗ Branch 1 not taken.
6210 int64_t duration = ic->duration + (ic->duration <= INT64_MAX - 5000 ? 5000 : 0);
865 6210 secs = duration / AV_TIME_BASE;
866 6210 us = duration % AV_TIME_BASE;
867 6210 mins = secs / 60;
868 6210 secs %= 60;
869 6210 hours = mins / 60;
870 6210 mins %= 60;
871 6210 av_log(NULL, AV_LOG_INFO, "%02"PRId64":%02"PRId64":%02"PRId64".%02"PRId64"", hours, mins, secs,
872 (100 * us) / AV_TIME_BASE);
873 } else {
874 1117 av_log(NULL, AV_LOG_INFO, "N/A");
875 }
876
2/2
✓ Branch 0 taken 5582 times.
✓ Branch 1 taken 1745 times.
7327 if (ic->start_time != AV_NOPTS_VALUE) {
877 int secs, us;
878 5582 av_log(NULL, AV_LOG_INFO, ", start: ");
879 5582 secs = llabs(ic->start_time / AV_TIME_BASE);
880 5582 us = llabs(ic->start_time % AV_TIME_BASE);
881 5582 av_log(NULL, AV_LOG_INFO, "%s%d.%06d",
882 5582 ic->start_time >= 0 ? "" : "-",
883 secs,
884
2/2
✓ Branch 0 taken 5571 times.
✓ Branch 1 taken 11 times.
5582 (int) av_rescale(us, 1000000, AV_TIME_BASE));
885 }
886 7327 av_log(NULL, AV_LOG_INFO, ", bitrate: ");
887
2/2
✓ Branch 0 taken 3253 times.
✓ Branch 1 taken 4074 times.
7327 if (ic->bit_rate)
888 3253 av_log(NULL, AV_LOG_INFO, "%"PRId64" kb/s", ic->bit_rate / 1000);
889 else
890 4074 av_log(NULL, AV_LOG_INFO, "N/A");
891 7327 av_log(NULL, AV_LOG_INFO, "\n");
892 }
893
894
2/2
✓ Branch 0 taken 44 times.
✓ Branch 1 taken 15208 times.
15252 if (ic->nb_chapters)
895 44 av_log(NULL, AV_LOG_INFO, " Chapters:\n");
896
2/2
✓ Branch 0 taken 105 times.
✓ Branch 1 taken 15252 times.
15357 for (i = 0; i < ic->nb_chapters; i++) {
897 105 const AVChapter *ch = ic->chapters[i];
898 105 av_log(NULL, AV_LOG_INFO, " Chapter #%d:%d: ", index, i);
899 105 av_log(NULL, AV_LOG_INFO,
900 105 "start %f, ", ch->start * av_q2d(ch->time_base));
901 105 av_log(NULL, AV_LOG_INFO,
902 105 "end %f\n", ch->end * av_q2d(ch->time_base));
903
904 105 dump_metadata(NULL, ch->metadata, " ", AV_LOG_INFO);
905 }
906
907
2/2
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 15202 times.
15252 if (ic->nb_programs) {
908 50 int j, k, total = 0;
909
2/2
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 50 times.
100 for (j = 0; j < ic->nb_programs; j++) {
910 50 const AVProgram *program = ic->programs[j];
911 50 const AVDictionaryEntry *name = av_dict_get(program->metadata,
912 "name", NULL, 0);
913
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 50 times.
50 av_log(NULL, AV_LOG_INFO, " Program %d %s\n", program->id,
914 name ? name->value : "");
915 50 dump_metadata(NULL, program->metadata, " ", AV_LOG_INFO);
916
2/2
✓ Branch 0 taken 102 times.
✓ Branch 1 taken 50 times.
152 for (k = 0; k < program->nb_stream_indexes; k++) {
917 102 dump_stream_format(ic, program->stream_index[k],
918 -1, index, is_output, AV_LOG_INFO);
919 102 printed[program->stream_index[k]] = 1;
920 }
921 50 total += program->nb_stream_indexes;
922 }
923
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 47 times.
50 if (total < ic->nb_streams)
924 3 av_log(NULL, AV_LOG_INFO, " No Program\n");
925 }
926
927
2/2
✓ Branch 0 taken 85 times.
✓ Branch 1 taken 15252 times.
15337 for (i = 0; i < ic->nb_stream_groups; i++)
928 85 dump_stream_group(ic, printed, i, index, is_output);
929
930
2/2
✓ Branch 0 taken 16451 times.
✓ Branch 1 taken 15252 times.
31703 for (i = 0; i < ic->nb_streams; i++)
931
2/2
✓ Branch 0 taken 16150 times.
✓ Branch 1 taken 301 times.
16451 if (!printed[i])
932 16150 dump_stream_format(ic, i, -1, index, is_output, AV_LOG_INFO);
933
934 15252 av_free(printed);
935 }
936