gstreamer: Add GstVideoMeta support
GStreamer video-info calculated stride and offset may differ from those used by the camera. For stride and offset mismatch, this patch adds video meta to buffer if downstream supports VideoMeta through allocation query. Otherwise, create a internal VideoPool using the caps, and copy video frame to this system memory. Signed-off-by: Hou Qi <qi.hou@nxp.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
@@ -599,6 +599,43 @@ gst_task_resume(GstTask *task)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !GST_CHECK_VERSION(1, 22, 0)
|
||||
/*
|
||||
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* Library <2002> Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||
* Copyright (C) <2007> David A. Schleef <ds@schleef.org>
|
||||
*/
|
||||
/*
|
||||
* This function has been imported directly from the gstreamer project to
|
||||
* support backwards compatibility and should be removed when the older version
|
||||
* is no longer supported.
|
||||
*/
|
||||
gint gst_video_format_info_extrapolate_stride(const GstVideoFormatInfo *finfo, gint plane, gint stride)
|
||||
{
|
||||
gint estride;
|
||||
gint comp[GST_VIDEO_MAX_COMPONENTS];
|
||||
gint i;
|
||||
|
||||
/* There is nothing to extrapolate on first plane. */
|
||||
if (plane == 0)
|
||||
return stride;
|
||||
|
||||
gst_video_format_info_component(finfo, plane, comp);
|
||||
|
||||
/*
|
||||
* For now, all planar formats have a single component on first plane, but
|
||||
* if there was a planar format with more, we'd have to make a ratio of the
|
||||
* number of component on the first plane against the number of component on
|
||||
* the current plane.
|
||||
*/
|
||||
estride = 0;
|
||||
for (i = 0; i < GST_VIDEO_MAX_COMPONENTS && comp[i] >= 0; i++)
|
||||
estride += GST_VIDEO_FORMAT_INFO_SCALE_WIDTH(finfo, comp[i], stride);
|
||||
|
||||
return estride;
|
||||
}
|
||||
#endif
|
||||
|
||||
G_LOCK_DEFINE_STATIC(cm_singleton_lock);
|
||||
static std::weak_ptr<CameraManager> cm_singleton_ptr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user