Commit 89a9a693 authored by Nicolas Dufresne's avatar Nicolas Dufresne Committed by Rob Clark

gst-decoder.c: advertise support for GstVideoMeta

This way, upstream decoder the produce frame with special strides and
offsets won't have to copy the frames. This also ensure DMABuf can be
delivered to kmscube.
Signed-off-by: 's avatarNicolas Dufresne <nicolas@ndufresne.ca>
parent f7dd2bc3
......@@ -234,11 +234,26 @@ bus_watch_cb(GstBus *bus, GstMessage *msg, gpointer user_data)
return TRUE;
}
static GstPadProbeReturn
appsink_query_cb(GstPad *pad G_GNUC_UNUSED, GstPadProbeInfo *info,
gpointer user_data G_GNUC_UNUSED)
{
GstQuery *query = info->data;
if (GST_QUERY_TYPE (query) != GST_QUERY_ALLOCATION)
return GST_PAD_PROBE_OK;
gst_query_add_allocation_meta(query, GST_VIDEO_META_API_TYPE, NULL);
return GST_PAD_PROBE_HANDLED;
}
struct decoder *
video_init(const struct egl *egl, const struct gbm *gbm, const char *filename)
{
struct decoder *dec;
GstElement *src, *decodebin;
GstPad *pad;
GstBus *bus;
dec = calloc(1, sizeof(*dec));
......@@ -253,6 +268,16 @@ video_init(const struct egl *egl, const struct gbm *gbm, const char *filename)
dec->sink = gst_bin_get_by_name(GST_BIN(dec->pipeline), "sink");
/* Implement the allocation query using a pad probe. This probe will
* adverstize support for GstVideoMeta, which avoid hardware accelerated
* decoder that produce special strides and offsets from having to
* copy the buffers.
*/
pad = gst_element_get_static_pad(dec->sink, "sink");
gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM,
appsink_query_cb, NULL, NULL);
gst_object_unref(pad);
src = gst_bin_get_by_name(GST_BIN(dec->pipeline), "src");
g_object_set(G_OBJECT(src), "location", filename, NULL);
gst_object_unref(src);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment