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
34
36
37 #define HEXDUMP_PRINT(...) \
38 do { \
39 if (!f) \
40 av_log(avcl, level, __VA_ARGS__); \
41 else \
42 fprintf(f, __VA_ARGS__); \
43 } while (0)
44
47 {
49
50 for (i = 0; i <
size; i += 16) {
51 len = size - i;
52 if (len > 16)
53 len = 16;
55 for (j = 0; j < 16; j++) {
56 if (j < len)
58 else
60 }
62 for (j = 0; j <
len; j++) {
63 c = buf[i + j];
64 if (c < ' ' || c > '~')
65 c = '.';
67 }
69 }
70 }
71
73 {
75 }
76
78 {
80 }
81
84 {
88 /* DTS is _always_ valid after av_read_frame() */
92 else
94 /* PTS may not be known if B-frames are present. */
98 else
102 if (dump_payload)
104 }
105
107 {
109 }
110
113 {
115 }
116
117
119 {
121 if (v % 100)
123 else if (v % (100 * 1000))
125 else
127 }
128
130 {
133
136 if (strcmp(
"language", tag->
key)) {
137 const char *p = tag->
value;
139 "%s %-16s: ", indent, tag->
key);
140 while (*p) {
141 char tmp[256];
142 size_t len = strcspn(p,
"\x8\xa\xb\xc\xd");
148 if (*p) p++;
149 }
151 }
152 }
153 }
154
155 /* param change side data*/
157 {
162
163 if (!data || sd->
size < 4)
164 goto fail;
165
167 data += 4;
168 size -= 4;
169
171 if (size < 4)
172 goto fail;
174 data += 4;
175 size -= 4;
177 }
179 if (size < 8)
180 goto fail;
182 data += 8;
183 size -= 8;
186 }
188 if (size < 4)
189 goto fail;
191 data += 4;
192 size -= 4;
194 }
196 if (size < 8)
197 goto fail;
199 data += 4;
200 size -= 4;
202 data += 4;
203 size -= 4;
205 }
206
207 return;
208 fail:
210 }
211
212 /* replaygain side data*/
214 {
216 if (gain == INT32_MIN)
218 else
221 }
222
223 static void print_peak(
void *ctx,
const char *str, uint32_t peak)
224 {
226 if (!peak)
228 else
231 }
232
234 {
236
237 if (sd->
size <
sizeof(*rg)) {
239 return;
240 }
242
247 }
248
250 {
252
253 if (sd->
size <
sizeof(*stereo)) {
255 return;
256 }
257
259
260 switch (stereo->
type) {
263 break;
266 break;
269 break;
272 break;
275 break;
278 break;
281 break;
284 break;
285 default:
287 break;
288 }
289
292 }
293
295 {
296 int i;
297
300
304
308 break;
311 break;
315 break;
318 break;
322 break;
326 break;
330 break;
331 default:
333 "unknown side data type %d (%d bytes)", sd.
type, sd.
size);
334 break;
335 }
336
338 }
339 }
340
341 /* "user interface" functions */
343 int index,
int is_output)
344 {
351 int use_format_separator = !*codec_separator;
352
353 if (use_format_separator)
356 if (use_format_separator)
359
360 /* the pid is an important information, so we display it */
361 /* XXX: add a generic system */
364 if (lang)
369
376 1024 * 1024);
379 display_aspect_ratio.
num, display_aspect_ratio.
den);
380 }
381
387
388 if (fps || tbr || tbn || tbc)
390
391 if (fps)
393 if (tbr)
395 if (tbn)
397 if (tbc)
399 }
400
422
424
426 }
427
429 const char *url, int is_output)
430 {
431 int i;
434 return;
435
437 is_output ? "Output" : "Input",
438 index,
440 is_output ? "to" : "from", url);
442
443 if (!is_output) {
446 int hours, mins, secs, us;
450 mins = secs / 60;
451 secs %= 60;
452 hours = mins / 60;
453 mins %= 60;
456 } else {
458 }
460 int secs, us;
466 }
470 else
473 }
474
482
484 }
485
487 int j, k, total = 0;
492 name ? name->
value :
"");
496 index, is_output);
498 }
500 }
503 }
504
506 if (!printed[i])
508
510 }