From 391035d8574ceef316112779035dc540dba4d264 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 2 Dec 2013 19:22:45 +0100 Subject: gl_video: use hwdec download_image call only if hwdec is active The hwdec driver can be loaded, even if it's not used (e.g. when playing a file with no hardware decoding after one with it enabled). Also, check whether dlimage is NULL. Since this will do call into the native hwdec API, there's a chance a driver could fail doing this, it's better to check the return value, even if this case currently can't happen. --- video/out/gl_video.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 27c3339997..2660dacf7a 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -1699,9 +1699,10 @@ struct mp_image *gl_video_download_image(struct gl_video *p) if (!p->have_image) return NULL; - if (p->hwdec && p->hwdec->driver->download_image) { + if (p->hwdec_active && p->hwdec->driver->download_image) { struct mp_image *dlimage = p->hwdec->driver->download_image(p->hwdec); - mp_image_set_attributes(dlimage, &p->image_params); + if (dlimage) + mp_image_set_attributes(dlimage, &p->image_params); return dlimage; } -- cgit v1.2.3