mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
glupload: Use base class metadata copy function
This allow properly copying selected meta, like the composition overlay. Note that output buffer need to be readable, but GlUpload keeps a ref. For now, simply drop GlUpload ref after perform, leaving that ref has no purpose. The method shall be removed in the future. https://bugzilla.gnome.org/show_bug.cgi?id=754047
This commit is contained in:
parent
b06fc679ba
commit
ae6f4a261b
1 changed files with 8 additions and 24 deletions
|
@ -39,8 +39,6 @@ G_DEFINE_TYPE_WITH_CODE (GstGLUploadElement, gst_gl_upload_element,
|
|||
|
||||
static gboolean gst_gl_upload_element_get_unit_size (GstBaseTransform * trans,
|
||||
GstCaps * caps, gsize * size);
|
||||
static gboolean gst_gl_upload_element_query (GstBaseTransform * bt,
|
||||
GstPadDirection direction, GstQuery * query);
|
||||
static GstCaps *_gst_gl_upload_element_transform_caps (GstBaseTransform * bt,
|
||||
GstPadDirection direction, GstCaps * caps, GstCaps * filter);
|
||||
static gboolean _gst_gl_upload_element_set_caps (GstBaseTransform * bt,
|
||||
|
@ -71,7 +69,6 @@ gst_gl_upload_element_class_init (GstGLUploadElementClass * klass)
|
|||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||
GstCaps *upload_caps;
|
||||
|
||||
bt_class->query = gst_gl_upload_element_query;
|
||||
bt_class->transform_caps = _gst_gl_upload_element_transform_caps;
|
||||
bt_class->set_caps = _gst_gl_upload_element_set_caps;
|
||||
bt_class->filter_meta = gst_gl_upload_element_filter_meta;
|
||||
|
@ -199,38 +196,21 @@ _gst_gl_upload_element_set_caps (GstBaseTransform * bt, GstCaps * in_caps,
|
|||
gst_caps_replace (&upload->in_caps, in_caps);
|
||||
gst_caps_replace (&upload->out_caps, out_caps);
|
||||
|
||||
if (upload->upload) {
|
||||
gst_gl_upload_release_buffer (upload->upload);
|
||||
if (upload->upload)
|
||||
return gst_gl_upload_set_caps (upload->upload, in_caps, out_caps);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_gl_upload_element_query (GstBaseTransform * bt, GstPadDirection direction,
|
||||
GstQuery * query)
|
||||
{
|
||||
GstGLUploadElement *upload = GST_GL_UPLOAD_ELEMENT (bt);
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_DRAIN:
|
||||
if (upload->upload)
|
||||
gst_gl_upload_release_buffer (upload->upload);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return GST_BASE_TRANSFORM_CLASS (parent_class)->query (bt, direction, query);
|
||||
}
|
||||
|
||||
GstFlowReturn
|
||||
gst_gl_upload_element_prepare_output_buffer (GstBaseTransform * bt,
|
||||
GstBuffer * buffer, GstBuffer ** outbuf)
|
||||
{
|
||||
GstGLUploadElement *upload = GST_GL_UPLOAD_ELEMENT (bt);
|
||||
GstGLUploadReturn ret;
|
||||
GstBaseTransformClass *bclass;
|
||||
|
||||
bclass = GST_BASE_TRANSFORM_GET_CLASS (bt);
|
||||
|
||||
if (gst_base_transform_is_passthrough (bt)) {
|
||||
*outbuf = buffer;
|
||||
|
@ -241,10 +221,14 @@ gst_gl_upload_element_prepare_output_buffer (GstBaseTransform * bt,
|
|||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
|
||||
ret = gst_gl_upload_perform_with_buffer (upload->upload, buffer, outbuf);
|
||||
/* FIXME Having to release after perform is an aberation */
|
||||
gst_gl_upload_release_buffer (upload->upload);
|
||||
|
||||
/* basetransform doesn't unref if they're the same */
|
||||
if (buffer == *outbuf)
|
||||
gst_buffer_unref (*outbuf);
|
||||
else
|
||||
bclass->copy_metadata (bt, buffer, *outbuf);
|
||||
|
||||
return ret == GST_GL_UPLOAD_DONE ? GST_FLOW_OK : GST_FLOW_ERROR;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue