]> git.sesse.net Git - ffmpeg/blobdiff - avconv_vdpau.c
qsvenc: support more RC methods
[ffmpeg] / avconv_vdpau.c
index 37b50f619cc496ca1a9563f0974274da597770b7..1bd1f481906ce5aedb380f2c7fd2ca1941d1ca5f 100644 (file)
@@ -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));