diff --git a/libavformat/codecstring.c b/libavformat/codecstring.c index 12e0fd22c8..acd2ea3a4e 100644 --- a/libavformat/codecstring.c +++ b/libavformat/codecstring.c @@ -54,7 +54,8 @@ static void set_vp9_codec_str(void *logctx, const AVCodecParameters *par, vpcc.profile, vpcc.level, vpcc.bitdepth); } else { // Default to just vp9 in case of error while finding out profile or level - av_log(logctx, AV_LOG_WARNING, "Could not find VP9 profile and/or level\n"); + if (logctx) + av_log(logctx, AV_LOG_WARNING, "Could not find VP9 profile and/or level\n"); av_bprintf(out, "vp9"); } } @@ -194,7 +195,8 @@ int ff_make_codec_str(void *logctx, const AVCodecParameters *par, // RFC 6381 av_bprintf(out, "mp4v.20"); // Unimplemented, should output ProfileLevelIndication as a decimal number - av_log(logctx, AV_LOG_WARNING, "Incomplete RFC 6381 codec string for mp4v\n"); + if (logctx) + av_log(logctx, AV_LOG_WARNING, "Incomplete RFC 6381 codec string for mp4v\n"); } else if (par->codec_id == AV_CODEC_ID_MP2) { av_bprintf(out, "mp4a.40.33"); } else if (par->codec_id == AV_CODEC_ID_MP3) { diff --git a/libavformat/vpcc.c b/libavformat/vpcc.c index 6601219e6a..d2989c55de 100644 --- a/libavformat/vpcc.c +++ b/libavformat/vpcc.c @@ -51,7 +51,8 @@ static int get_vpx_chroma_subsampling(void *logctx, return VPX_SUBSAMPLING_444; } } - av_log(logctx, AV_LOG_ERROR, "Unsupported pixel format (%d)\n", pixel_format); + if (logctx) + av_log(logctx, AV_LOG_ERROR, "Unsupported pixel format (%d)\n", pixel_format); return -1; } @@ -59,8 +60,9 @@ static int get_bit_depth(void *logctx, enum AVPixelFormat pixel_format) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pixel_format); if (desc == NULL) { - av_log(logctx, AV_LOG_ERROR, "Unsupported pixel format (%d)\n", - pixel_format); + if (logctx) + av_log(logctx, AV_LOG_ERROR, "Unsupported pixel format (%d)\n", + pixel_format); return -1; } return desc->comp[0].depth; @@ -187,7 +189,7 @@ int ff_isom_get_vpcc_features(void *logctx, const AVCodecParameters *par, } } - if (profile == AV_PROFILE_UNKNOWN || !bit_depth) + if ((profile == AV_PROFILE_UNKNOWN || !bit_depth) && logctx) av_log(logctx, AV_LOG_WARNING, "VP9 profile and/or bit depth not set or could not be derived\n"); vpcc->profile = profile;