From 57831d52dc0c8d22feb497d06ac934192b5b907b Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 24 Sep 2015 23:48:57 +0200 Subject: vo_opengl: actually set hardware decoder mapped texture format Surfaces used by hardware decoding formats can be mapped exactly like a specific software pixel format, e.g. RGBA or NV12. p->image_params is supposed to be set to this format, but it wasn't. (How did this ever work?) Also, setting params->imgfmt in the hwdec interop drivers is pointless and redundant. (Change them to asserts, because why not.) --- video/out/opengl/hwdec_vaglx.c | 2 +- video/out/opengl/hwdec_vda.c | 4 +++- video/out/opengl/hwdec_vdpau.c | 2 +- video/out/opengl/video.c | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/video/out/opengl/hwdec_vaglx.c b/video/out/opengl/hwdec_vaglx.c index ad7496b9be..6ad269ae3d 100644 --- a/video/out/opengl/hwdec_vaglx.c +++ b/video/out/opengl/hwdec_vaglx.c @@ -137,7 +137,7 @@ static int reinit(struct gl_hwdec *hw, struct mp_image_params *params) destroy_texture(hw); - params->imgfmt = hw->driver->imgfmt; + assert(params->imgfmt == hw->driver->imgfmt); gl->GenTextures(1, &p->gl_texture); gl->BindTexture(GL_TEXTURE_2D, p->gl_texture); diff --git a/video/out/opengl/hwdec_vda.c b/video/out/opengl/hwdec_vda.c index 271c8b7941..e921df2f80 100644 --- a/video/out/opengl/hwdec_vda.c +++ b/video/out/opengl/hwdec_vda.c @@ -19,6 +19,8 @@ // Note: handles both VDA and VideoToolbox +#include + #include #include #include @@ -174,7 +176,7 @@ static int create(struct gl_hwdec *hw) static int reinit(struct gl_hwdec *hw, struct mp_image_params *params) { - params->imgfmt = hw->driver->imgfmt; + assert(params->imgfmt == hw->driver->imgfmt); return 0; } diff --git a/video/out/opengl/hwdec_vdpau.c b/video/out/opengl/hwdec_vdpau.c index ac1b7bef05..b9320ba842 100644 --- a/video/out/opengl/hwdec_vdpau.c +++ b/video/out/opengl/hwdec_vdpau.c @@ -134,7 +134,7 @@ static int reinit(struct gl_hwdec *hw, struct mp_image_params *params) destroy_objects(hw); - params->imgfmt = hw->driver->imgfmt; + assert(params->imgfmt == hw->driver->imgfmt); p->image_params = *params; if (mp_vdpau_handle_preemption(p->ctx, &p->preemption_counter) < 1) diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c index 291e98d0a8..10db8f88b6 100644 --- a/video/out/opengl/video.c +++ b/video/out/opengl/video.c @@ -691,6 +691,7 @@ static void init_video(struct gl_video *p) if (p->hwdec->driver->reinit(p->hwdec, &p->image_params) < 0) MP_ERR(p, "Initializing texture for hardware decoding failed.\n"); init_format(p->image_params.imgfmt, p); + p->image_params.imgfmt = p->image_desc.id; p->gl_target = p->hwdec->gl_texture_target; } -- cgit v1.2.3