Codebase list kmscube / 89a9a69
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: Nicolas Dufresne <nicolas@ndufresne.ca> Nicolas Dufresne authored 7 years ago Rob Clark committed 7 years ago
1 changed file(s) with 25 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
233233 return TRUE;
234234 }
235235
236 static GstPadProbeReturn
237 appsink_query_cb(GstPad *pad G_GNUC_UNUSED, GstPadProbeInfo *info,
238 gpointer user_data G_GNUC_UNUSED)
239 {
240 GstQuery *query = info->data;
241
242 if (GST_QUERY_TYPE (query) != GST_QUERY_ALLOCATION)
243 return GST_PAD_PROBE_OK;
244
245 gst_query_add_allocation_meta(query, GST_VIDEO_META_API_TYPE, NULL);
246
247 return GST_PAD_PROBE_HANDLED;
248 }
249
236250 struct decoder *
237251 video_init(const struct egl *egl, const struct gbm *gbm, const char *filename)
238252 {
239253 struct decoder *dec;
240254 GstElement *src, *decodebin;
255 GstPad *pad;
241256 GstBus *bus;
242257
243258 dec = calloc(1, sizeof(*dec));
251266 dec->pipeline = gst_parse_launch(pipeline, NULL);
252267
253268 dec->sink = gst_bin_get_by_name(GST_BIN(dec->pipeline), "sink");
269
270 /* Implement the allocation query using a pad probe. This probe will
271 * adverstize support for GstVideoMeta, which avoid hardware accelerated
272 * decoder that produce special strides and offsets from having to
273 * copy the buffers.
274 */
275 pad = gst_element_get_static_pad(dec->sink, "sink");
276 gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM,
277 appsink_query_cb, NULL, NULL);
278 gst_object_unref(pad);
254279
255280 src = gst_bin_get_by_name(GST_BIN(dec->pipeline), "src");
256281 g_object_set(G_OBJECT(src), "location", filename, NULL);