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
32
34
35 #define HEXDUMP_PRINT(...) \
36 do { \
37 if (!f) \
38 av_log(avcl, level, __VA_ARGS__); \
39 else \
40 fprintf(f, __VA_ARGS__); \
41 } while (0)
42
45 {
47
48 for (i = 0; i <
size; i += 16) {
49 len = size - i;
50 if (len > 16)
51 len = 16;
53 for (j = 0; j < 16; j++) {
54 if (j < len)
56 else
58 }
60 for (j = 0; j <
len; j++) {
61 c = buf[i + j];
62 if (c < ' ' || c > '~')
63 c = '.';
65 }
67 }
68 }
69
71 {
73 }
74
76 {
78 }
79
82 {
86 /* DTS is _always_ valid after av_read_frame() */
90 else
92 /* PTS may not be known if B-frames are present. */
96 else
100 if (dump_payload)
102 }
103
105 {
107 }
108
111 {
113 }
114
115
117 {
119 if (v % 100)
121 else if (v % (100 * 1000))
123 else
125 }
126
128 {
131
134 if (strcmp(
"language", tag->
key)) {
135 const char *p = tag->
value;
137 "%s %-16s: ", indent, tag->
key);
138 while (*p) {
139 char tmp[256];
140 size_t len = strcspn(p,
"\x8\xa\xb\xc\xd");
146 if (*p) p++;
147 }
149 }
150 }
151 }
152
153 /* param change side data*/
155 {
160
161 if (!data || sd->
size < 4)
162 goto fail;
163
165 data += 4;
166 size -= 4;
167
169 if (size < 4)
170 goto fail;
172 data += 4;
173 size -= 4;
175 }
177 if (size < 8)
178 goto fail;
180 data += 8;
181 size -= 8;
184 }
186 if (size < 4)
187 goto fail;
189 data += 4;
190 size -= 4;
192 }
194 if (size < 8)
195 goto fail;
197 data += 4;
198 size -= 4;
200 data += 4;
201 size -= 4;
203 }
204
205 return;
206 fail:
208 }
209
210 /* replaygain side data*/
212 {
214 if (gain == INT32_MIN)
216 else
219 }
220
221 static void print_peak(
void *ctx,
const char *str, uint32_t peak)
222 {
224 if (!peak)
226 else
229 }
230
232 {
234
235 if (sd->
size <
sizeof(*rg)) {
237 return;
238 }
240
245 }
246
248 {
249 int i;
250
253
257
261 break;
264 break;
268 break;
271 break;
275 break;
279 break;
280 default:
282 "unknown side data type %d (%d bytes)", sd.
type, sd.
size);
283 break;
284 }
285
287 }
288 }
289
290 /* "user interface" functions */
292 int index,
int is_output)
293 {
298
301
302 /* the pid is an important information, so we display it */
303 /* XXX: add a generic system */
306 if (lang)
311
318 1024 * 1024);
321 display_aspect_ratio.
num, display_aspect_ratio.
den);
322 }
323
327 #if FF_API_R_FRAME_RATE
330 #endif
335 }
336
358
360
362 }
363
365 const char *url, int is_output)
366 {
367 int i;
370 return;
371
373 is_output ? "Output" : "Input",
374 index,
376 is_output ? "to" : "from", url);
378
379 if (!is_output) {
382 int hours, mins, secs, us;
386 mins = secs / 60;
387 secs %= 60;
388 hours = mins / 60;
389 mins %= 60;
392 } else {
394 }
396 int secs, us;
402 }
406 else
409 }
410
418
420 }
421
423 int j, k, total = 0;
426 "name", NULL, 0);
428 name ? name->
value :
"");
432 index, is_output);
434 }
436 }
439 }
440
442 if (!printed[i])
444
446 }