Don't use downstream buffer allocation.
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Thu, 6 Oct 2011 20:04:37 +0000 (16:04 -0400)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Thu, 8 Dec 2011 13:58:58 +0000 (14:58 +0100)
With the new video/x-surface abstraction, we can't rely on having a VA
specific sink downstream. Also, there was no particular reason to do that.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
gst/vaapi/gstvaapidecode.c
gst/vaapi/gstvaapisink.c

index 716c352..f267d0f 100644 (file)
@@ -209,17 +209,12 @@ gst_vaapidecode_step(GstVaapiDecode *decode)
             decode
         );
 
-        buffer = NULL;
-        ret = gst_pad_alloc_buffer(
-            decode->srcpad,
-            0, 0,
-            GST_PAD_CAPS(decode->srcpad),
-            &buffer
-        );
-        if (ret != GST_FLOW_OK || !buffer)
+        buffer = gst_vaapi_video_buffer_new(decode->display);
+        if (!buffer)
             goto error_create_buffer;
 
         GST_BUFFER_TIMESTAMP(buffer) = GST_VAAPI_SURFACE_PROXY_TIMESTAMP(proxy);
+        gst_buffer_set_caps(buffer, GST_PAD_CAPS(decode->srcpad));
         gst_vaapi_video_buffer_set_surface_proxy(
             GST_VAAPI_VIDEO_BUFFER(buffer),
             proxy
index 067e2f0..c68a3ae 100644 (file)
@@ -482,52 +482,6 @@ gst_vaapisink_set_caps(GstBaseSink *base_sink, GstCaps *caps)
     return TRUE;
 }
 
-static GstFlowReturn
-gst_vaapisink_buffer_alloc(
-    GstBaseSink *base_sink,
-    guint64      offset,
-    guint        size,
-    GstCaps     *caps,
-    GstBuffer  **pout_buffer
-)
-{
-    GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
-    GstStructure *structure;
-    GstBuffer *buffer;
-
-    if (!gst_vaapi_ensure_display(sink, &sink->display))
-        goto error_ensure_display;
-
-    structure = gst_caps_get_structure(caps, 0);
-    if (!gst_structure_has_name(structure, GST_VAAPI_SURFACE_CAPS_NAME))
-        goto error_invalid_caps;
-
-    buffer = gst_vaapi_video_buffer_new(sink->display);
-    if (!buffer)
-        goto error_create_buffer;
-
-    gst_buffer_set_caps(buffer, caps);
-    *pout_buffer = buffer;
-    return GST_FLOW_OK;
-
-    /* ERRORS */
-error_ensure_display:
-    {
-        GST_ERROR("failed to ensure display");
-        return GST_FLOW_UNEXPECTED;
-    }
-error_invalid_caps:
-    {
-        GST_ERROR("failed to validate input caps");
-        return GST_FLOW_UNEXPECTED;
-    }
-error_create_buffer:
-    {
-        GST_ERROR("failed to create video buffer");
-        return GST_FLOW_UNEXPECTED;
-    }
-}
-
 #if USE_VAAPISINK_GLX
 static void
 render_background(GstVaapiSink *sink)
@@ -837,7 +791,6 @@ gst_vaapisink_class_init(GstVaapiSinkClass *klass)
     basesink_class->start        = gst_vaapisink_start;
     basesink_class->stop         = gst_vaapisink_stop;
     basesink_class->set_caps     = gst_vaapisink_set_caps;
-    basesink_class->buffer_alloc = gst_vaapisink_buffer_alloc;
     basesink_class->preroll      = gst_vaapisink_show_frame;
     basesink_class->render       = gst_vaapisink_show_frame;
     basesink_class->query        = gst_vaapisink_query;