vda, videotoolbox: guard against unexpected pixel format

Should not happen, but since we don't control decoder video surface
allocation, anything could happen, and the code should be able to deal
with it. Untested.
This commit is contained in:
wm4 2015-08-23 21:41:54 +02:00
parent 63dc0085c8
commit 3bbcbc15a5
1 changed files with 4 additions and 0 deletions

View File

@ -96,6 +96,10 @@ static struct mp_image *download_image(struct mp_hwdec_ctx *ctx,
size_t height = CVPixelBufferGetHeight(pbuf);
uint32_t cvpixfmt = CVPixelBufferGetPixelFormatType(pbuf);
struct vda_format *f = vda_get_gl_format(cvpixfmt);
if (!f) {
CVPixelBufferUnlockBaseAddress(pbuf, 0);
return NULL;
}
struct mp_image img = {0};
mp_image_setfmt(&img, f->imgfmt);