#include "libavutil/bprint.h"
#include "libavutil/display.h"
#include "libavutil/hash.h"
+#include "libavutil/mastering_display_metadata.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/spherical.h"
# ifdef pthread_mutex_lock
# undef pthread_mutex_lock
# endif
-# define pthread_mutex_lock(a)
+# define pthread_mutex_lock(a) do{}while(0)
# ifdef pthread_mutex_unlock
# undef pthread_mutex_unlock
# endif
-# define pthread_mutex_unlock(a)
+# define pthread_mutex_unlock(a) do{}while(0)
#endif
typedef struct InputStream {
static ReadInterval *read_intervals;
static int read_intervals_nb = 0;
+static int find_stream_info = 1;
+
/* section structure definition */
#define SECTION_MAX_NB_CHILDREN 10
print_int("discard_padding", AV_RL32(sd->data + 4));
print_int("skip_reason", AV_RL8(sd->data + 8));
print_int("discard_reason", AV_RL8(sd->data + 9));
+ } else if (sd->type == AV_PKT_DATA_MASTERING_DISPLAY_METADATA) {
+ AVMasteringDisplayMetadata *metadata = (AVMasteringDisplayMetadata *)sd->data;
+
+ if (metadata->has_primaries) {
+ print_q("red_x", metadata->display_primaries[0][0], '/');
+ print_q("red_y", metadata->display_primaries[0][1], '/');
+ print_q("green_x", metadata->display_primaries[1][0], '/');
+ print_q("green_y", metadata->display_primaries[1][1], '/');
+ print_q("blue_x", metadata->display_primaries[2][0], '/');
+ print_q("blue_y", metadata->display_primaries[2][1], '/');
+
+ print_q("white_point_x", metadata->white_point[0], '/');
+ print_q("white_point_y", metadata->white_point[1], '/');
+ }
+
+ if (metadata->has_luminance) {
+ print_q("min_luminance", metadata->min_luminance, '/');
+ print_q("max_luminance", metadata->max_luminance, '/');
+ }
+ } else if (sd->type == AV_PKT_DATA_CONTENT_LIGHT_LEVEL) {
+ AVContentLightMetadata *metadata = (AVContentLightMetadata *)sd->data;
+ print_int("max_content", metadata->MaxCLL);
+ print_int("max_average", metadata->MaxFALL);
}
writer_print_section_footer(w);
}
print_time("pkt_pts_time", frame->pts, &stream->time_base);
print_ts ("pkt_dts", frame->pkt_dts);
print_time("pkt_dts_time", frame->pkt_dts, &stream->time_base);
- print_ts ("best_effort_timestamp", av_frame_get_best_effort_timestamp(frame));
- print_time("best_effort_timestamp_time", av_frame_get_best_effort_timestamp(frame), &stream->time_base);
- print_duration_ts ("pkt_duration", av_frame_get_pkt_duration(frame));
- print_duration_time("pkt_duration_time", av_frame_get_pkt_duration(frame), &stream->time_base);
- if (av_frame_get_pkt_pos (frame) != -1) print_fmt ("pkt_pos", "%"PRId64, av_frame_get_pkt_pos(frame));
+ print_ts ("best_effort_timestamp", frame->best_effort_timestamp);
+ print_time("best_effort_timestamp_time", frame->best_effort_timestamp, &stream->time_base);
+ print_duration_ts ("pkt_duration", frame->pkt_duration);
+ print_duration_time("pkt_duration_time", frame->pkt_duration, &stream->time_base);
+ if (frame->pkt_pos != -1) print_fmt ("pkt_pos", "%"PRId64, frame->pkt_pos);
else print_str_opt("pkt_pos", "N/A");
- if (av_frame_get_pkt_size(frame) != -1) print_val ("pkt_size", av_frame_get_pkt_size(frame), unit_byte_str);
+ if (frame->pkt_size != -1) print_val ("pkt_size", frame->pkt_size, unit_byte_str);
else print_str_opt("pkt_size", "N/A");
switch (stream->codecpar->codec_type) {
if (s) print_str ("sample_fmt", s);
else print_str_opt("sample_fmt", "unknown");
print_int("nb_samples", frame->nb_samples);
- print_int("channels", av_frame_get_channels(frame));
- if (av_frame_get_channel_layout(frame)) {
+ print_int("channels", frame->channels);
+ if (frame->channel_layout) {
av_bprint_clear(&pbuf);
- av_bprint_channel_layout(&pbuf, av_frame_get_channels(frame),
- av_frame_get_channel_layout(frame));
+ av_bprint_channel_layout(&pbuf, frame->channels,
+ frame->channel_layout);
print_str ("channel_layout", pbuf.str);
} else
print_str_opt("channel_layout", "unknown");
break;
}
if (do_show_frame_tags)
- show_tags(w, av_frame_get_metadata(frame), SECTION_ID_FRAME_TAGS);
+ show_tags(w, frame->metadata, SECTION_ID_FRAME_TAGS);
if (do_show_log)
show_log(w, SECTION_ID_FRAME_LOGS, SECTION_ID_FRAME_LOG, do_show_log);
if (frame->nb_side_data) {
char tcbuf[AV_TIMECODE_STR_SIZE];
av_timecode_make_mpeg_tc_string(tcbuf, *(int64_t *)(sd->data));
print_str("timecode", tcbuf);
+ } else if (sd->type == AV_FRAME_DATA_MASTERING_DISPLAY_METADATA) {
+ AVMasteringDisplayMetadata *metadata = (AVMasteringDisplayMetadata *)sd->data;
+
+ if (metadata->has_primaries) {
+ print_q("red_x", metadata->display_primaries[0][0], '/');
+ print_q("red_y", metadata->display_primaries[0][1], '/');
+ print_q("green_x", metadata->display_primaries[1][0], '/');
+ print_q("green_y", metadata->display_primaries[1][1], '/');
+ print_q("blue_x", metadata->display_primaries[2][0], '/');
+ print_q("blue_y", metadata->display_primaries[2][1], '/');
+
+ print_q("white_point_x", metadata->white_point[0], '/');
+ print_q("white_point_y", metadata->white_point[1], '/');
+ }
+
+ if (metadata->has_luminance) {
+ print_q("min_luminance", metadata->min_luminance, '/');
+ print_q("max_luminance", metadata->max_luminance, '/');
+ }
+ } else if (sd->type == AV_FRAME_DATA_CONTENT_LIGHT_LEVEL) {
+ AVContentLightMetadata *metadata = (AVContentLightMetadata *)sd->data;
+ print_int("max_content", metadata->MaxCLL);
+ print_int("max_average", metadata->MaxFALL);
}
writer_print_section_footer(w);
}
else
print_str_opt("color_range", "N/A");
- s = av_get_colorspace_name(par->color_space);
- if (s) print_str ("color_space", s);
- else print_str_opt("color_space", "unknown");
+ if (par->color_space != AVCOL_SPC_UNSPECIFIED)
+ print_str("color_space", av_color_space_name(par->color_space));
+ else
+ print_str_opt("color_space", av_color_space_name(par->color_space));
if (par->color_trc != AVCOL_TRC_UNSPECIFIED)
print_str("color_transfer", av_color_transfer_name(par->color_trc));
static int open_input_file(InputFile *ifile, const char *filename)
{
- int err, i, orig_nb_streams;
+ int err, i;
AVFormatContext *fmt_ctx = NULL;
AVDictionaryEntry *t;
- AVDictionary **opts;
int scan_all_pmts_set = 0;
fmt_ctx = avformat_alloc_context();
return AVERROR_OPTION_NOT_FOUND;
}
- /* fill the streams in the format context */
- opts = setup_find_stream_info_opts(fmt_ctx, codec_opts);
- orig_nb_streams = fmt_ctx->nb_streams;
+ if (find_stream_info) {
+ AVDictionary **opts = setup_find_stream_info_opts(fmt_ctx, codec_opts);
+ int orig_nb_streams = fmt_ctx->nb_streams;
- err = avformat_find_stream_info(fmt_ctx, opts);
+ err = avformat_find_stream_info(fmt_ctx, opts);
- for (i = 0; i < orig_nb_streams; i++)
- av_dict_free(&opts[i]);
- av_freep(&opts);
+ for (i = 0; i < orig_nb_streams; i++)
+ av_dict_free(&opts[i]);
+ av_freep(&opts);
- if (err < 0) {
- print_error(filename, err);
- return err;
+ if (err < 0) {
+ print_error(filename, err);
+ return err;
+ }
}
av_dump_format(fmt_ctx, 0, filename, 0);
} else {
selected_streams[i] = 1;
}
+ if (!selected_streams[i])
+ ifile.fmt_ctx->streams[i]->discard = AVDISCARD_ALL;
}
if (do_read_frames || do_read_packets) {
DEFINE_OPT_SHOW_SECTION(programs, PROGRAMS)
static const OptionDef real_options[] = {
-#include "cmdutils_common_opts.h"
+ CMDUTILS_COMMON_OPTIONS
{ "f", HAS_ARG, {.func_arg = opt_format}, "force format", "format" },
{ "unit", OPT_BOOL, {&show_value_unit}, "show unit of the displayed values" },
{ "prefix", OPT_BOOL, {&use_value_prefix}, "use SI prefixes for the displayed values" },
{ "read_intervals", HAS_ARG, {.func_arg = opt_read_intervals}, "set read intervals", "read_intervals" },
{ "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {.func_arg = opt_default}, "generic catch all option", "" },
{ "i", HAS_ARG, {.func_arg = opt_input_file_i}, "read specified file", "input_file"},
+ { "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { &find_stream_info },
+ "read and decode the streams to fill missing information with heuristics" },
{ NULL, },
};
goto end;
}
#endif
- av_log_set_callback(log_callback);
-
av_log_set_flags(AV_LOG_SKIP_REPEATED);
register_exit(ffprobe_cleanup);
show_banner(argc, argv, options);
parse_options(NULL, argc, argv, options, opt_input_file);
+ if (do_show_log)
+ av_log_set_callback(log_callback);
+
/* mark things to show, based on -show_entries */
SET_DO_SHOW(CHAPTERS, chapters);
SET_DO_SHOW(ERROR, error);