From a7fe47e49521009e2790e28c286ef199dae0b4f5 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 4 May 2014 10:50:32 +0200 Subject: vdpau: deduplicate video surface upload code This was a minor code duplication between vf_vdpaupp.c and vo_vdpau.c. (In theory, we could always require using vf_vdpaupp with vo_vdpau, but I think it's better if vo_vdpau can work standalone.) --- video/out/vo_vdpau.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'video/out/vo_vdpau.c') diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c index 476353e25e..053eabbe7a 100644 --- a/video/out/vo_vdpau.c +++ b/video/out/vo_vdpau.c @@ -926,9 +926,9 @@ static struct mp_image *filter_image(struct vo *vo, struct mp_image *mpi) struct mp_image *reserved_mpi = NULL; VdpStatus vdp_st; - if (vc->image_format == IMGFMT_VDPAU) { - reserved_mpi = mp_image_new_ref(mpi); - } else if (vc->rgb_mode) { + handle_preemption(vo); + + if (vc->rgb_mode) { reserved_mpi = get_rgb_surface(vo); if (!reserved_mpi) goto end; @@ -942,23 +942,12 @@ static struct mp_image *filter_image(struct vo *vo, struct mp_image *mpi) "output_surface_put_bits_native"); } } else { - reserved_mpi = mp_vdpau_get_video_surface(vc->mpvdp, vc->vdp_chroma_type, - mpi->w, mpi->h); - if (!reserved_mpi) - goto end; - VdpVideoSurface surface = (VdpVideoSurface)(intptr_t)reserved_mpi->planes[3]; - if (handle_preemption(vo) >= 0) { - const void *destdata[3] = {mpi->planes[0], mpi->planes[2], - mpi->planes[1]}; - if (vc->image_format == IMGFMT_NV12) - destdata[1] = destdata[2]; - vdp_st = vdp->video_surface_put_bits_y_cb_cr(surface, - vc->vdp_pixel_format, destdata, mpi->stride); - CHECK_VDP_WARNING(vo, "Error when calling " - "vdp_video_surface_put_bits_y_cb_cr"); - } + reserved_mpi = mp_vdpau_upload_video_surface(vc->mpvdp, mpi); } + if (!reserved_mpi) + goto end; + mp_image_copy_attributes(reserved_mpi, mpi); end: -- cgit v1.2.3