summaryrefslogtreecommitdiff
path: root/libavfilter/buffersrc.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-03-16 22:36:56 +0100
committerAnton Khirnov <anton@khirnov.net>2013-03-19 11:12:17 +0100
commitc977039e585bfff28ecc037ef827c6c3d1ed88aa (patch)
tree74aef763803811bb899c9cd856bbdb8da8476978 /libavfilter/buffersrc.c
parent2c328a907978b61949fd20f7c991803174337855 (diff)
lavc, lavfi: fix counting number of planes in AVBufferRef wrappers
Number of planes is not always equal to the number of components even for formats marked with PIX_FMT_PLANAR -- e.g. NV12 has three components in two planes.
Diffstat (limited to 'libavfilter/buffersrc.c')
-rw-r--r--libavfilter/buffersrc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index 65cacf7d85..19419e6d25 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -186,11 +186,11 @@ do { \
if (ctx->outputs[0]->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_w : 0;