diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2018-02-27 16:20:15 -0500 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2018-02-27 17:51:02 -0500 |
commit | fde55003ca58ab6114bb903969674da8fe5f3f74 (patch) | |
tree | cd09a20b6b8b292d52e12c837d7220409338af64 /gst/vaapi/gstvaapipostproc.c | |
parent | e82fafc482a6c9136179f2c363cd7189f8d23e3a (diff) |
postproc: Copy meta data from input to output
This will ensure that meta data without memory tags will be copied. This
was noticed when testing ROI.
https://bugzilla.gnome.org/show_bug.cgi?id=768248
Diffstat (limited to 'gst/vaapi/gstvaapipostproc.c')
-rw-r--r-- | gst/vaapi/gstvaapipostproc.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/gst/vaapi/gstvaapipostproc.c b/gst/vaapi/gstvaapipostproc.c index 8ad3f286..d5a0557c 100644 --- a/gst/vaapi/gstvaapipostproc.c +++ b/gst/vaapi/gstvaapipostproc.c @@ -1260,6 +1260,13 @@ gst_vaapipostproc_transform_size (GstBaseTransform * trans, return TRUE; } +static gboolean +gst_vaapipostproc_transform_meta (GstBaseTransform * trans, GstBuffer * outbuf, + GstMeta * meta, GstBuffer * inbuf) +{ + return TRUE; +} + static GstFlowReturn gst_vaapipostproc_transform (GstBaseTransform * trans, GstBuffer * inbuf, GstBuffer * outbuf) @@ -1325,6 +1332,7 @@ gst_vaapipostproc_prepare_output_buffer (GstBaseTransform * trans, GstBuffer * inbuf, GstBuffer ** outbuf_ptr) { GstVaapiPostproc *const postproc = GST_VAAPIPOSTPROC (trans); + GstBaseTransformClass *bclass = GST_BASE_TRANSFORM_GET_CLASS (trans); if (gst_base_transform_is_passthrough (trans)) { *outbuf_ptr = inbuf; @@ -1337,7 +1345,18 @@ gst_vaapipostproc_prepare_output_buffer (GstBaseTransform * trans, *outbuf_ptr = create_output_buffer (postproc); } - return *outbuf_ptr ? GST_FLOW_OK : GST_FLOW_ERROR; + if (!*outbuf_ptr) + return GST_FLOW_ERROR; + + if (inbuf != *outbuf_ptr && bclass->copy_metadata) { + if (!bclass->copy_metadata (trans, inbuf, *outbuf_ptr)) { + /* something failed, post a warning */ + GST_ELEMENT_WARNING (trans, STREAM, NOT_IMPLEMENTED, + ("could not copy metadata"), (NULL)); + } + } + + return GST_FLOW_OK; } static gboolean @@ -1673,6 +1692,7 @@ gst_vaapipostproc_class_init (GstVaapiPostprocClass * klass) trans_class->fixate_caps = gst_vaapipostproc_fixate_caps; trans_class->transform_caps = gst_vaapipostproc_transform_caps; trans_class->transform_size = gst_vaapipostproc_transform_size; + trans_class->transform_meta = gst_vaapipostproc_transform_meta; trans_class->transform = gst_vaapipostproc_transform; trans_class->set_caps = gst_vaapipostproc_set_caps; trans_class->query = gst_vaapipostproc_query; |