summaryrefslogtreecommitdiffstats
path: root/video/out/vo_vdpau.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-04 10:50:32 +0200
committerwm4 <wm4@nowhere>2014-05-04 10:51:14 +0200
commita7fe47e49521009e2790e28c286ef199dae0b4f5 (patch)
tree559383a9d598067b6edf0dccae85bfcfd2c09c84 /video/out/vo_vdpau.c
parent94441ed13963356fa25f7e52a12e36387220ebba (diff)
downloadmpv-a7fe47e49521009e2790e28c286ef199dae0b4f5.tar.bz2
mpv-a7fe47e49521009e2790e28c286ef199dae0b4f5.tar.xz
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.)
Diffstat (limited to 'video/out/vo_vdpau.c')
-rw-r--r--video/out/vo_vdpau.c25
1 files changed, 7 insertions, 18 deletions
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: