aboutsummaryrefslogtreecommitdiffstats
path: root/avconv_vdpau.c
diff options
context:
space:
mode:
authorRémi Denis-Courmont <remi@remlab.net>2014-12-19 19:15:11 +0200
committerAnton Khirnov <anton@khirnov.net>2014-12-25 20:47:49 +0100
commit1f9237f2ac46dfbed1bfa1f4f0f1314c2a1d62ec (patch)
tree063858d0ee0b03e08224b4864ca97fe90d937320 /avconv_vdpau.c
parentebd5320afd42d4315851f3e0ca7f5d4a6300eb68 (diff)
downloadffmpeg-1f9237f2ac46dfbed1bfa1f4f0f1314c2a1d62ec.tar.gz
avconv_vdpau: allocate video surface of VDPAU-specified size
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net> Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'avconv_vdpau.c')
-rw-r--r--avconv_vdpau.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/avconv_vdpau.c b/avconv_vdpau.c
index 37b50f619c..1bd1f48190 100644
--- a/avconv_vdpau.c
+++ b/avconv_vdpau.c
@@ -90,9 +90,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);
@@ -108,8 +113,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));