]> git.sesse.net Git - ffmpeg/commitdiff
utils: add workaround for AVHWAccel in ff_get_buffer compat code
authorJanne Grunau <janne-libav@jannau.net>
Mon, 25 Mar 2013 16:28:37 +0000 (17:28 +0100)
committerJanne Grunau <janne-libav@jannau.net>
Tue, 26 Mar 2013 18:44:50 +0000 (19:44 +0100)
Since c977039e585bfff28ecc037ef827c6c3d1ed88aa plane count for
PIX_FMT_HWACCEL pixel formats is 0 instead of 1. The created dummy
AVBuffers are still bogus since AVFrame does not hold frame data when
AVHWAccels are used.

libavcodec/utils.c

index e64ca11d66d0f2f065e7417c9de8e3dc5875ccc1..2b63759b90147e54fa52a7bcd10b96664e46e871 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;