48#define HEXDUMP_PRINT(...) \
51 av_log(avcl, level, __VA_ARGS__); \
53 fprintf(f, __VA_ARGS__); \
57 const uint8_t *buf,
int size)
61 for (
i = 0;
i <
size;
i += 16) {
66 for (j = 0; j < 16; j++) {
73 for (j = 0; j <
len; j++) {
75 if (
c <
' ' ||
c >
'~')
129static void print_fps(
double d,
const char *postfix,
int log_level)
131 uint64_t v =
lrintf(d * 100);
133 av_log(
NULL, log_level,
"%1.4f %s", d, postfix);
135 av_log(
NULL, log_level,
"%3.2f %s", d, postfix);
136 else if (v % (100 * 1000))
137 av_log(
NULL, log_level,
"%1.0f %s", d, postfix);
139 av_log(
NULL, log_level,
"%1.0fk %s", d / 1000, postfix);
143 const char *
name,
const char *indent,
153 if (strcmp(
"language",
tag->key)) {
154 const char *p =
tag->value;
156 "%s %-16s: ", indent,
tag->key);
158 size_t len = strcspn(p,
"\x8\xa\xb\xc\xd");
161 if (*p == 0xd)
av_log(
ctx, log_level,
" ");
162 if (*p == 0xa)
av_log(
ctx, log_level,
"\n%s %-16s: ", indent,
"");
196 av_log(
ctx, log_level,
"sample_rate %"PRIu32
", ", sample_rate);
219 if (gain == INT32_MIN)
222 av_log(
ctx, log_level,
"%f", gain / 100000.0f);
226static void print_peak(
void *
ctx,
const char *str, uint32_t peak,
int log_level)
232 av_log(
ctx, log_level,
"%f", (
float) peak / UINT32_MAX);
240 if (sd->
size <
sizeof(*rg)) {
256 if (sd->
size <
sizeof(*stereo)) {
263 av_log(
ctx, log_level,
"%s, view: %s, primary eye: %s",
269 av_log(
ctx, log_level,
", horizontal_disparity_adjustment: %0.4f",
282 if (sd->
size <
sizeof(*ast)) {
295 av_log(
ctx, log_level,
"visually impaired");
298 av_log(
ctx, log_level,
"hearing impaired");
325 if (sd->
size <
sizeof(*cpb)) {
331 "bitrate max/min/avg: %"PRId64
"/%"PRId64
"/%"PRId64
" buffer size: %"PRId64
" ",
335 av_log(
ctx, log_level,
"vbv_delay: N/A");
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",
366 "MaxCLL=%d, MaxFALL=%d",
375 "ambient_illuminance=%f, ambient_light_x=%f, ambient_light_y=%f",
385 double yaw, pitch, roll;
387 if (sd->
size <
sizeof(*spherical)) {
394 if (spherical->
yaw || spherical->
pitch || spherical->
roll) {
395 yaw = ((
double)spherical->
yaw) / (1 << 16);
398 av_log(
ctx, log_level,
"(%f/%f/%f) ", yaw, pitch, roll);
405 av_log(
ctx, log_level,
"[%zu, %zu, %zu, %zu] ", l, t,
r,
b);
417 av_log(
ctx, log_level,
"version: %d.%d, profile: %d, level: %d, "
418 "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d, "
432 const uint32_t *tc = (
const uint32_t *)sd->
data;
434 if ((sd->
size !=
sizeof(uint32_t) * 4) || (tc[0] > 3)) {
439 for (
int j = 1; j <= tc[0]; j++) {
442 av_log(
ctx, log_level,
"timecode - %s%s", tcbuf, j != tc[0] ?
", " :
"");
448 uint32_t top, bottom,
left, right;
450 if (sd->
size <
sizeof(uint32_t) * 4) {
451 av_log(
ctx, log_level,
"invalid data\n");
460 av_log(
ctx, log_level,
"%"PRIu32
"/%"PRIu32
"/%"PRIu32
"/%"PRIu32
"",
left, right, top, bottom);
473 const char *indent,
int log_level)
478 av_log(
ctx, log_level,
"%sSide data:\n", indent);
480 for (
i = 0;
i < nb_side_data;
i++) {
495 av_log(
ctx, log_level,
"rotation of %.2f degrees",
505 av_log(
ctx, log_level,
"%"PRId32
", pict_type: %c",
539 av_log(
ctx, log_level,
"unknown side data type %d "
565 av_log(
NULL, log_level,
" (hearing impaired)");
567 av_log(
NULL, log_level,
" (visual impaired)");
573 av_log(
NULL, log_level,
" (timed thumbnails)");
592 int group_index,
int index,
int is_output,
601 const char *group_indent = group_index >= 0 ?
" " :
"";
602 const char *extra_indent = group_index >= 0 ?
" " :
" ";
650 av_log(
NULL, log_level,
", SAR %d:%d DAR %d:%d",
652 display_aspect_ratio.
num, display_aspect_ratio.
den);
660 if (fps || tbr || tbn)
673 av_log(
NULL, log_level,
", start %.6f", stream_start);
683 extra_indent, log_level);
687 int i,
int index,
int is_output)
706 for (
int j = 0; j < audio_element->
nb_layers; j++) {
714 for (
int k = 0; channel_count > 0 && k < stg->
nb_streams; k++) {
717 printed[st->
index] = 1;
730 for (
int j = 0; j < mix_presentation->
nb_submixes; j++) {
751 for (
int k = 0; k < sub_mix->
nb_layouts; k++) {
768 const char *ptr =
NULL;
794 if (st && !printed[st->
index]) {
796 printed[st->
index] = 1;
801 if (!printed[st->
index]) {
803 printed[st->
index] = 1;
812 const char *ptr =
NULL;
814 "Dolby Vision" :
"LCEVC");
834 printed[st->
index] = 1;
843 printed[st->
index] = 1;
853 const char *url,
int is_output)
861 is_output ?
"Output" :
"Input",
864 is_output ?
"to" :
"from", url);
Libavcodec external API header.
static int BS_FUNC left(const BSCTX *bc)
Return the number of the bits left in a buffer.
static int FUNC metadata(CodedBitstreamContext *ctx, RWContext *rw, APVRawMetadata *current)
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
Public libavutil channel layout APIs header.
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
@ AV_AUDIO_SERVICE_TYPE_VOICE_OVER
@ AV_AUDIO_SERVICE_TYPE_EMERGENCY
@ AV_AUDIO_SERVICE_TYPE_EFFECTS
@ AV_AUDIO_SERVICE_TYPE_MAIN
@ AV_AUDIO_SERVICE_TYPE_DIALOGUE
@ AV_AUDIO_SERVICE_TYPE_KARAOKE
@ AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED
@ AV_AUDIO_SERVICE_TYPE_COMMENTARY
@ AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED
static void dump_sidedata(void *ctx, const AVPacketSideData *side_data, int nb_side_data, int w, int h, AVRational avg_frame_rate, const char *indent, int log_level)
static void dump_replaygain(void *ctx, const AVPacketSideData *sd, int log_level)
static void dump_dovi_conf(void *ctx, const AVPacketSideData *sd, int log_level)
static void dump_content_light_metadata(void *ctx, const AVPacketSideData *sd, int log_level)
static void pkt_dump_internal(void *avcl, FILE *f, int level, const AVPacket *pkt, int dump_payload, AVRational time_base)
static void dump_stream_format(const AVFormatContext *ic, int i, int group_index, int index, int is_output, int log_level)
static void dump_spherical(void *ctx, int w, int h, const AVPacketSideData *sd, int log_level)
static void dump_s12m_timecode(void *ctx, AVRational avg_frame_rate, const AVPacketSideData *sd, int log_level)
static void dump_tdrdi(void *ctx, const AVPacketSideData *sd, int log_level)
static void dump_audioservicetype(void *ctx, const AVPacketSideData *sd, int log_level)
static void dump_paramchange(void *ctx, const AVPacketSideData *sd, int log_level)
static void dump_cpb(void *ctx, const AVPacketSideData *sd, int log_level)
static void hex_dump_internal(void *avcl, FILE *f, int level, const uint8_t *buf, int size)
static void dump_cropping(void *ctx, const AVPacketSideData *sd, int log_level)
static void dump_metadata(void *ctx, const AVDictionary *m, const char *indent, int log_level)
#define HEXDUMP_PRINT(...)
static void dump_disposition(int disposition, int log_level)
static void dump_dictionary(void *ctx, const AVDictionary *m, const char *name, const char *indent, int log_level)
static void dump_stereo3d(void *ctx, const AVPacketSideData *sd, int log_level)
static void dump_stream_group(const AVFormatContext *ic, uint8_t *printed, int i, int index, int is_output)
static void print_peak(void *ctx, const char *str, uint32_t peak, int log_level)
static void print_gain(void *ctx, const char *str, int32_t gain, int log_level)
static void dump_mastering_display_metadata(void *ctx, const AVPacketSideData *sd, int log_level)
static void dump_ambient_viewing_environment_metadata(void *ctx, const AVPacketSideData *sd, int log_level)
static void print_fps(double d, const char *postfix, int log_level)
static char separator(CheckasmFormat format)
static unsigned int nb_streams
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
const char * av_packet_side_data_name(enum AVPacketSideDataType type)
@ AV_PKT_DATA_S12M_TIMECODE
Timecode which conforms to SMPTE ST 12-1:2014.
@ AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT
Ambient viewing environment metadata, as defined by H.274.
@ AV_PKT_DATA_3D_REFERENCE_DISPLAYS
This side data contains information about the reference display width(s) and reference viewing distan...
@ AV_PKT_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata (based on SMPTE-2086:2014).
@ AV_PKT_DATA_AUDIO_SERVICE_TYPE
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.
@ AV_PKT_DATA_SPHERICAL
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
@ AV_PKT_DATA_QUALITY_STATS
This side data contains quality related information from the encoder.
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
@ AV_PKT_DATA_CPB_PROPERTIES
This side data corresponds to the AVCPBProperties struct.
@ AV_PKT_DATA_PARAM_CHANGE
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
@ AV_PKT_DATA_STEREO3D
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
@ AV_PKT_DATA_FRAME_CROPPING
The number of pixels to discard from the top/bottom/left/right border of the decoded frame to obtain ...
@ AV_PKT_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
@ AV_PKT_DATA_REPLAYGAIN
This side data should be associated with an audio stream and contains ReplayGain information in form ...
@ AV_PKT_DATA_DOVI_CONF
DOVI configuration ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2....
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
@ AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE
@ AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS
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.
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.
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.
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.
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,...
int av_channel_layout_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
Get a human-readable string describing the channel layout properties.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
int av_dict_count(const AVDictionary *m)
Get number of entries in dictionary.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
char * av_stristr(const char *s1, const char *s2)
Locate the first case-independent occurrence in the string haystack of the string needle.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define AV_TIME_BASE
Internal time base represented as integer.
double av_display_rotation_get(const int32_t matrix[9])
Extract the rotation component of the transformation matrix.
const char * av_spherical_projection_name(enum AVSphericalProjection projection)
Provide a human-readable name of a given AVSphericalProjection.
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.
@ AV_SPHERICAL_EQUIRECTANGULAR_TILE
Video represents a portion of a sphere mapped on a flat surface using equirectangular projection.
@ AV_SPHERICAL_CUBEMAP
Video frame is split into 6 faces of a cube, and arranged on a 3x2 layout.
const char * av_stereo3d_view_name(unsigned int view)
Provide a human-readable name of a given stereo3d view.
const char * av_stereo3d_type_name(unsigned int type)
Provide a human-readable name of a given stereo3d type.
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
const char * av_stereo3d_primary_eye_name(unsigned int eye)
Provide a human-readable name of a given stereo3d primary eye.
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
#define us(width, name, range_min, range_max, subs,...)
Immersive Audio Model and Formats API header.
Memory handling functions.
This structure describes information about the reference display width(s) and reference viewing dista...
uint8_t num_ref_displays
The number of reference displays that are signalled in this struct.
Ambient viewing environment metadata as defined by H.274.
AVRational ambient_illuminance
Environmental illuminance of the ambient viewing environment in lux.
AVRational ambient_light_x
Normalized x chromaticity coordinate of the environmental ambient light in the nominal viewing enviro...
AVRational ambient_light_y
Normalized y chromaticity coordinate of the environmental ambient light in the nominal viewing enviro...
This structure describes the bitrate properties of an encoded bitstream.
int64_t avg_bitrate
Average bitrate of the stream, in bits per second.
int64_t max_bitrate
Maximum bitrate of the stream, in bits per second.
int64_t buffer_size
The size of the buffer to which the ratecontrol is applied, in bits.
uint64_t vbv_delay
The delay between the time the packet this structure is associated with is received and the time when...
int64_t min_bitrate
Minimum bitrate of the stream, in bits per second.
int nb_channels
Number of channels in this layout.
int64_t end
chapter start/end time in time_base units
AVRational time_base
time base in which the start/end timestamps are specified
main external API structure.
int width
picture width / height.
int qmin
minimum quantizer
const struct AVCodec * codec
int qmax
maximum quantizer
int coded_width
Bitstream width / height, may be different from width/height e.g.
int height
The height of the video frame in pixels.
int nb_coded_side_data
Amount of entries in coded_side_data.
AVChannelLayout ch_layout
The channel layout and number of channels.
int width
The width of the video frame in pixels.
enum AVMediaType codec_type
General type of the encoded data.
AVRational sample_aspect_ratio
The aspect ratio (width/height) which a single pixel should have when displayed.
AVPacketSideData * coded_side_data
Additional data associated with the entire stream.
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
uint8_t dv_md_compression
uint8_t dv_bl_signal_compatibility_id
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
AVStreamGroup ** stream_groups
A list of all stream groups in the file.
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds.
AVDictionary * metadata
Metadata that applies to the whole file.
const struct AVOutputFormat * oformat
The output container format.
const struct AVInputFormat * iformat
The input container format.
unsigned int nb_chapters
Number of chapters in AVChapter array.
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
unsigned int nb_stream_groups
Number of elements in AVFormatContext.stream_groups.
AVStream ** streams
A list of all streams in the file.
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
uint8_t * dump_separator
dump format separator.
Information on how to combine one or more audio streams, as defined in section 3.6 of IAMF.
unsigned int nb_layers
Number of layers, or channel groups, in the Audio Element.
A layer defining a Channel Layout in the Audio Element.
AVChannelLayout ch_layout
Information on how to render and mix one or more AVIAMFAudioElement to generate the final audio outpu...
unsigned int nb_submixes
Number of submixes in the presentation.
AVDictionary * annotations
A dictionary of strings describing the mix in different languages.
AVIAMFSubmix ** submixes
Array of submixes.
Submix element as defined in section 3.7 of IAMF.
unsigned int audio_element_id
The id of the Audio Element this submix element references.
AVDictionary * annotations
A dictionary of strings describing the submix in different languages.
Submix layout as defined in section 3.7.6 of IAMF.
enum AVIAMFSubmixLayoutType layout_type
AVChannelLayout sound_system
Channel layout matching one of Sound Systems A to J of ITU-2051-3, plus 7.1.2ch, 3....
Submix layout as defined in section 3.7 of IAMF.
unsigned int nb_elements
Number of elements in the submix.
AVIAMFSubmixElement ** elements
Array of submix elements.
AVIAMFSubmixLayout ** layouts
Array of submix layouts.
unsigned int nb_layouts
Number of layouts in the submix.
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
enum AVPacketSideDataType type
This structure stores compressed data.
New fields can be added to the end with minor version bumps.
unsigned int nb_stream_indexes
unsigned int * stream_index
Rational number (pair of numerator and denominator).
ReplayGain information (see http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1....
uint32_t track_peak
Peak track amplitude, with 100000 representing full scale (but values may overflow).
uint32_t album_peak
Same as track_peak, but for the whole album,.
int32_t track_gain
Track replay gain in microbels (divide by 100000 to get the value in dB).
int32_t album_gain
Same as track_gain, but for the whole album.
This structure describes how to handle spherical videos, outlining information about projection,...
enum AVSphericalProjection projection
Projection type.
int32_t pitch
Rotation around the right vector [-90, 90].
int32_t roll
Rotation around the forward vector [-180, 180].
int32_t yaw
Rotation around the up vector [-180, 180].
uint32_t padding
Number of pixels to pad from the edge of each cube face.
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
enum AVStereo3DType type
How views are packed within the video.
uint32_t baseline
The distance between the centres of the lenses of the camera system, in micrometers.
AVRational horizontal_disparity_adjustment
Relative shift of the left and right images, which changes the zero parallax plane.
enum AVStereo3DPrimaryEye primary_eye
Which eye is the primary eye when rendering in 2D.
int flags
Additional information about the frame packing.
AVRational horizontal_field_of_view
Horizontal field of view, in degrees.
enum AVStereo3DView view
Determines which views are packed.
AVStreamGroupLayeredVideo is meant to define the relation between a base layer video stream and a sep...
int height
Height of the final image for presentation.
unsigned int el_index
Index of the enhancement layer stream in AVStreamGroup.
int width
Width of the final stream for presentation.
AVStreamGroupTileGrid holds information on how to combine several independent images on a single canv...
int nb_coded_side_data
Amount of entries in coded_side_data.
int width
Width of the final image for presentation.
int height
Height of the final image for presentation.
int coded_width
Width of the canvas.
struct AVStreamGroupTileGrid::@036353327352337314037001273105074056331305251354 * offsets
An nb_tiles sized array of offsets in pixels from the topleft edge of the canvas, indicating where ea...
unsigned int nb_tiles
Amount of tiles in the grid.
unsigned int idx
Index of the stream in the group this tile references.
int coded_height
Width of the canvas.
AVPacketSideData * coded_side_data
Additional data associated with the grid.
union AVStreamGroup::@166361102046003066253145020066347265153020354020 params
Group type-specific parameters.
enum AVStreamGroupParamsType type
Group type.
struct AVIAMFMixPresentation * iamf_mix_presentation
struct AVStreamGroupTileGrid * tile_grid
unsigned int nb_streams
Number of elements in AVStreamGroup.streams.
AVDictionary * metadata
Metadata that applies to the whole group.
unsigned int index
Group index in AVFormatContext.
struct AVIAMFAudioElement * iamf_audio_element
int disposition
Stream group disposition - a combination of AV_DISPOSITION_* flags.
int64_t id
Group type-specific group ID.
AVStream ** streams
A list of streams in the group.
struct AVStreamGroupLayeredVideo * layered_video
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
int id
Format-specific stream ID.
int index
stream index in AVFormatContext
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
AVRational avg_frame_rate
Average framerate.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
AVRational r_frame_rate
Real base framerate of the stream.
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
struct AVCodecContext * avctx
The codec context used by avformat_find_stream_info, the parser, etc.
int codec_info_nb_frames
Number of frames that have been demuxed during avformat_find_stream_info()
static AVFormatContext * ctx
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.
#define AV_TIMECODE_STR_SIZE