diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2015-08-20 17:27:34 -0700 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2015-08-22 22:15:36 -0700 |
commit | 206638c4398a58f373f069ae2150a056458cc592 (patch) | |
tree | e75759b9110264ea3033266d4905233344fdae6a /ext/gl | |
parent | 98457cb6ea7fc22834603546baef07264bffa296 (diff) | |
download | gstreamer-plugins-bad-206638c4398a58f373f069ae2150a056458cc592.tar.gz |
gl: Let base transform relay the meta api for us
During allocation query, when this element is not passthrough, it must
relay the overlay compostion meta and it's parameters. Fortunatly, base
transform can do this for us.
https://bugzilla.gnome.org/show_bug.cgi?id=753850
Diffstat (limited to 'ext/gl')
-rw-r--r-- | ext/gl/gstglcolorconvertelement.c | 12 | ||||
-rw-r--r-- | ext/gl/gstgluploadelement.c | 35 |
2 files changed, 27 insertions, 20 deletions
diff --git a/ext/gl/gstglcolorconvertelement.c b/ext/gl/gstglcolorconvertelement.c index 5a4296878..09e739d87 100644 --- a/ext/gl/gstglcolorconvertelement.c +++ b/ext/gl/gstglcolorconvertelement.c @@ -41,6 +41,9 @@ static GstCaps *gst_gl_color_convert_element_transform_caps (GstBaseTransform * bt, GstPadDirection direction, GstCaps * caps, GstCaps * filter); static gboolean gst_gl_color_convert_element_get_unit_size (GstBaseTransform * trans, GstCaps * caps, gsize * size); +static gboolean +gst_gl_color_convert_element_filter_meta (GstBaseTransform * trans, + GstQuery * query, GType api, const GstStructure * params); static gboolean gst_gl_color_convert_element_decide_allocation (GstBaseTransform * trans, GstQuery * query); static GstFlowReturn @@ -92,6 +95,7 @@ gst_gl_color_convert_element_class_init (GstGLColorConvertElementClass * klass) bt_class->transform_caps = gst_gl_color_convert_element_transform_caps; bt_class->set_caps = gst_gl_color_convert_element_set_caps; bt_class->get_unit_size = gst_gl_color_convert_element_get_unit_size; + bt_class->filter_meta = gst_gl_color_convert_element_filter_meta; bt_class->decide_allocation = gst_gl_color_convert_element_decide_allocation; bt_class->prepare_output_buffer = gst_gl_color_convert_element_prepare_output_buffer; @@ -160,6 +164,14 @@ gst_gl_color_convert_element_get_unit_size (GstBaseTransform * trans, } static gboolean +gst_gl_color_convert_element_filter_meta (GstBaseTransform * trans, + GstQuery * query, GType api, const GstStructure * params) +{ + /* propose all metadata upstream */ + return TRUE; +} + +static gboolean gst_gl_color_convert_element_decide_allocation (GstBaseTransform * trans, GstQuery * query) { diff --git a/ext/gl/gstgluploadelement.c b/ext/gl/gstgluploadelement.c index 0b35ec9c5..bebb6f3e5 100644 --- a/ext/gl/gstgluploadelement.c +++ b/ext/gl/gstgluploadelement.c @@ -45,6 +45,8 @@ 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, GstCaps * in_caps, GstCaps * out_caps); +static gboolean gst_gl_upload_element_filter_meta (GstBaseTransform * trans, + GstQuery * query, GType api, const GstStructure * params); static gboolean _gst_gl_upload_element_propose_allocation (GstBaseTransform * bt, GstQuery * decide_query, GstQuery * query); static gboolean _gst_gl_upload_element_decide_allocation (GstBaseTransform * @@ -72,6 +74,7 @@ gst_gl_upload_element_class_init (GstGLUploadElementClass * klass) 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; bt_class->propose_allocation = _gst_gl_upload_element_propose_allocation; bt_class->decide_allocation = _gst_gl_upload_element_decide_allocation; bt_class->get_unit_size = gst_gl_upload_element_get_unit_size; @@ -140,36 +143,28 @@ _gst_gl_upload_element_transform_caps (GstBaseTransform * bt, } static gboolean +gst_gl_upload_element_filter_meta (GstBaseTransform * trans, GstQuery * query, + GType api, const GstStructure * params) +{ + /* propose all metadata upstream */ + return TRUE; +} + +static gboolean _gst_gl_upload_element_propose_allocation (GstBaseTransform * bt, GstQuery * decide_query, GstQuery * query) { - guint alloc_index; - gboolean alloc_has_overlay_meta; GstGLUploadElement *upload = GST_GL_UPLOAD_ELEMENT (bt); + gboolean ret; if (!upload->upload) return FALSE; - alloc_has_overlay_meta = - gst_query_find_allocation_meta (decide_query, - GST_VIDEO_OVERLAY_COMPOSITION_META_API_TYPE, &alloc_index); - - if (alloc_has_overlay_meta) { - const GstStructure *params; - GST_DEBUG ("adding allocation meta in upload for textoverlay"); - - /* read window size from decide_query */ - gst_query_parse_nth_allocation_meta (decide_query, alloc_index, ¶ms); - - /* it does not matter if params are NULL (no known window size), forward - * the meta in any case */ - gst_query_add_allocation_meta (query, - GST_VIDEO_OVERLAY_COMPOSITION_META_API_TYPE, params); - } - + ret = GST_BASE_TRANSFORM_CLASS (parent_class)->propose_allocation (bt, + decide_query, query); gst_gl_upload_propose_allocation (upload->upload, decide_query, query); - return TRUE; + return ret; } static gboolean |