aboutsummaryrefslogtreecommitdiffhomepage
path: root/video/filter
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2016-06-21 21:40:37 +0200
committerGravatar wm4 <wm4@nowhere>2016-06-21 21:44:13 +0200
commit6f9973618cf7f137f9007d00c86a4949f4b12c71 (patch)
treedfe984ec2910ff20e0f2b8ea3767b981024502ca /video/filter
parentb40d8fdfa3aedb538f60dcb605ef5ca486dcca36 (diff)
vf_vdpaurb: use new common nv12 download code
See previous commit. (The mixing case was never supported, so this has equivalent functionality.) This also implicitly fixes a bug: the old code allocated image data for the cropped surface size only, which means the video_surface_get_bits_y_cb_cr call could write beyond the allocated image memory.
Diffstat (limited to 'video/filter')
-rw-r--r--video/filter/vf_vdpaurb.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/video/filter/vf_vdpaurb.c b/video/filter/vf_vdpaurb.c
index 35c0f9c04d..2e6da79766 100644
--- a/video/filter/vf_vdpaurb.c
+++ b/video/filter/vf_vdpaurb.c
@@ -35,10 +35,7 @@ struct vf_priv_s {
static int filter_ext(struct vf_instance *vf, struct mp_image *mpi)
{
- VdpStatus vdp_st;
struct vf_priv_s *p = vf->priv;
- struct mp_vdpau_ctx *ctx = p->ctx;
- struct vdp_functions *vdp = &ctx->vdp;
if (!mpi) {
return 0;
@@ -56,21 +53,14 @@ static int filter_ext(struct vf_instance *vf, struct mp_image *mpi)
return -1;
}
- struct mp_image *out = vf_alloc_out_image(vf);
- if (!out) {
+ struct mp_hwdec_ctx *hwctx = &p->ctx->hwctx;
+
+ struct mp_image *out = hwctx->download_image(hwctx, mpi, vf->out_pool);
+ if (!out || out->imgfmt != IMGFMT_NV12) {
mp_image_unrefp(&mpi);
+ mp_image_unrefp(&out);
return -1;
}
- mp_image_copy_attributes(out, mpi);
-
- VdpVideoSurface surface = (uintptr_t)mpi->planes[3];
- assert(surface > 0);
-
- vdp_st = vdp->video_surface_get_bits_y_cb_cr(surface,
- VDP_YCBCR_FORMAT_NV12,
- (void * const *)out->planes,
- out->stride);
- CHECK_VDP_WARNING(vf, "Error when calling vdp_output_surface_get_bits_y_cb_cr");
vf_add_output_frame(vf, out);
mp_image_unrefp(&mpi);