summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-02 19:22:45 +0100
committerwm4 <wm4@nowhere>2013-12-02 19:22:45 +0100
commit391035d8574ceef316112779035dc540dba4d264 (patch)
tree769ada924ee80cefea84bdd4961025ea3bc09f63 /video/out
parent6fb020f5de1487484712e7113db0e86dd97481bd (diff)
downloadmpv-391035d8574ceef316112779035dc540dba4d264.tar.bz2
mpv-391035d8574ceef316112779035dc540dba4d264.tar.xz
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.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/gl_video.c5
1 files 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;
}