Commit a6ab9ed5 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '1f9237f2'

* commit '1f9237f2':
  avconv_vdpau: allocate video surface of VDPAU-specified size
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 75173154 1f9237f2
...@@ -100,9 +100,14 @@ static int vdpau_get_buffer(AVCodecContext *s, AVFrame *frame, int flags) ...@@ -100,9 +100,14 @@ static int vdpau_get_buffer(AVCodecContext *s, AVFrame *frame, int flags)
VDPAUContext *ctx = ist->hwaccel_ctx; VDPAUContext *ctx = ist->hwaccel_ctx;
VdpVideoSurface *surface; VdpVideoSurface *surface;
VdpStatus err; VdpStatus err;
VdpChromaType chroma;
uint32_t width, height;
av_assert0(frame->format == AV_PIX_FMT_VDPAU); 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)); surface = av_malloc(sizeof(*surface));
if (!surface) if (!surface)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
...@@ -118,8 +123,8 @@ static int vdpau_get_buffer(AVCodecContext *s, AVFrame *frame, int flags) ...@@ -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 // properly we should keep a pool of surfaces instead of creating
// them anew for each frame, but since we don't care about speed // them anew for each frame, but since we don't care about speed
// much in this code, we don't bother // much in this code, we don't bother
err = ctx->video_surface_create(ctx->device, VDP_CHROMA_TYPE_420, err = ctx->video_surface_create(ctx->device, chroma, width, height,
frame->width, frame->height, surface); surface);
if (err != VDP_STATUS_OK) { if (err != VDP_STATUS_OK) {
av_log(NULL, AV_LOG_ERROR, "Error allocating a VDPAU video surface: %s\n", av_log(NULL, AV_LOG_ERROR, "Error allocating a VDPAU video surface: %s\n",
ctx->get_error_string(err)); ctx->get_error_string(err));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment