From ae94f329a9b1296bf740e85c888910f8483e21cd Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 15 Jul 2016 12:01:30 +0200 Subject: vo_opengl: hwdec: reset hw_subfmt field In theory, mp_image_params with hw_subfmt set to non-0 if imgfmt is not a hwaccel format is invalid. (It worked fine because nothing checks this yet.) --- video/out/opengl/hwdec_d3d11egl.c | 1 + video/out/opengl/hwdec_d3d11eglrgb.c | 1 + video/out/opengl/hwdec_dxva2egl.c | 1 + video/out/opengl/hwdec_dxva2gldx.c | 1 + video/out/opengl/hwdec_osx.c | 1 + video/out/opengl/hwdec_vaegl.c | 1 + video/out/opengl/hwdec_vaglx.c | 1 + video/out/opengl/hwdec_vdpau.c | 2 ++ 8 files changed, 9 insertions(+) diff --git a/video/out/opengl/hwdec_d3d11egl.c b/video/out/opengl/hwdec_d3d11egl.c index 07333c372e..4360286064 100644 --- a/video/out/opengl/hwdec_d3d11egl.c +++ b/video/out/opengl/hwdec_d3d11egl.c @@ -255,6 +255,7 @@ static int reinit(struct gl_hwdec *hw, struct mp_image_params *params) goto fail; params->imgfmt = params->hw_subfmt; + params->hw_subfmt = 0; for (int n = 0; n < num_planes; n++) { gl->ActiveTexture(GL_TEXTURE0 + texunits + n); diff --git a/video/out/opengl/hwdec_d3d11eglrgb.c b/video/out/opengl/hwdec_d3d11eglrgb.c index be8057cde3..d43b1f503b 100644 --- a/video/out/opengl/hwdec_d3d11eglrgb.c +++ b/video/out/opengl/hwdec_d3d11eglrgb.c @@ -190,6 +190,7 @@ static int reinit(struct gl_hwdec *hw, struct mp_image_params *params) gl->BindTexture(GL_TEXTURE_2D, 0); params->imgfmt = IMGFMT_RGB0; + params->hw_subfmt = 0; return 0; } diff --git a/video/out/opengl/hwdec_dxva2egl.c b/video/out/opengl/hwdec_dxva2egl.c index f206b962d1..aa06c43fbe 100644 --- a/video/out/opengl/hwdec_dxva2egl.c +++ b/video/out/opengl/hwdec_dxva2egl.c @@ -273,6 +273,7 @@ static int reinit(struct gl_hwdec *hw, struct mp_image_params *params) gl->BindTexture(GL_TEXTURE_2D, 0); params->imgfmt = IMGFMT_RGB0; + params->hw_subfmt = 0; return 0; fail: destroy_textures(hw); diff --git a/video/out/opengl/hwdec_dxva2gldx.c b/video/out/opengl/hwdec_dxva2gldx.c index 4cd8c1c0b2..c0bca283bb 100644 --- a/video/out/opengl/hwdec_dxva2gldx.c +++ b/video/out/opengl/hwdec_dxva2gldx.c @@ -160,6 +160,7 @@ static int reinit(struct gl_hwdec *hw, struct mp_image_params *params) } params->imgfmt = SHARED_SURFACE_MPFMT; + params->hw_subfmt = 0; return 0; fail: diff --git a/video/out/opengl/hwdec_osx.c b/video/out/opengl/hwdec_osx.c index 17399a80f4..677661c09e 100644 --- a/video/out/opengl/hwdec_osx.c +++ b/video/out/opengl/hwdec_osx.c @@ -193,6 +193,7 @@ static int reinit(struct gl_hwdec *hw, struct mp_image_params *params) } params->imgfmt = f->imgfmt; + params->hw_subfmt = 0; return 0; } diff --git a/video/out/opengl/hwdec_vaegl.c b/video/out/opengl/hwdec_vaegl.c index 1de5969bc4..85f994ec5e 100644 --- a/video/out/opengl/hwdec_vaegl.c +++ b/video/out/opengl/hwdec_vaegl.c @@ -262,6 +262,7 @@ static int reinit(struct gl_hwdec *hw, struct mp_image_params *params) MP_VERBOSE(p, "hw format: %s\n", mp_imgfmt_to_name(p->current_mpfmt)); params->imgfmt = p->current_mpfmt; + params->hw_subfmt = 0; return 0; } diff --git a/video/out/opengl/hwdec_vaglx.c b/video/out/opengl/hwdec_vaglx.c index 0400604067..ac817d79c4 100644 --- a/video/out/opengl/hwdec_vaglx.c +++ b/video/out/opengl/hwdec_vaglx.c @@ -167,6 +167,7 @@ static int reinit(struct gl_hwdec *hw, struct mp_image_params *params) gl->BindTexture(GL_TEXTURE_2D, 0); params->imgfmt = IMGFMT_RGB0; + params->hw_subfmt = 0; return 0; } diff --git a/video/out/opengl/hwdec_vdpau.c b/video/out/opengl/hwdec_vdpau.c index 83f664a756..f9d101c636 100644 --- a/video/out/opengl/hwdec_vdpau.c +++ b/video/out/opengl/hwdec_vdpau.c @@ -173,6 +173,7 @@ static int reinit(struct gl_hwdec *hw, struct mp_image_params *params) if (p->direct_mode) { params->imgfmt = IMGFMT_NV12; + params->hw_subfmt = 0; } else { vdp_st = vdp->output_surface_create(p->ctx->vdp_device, VDP_RGBA_FORMAT_B8G8R8A8, @@ -188,6 +189,7 @@ static int reinit(struct gl_hwdec *hw, struct mp_image_params *params) gl->VDPAUSurfaceAccessNV(p->vdpgl_surface, GL_READ_ONLY); params->imgfmt = IMGFMT_RGB0; + params->hw_subfmt = 0; } gl_check_error(gl, hw->log, "After initializing vdpau OpenGL interop"); -- cgit v1.2.3