X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=ffmpeg_vdpau.c;h=b05e557613e2a7545066396e32f9e63c06b83191;hb=e59bd089868603c09faa2893fe68b426c07b46b6;hp=14a3773e88823912eea35b1b2fc5676176fa6562;hpb=f346e37aa27475b4d2153f3606c7d47847854de3;p=ffmpeg diff --git a/ffmpeg_vdpau.c b/ffmpeg_vdpau.c index 14a3773e888..b05e557613e 100644 --- a/ffmpeg_vdpau.c +++ b/ffmpeg_vdpau.c @@ -100,9 +100,14 @@ static int vdpau_get_buffer(AVCodecContext *s, AVFrame *frame, int flags) VDPAUContext *ctx = ist->hwaccel_ctx; VdpVideoSurface *surface; VdpStatus err; + VdpChromaType chroma; + uint32_t width, height; av_assert0(frame->format == AV_PIX_FMT_VDPAU); + if (av_vdpau_get_surface_parameters(s, &chroma, &width, &height)) + return AVERROR(ENOSYS); + surface = av_malloc(sizeof(*surface)); if (!surface) return AVERROR(ENOMEM); @@ -118,8 +123,8 @@ static int vdpau_get_buffer(AVCodecContext *s, AVFrame *frame, int flags) // properly we should keep a pool of surfaces instead of creating // them anew for each frame, but since we don't care about speed // much in this code, we don't bother - err = ctx->video_surface_create(ctx->device, VDP_CHROMA_TYPE_420, - frame->width, frame->height, surface); + err = ctx->video_surface_create(ctx->device, chroma, width, height, + surface); if (err != VDP_STATUS_OK) { av_log(NULL, AV_LOG_ERROR, "Error allocating a VDPAU video surface: %s\n", ctx->get_error_string(err));