diff options
author | Martin Vignali <martin.vignali@gmail.com> | 2018-10-20 15:54:15 +0200 |
---|---|---|
committer | Martin Vignali <martin.vignali@gmail.com> | 2018-10-24 21:21:05 +0200 |
commit | 66974311b1da2e854aaa6320648e7f0bdbbb84ea (patch) | |
tree | 187887eecd7edf7c2de107ca53030d51f4e902c7 | |
parent | 78f04843bf322eead095f5faaf591a3c0b46daf9 (diff) | |
download | ffmpeg-66974311b1da2e854aaa6320648e7f0bdbbb84ea.tar.gz |
avfilter/show_info : add print of color information (range, color_primaries, color_trc, colorspace)
-rw-r--r-- | libavfilter/vf_showinfo.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c index 689b5399db..37e73b60aa 100644 --- a/libavfilter/vf_showinfo.c +++ b/libavfilter/vf_showinfo.c @@ -95,6 +95,39 @@ static void dump_stereo3d(AVFilterContext *ctx, AVFrameSideData *sd) av_log(ctx, AV_LOG_INFO, " (inverted)"); } +static void dump_color_property(AVFilterContext *ctx, AVFrame *frame) +{ + const char *color_range_str = av_color_range_name(frame->color_range); + const char *colorspace_str = av_color_space_name(frame->colorspace); + const char *color_primaries_str = av_color_primaries_name(frame->color_primaries); + const char *color_trc_str = av_color_transfer_name(frame->color_trc); + + if (!color_range_str || frame->color_range == AVCOL_RANGE_UNSPECIFIED) { + av_log(ctx, AV_LOG_INFO, "color_range:unknown"); + } else { + av_log(ctx, AV_LOG_INFO, "color_range:%s", color_range_str); + } + + if (!colorspace_str || frame->colorspace == AVCOL_SPC_UNSPECIFIED) { + av_log(ctx, AV_LOG_INFO, " color_space:unknown"); + } else { + av_log(ctx, AV_LOG_INFO, " color_space:%s", colorspace_str); + } + + if (!color_primaries_str || frame->color_primaries == AVCOL_PRI_UNSPECIFIED) { + av_log(ctx, AV_LOG_INFO, " color_primaries:unknown"); + } else { + av_log(ctx, AV_LOG_INFO, " color_primaries:%s", color_primaries_str); + } + + if (!color_trc_str || frame->color_trc == AVCOL_TRC_UNSPECIFIED) { + av_log(ctx, AV_LOG_INFO, " color_trc:unknown"); + } else { + av_log(ctx, AV_LOG_INFO, " color_trc:%s", color_trc_str); + } + av_log(ctx, AV_LOG_INFO, "\n"); +} + static void update_sample_stats(const uint8_t *src, int len, int64_t *sum, int64_t *sum2) { int i; @@ -200,6 +233,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) av_log(ctx, AV_LOG_INFO, "\n"); } + dump_color_property(ctx, frame); + return ff_filter_frame(inlink->dst->outputs[0], frame); } |