FFmpeg: libavformat/dump.c Source File
Go to the documentation of this file. 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
37
39
42
43 #define HEXDUMP_PRINT(...) \
44 do { \
45 if (!f) \
46 av_log(avcl, level, __VA_ARGS__); \
47 else \
48 fprintf(f, __VA_ARGS__); \
49 } while (0)
50
52 const uint8_t *buf,
int size)
53 {
55
56 for (
i = 0;
i <
size;
i += 16) {
61 for (j = 0; j < 16; j++) {
64 else
66 }
68 for (j = 0; j <
len; j++) {
70 if (c < ' ' || c > '~')
73 }
75 }
76 }
77
79 {
81 }
82
84 {
86 }
87
90 {
94 /* DTS is _always_ valid after av_read_frame() */
98 else
100 /* PTS may not be known if B-frames are present. */
104 else
108 if (dump_payload)
110 }
111
113 {
115 }
116
119 {
121 }
122
123
125 {
127 if (!v)
129 else if (v % 100)
131 else if (v % (100 * 1000))
133 else
135 }
136
138 {
141
144 if (strcmp(
"language",
tag->key)) {
145 const char *p =
tag->value;
147 "%s %-16s: ", indent,
tag->key);
148 while (*p) {
149 size_t len = strcspn(p,
"\x8\xa\xb\xc\xd");
154 if (*p) p++;
155 }
157 }
158 }
159 }
160
161 /* param change side data*/
163 {
167 #if FF_API_OLD_CHANNEL_LAYOUT
170 #endif
171
174
178
179 #if FF_API_OLD_CHANNEL_LAYOUT
181 if (
flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
188 }
189 if (
flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) {
197 }
199 #endif /* FF_API_OLD_CHANNEL_LAYOUT */
207 }
218 }
219
220 return;
223 }
224
225 /* replaygain side data*/
227 {
229 if (gain == INT32_MIN)
231 else
234 }
235
237 {
239 if (!peak)
241 else
244 }
245
247 {
249
250 if (sd->
size <
sizeof(*rg)) {
252 return;
253 }
255
260 }
261
263 {
265
266 if (sd->
size <
sizeof(*stereo)) {
268 return;
269 }
270
272
274
277 }
278
280 {
282
283 if (sd->
size <
sizeof(*ast)) {
285 return;
286 }
287
288 switch (*ast) {
291 break;
294 break;
297 break;
300 break;
303 break;
306 break;
309 break;
312 break;
315 break;
316 default:
318 break;
319 }
320 }
321
323 {
325
326 if (sd->
size <
sizeof(*cpb)) {
328 return;
329 }
330
332 "bitrate max/min/avg: %"PRId64"/%"PRId64"/%"PRId64" buffer size: %"PRId64" ",
337 else
339 }
340
342 {
346 "has_primaries:%d has_luminance:%d "
347 "r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f) "
348 "min_luminance=%f, max_luminance=%f",
358 }
359
361 {
365 "MaxCLL=%d, MaxFALL=%d",
367 }
368
371 {
373 double yaw, pitch, roll;
374
375 if (sd->
size <
sizeof(*spherical)) {
377 return;
378 }
379
381
382 yaw = ((
double)spherical->
yaw) / (1 << 16);
386
396 }
397 }
398
400 {
403
405 "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d",
412 }
413
415 {
416 const uint32_t *
tc = (
const uint32_t *)sd->
data;
417
418 if ((sd->
size !=
sizeof(uint32_t) * 4) || (
tc[0] > 3)) {
420 return;
421 }
422
423 for (
int j = 1; j <=
tc[0]; j++) {
427 }
428 }
429
431 {
433
436
440
444 break;
447 break;
451 break;
454 break;
458 break;
462 break;
466 break;
470 break;
474 break;
478 break;
481 break;
485 break;
488 break;
491 break;
495 break;
499 break;
500 default:
503 break;
504 }
505
507 }
508 }
509
510 /* "user interface" functions */
512 int index,
int is_output)
513 {
514 char buf[256];
522
524 if (!avctx)
525 return;
526
530 return;
531 }
532
533 // Fields which are missing from AVCodecParameters need to be taken from the AVCodecContext
540
541 if (separator)
542 av_opt_set(avctx,
"dump_separator", separator, 0);
545
547
548 /* the pid is an important information, so we display it */
549 /* XXX: add a generic system */
552 if (lang)
557
564 1024 * 1024);
567 display_aspect_ratio.
num, display_aspect_ratio.
den);
568 }
569
574
575 if (fps || tbr || tbn)
577
578 if (fps)
580 if (tbr)
582 if (tbn)
584 }
585
623
625
627 }
628
630 const char *url, int is_output)
631 {
635 return;
636
638 is_output ? "Output" : "Input",
641 is_output ? "to" : "from", url);
643
644 if (!is_output) {
647 int64_t hours, mins, secs,
us;
651 mins = secs / 60;
652 secs %= 60;
653 hours = mins / 60;
654 mins %= 60;
657 } else {
659 }
667 secs,
669 }
673 else
676 }
677
687
689 }
690
692 int j, k, total = 0;
700 for (k = 0; k <
program->nb_stream_indexes; k++) {
703 printed[
program->stream_index[k]] = 1;
704 }
705 total +=
program->nb_stream_indexes;
706 }
709 }
710
714
716 }
void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st)
Send a nice dump of a packet to the specified file stream.
#define FF_ENABLE_DEPRECATION_WARNINGS
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_TIMECODE_STR_SIZE
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
static void dump_paramchange(void *ctx, const AVPacketSideData *sd)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C program
enum AVMediaType codec_type
General type of the encoded data.
enum AVSphericalProjection projection
Projection type.
unsigned int nb_chapters
Number of chapters in AVChapter array.
This struct describes the properties of an encoded stream.
@ AV_PKT_DATA_PARAM_CHANGE
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
int av_dict_count(const AVDictionary *m)
Get number of entries in dictionary.
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
const char * av_get_channel_name(uint64_t channel)
Get the name of a given channel.
static void hex_dump_internal(void *avcl, FILE *f, int level, const uint8_t *buf, int size)
static void dump_s12m_timecode(void *ctx, const AVStream *st, const AVPacketSideData *sd)
unsigned MaxCLL
Max content light level (cd/m^2).
AVStream ** streams
A list of all streams in the file.
void av_spherical_tile_bounds(const AVSphericalMapping *map, size_t width, size_t height, size_t *left, size_t *top, size_t *right, size_t *bottom)
Convert the bounding fields from an AVSphericalVideo from 0.32 fixed point to pixels.
static void dump_dovi_conf(void *ctx, const AVPacketSideData *sd)
int32_t album_gain
Same as track_gain, but for the whole album.
@ AV_PKT_DATA_PALETTE
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette.
AVRational avg_frame_rate
Average framerate.
@ AV_AUDIO_SERVICE_TYPE_VOICE_OVER
static void print_fps(double d, const char *postfix)
@ AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
@ AV_SPHERICAL_EQUIRECTANGULAR_TILE
Video represents a portion of a sphere mapped on a flat surface using equirectangular projection.
static void dump_cpb(void *ctx, const AVPacketSideData *sd)
@ AV_PKT_DATA_SPHERICAL
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
int qmax
maximum quantizer
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
const struct AVCodec * codec
static void dump_audioservicetype(void *ctx, const AVPacketSideData *sd)
struct AVCodecContext * avctx
The codec context used by avformat_find_stream_info, the parser, etc.
uint8_t * dump_separator
dump format separator.
#define us(width, name, range_min, range_max, subs,...)
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
@ AV_PKT_DATA_REPLAYGAIN
This side data should be associated with an audio stream and contains ReplayGain information in form ...
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionary * metadata
Metadata that applies to the whole file.
void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)
Print detailed information about the input or output format, such as duration, bitrate,...
@ AV_PKT_DATA_AUDIO_SERVICE_TYPE
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
@ AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
int64_t end
chapter start/end time in time_base units
@ AV_PKT_DATA_STEREO3D
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
@ AV_PKT_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata (based on SMPTE-2086:2014).
AVRational sample_aspect_ratio
Video only.
const struct AVInputFormat * iformat
The input container format.
static void dump_metadata(void *ctx, const AVDictionary *m, const char *indent)
static double av_q2d(AVRational a)
Convert an AVRational to a double.
@ AV_PKT_DATA_ICC_PROFILE
ICC profile data consisting of an opaque octet buffer following the format described by ISO 15076-1.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int codec_info_nb_frames
Number of frames that have been demuxed during avformat_find_stream_info()
@ AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED
uint32_t track_peak
Peak track amplitude, with 100000 representing full scale (but values may overflow).
This structure describes the bitrate properties of an encoded bitstream.
static void print_peak(void *ctx, const char *str, uint32_t peak)
int flags
Additional information about the frame packing.
static void dump_mastering_display_metadata(void *ctx, const AVPacketSideData *sd)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
uint8_t dv_bl_signal_compatibility_id
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
Rational number (pair of numerator and denominator).
static void print_gain(void *ctx, const char *str, int32_t gain)
enum AVPacketSideDataType type
static void dump_content_light_metadata(void *ctx, const AVPacketSideData *sd)
@ AV_AUDIO_SERVICE_TYPE_EMERGENCY
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
static void dump_stereo3d(void *ctx, const AVPacketSideData *sd)
static void dump_spherical(void *ctx, const AVCodecParameters *par, const AVPacketSideData *sd)
const char * av_spherical_projection_name(enum AVSphericalProjection projection)
Provide a human-readable name of a given AVSphericalProjection.
@ AV_SPHERICAL_CUBEMAP
Video frame is split into 6 faces of a cube, and arranged on a 3x2 layout.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static void dump_stream_format(const AVFormatContext *ic, int i, int index, int is_output)
int32_t track_gain
Track replay gain in microbels (divide by 100000 to get the value in dB).
@ AV_PKT_DATA_H263_MB_INFO
An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of structures with info about macroblo...
int64_t min_bitrate
Minimum bitrate of the stream, in bits per second.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
uint32_t padding
Number of pixels to pad from the edge of each cube face.
@ AV_PKT_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
int flags
A combination of AV_PKT_FLAG values.
int64_t avg_bitrate
Average bitrate of the stream, in bits per second.
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
#define AV_LOG_INFO
Standard information.
AVPacketSideData * side_data
An array of side data that applies to the whole stream (i.e.
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel layout
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
uint64_t vbv_delay
The delay between the time the packet this structure is associated with is received and the time when...
#define HEXDUMP_PRINT(...)
int32_t roll
Rotation around the forward vector [-180, 180].
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
char * av_timecode_make_smpte_tc_string2(char *buf, AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field)
Get the timecode string from the SMPTE timecode format.
unsigned properties
Properties of the stream that gets decoded.
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
Fill the codec context based on the values from the supplied codec parameters.
#define AV_TIME_BASE
Internal time base represented as integer.
int64_t max_bitrate
Maximum bitrate of the stream, in bits per second.
static void dump_sidedata(void *ctx, const AVStream *st, const char *indent)
@ AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
New fields can be added to the end with minor version bumps.
@ AV_PKT_DATA_CPB_PROPERTIES
This side data corresponds to the AVCPBProperties struct.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
int id
Format-specific stream ID.
@ AV_PKT_DATA_DOVI_CONF
DOVI configuration ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2....
void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size)
Send a nice hexadecimal dump of a buffer to the log.
const struct AVOutputFormat * oformat
The output container format.
int64_t buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
int32_t pitch
Rotation around the right vector [-90, 90].
int nb_side_data
The number of elements in the AVStream.side_data array.
enum AVStereo3DType type
How views are packed within the video.
@ AV_AUDIO_SERVICE_TYPE_KARAOKE
@ AV_PKT_DATA_S12M_TIMECODE
Timecode which conforms to SMPTE ST 12-1:2014.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
main external API structure.
static void dump_replaygain(void *ctx, const AVPacketSideData *sd)
int qmin
minimum quantizer
@ AV_PKT_DATA_NEW_EXTRADATA
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
@ AV_AUDIO_SERVICE_TYPE_COMMENTARY
uint32_t album_peak
Same as track_peak, but for the whole album,.
AVRational r_frame_rate
Real base framerate of the stream.
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
static void pkt_dump_internal(void *avcl, FILE *f, int level, const AVPacket *pkt, int dump_payload, AVRational time_base)
#define FF_DISABLE_DEPRECATION_WARNINGS
ReplayGain information (see http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1....
int coded_width
Bitstream width / height, may be different from width/height e.g.
@ AV_AUDIO_SERVICE_TYPE_EFFECTS
unsigned MaxFALL
Max average light level per frame (cd/m^2).
This structure stores compressed data.
@ AV_PKT_DATA_QUALITY_STATS
This side data contains quality related information from the encoder.
#define flags(name, subs,...)
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds.
const char * av_stereo3d_type_name(unsigned int type)
Provide a human-readable name of a given stereo3d type.
void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload, const AVStream *st)
Send a nice dump of a packet to the log.
@ AV_AUDIO_SERVICE_TYPE_DIALOGUE
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
AVRational time_base
time base in which the start/end timestamps are specified
@ AV_AUDIO_SERVICE_TYPE_MAIN
This structure describes how to handle spherical videos, outlining information about projection,...
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
int32_t yaw
Rotation around the up vector [-180, 180].
double av_display_rotation_get(const int32_t matrix[9])
Extract the rotation component of the transformation matrix.
void av_hex_dump(FILE *f, const uint8_t *buf, int size)
Send a nice hexadecimal dump of a buffer to the specified file stream.
Generated on Tue Feb 28 2023 21:34:03 for FFmpeg by
doxygen
1.8.17