utils: add workaround for AVHWAccel in ff_get_buffer compat code
[ffmpeg.git] / libavcodec / utils.c
index e64ca11..2b63759 100644 (file)
@@ -661,6 +661,10 @@ do {                                                                    \
             const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
 
             planes = av_pix_fmt_count_planes(frame->format);
+            /* workaround for AVHWAccel plane count of 0, buf[0] is used as
+               check for allocated buffers: make libavcodec happy */
+            if (desc && desc->flags & PIX_FMT_HWACCEL)
+                planes = 1;
             if (!desc || planes <= 0) {
                 ret = AVERROR(EINVAL);
                 goto fail;