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 | |
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
-rw-r--r-- | ext/gl/gstglcolorconvertelement.c | 12 | ||||
-rw-r--r-- | ext/gl/gstgluploadelement.c | 35 | ||||
-rw-r--r-- | gst-libs/gst/gl/gstglbasefilter.c | 14 |
3 files changed, 29 insertions, 32 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 diff --git a/gst-libs/gst/gl/gstglbasefilter.c b/gst-libs/gst/gl/gstglbasefilter.c index 68cc114c7..8538644ff 100644 --- a/gst-libs/gst/gl/gstglbasefilter.c +++ b/gst-libs/gst/gl/gstglbasefilter.c @@ -69,8 +69,6 @@ static gboolean gst_gl_base_filter_start (GstBaseTransform * bt); static gboolean gst_gl_base_filter_stop (GstBaseTransform * bt); static gboolean gst_gl_base_filter_decide_allocation (GstBaseTransform * trans, GstQuery * query); -static gboolean gst_gl_base_filter_propose_allocation (GstBaseTransform * trans, - GstQuery * decide_query, GstQuery * query); /* GstGLContextThreadFunc */ static void gst_gl_base_filter_gl_start (GstGLContext * context, gpointer data); @@ -95,8 +93,6 @@ gst_gl_base_filter_class_init (GstGLBaseFilterClass * klass) GST_BASE_TRANSFORM_CLASS (klass)->stop = gst_gl_base_filter_stop; GST_BASE_TRANSFORM_CLASS (klass)->decide_allocation = gst_gl_base_filter_decide_allocation; - GST_BASE_TRANSFORM_CLASS (klass)->propose_allocation = - gst_gl_base_filter_propose_allocation; element_class->set_context = gst_gl_base_filter_set_context; element_class->change_state = gst_gl_base_filter_change_state; @@ -365,7 +361,8 @@ gst_gl_base_filter_decide_allocation (GstBaseTransform * trans, goto error; } - return TRUE; + return GST_BASE_TRANSFORM_CLASS (parent_class)->decide_allocation (trans, + query); context_error: { @@ -381,13 +378,6 @@ error: } } -static gboolean -gst_gl_base_filter_propose_allocation (GstBaseTransform * trans, - GstQuery * decide_query, GstQuery * query) -{ - return FALSE; -} - static GstStateChangeReturn gst_gl_base_filter_change_state (GstElement * element, GstStateChange transition) |