From: Rémi Denis-Courmont <[email protected]>

---
 avconv_vdpau.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/avconv_vdpau.c b/avconv_vdpau.c
index d62fbce..b04e748 100644
--- a/avconv_vdpau.c
+++ b/avconv_vdpau.c
@@ -89,6 +89,7 @@ static int vdpau_get_buffer(AVCodecContext *s, AVFrame 
*frame, int flags)
     InputStream         *ist = s->opaque;
     VDPAUContext        *ctx = ist->hwaccel_ctx;
     VdpVideoSurface *surface;
+    VdpChromaType        chroma = av_vdpau_get_chroma_type(s);
     VdpStatus err;
 
     av_assert0(frame->format == AV_PIX_FMT_VDPAU);
@@ -108,7 +109,7 @@ 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,
+    err = ctx->video_surface_create(ctx->device, chroma,
                                     frame->width, frame->height, surface);
     if (err != VDP_STATUS_OK) {
         av_log(NULL, AV_LOG_ERROR, "Error allocating a VDPAU video surface: 
%s\n",
@@ -267,6 +268,9 @@ do {
 
     s->hwaccel_context = vdpau_ctx;
 
+    if (av_vdpau_get_chroma_type(s) != VDP_CHROMA_TYPE_420)
+        goto fail;
+
     ctx->get_information_string(&vendor);
     av_log(NULL, AV_LOG_VERBOSE, "Using VDPAU -- %s -- on X11 display %s, "
            "to decode input stream #%d:%d.\n", vendor,
-- 
1.8.1.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to