0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-19 19:42:24 +02:00

vo_vdpau: check maximum video size

Check the maximum size of video surfaces, and refuse initialization if
the video is too large for them.

Maybe we could do something more sophisticated, like inserting a
software scaler. On the other hand, this would have a very questionable
benefit, as it would be guaranteed to be too slow.
This commit is contained in:
wm4 2015-06-04 22:29:21 +02:00
parent c06cd1b993
commit af58bfb62b
2 changed files with 21 additions and 0 deletions

View File

@ -412,10 +412,29 @@ static bool status_ok(struct vo *vo)
static int reconfig(struct vo *vo, struct mp_image_params *params, int flags)
{
struct vdpctx *vc = vo->priv;
struct vdp_functions *vdp = vc->vdp;
VdpStatus vdp_st;
if (!check_preemption(vo))
return -1;
VdpChromaType chroma_type = VDP_CHROMA_TYPE_420;
mp_vdpau_get_format(params->imgfmt, &chroma_type, NULL);
VdpBool ok;
uint32_t max_w, max_h;
vdp_st = vdp->video_surface_query_capabilities(vc->vdp_device, chroma_type,
&ok, &max_w, &max_h);
CHECK_VDP_ERROR(vo, "Error when calling vdp_video_surface_query_capabilities");
if (!ok)
return -1;
if (params->w > max_w || params->h > max_h) {
if (ok)
MP_ERR(vo, "Video too large for vdpau.\n");
return -1;
}
vc->image_format = params->imgfmt;
vc->vid_width = params->w;
vc->vid_height = params->h;

View File

@ -45,3 +45,5 @@ VDP_FUNCTION(VdpVideoSurfaceDestroy, VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, video_su
VDP_FUNCTION(VdpVideoSurfacePutBitsYCbCr, VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR, video_surface_put_bits_y_cb_cr)
VDP_FUNCTION(VdpVideoSurfaceGetBitsYCbCr, VDP_FUNC_ID_VIDEO_SURFACE_GET_BITS_Y_CB_CR, video_surface_get_bits_y_cb_cr)
VDP_FUNCTION(VdpVideoSurfaceGetParameters, VDP_FUNC_ID_VIDEO_SURFACE_GET_PARAMETERS, video_surface_get_parameters)
VDP_FUNCTION(VdpVideoSurfaceQueryCapabilities, VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES, video_surface_query_capabilities)
VDP_FUNCTION(VdpOutputSurfaceQueryCapabilities, VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_CAPABILITIES, output_surface_query_capabilities)