summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 4d57865629..e18f42d99a 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -660,11 +660,11 @@ do { \
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
- if (!desc) {
+ planes = av_pix_fmt_count_planes(frame->format);
+ if (!desc || planes <= 0) {
ret = AVERROR(EINVAL);
goto fail;
}
- planes = (desc->flags & PIX_FMT_PLANAR) ? desc->nb_components : 1;
for (i = 0; i < planes; i++) {
int v_shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;