Browse code

Merge commit '1f9237f2ac46dfbed1bfa1f4f0f1314c2a1d62ec'

* commit '1f9237f2ac46dfbed1bfa1f4f0f1314c2a1d62ec':
avconv_vdpau: allocate video surface of VDPAU-specified size

Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2014/12/27 21:25:52
Showing 1 changed files
... ...
@@ -100,9 +100,14 @@ static int vdpau_get_buffer(AVCodecContext *s, AVFrame *frame, int flags)
100 100
     VDPAUContext        *ctx = ist->hwaccel_ctx;
101 101
     VdpVideoSurface *surface;
102 102
     VdpStatus err;
103
+    VdpChromaType chroma;
104
+    uint32_t width, height;
103 105
 
104 106
     av_assert0(frame->format == AV_PIX_FMT_VDPAU);
105 107
 
108
+    if (av_vdpau_get_surface_parameters(s, &chroma, &width, &height))
109
+        return AVERROR(ENOSYS);
110
+
106 111
     surface = av_malloc(sizeof(*surface));
107 112
     if (!surface)
108 113
         return AVERROR(ENOMEM);
... ...
@@ -118,8 +123,8 @@ static int vdpau_get_buffer(AVCodecContext *s, AVFrame *frame, int flags)
118 118
     // properly we should keep a pool of surfaces instead of creating
119 119
     // them anew for each frame, but since we don't care about speed
120 120
     // much in this code, we don't bother
121
-    err = ctx->video_surface_create(ctx->device, VDP_CHROMA_TYPE_420,
122
-                                    frame->width, frame->height, surface);
121
+    err = ctx->video_surface_create(ctx->device, chroma, width, height,
122
+                                    surface);
123 123
     if (err != VDP_STATUS_OK) {
124 124
         av_log(NULL, AV_LOG_ERROR, "Error allocating a VDPAU video surface: %s\n",
125 125
                ctx->get_error_string(err));