diff options
author | wm4 <wm4@nowhere> | 2016-06-08 22:16:32 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-06-08 22:16:32 +0200 |
commit | 4123c9642d2cef03963f6802e32b9748c362c116 (patch) | |
tree | fef1d3f9a144f2f1667d2c378775e7bc93091b77 /video/out/opengl | |
parent | ff37d7efeca2a53819104039348dfbe39c4aca98 (diff) |
vo_opengl: hwdec_vdpau: remove minor code duplication
Move unmap() to the top of the function, and replace some duplicated
code with a call to it.
Diffstat (limited to 'video/out/opengl')
-rw-r--r-- | video/out/opengl/hwdec_vdpau.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/video/out/opengl/hwdec_vdpau.c b/video/out/opengl/hwdec_vdpau.c index f0bc4a6cdd..e1bccd7771 100644 --- a/video/out/opengl/hwdec_vdpau.c +++ b/video/out/opengl/hwdec_vdpau.c @@ -44,6 +44,16 @@ struct priv { bool mapped; }; +static void unmap(struct gl_hwdec *hw) +{ + struct priv *p = hw->priv; + GL *gl = hw->gl; + + if (p->mapped) + gl->VDPAUUnmapSurfacesNV(1, &p->vdpgl_surface); + p->mapped = false; +} + static void mark_vdpau_objects_uninitialized(struct gl_hwdec *hw) { struct priv *p = hw->priv; @@ -59,9 +69,7 @@ static void destroy_objects(struct gl_hwdec *hw) struct vdp_functions *vdp = &p->ctx->vdp; VdpStatus vdp_st; - if (p->mapped) - gl->VDPAUUnmapSurfacesNV(1, &p->vdpgl_surface); - p->mapped = false; + unmap(hw); if (p->vdpgl_surface) gl->VDPAUUnregisterSurfaceNV(p->vdpgl_surface); @@ -206,16 +214,6 @@ static int map_frame(struct gl_hwdec *hw, struct mp_image *hw_image, return 0; } -static void unmap(struct gl_hwdec *hw) -{ - struct priv *p = hw->priv; - GL *gl = hw->gl; - - if (p->mapped) - gl->VDPAUUnmapSurfacesNV(1, &p->vdpgl_surface); - p->mapped = false; -} - const struct gl_hwdec_driver gl_hwdec_vdpau = { .name = "vdpau-glx", .api = HWDEC_VDPAU, |