X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=ffprobe.c;h=e295c53def4abaae474eeb589973a0a1dbb2fe85;hb=ae6f6d4e34b8353a547be48fbf34b95a1c3652e9;hp=ce964e0093a471c873a4f9257a8368bb5f2fa31e;hpb=8c6f18e4449ad2bb3c30621b9dca45acc86332cb;p=ffmpeg diff --git a/ffprobe.c b/ffprobe.c index ce964e0093a..e295c53def4 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -35,6 +35,7 @@ #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" @@ -57,11 +58,11 @@ # 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 { @@ -1893,6 +1894,29 @@ static void print_pkt_side_data(WriterContext *w, 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); } @@ -2116,6 +2140,29 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, 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); } @@ -2427,9 +2474,10 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id 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)); @@ -2886,6 +2934,8 @@ static int probe_file(WriterContext *wctx, const char *filename) } else { selected_streams[i] = 1; } + if (!selected_streams[i]) + ifile.fmt_ctx->streams[i]->discard = AVDISCARD_ALL; } if (do_read_frames || do_read_packets) { @@ -3379,7 +3429,7 @@ DEFINE_OPT_SHOW_SECTION(streams, STREAMS) 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" },