mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
glfilter: Remove hard-coded pad templates
Add a function to install the default RGBA pad templates, but don't make them required so that there can be GstGLFilter sub-classes with different input/output caps if they want. Remove the hard-coded RGBA restriction in the set_caps_features call, as it will be taken care of by intersecting with the pad templates. Update all the sub-classes to match
This commit is contained in:
parent
cb3a65a19a
commit
6083ad6287
16 changed files with 42 additions and 8 deletions
|
@ -280,6 +280,8 @@ gst_gl_bumper_class_init (GstGLBumperClass * klass)
|
|||
gobject_class->set_property = gst_gl_bumper_set_property;
|
||||
gobject_class->get_property = gst_gl_bumper_get_property;
|
||||
|
||||
gst_gl_filter_add_rgba_pad_templates (GST_GL_FILTER_CLASS (klass));
|
||||
|
||||
GST_GL_FILTER_CLASS (klass)->filter_texture = gst_gl_bumper_filter_texture;
|
||||
GST_GL_FILTER_CLASS (klass)->display_init_cb = gst_gl_bumper_init_resources;
|
||||
GST_GL_FILTER_CLASS (klass)->display_reset_cb = gst_gl_bumper_reset_resources;
|
||||
|
|
|
@ -292,6 +292,8 @@ gst_gl_color_balance_class_init (GstGLColorBalanceClass * klass)
|
|||
GST_DEBUG_CATEGORY_INIT (glcolorbalance_debug, "glcolorbalance", 0,
|
||||
"glcolorbalance");
|
||||
|
||||
gst_gl_filter_add_rgba_pad_templates (GST_GL_FILTER_CLASS (klass));
|
||||
|
||||
gobject_class->finalize = gst_gl_color_balance_finalize;
|
||||
gobject_class->set_property = gst_gl_color_balance_set_property;
|
||||
gobject_class->get_property = gst_gl_color_balance_get_property;
|
||||
|
|
|
@ -89,6 +89,8 @@ gst_gl_colorscale_class_init (GstGLColorscaleClass * klass)
|
|||
base_filter_class = GST_GL_BASE_FILTER_CLASS (klass);
|
||||
filter_class = GST_GL_FILTER_CLASS (klass);
|
||||
|
||||
gst_gl_filter_add_rgba_pad_templates (GST_GL_FILTER_CLASS (klass));
|
||||
|
||||
gobject_class->set_property = gst_gl_colorscale_set_property;
|
||||
gobject_class->get_property = gst_gl_colorscale_get_property;
|
||||
|
||||
|
|
|
@ -241,6 +241,8 @@ gst_gl_deinterlace_class_init (GstGLDeinterlaceClass * klass)
|
|||
gobject_class = (GObjectClass *) klass;
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
||||
gst_gl_filter_add_rgba_pad_templates (GST_GL_FILTER_CLASS (klass));
|
||||
|
||||
gobject_class->set_property = gst_gl_deinterlace_set_property;
|
||||
gobject_class->get_property = gst_gl_deinterlace_get_property;
|
||||
|
||||
|
|
|
@ -215,6 +215,9 @@ gst_gl_differencematte_class_init (GstGLDifferenceMatteClass * klass)
|
|||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
||||
gst_gl_filter_add_rgba_pad_templates (GST_GL_FILTER_CLASS (klass));
|
||||
|
||||
gobject_class->set_property = gst_gl_differencematte_set_property;
|
||||
gobject_class->get_property = gst_gl_differencematte_get_property;
|
||||
|
||||
|
|
|
@ -327,6 +327,8 @@ gst_gl_effects_class_init (GstGLEffectsClass * klass)
|
|||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
||||
gst_gl_filter_add_rgba_pad_templates (GST_GL_FILTER_CLASS (klass));
|
||||
|
||||
GST_BASE_TRANSFORM_CLASS (klass)->start = gst_gl_effects_init_resources;
|
||||
GST_BASE_TRANSFORM_CLASS (klass)->stop = gst_gl_effects_reset_resources;
|
||||
|
||||
|
|
|
@ -81,6 +81,8 @@ gst_gl_filter_app_class_init (GstGLFilterAppClass * klass)
|
|||
gobject_class = (GObjectClass *) klass;
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
||||
gst_gl_filter_add_rgba_pad_templates (GST_GL_FILTER_CLASS (klass));
|
||||
|
||||
gobject_class->set_property = gst_gl_filter_app_set_property;
|
||||
gobject_class->get_property = gst_gl_filter_app_get_property;
|
||||
|
||||
|
|
|
@ -135,6 +135,8 @@ gst_gl_filter_cube_class_init (GstGLFilterCubeClass * klass)
|
|||
gobject_class = (GObjectClass *) klass;
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
||||
gst_gl_filter_add_rgba_pad_templates (GST_GL_FILTER_CLASS (klass));
|
||||
|
||||
gobject_class->set_property = gst_gl_filter_cube_set_property;
|
||||
gobject_class->get_property = gst_gl_filter_cube_get_property;
|
||||
|
||||
|
|
|
@ -153,6 +153,8 @@ gst_gl_filter_glass_class_init (GstGLFilterGlassClass * klass)
|
|||
gobject_class = (GObjectClass *) klass;
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
||||
gst_gl_filter_add_rgba_pad_templates (GST_GL_FILTER_CLASS (klass));
|
||||
|
||||
gobject_class->set_property = gst_gl_filter_glass_set_property;
|
||||
gobject_class->get_property = gst_gl_filter_glass_get_property;
|
||||
|
||||
|
|
|
@ -91,6 +91,8 @@ gst_gl_filter_reflected_screen_class_init (GstGLFilterReflectedScreenClass *
|
|||
gobject_class = (GObjectClass *) klass;
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
||||
gst_gl_filter_add_rgba_pad_templates (GST_GL_FILTER_CLASS (klass));
|
||||
|
||||
gobject_class->set_property = gst_gl_filter_reflected_screen_set_property;
|
||||
gobject_class->get_property = gst_gl_filter_reflected_screen_get_property;
|
||||
|
||||
|
|
|
@ -115,6 +115,8 @@ gst_gl_filtershader_class_init (GstGLFilterShaderClass * klass)
|
|||
gobject_class = (GObjectClass *) klass;
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
||||
gst_gl_filter_add_rgba_pad_templates (GST_GL_FILTER_CLASS (klass));
|
||||
|
||||
gobject_class->finalize = gst_gl_filtershader_finalize;
|
||||
gobject_class->set_property = gst_gl_filtershader_set_property;
|
||||
gobject_class->get_property = gst_gl_filtershader_get_property;
|
||||
|
|
|
@ -189,6 +189,8 @@ gst_gl_overlay_class_init (GstGLOverlayClass * klass)
|
|||
gobject_class = (GObjectClass *) klass;
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
||||
gst_gl_filter_add_rgba_pad_templates (GST_GL_FILTER_CLASS (klass));
|
||||
|
||||
gobject_class->set_property = gst_gl_overlay_set_property;
|
||||
gobject_class->get_property = gst_gl_overlay_get_property;
|
||||
|
||||
|
|
|
@ -129,6 +129,8 @@ gst_gl_transformation_class_init (GstGLTransformationClass * klass)
|
|||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
base_transform_class = GST_BASE_TRANSFORM_CLASS (klass);
|
||||
|
||||
gst_gl_filter_add_rgba_pad_templates (GST_GL_FILTER_CLASS (klass));
|
||||
|
||||
gobject_class->set_property = gst_gl_transformation_set_property;
|
||||
gobject_class->get_property = gst_gl_transformation_get_property;
|
||||
|
||||
|
|
|
@ -101,6 +101,8 @@ gst_gl_view_convert_element_class_init (GstGLViewConvertElementClass * klass)
|
|||
gobject_class = (GObjectClass *) klass;
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
||||
gst_gl_filter_add_rgba_pad_templates (GST_GL_FILTER_CLASS (klass));
|
||||
|
||||
gobject_class->set_property = gst_gl_view_convert_element_set_property;
|
||||
gobject_class->get_property = gst_gl_view_convert_element_get_property;
|
||||
gobject_class->dispose = gst_gl_view_convert_dispose;
|
||||
|
|
|
@ -118,14 +118,22 @@ static void gst_gl_filter_gl_stop (GstGLBaseFilter * filter);
|
|||
static gboolean gst_gl_filter_gl_set_caps (GstGLBaseFilter * bt,
|
||||
GstCaps * incaps, GstCaps * outcaps);
|
||||
|
||||
void
|
||||
gst_gl_filter_add_rgba_pad_templates (GstGLFilterClass * klass)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||
gst_element_class_add_static_pad_template (element_class,
|
||||
&gst_gl_filter_src_pad_template);
|
||||
gst_element_class_add_static_pad_template (element_class,
|
||||
&gst_gl_filter_sink_pad_template);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_gl_filter_class_init (GstGLFilterClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *element_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = gst_gl_filter_set_property;
|
||||
gobject_class->get_property = gst_gl_filter_get_property;
|
||||
|
@ -146,11 +154,6 @@ gst_gl_filter_class_init (GstGLFilterClass * klass)
|
|||
GST_GL_BASE_FILTER_CLASS (klass)->gl_set_caps = gst_gl_filter_gl_set_caps;
|
||||
|
||||
klass->transform_internal_caps = default_transform_internal_caps;
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class,
|
||||
&gst_gl_filter_src_pad_template);
|
||||
gst_element_class_add_static_pad_template (element_class,
|
||||
&gst_gl_filter_sink_pad_template);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -618,7 +621,6 @@ gst_gl_filter_set_caps_features (const GstCaps * caps,
|
|||
gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_GL_MEMORY));
|
||||
}
|
||||
|
||||
gst_caps_set_simple (ret, "format", G_TYPE_STRING, "RGBA", NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -118,6 +118,9 @@ struct _GstGLFilterClass
|
|||
gpointer _padding[GST_PADDING];
|
||||
};
|
||||
|
||||
GST_EXPORT
|
||||
void gst_gl_filter_add_rgba_pad_templates (GstGLFilterClass *klass);
|
||||
|
||||
GST_EXPORT
|
||||
gboolean gst_gl_filter_filter_texture (GstGLFilter * filter, GstBuffer * inbuf,
|
||||
GstBuffer * outbuf);
|
||||
|
|
Loading…
Reference in a new issue