From b170d1a9827d4a944142c266798d2e5266489362 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 6 Oct 2011 16:04:37 -0400 Subject: [PATCH] Don't use downstream buffer allocation. 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 --- gst/vaapi/gstvaapidecode.c | 11 +++------ gst/vaapi/gstvaapisink.c | 47 -------------------------------------- 2 files changed, 3 insertions(+), 55 deletions(-) diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index 716c3525a4..f267d0ff48 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -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 diff --git a/gst/vaapi/gstvaapisink.c b/gst/vaapi/gstvaapisink.c index 067e2f0ec6..c68a3ae63b 100644 --- a/gst/vaapi/gstvaapisink.c +++ b/gst/vaapi/gstvaapisink.c @@ -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;