aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-08-22 17:27:17 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-08-24 12:57:00 +0200
commit92a1da1b7d3bee9409f5952559f3579638d0f327 (patch)
tree5f499e4898dc78d4c299631327a8e8e1a6539d05
parent6da07b7b6a05c8c78b91d860b1c295ec94f5e1c4 (diff)
downloadffmpeg-92a1da1b7d3bee9409f5952559f3579638d0f327.tar.gz
ffprobe: Fix NULL pointer handling in color parameter printing
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 351e28f9a799d9bbbb33dd10c964dca7219fa13b) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--ffprobe.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/ffprobe.c b/ffprobe.c
index fecbbce5d8..bad2f4713b 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1682,6 +1682,16 @@ static inline int show_tags(WriterContext *w, AVDictionary *tags, int section_id
return ret;
}
+static void print_color_space(WriterContext *w, enum AVColorSpace color_space)
+{
+ const char *val = av_get_colorspace_name(color_space);
+ if (!val || color_space == AVCOL_SPC_UNSPECIFIED) {
+ print_str_opt("color_space", "unknown");
+ } else {
+ print_str("color_space", val);
+ }
+}
+
static void show_packet(WriterContext *w, AVFormatContext *fmt_ctx, AVPacket *pkt, int packet_idx)
{
char val_str[128];
@@ -2101,9 +2111,8 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
print_str ("color_range", dec_ctx->color_range == AVCOL_RANGE_MPEG ? "tv": "pc");
else
print_str_opt("color_range", "N/A");
- s = av_get_colorspace_name(dec_ctx->colorspace);
- if (s) print_str ("color_space", s);
- else print_str_opt("color_space", "unknown");
+ print_color_space(w, dec_ctx->colorspace);
+
if (dec_ctx->timecode_frame_start >= 0) {
char tcbuf[AV_TIMECODE_STR_SIZE];
av_timecode_make_mpeg_tc_string(tcbuf, dec_ctx->timecode_frame_start);